OLD | NEW |
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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 8 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
9 #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h" | 9 #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" | 12 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" |
13 #include "components/dom_distiller/core/url_constants.h" | 13 #include "components/dom_distiller/core/url_constants.h" |
14 | 14 |
15 void RegisterDomDistillerViewerSource(Profile* profile) { | 15 void RegisterDomDistillerViewerSource(Profile* profile) { |
16 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 16 const base::CommandLine& command_line = |
| 17 *base::CommandLine::ForCurrentProcess(); |
17 if (command_line.HasSwitch(switches::kEnableDomDistiller)) { | 18 if (command_line.HasSwitch(switches::kEnableDomDistiller)) { |
18 dom_distiller::DomDistillerServiceFactory* dom_distiller_service_factory = | 19 dom_distiller::DomDistillerServiceFactory* dom_distiller_service_factory = |
19 dom_distiller::DomDistillerServiceFactory::GetInstance(); | 20 dom_distiller::DomDistillerServiceFactory::GetInstance(); |
20 // The LazyDomDistillerService deletes itself when the profile is destroyed. | 21 // The LazyDomDistillerService deletes itself when the profile is destroyed. |
21 dom_distiller::LazyDomDistillerService* lazy_service = | 22 dom_distiller::LazyDomDistillerService* lazy_service = |
22 new dom_distiller::LazyDomDistillerService( | 23 new dom_distiller::LazyDomDistillerService( |
23 profile, dom_distiller_service_factory); | 24 profile, dom_distiller_service_factory); |
24 content::URLDataSource::Add( | 25 content::URLDataSource::Add( |
25 profile, | 26 profile, |
26 new dom_distiller::DomDistillerViewerSource( | 27 new dom_distiller::DomDistillerViewerSource( |
27 lazy_service, dom_distiller::kDomDistillerScheme)); | 28 lazy_service, dom_distiller::kDomDistillerScheme)); |
28 } | 29 } |
29 } | 30 } |
OLD | NEW |