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

Commit

Permalink
fix print to pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed Oct 14, 2017
1 parent adbd3e0 commit a0d913d
Show file tree
Hide file tree
Showing 26 changed files with 485 additions and 400 deletions.
4 changes: 0 additions & 4 deletions atom/app/atom_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,6 @@ int AtomMainDelegate::RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) {
static const MainFunction kMainFunctions[] = {
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(CHROME_MULTIPLE_DLL_CHILD)
{ switches::kCloudPrintServiceProcess, CloudPrintServiceProcessMain },
#endif

#if defined(OS_MACOSX)
{ switches::kRelauncherProcess, relauncher::RelauncherMain },
#else
Expand Down
2 changes: 1 addition & 1 deletion atom/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ source_set("browser") {
"//electron:common",
"//electron/muon/app",
# @todo(bridiver) fix circular dep
# "//electron/chromium_src:browser",
# "//electron/muon/browser",
"//base",
"//chrome/common:constants",
"//storage/browser",
Expand Down
4 changes: 2 additions & 2 deletions atom/browser/api/atom_api_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "brave/browser/brave_content_browser_client.h"
#include "brave/common/workers/v8_worker_thread.h"
#include "brave/common/workers/worker_bindings.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/common/chrome_paths.h"
#include "components/component_updater/component_updater_paths.h"
#include "content/browser/plugin_service_impl.h"
Expand All @@ -53,6 +52,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/common/content_switches.h"
#include "extensions/features/features.h"
#include "muon/browser/muon_browser_process_impl.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "net/ssl/client_cert_identity.h"
Expand Down Expand Up @@ -476,7 +476,7 @@ App::App(v8::Isolate* isolate) {
atom::Browser::Get()->AddObserver(this);
content::GpuDataManager::GetInstance()->AddObserver(this);
Init(isolate);
static_cast<BrowserProcessImpl*>(g_browser_process)->set_app(this);
static_cast<MuonBrowserProcessImpl*>(g_browser_process)->set_app(this);
#if BUILDFLAG(ENABLE_EXTENSIONS)
registrar_.Add(this,
content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED,
Expand Down
8 changes: 8 additions & 0 deletions atom/browser/api/atom_api_web_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/display/screen.h"

#if BUILDFLAG(ENABLE_PRINTING)
#include "chrome/browser/printing/printing_init.h"
#endif

#if !defined(OS_MACOSX)
#include "ui/aura/window.h"
#endif
Expand Down Expand Up @@ -469,6 +473,10 @@ void WebContents::CompleteInit(v8::Isolate* isolate,
// Intialize security state client.
SecurityStateTabHelper::CreateForWebContents(web_contents);

#if BUILDFLAG(ENABLE_PRINTING)
printing::InitializePrinting(web_contents);
#endif

std::string name;
options.Get("name", &name);

Expand Down
6 changes: 4 additions & 2 deletions atom/browser/atom_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "base/time/default_tick_clock.h"
#include "base/trace_event/trace_event.h"
#include "browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
Expand All @@ -49,6 +48,7 @@
#include "device/geolocation/geolocation_delegate.h"
#include "device/geolocation/geolocation_provider.h"
#include "muon/app/muon_crash_reporter_client.h"
#include "muon/browser/muon_browser_process_impl.h"
#include "v8/include/v8.h"
#include "v8/include/v8-debug.h"

Expand Down Expand Up @@ -205,8 +205,10 @@ int AtomBrowserMainParts::PreCreateThreads() {
{
TRACE_EVENT0("startup",
"AtomBrowserMainParts::PreCreateThreads:InitBrowswerProcessImpl");
auto command_line = base::CommandLine::ForCurrentProcess();
fake_browser_process_.reset(
new BrowserProcessImpl(local_state_task_runner.get()));
new MuonBrowserProcessImpl(local_state_task_runner.get(),
*command_line));
}

if (parsed_command_line_.HasSwitch(switches::kEnableProfiling)) {
Expand Down
5 changes: 0 additions & 5 deletions atom/browser/common_web_contents_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include "base/strings/utf_string_conversions.h"
#include "brave/browser/brave_javascript_dialog_manager.h"
#include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/printing/print_preview_message_handler.h"
#include "chrome/browser/printing/print_view_manager_basic.h"
#include "chrome/browser/ssl/security_state_tab_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
Expand Down Expand Up @@ -185,9 +183,6 @@ void CommonWebContentsDelegate::InitWithWebContents(
browser_context_ = browser_context;
web_contents->SetDelegate(this);

printing::PrintViewManagerBasic::CreateForWebContents(web_contents);
printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents);

// Create InspectableWebContents.
web_contents_.reset(brightray::InspectableWebContents::Create(web_contents));
web_contents_->SetDelegate(this);
Expand Down
4 changes: 2 additions & 2 deletions atom/browser/importer/profile_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#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/password_manager/password_store_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
Expand All @@ -27,6 +26,7 @@
#include "components/keyed_service/core/service_access_type.h"
#include "components/password_manager/core/browser/password_manager.h"
#include "content/public/browser/browser_thread.h"
#include "muon/browser/muon_browser_process_impl.h"

#if defined(OS_WIN)
#include "components/password_manager/core/browser/webdata/password_web_data_service_win.h"
Expand All @@ -36,7 +36,7 @@ namespace importer {
void ShowImportLockDialog(gfx::NativeWindow parent,
const base::Callback<void(bool)>& callback) {
atom::api::App *app =
static_cast<BrowserProcessImpl*>(g_browser_process)->app();
static_cast<MuonBrowserProcessImpl*>(g_browser_process)->app();
if (app) {
app->Emit("show-warning-dialog");
}
Expand Down
3 changes: 2 additions & 1 deletion brave/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ source_set("browser") {
deps = [
":apis",
"//electron/atom/browser",
"//electron/chromium_src:browser",
"//electron:common",
"//electron/muon/app",
"//electron/muon/browser",
"//chrome/common",
"//components/autofill/content/browser:risk_proto",
"//components/autofill/content/browser",
Expand Down Expand Up @@ -141,6 +141,7 @@ source_set("apis") {

deps = [
"//electron/build/node",
"//electron/muon/browser",
"//v8:v8",
"//v8:v8_libplatform",
"//third_party/WebKit/public:blink_headers",
Expand Down
10 changes: 5 additions & 5 deletions brave/browser/api/brave_api_component_updater.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include "base/base64.h"
#include "brave/browser/component_updater/extension_installer_traits.h"
#include "brave/browser/component_updater/widevine_cdm_component_installer.h"
#include "chrome/browser/browser_process_impl.h"
#include "components/component_updater/component_updater_service.h"
#include "components/update_client/crx_update_item.h"
#include "muon/browser/muon_browser_process_impl.h"
#include "native_mate/dictionary.h"

#include "atom/common/node_includes.h"
Expand All @@ -35,7 +35,7 @@ component_updater::ComponentUpdateService* ComponentsUI::GetCUSForID(
if (component_id == kWidevineId) {
return g_browser_process->component_updater();
}
return static_cast<BrowserProcessImpl*>(g_browser_process)->
return static_cast<MuonBrowserProcessImpl*>(g_browser_process)->
brave_component_updater();
}

Expand Down Expand Up @@ -85,7 +85,7 @@ void ComponentUpdater::RegisterComponentForUpdate(
const base::Closure& registered_callback,
const ReadyCallback& ready_callback) {
brave::RegisterExtension(
static_cast<BrowserProcessImpl*>(g_browser_process)->
static_cast<MuonBrowserProcessImpl*>(g_browser_process)->
brave_component_updater(),
public_key, registered_callback, ready_callback);
}
Expand All @@ -104,7 +104,7 @@ void ComponentUpdater::OnComponentReady(
void ComponentUpdater::RegisterComponent(mate::Arguments* args) {
static bool registeredObserver = false;
if (!registeredObserver) {
static_cast<BrowserProcessImpl*>(g_browser_process)->
static_cast<MuonBrowserProcessImpl*>(g_browser_process)->
brave_component_updater()->AddObserver(this);
g_browser_process->component_updater()->AddObserver(this);
registeredObserver = true;
Expand Down Expand Up @@ -151,7 +151,7 @@ std::vector<std::string> ComponentUpdater::GetComponentIDs() {
std::vector<std::string> components =
g_browser_process->component_updater()->GetComponentIDs();
std::vector<std::string> brave_components =
static_cast<BrowserProcessImpl*>(g_browser_process)->
static_cast<MuonBrowserProcessImpl*>(g_browser_process)->
brave_component_updater()->GetComponentIDs();
components.insert(components.end(),
brave_components.begin(), brave_components.end());
Expand Down
101 changes: 72 additions & 29 deletions chromium_src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ source_set("browser") {
configs += [ "//electron/build:electron_config" ]
configs += [ ":chromium_src_config" ]

public_deps = []
public_deps = [
"//content/public/browser",
]

deps = [
":bookmarks",
Expand All @@ -150,9 +152,11 @@ source_set("browser") {
"//electron/brave/browser:tab_manager",
"//base",
"//chrome/common",
"//chrome/common:service_process_mojom",
"//chrome/utility",
"//components/certificate_transparency",
"//components/crash/content/app",
"//components/crash/core/browser",
"//components/data_usage/core",
"//components/prefs",
"//components/ssl_config",
Expand All @@ -169,7 +173,7 @@ source_set("browser") {
"//chrome/browser/browser_process.cc",
"//chrome/browser/browser_process.h",
"chrome/browser/browser_process_impl.cc",
"chrome/browser/browser_process_impl.h",
"//chrome/browser/browser_process_impl.h",
"//chrome/browser/browser_shutdown.cc",
"//chrome/browser/chrome_notification_types.h",
"chrome/browser/custom_handlers/protocol_handler_registry.cc",
Expand All @@ -193,6 +197,16 @@ source_set("browser") {
"//chrome/browser/first_run/upgrade_util.h",
"chrome/browser/first_run/upgrade_util.cc",

"//chrome/browser/gpu/gpu_mode_manager.cc",
"//chrome/browser/gpu/gpu_mode_manager.h",

"//chrome/browser/icon_loader.cc",
"//chrome/browser/icon_loader.h",
"//chrome/browser/icon_loader_mac.mm",
"//chrome/browser/icon_loader_win.cc",
"//chrome/browser/icon_manager.cc",
"//chrome/browser/icon_manager.h",

"//chrome/browser/lifetime/keep_alive_registry.cc",
"//chrome/browser/lifetime/keep_alive_registry.h",
"//chrome/browser/lifetime/keep_alive_types.cc",
Expand All @@ -202,6 +216,8 @@ source_set("browser") {

"//chrome/browser/net/chrome_mojo_proxy_resolver_factory.cc",
"//chrome/browser/net/chrome_mojo_proxy_resolver_factory.h",
"chrome/browser/net/system_network_context_manager.cc",
"//chrome/browser/net/system_network_context_manager.h",

"//chrome/browser/prefs/chrome_command_line_pref_store.cc",
"//chrome/browser/prefs/chrome_command_line_pref_store.h",
Expand Down Expand Up @@ -249,26 +265,7 @@ source_set("browser") {
"//chrome/browser/content_settings/cookie_settings_factory.h",
"chrome/browser/content_settings/host_content_settings_map_factory.cc",
"chrome/browser/content_settings/host_content_settings_map_factory.h",
"//chrome/browser/printing/print_job.cc",
"//chrome/browser/printing/print_job.h",
"//chrome/browser/printing/print_job_manager.cc",
"//chrome/browser/printing/print_job_manager.h",
"//chrome/browser/printing/print_job_worker.cc",
"//chrome/browser/printing/print_job_worker.h",
"//chrome/browser/printing/print_job_worker_owner.cc",
"//chrome/browser/printing/print_job_worker_owner.h",
"chrome/browser/printing/print_preview_message_handler.cc",
"chrome/browser/printing/print_preview_message_handler.h",
"//chrome/browser/printing/print_view_manager_base.cc",
"//chrome/browser/printing/print_view_manager_base.h",
"//chrome/browser/printing/print_view_manager_basic.cc",
"//chrome/browser/printing/print_view_manager_basic.h",
"//chrome/browser/printing/print_view_manager_common.cc",
"//chrome/browser/printing/print_view_manager_common.h",
"//chrome/browser/printing/printer_query.cc",
"//chrome/browser/printing/printer_query.h",
"//chrome/browser/printing/printing_message_filter.cc",
"//chrome/browser/printing/printing_message_filter.h",

"//chrome/browser/ssl/security_state_tab_helper.cc",
"//chrome/browser/ssl/security_state_tab_helper.h",
"//chrome/browser/tab_contents/tab_util.cc",
Expand All @@ -278,6 +275,13 @@ source_set("browser") {

"//chrome/browser/cache_stats_recorder.cc",
"//chrome/browser/cache_stats_recorder.h",

"//chrome/browser/upgrade_detector.cc",
"//chrome/browser/upgrade_detector.h",
"chrome/browser/upgrade_detector_impl.cc",
"//chrome/browser/service_process/service_process_control.cc",
"//chrome/browser/service_process/service_process_control.h",
"//chrome/browser/service_process/service_process_control_mac.mm",
]

if (is_win || is_mac) {
Expand All @@ -287,11 +291,6 @@ source_set("browser") {
]
}

deps += [
"//components/crash/content/app",
"//components/crash/core/browser",
]

if (is_win) {
sources += [
"//chrome/browser/win/browser_util.h",
Expand Down Expand Up @@ -357,10 +356,51 @@ source_set("browser") {
}

if (enable_basic_printing || enable_print_preview) {
sources += [
"//chrome/browser/printing/background_printing_manager.cc",
"//chrome/browser/printing/background_printing_manager.h",
"//chrome/browser/printing/print_job.cc",
"//chrome/browser/printing/print_job.h",
"//chrome/browser/printing/print_job_manager.cc",
"//chrome/browser/printing/print_job_manager.h",
"//chrome/browser/printing/print_job_worker.cc",
"//chrome/browser/printing/print_job_worker.h",
"//chrome/browser/printing/print_job_worker_owner.cc",
"//chrome/browser/printing/print_job_worker_owner.h",
"//chrome/browser/printing/print_view_manager_base.cc",
"//chrome/browser/printing/print_view_manager_base.h",
"//chrome/browser/printing/print_view_manager_basic.cc",
"//chrome/browser/printing/print_view_manager_basic.h",
"//chrome/browser/printing/print_view_manager_common.cc",
"//chrome/browser/printing/print_view_manager_common.h",
"//chrome/browser/printing/printer_query.cc",
"//chrome/browser/printing/printer_query.h",
"//chrome/browser/printing/printing_init.cc",
"//chrome/browser/printing/printing_init.h",
"//chrome/browser/printing/printing_message_filter.cc",
"//chrome/browser/printing/printing_message_filter.h",
]
deps += [
"//components/printing/browser",
"//printing",
]

if (enable_print_preview) {
sources += [
"chrome/browser/printing/print_error_dialog.cc",
"//chrome/browser/printing/print_error_dialog.h",
"//chrome/browser/printing/print_preview_data_service.cc",
"//chrome/browser/printing/print_preview_data_service.h",
"chrome/browser/printing/print_preview_dialog_controller.cc",
"//chrome/browser/printing/print_preview_dialog_controller.h",
"chrome/browser/printing/print_preview_message_handler.cc",
"chrome/browser/printing/print_preview_message_handler.h",
"//chrome/browser/printing/print_view_manager.cc",
"//chrome/browser/printing/print_view_manager.h",
"chrome/browser/ui/webui/print_preview/print_preview_ui.cc",
"//chrome/browser/ui/webui/print_preview/print_preview_ui.h",
]
}
}

if (enable_webrtc) {
Expand Down Expand Up @@ -777,8 +817,12 @@ source_set("downloads") {
configs += [ ":chromium_src_config" ]

sources = [
"chrome/browser/download/download_core_service.cc",
"//chrome/browser/download/download_core_service.h",
"//chrome/browser/download/download_path_reservation_tracker.cc",
"//chrome/browser/download/download_path_reservation_tracker.h",
"chrome/browser/download/download_request_limiter.cc",
"//chrome/browser/download/download_request_limiter.h",
]

deps = [
Expand Down Expand Up @@ -899,8 +943,6 @@ source_set("lifetime") {
configs += [ ":chromium_src_config" ]

sources = [
"chrome/browser/download/download_core_service.cc",
"//chrome/browser/download/download_core_service.h",
"chrome/browser/lifetime/browser_close_manager.cc",
"//chrome/browser/lifetime/browser_close_manager.h",
"//chrome/browser/lifetime/termination_notification.cc",
Expand All @@ -923,6 +965,7 @@ source_set("lifetime") {
deps = [
"//base",
":sessions",
":downloads",
"//chrome/common",
"//components/metrics",
"//components/prefs",
Expand Down
Loading

0 comments on commit a0d913d

Please sign in to comment.