summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profiles
diff options
context:
space:
mode:
authornyquist <nyquist@chromium.org>2014-09-26 10:54:25 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-26 17:54:42 +0000
commit6e3ab0a5c3ca6fcb76a736107e08dbbbf1e2637a (patch)
treea7a195bcbc3cb6c519752f6ca7a908d3d792af97 /chrome/browser/profiles
parentafdaf434f9435722f239de0954df3618156ae0a0 (diff)
downloadchromium_src-6e3ab0a5c3ca6fcb76a736107e08dbbbf1e2637a.zip
chromium_src-6e3ab0a5c3ca6fcb76a736107e08dbbbf1e2637a.tar.gz
chromium_src-6e3ab0a5c3ca6fcb76a736107e08dbbbf1e2637a.tar.bz2
Add support for using DOM Distiller in incognito.
Currently the DOM Distiller does not work in incognito, since the source for the chrome-distiller:// scheme has not been registered. This CL moves the functionality for registering the scheme to a generic place and it is now used by both ProfileImpl and by OffTheRecordProfile during profile creation. It also makes both the normal profile and the incognito profile use the same instance of the DomDistillerService. BUG=380036 Review URL: https://codereview.chromium.org/608653002 Cr-Commit-Position: refs/heads/master@{#296974}
Diffstat (limited to 'chrome/browser/profiles')
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.cc5
-rw-r--r--chrome/browser/profiles/profile_impl.cc23
2 files changed, 6 insertions, 22 deletions
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index ef044df..4df068d 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/background/background_contents_service_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/browser/dom_distiller/profile_utils.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_service.h"
#include "chrome/browser/download/download_service_factory.h"
@@ -160,6 +161,10 @@ void OffTheRecordProfileImpl::Init() {
BrowserThread::IO, FROM_HERE,
base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this));
#endif
+
+ // The DomDistillerViewerSource is not a normal WebUI so it must be registered
+ // as a URLDataSource early.
+ RegisterDomDistillerViewerSource(this);
}
OffTheRecordProfileImpl::~OffTheRecordProfileImpl() {
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 4229b4f..f770e23 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -34,8 +34,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/cookie_settings.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
-#include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
-#include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h"
+#include "chrome/browser/dom_distiller/profile_utils.h"
#include "chrome/browser/domain_reliability/service_factory.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_service.h"
@@ -85,8 +84,6 @@
#include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
#include "components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h"
-#include "components/dom_distiller/content/dom_distiller_viewer_source.h"
-#include "components/dom_distiller/core/url_constants.h"
#include "components/domain_reliability/monitor.h"
#include "components/domain_reliability/service.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
@@ -251,24 +248,6 @@ std::string ExitTypeToSessionTypePrefValue(Profile::ExitType type) {
return std::string();
}
-// Setup URLDataSource for the chrome-distiller:// scheme for the given
-// |profile|.
-void RegisterDomDistillerViewerSource(Profile* profile) {
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kEnableDomDistiller)) {
- dom_distiller::DomDistillerServiceFactory* dom_distiller_service_factory =
- dom_distiller::DomDistillerServiceFactory::GetInstance();
- // The LazyDomDistillerService deletes itself when the profile is destroyed.
- dom_distiller::LazyDomDistillerService* lazy_service =
- new dom_distiller::LazyDomDistillerService(
- profile, dom_distiller_service_factory);
- content::URLDataSource::Add(
- profile,
- new dom_distiller::DomDistillerViewerSource(
- lazy_service, dom_distiller::kDomDistillerScheme));
- }
-}
-
PrefStore* CreateExtensionPrefStore(Profile* profile,
bool incognito_pref_store) {
#if defined(ENABLE_EXTENSIONS)