Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
Emit show-warning-dialog by app
Browse files Browse the repository at this point in the history
also fix lint

Auditors: @bridiver, @bbondy
  • Loading branch information
darkdh committed May 15, 2017
1 parent 14d24b4 commit 783033a
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 17 deletions.
5 changes: 5 additions & 0 deletions atom/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ source_set("importer") {
"//electron/build:electron_config"
]

include_dirs = [
# make sure chromium_src comes before the chrome src root
"//electron/chromium_src",
]

sources = [
"importer/external_process_importer_client.cc",
"importer/external_process_importer_client.h",
Expand Down
1 change: 1 addition & 0 deletions atom/browser/api/atom_api_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <map>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion atom/browser/autofill/atom_autofill_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "atom/common/native_mate_converters/string16_converter.h"
#include "base/strings/utf_string_conversions.h"
#include "brave/browser/brave_browser_context.h"
#include "chrome/browser/browser_process.h"
#include "brave/browser/password_manager/brave_password_manager_client.h"
#include "chrome/browser/browser_process.h"
#include "components/autofill/content/browser/content_autofill_driver.h"
#include "components/autofill/content/browser/content_autofill_driver_factory.h"
#include "components/autofill/core/browser/popup_item_ids.h"
Expand Down
4 changes: 2 additions & 2 deletions atom/browser/extensions/atom_extensions_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

#include "atom/browser/browser.h"
#include "atom/browser/extensions/api/atom_extensions_api_client.h"
#include "atom/browser/extensions/atom_extensions_browser_client.h"
#include "chrome/browser/extensions/chrome_extension_api_frame_id_map_helper.h"
#include "atom/browser/extensions/atom_extension_host_delegate.h"
#include "atom/browser/extensions/atom_extension_system_factory.h"
#include "atom/browser/extensions/atom_extension_web_contents_observer.h"
#include "atom/browser/extensions/atom_extensions_browser_client.h"
#include "atom/browser/extensions/atom_process_manager_delegate.h"
#include "atom/browser/web_contents_preferences.h"
#include "base/command_line.h"
Expand All @@ -22,6 +21,7 @@
#include "base/version.h"
#include "brave/browser/brave_browser_context.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/chrome_extension_api_frame_id_map_helper.h"
#include "chrome/browser/extensions/event_router_forwarder.h"
#include "chrome/common/chrome_paths.h"
#include "components/user_prefs/user_prefs.h"
Expand Down
19 changes: 14 additions & 5 deletions atom/browser/importer/profile_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,38 @@
#include <set>
#include <string>

#include "atom/browser/api/atom_api_app.h"
#include "atom/browser/api/atom_api_importer.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "base/base64.h"
#include "base/strings/utf_string_conversions.h"
#include "brave/common/importer/imported_cookie_entry.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/importer/imported_bookmark_entry.h"
#include "components/autofill/core/browser/webdata/autofill_entry.h"
#include "components/autofill/core/common/password_form.h"
#include "content/public/browser/browser_thread.h"

#if defined(OS_WIN)
#include "components/password_manager/core/browser/webdata/password_web_data_service_win.h"
#endif

namespace importer {
void ShowImportLockDialog(gfx::NativeWindow parent,
const base::Callback<void(bool)>& callback) {}
const base::Callback<void(bool)>& callback) {
atom::api::App *app =
static_cast<BrowserProcessImpl*>(g_browser_process)->app();
if (app) {
app->Emit("show-warning-dialog");
}
// TODO(darkdh): emit callback and let users have continue option without
// restart anotehr import process
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE, base::Bind(callback, false));
}
} // namespace importer

namespace atom {
Expand Down Expand Up @@ -187,10 +200,6 @@ void ProfileWriter::Initialize(atom::api::Importer* importer) {
importer_ = importer;
}

bool ProfileWriter::ShowWarningDialog() {
return importer_->Emit("show-warning-dialog");
}

ProfileWriter::~ProfileWriter() {}

} // namespace atom
2 changes: 0 additions & 2 deletions atom/browser/importer/profile_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ class ProfileWriter : public ::ProfileWriter {
virtual void AddCookies(const std::vector<ImportedCookieEntry>& cookies);
void Initialize(atom::api::Importer* importer);

bool ShowWarningDialog();

protected:
friend class base::RefCountedThreadSafe<ProfileWriter>;

Expand Down
6 changes: 4 additions & 2 deletions atom/common/native_mate_converters/file_path_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ template<>
struct Converter<base::CommandLine> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const base::CommandLine& val) {
return Converter<base::CommandLine::StringVector>::ToV8(isolate, val.argv());
return Converter<base::CommandLine::StringVector>::ToV8(isolate,
val.argv());
}
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
Expand All @@ -48,7 +49,8 @@ struct Converter<base::CommandLine> {
return true;

base::CommandLine::StringVector path;
if (Converter<base::CommandLine::StringVector>::FromV8(isolate, val, &path)) {
if (Converter<base::CommandLine::StringVector>::FromV8(isolate, val,
&path)) {
*out = base::CommandLine(path);
return true;
} else {
Expand Down
7 changes: 5 additions & 2 deletions brave/browser/api/brave_api_extension.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "brave/browser/api/brave_api_extension.h"

#include <map>
#include <memory>
#include <string>
#include <vector>
Expand Down Expand Up @@ -105,8 +106,10 @@ scoped_refptr<extensions::Extension> LoadExtension(const base::FilePath& path,
return extension;
}

std::map<std::string, base::Callback<GURL(const GURL&)>> url_override_callbacks_;
std::map<std::string, base::Callback<GURL(const GURL&)>> reverse_url_override_callbacks_;
std::map<std::string,
base::Callback<GURL(const GURL&)>> url_override_callbacks_;
std::map<std::string,
base::Callback<GURL(const GURL&)>> reverse_url_override_callbacks_;
} // namespace

namespace brave {
Expand Down
7 changes: 4 additions & 3 deletions brave/common/workers/worker_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ WorkerBindings::WorkerBindings(extensions::ScriptContext* context,
worker_(worker),
weak_ptr_factory_(this) {
RouteFunction("postMessage",
base::Bind(&WorkerBindings::PostMessage, weak_ptr_factory_.GetWeakPtr()));
base::Bind(&WorkerBindings::PostMessage,
weak_ptr_factory_.GetWeakPtr()));
RouteFunction("close",
base::Bind(&WorkerBindings::Close, weak_ptr_factory_.GetWeakPtr()));
base::Bind(&WorkerBindings::Close, weak_ptr_factory_.GetWeakPtr()));
RouteFunction("onerror",
base::Bind(&WorkerBindings::OnError, weak_ptr_factory_.GetWeakPtr()));
base::Bind(&WorkerBindings::OnError, weak_ptr_factory_.GetWeakPtr()));

v8::Local<v8::Context> v8_context = context->v8_context();
v8::Isolate* isolate = v8_context->GetIsolate();
Expand Down

0 comments on commit 783033a

Please sign in to comment.