Skip to content

Commit

Permalink
chore: cleanup api usage from //chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 committed Dec 14, 2018
1 parent a19ba5c commit 7f57e31
Show file tree
Hide file tree
Showing 12 changed files with 357 additions and 109 deletions.
2 changes: 1 addition & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ static_library("electron_lib") {
"//base",
"//base:i18n",
"//chrome/app/resources:platform_locale_settings",
"//chrome/common",
"//components/certificate_transparency",
"//components/net_log",
"//components/network_session_configurator/common",
Expand Down Expand Up @@ -371,6 +370,7 @@ static_library("electron_lib") {
sources += filenames.lib_sources_nss
}
if (is_win) {
sources += filenames.lib_sources_win
libs += [ "dwmapi.lib" ]
}
if (is_linux || is_win) {
Expand Down
7 changes: 6 additions & 1 deletion atom/browser/api/atom_api_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "atom/common/native_mate_converters/net_converter.h"
#include "atom/common/native_mate_converters/network_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "atom/common/options_switches.h"
#include "base/command_line.h"
#include "base/environment.h"
Expand Down Expand Up @@ -54,6 +53,12 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/image/image.h"

// clang-format off
// This header should be declared at the end to avoid
// redefinition errors.
#include "atom/common/node_includes.h" // NOLINT(build/include_alpha)
// clang-format on

#if defined(OS_WIN)
#include "atom/browser/ui/win/jump_list.h"
#include "base/strings/utf_string_conversions.h"
Expand Down
2 changes: 1 addition & 1 deletion atom/browser/api/atom_api_web_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1488,11 +1488,11 @@ void WebContents::Print(mate::Arguments* args) {

std::vector<printing::PrinterBasicInfo> WebContents::GetPrinterList() {
std::vector<printing::PrinterBasicInfo> printers;
auto print_backend = printing::PrintBackend::CreateInstance(nullptr);
{
// TODO(deepak1556): Deprecate this api in favor of an
// async version and post a non blocing task call.
base::ThreadRestrictions::ScopedAllowIO allow_io;
auto print_backend = printing::PrintBackend::CreateInstance(nullptr);
print_backend->EnumeratePrinters(&printers);
}
return printers;
Expand Down
6 changes: 6 additions & 0 deletions atom/browser/atom_browser_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "brightray/common/application_info.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/prefs/json_pref_store.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
Expand Down Expand Up @@ -119,13 +120,18 @@ AtomBrowserContext::AtomBrowserContext(const std::string& partition,
proxy_config_monitor_ = std::make_unique<ProxyConfigMonitor>(prefs_.get());
io_handle_ = new URLRequestContextGetter::Handle(weak_factory_.GetWeakPtr());
cookie_change_notifier_ = std::make_unique<CookieChangeNotifier>(this);

BrowserContextDependencyManager::GetInstance()->MarkBrowserContextLive(this);
}

AtomBrowserContext::~AtomBrowserContext() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
NotifyWillBeDestroyed(this);
ShutdownStoragePartitions();
io_handle_->ShutdownOnUIThread();
// Notify any keyed services of browser context destruction.
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
this);
}

void AtomBrowserContext::InitPrefs() {
Expand Down
4 changes: 2 additions & 2 deletions atom/browser/atom_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "atom/common/node_bindings.h"
#include "base/command_line.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/icon_manager.h"
#include "chrome/browser/net/chrome_net_log_helper.h"
#include "components/net_log/chrome_net_log.h"
Expand Down Expand Up @@ -68,7 +68,7 @@ AtomBrowserMainParts* AtomBrowserMainParts::self_ = nullptr;

AtomBrowserMainParts::AtomBrowserMainParts(
const content::MainFunctionParams& params)
: fake_browser_process_(new BrowserProcess),
: fake_browser_process_(new BrowserProcessImpl),
browser_(new Browser),
node_bindings_(NodeBindings::Create(NodeBindings::BROWSER)),
atom_bindings_(new AtomBindings(uv_default_loop())),
Expand Down
18 changes: 2 additions & 16 deletions chromium_src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import("//third_party/widevine/cdm/widevine.gni")
source_set("chrome") {
visibility = [ "//electron:electron_lib" ]
sources = [
"//chrome/browser/browser_process.cc",
"//chrome/browser/browser_process.h",
"//chrome/browser/icon_loader.cc",
"//chrome/browser/icon_loader.h",
"//chrome/browser/icon_loader_mac.mm",
Expand Down Expand Up @@ -59,22 +61,6 @@ source_set("chrome") {
deps += [ "//ui/snapshot" ]
}

sources += [
"//chrome/browser/platform_util.cc",
"//chrome/browser/platform_util.h",
"//chrome/browser/ui/browser_dialogs.h",
]

if (is_mac) {
sources += [ "//chrome/browser/platform_util_mac.mm" ]
}
if (is_linux) {
sources += [ "//chrome/browser/platform_util_linux.cc" ]
}
if (is_win) {
sources += [ "//chrome/browser/platform_util_win.cc" ]
}

if (enable_basic_printing) {
sources += [
"//chrome/browser/printing/print_job.cc",
Expand Down
39 changes: 0 additions & 39 deletions chromium_src/chrome/browser/browser_process.cc

This file was deleted.

45 changes: 0 additions & 45 deletions chromium_src/chrome/browser/browser_process.h

This file was deleted.

Loading

0 comments on commit 7f57e31

Please sign in to comment.