Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(650)

Side by Side Diff: chrome/browser/dom_distiller/profile_utils.cc

Issue 2108833002: Remove Simplify Page option from Print Preview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mark histogram entries as unused Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/dom_distiller/profile_utils.h" 5 #include "chrome/browser/dom_distiller/profile_utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" 11 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
12 #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h" 12 #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/chrome_isolated_world_ids.h" 14 #include "chrome/common/chrome_isolated_world_ids.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/features.h" 16 #include "chrome/common/features.h"
17 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h" 17 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h"
18 #include "components/dom_distiller/content/browser/distiller_ui_handle.h" 18 #include "components/dom_distiller/content/browser/distiller_ui_handle.h"
19 #include "components/dom_distiller/content/browser/dom_distiller_viewer_source.h " 19 #include "components/dom_distiller/content/browser/dom_distiller_viewer_source.h "
20 #include "components/dom_distiller/core/dom_distiller_switches.h" 20 #include "components/dom_distiller/core/dom_distiller_switches.h"
21 #include "components/dom_distiller/core/url_constants.h" 21 #include "components/dom_distiller/core/url_constants.h"
22 22
23 #if defined(ENABLE_PRINT_PREVIEW)
24 #include "chrome/browser/ui/webui/print_preview/print_preview_distiller.h"
25 #endif // defined(ENABLE_PRINT_PREVIEW)
26
27 #if BUILDFLAG(ANDROID_JAVA_UI) 23 #if BUILDFLAG(ANDROID_JAVA_UI)
28 #include "chrome/browser/android/dom_distiller/distiller_ui_handle_android.h" 24 #include "chrome/browser/android/dom_distiller/distiller_ui_handle_android.h"
29 #endif // BUILDFLAG(ANDROID_JAVA_UI) 25 #endif // BUILDFLAG(ANDROID_JAVA_UI)
30 26
31 void RegisterDomDistillerViewerSource(Profile* profile) { 27 namespace dom_distiller {
28
29 void RegisterViewerSource(Profile* profile) {
32 bool enabled_distiller = base::CommandLine::ForCurrentProcess()->HasSwitch( 30 bool enabled_distiller = base::CommandLine::ForCurrentProcess()->HasSwitch(
33 switches::kEnableDomDistiller); 31 switches::kEnableDomDistiller);
34 #if defined(ENABLE_PRINT_PREVIEW) 32 if (!enabled_distiller)
35 if (PrintPreviewDistiller::IsEnabled()) 33 return;
36 enabled_distiller = true;
37 #endif // defined(ENABLE_PRINT_PREVIEW)
38 34
39 if (enabled_distiller) { 35 DomDistillerServiceFactory* dom_distiller_service_factory =
40 dom_distiller::DomDistillerServiceFactory* dom_distiller_service_factory = 36 DomDistillerServiceFactory::GetInstance();
41 dom_distiller::DomDistillerServiceFactory::GetInstance(); 37 // The LazyDomDistillerService deletes itself when the profile is destroyed.
42 // The LazyDomDistillerService deletes itself when the profile is destroyed. 38 LazyDomDistillerService* lazy_service =
43 dom_distiller::LazyDomDistillerService* lazy_service = 39 new LazyDomDistillerService(profile, dom_distiller_service_factory);
44 new dom_distiller::LazyDomDistillerService( 40 std::unique_ptr<DistillerUIHandle> ui_handle;
45 profile, dom_distiller_service_factory);
46 std::unique_ptr<dom_distiller::DistillerUIHandle> ui_handle;
47 41
48 #if BUILDFLAG(ANDROID_JAVA_UI) 42 #if BUILDFLAG(ANDROID_JAVA_UI)
49 ui_handle.reset( 43 ui_handle.reset(new dom_distiller::android::DistillerUIHandleAndroid());
50 new dom_distiller::android::DistillerUIHandleAndroid());
51 #endif // BUILDFLAG(ANDROID_JAVA_UI) 44 #endif // BUILDFLAG(ANDROID_JAVA_UI)
52 45
53 // Set the JavaScript world ID. 46 // Set the JavaScript world ID.
54 if (!dom_distiller::DistillerJavaScriptWorldIdIsSet()) { 47 if (!DistillerJavaScriptWorldIdIsSet()) {
55 dom_distiller::SetDistillerJavaScriptWorldId( 48 SetDistillerJavaScriptWorldId(chrome::ISOLATED_WORLD_ID_CHROME_INTERNAL);
56 chrome::ISOLATED_WORLD_ID_CHROME_INTERNAL); 49 }
57 }
58 50
59 content::URLDataSource::Add( 51 content::URLDataSource::Add(
60 profile, new dom_distiller::DomDistillerViewerSource( 52 profile, new DomDistillerViewerSource(lazy_service, kDomDistillerScheme,
61 lazy_service, dom_distiller::kDomDistillerScheme, 53 std::move(ui_handle)));
62 std::move(ui_handle)));
63 }
64 } 54 }
55
56 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « chrome/browser/dom_distiller/profile_utils.h ('k') | chrome/browser/printing/print_preview_dialog_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698