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/lazy_dom_distiller_service.h" | 5 #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h" |
6 | 6 |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "components/dom_distiller/core/distiller_page.h" | 10 #include "components/dom_distiller/core/distiller_page.h" |
11 #include "components/dom_distiller/core/dom_distiller_service.h" | 11 #include "components/dom_distiller/core/dom_distiller_service.h" |
12 #include "components/dom_distiller/core/reader_mode_preferences.h" | |
12 #include "content/public/browser/notification_source.h" | 13 #include "content/public/browser/notification_source.h" |
13 | 14 |
14 namespace dom_distiller { | 15 namespace dom_distiller { |
15 | 16 |
16 LazyDomDistillerService::LazyDomDistillerService( | 17 LazyDomDistillerService::LazyDomDistillerService( |
17 Profile* profile, | 18 Profile* profile, |
18 const DomDistillerServiceFactory* service_factory) | 19 const DomDistillerServiceFactory* service_factory) |
19 : profile_(profile), service_factory_(service_factory) { | 20 : profile_(profile), service_factory_(service_factory) { |
20 registrar_.Add(this, | 21 registrar_.Add(this, |
21 chrome::NOTIFICATION_PROFILE_DESTROYED, | 22 chrome::NOTIFICATION_PROFILE_DESTROYED, |
22 content::Source<Profile>(profile)); | 23 content::Source<Profile>(profile)); |
24 reader_mode_prefs_.reset(new ReaderModePrefs(profile_)); | |
battre
2014/06/23 08:37:23
Move this after service_factory_(service_factory)
nyquist
2014/06/23 16:03:05
Also, like battre has mentioned, this is probably
smaslo
2014/06/23 22:14:32
Removed completely.
smaslo
2014/06/23 22:14:32
Done.
| |
23 } | 25 } |
24 | 26 |
25 LazyDomDistillerService::~LazyDomDistillerService() { | 27 LazyDomDistillerService::~LazyDomDistillerService() { |
26 } | 28 } |
27 | 29 |
28 // This will create an object and schedule work the first time it's called | 30 // This will create an object and schedule work the first time it's called |
29 // and just return an existing object after that. | 31 // and just return an existing object after that. |
30 DomDistillerServiceInterface* LazyDomDistillerService::instance() const { | 32 DomDistillerServiceInterface* LazyDomDistillerService::instance() const { |
31 return service_factory_->GetForBrowserContext(profile_); | 33 return service_factory_->GetForBrowserContext(profile_); |
32 } | 34 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 } | 88 } |
87 | 89 |
88 void LazyDomDistillerService::AddObserver(DomDistillerObserver* observer) { | 90 void LazyDomDistillerService::AddObserver(DomDistillerObserver* observer) { |
89 instance()->AddObserver(observer); | 91 instance()->AddObserver(observer); |
90 } | 92 } |
91 | 93 |
92 void LazyDomDistillerService::RemoveObserver(DomDistillerObserver* observer) { | 94 void LazyDomDistillerService::RemoveObserver(DomDistillerObserver* observer) { |
93 instance()->RemoveObserver(observer); | 95 instance()->RemoveObserver(observer); |
94 } | 96 } |
95 | 97 |
98 ReaderModePrefs* LazyDomDistillerService::GetReaderModePrefs() const { | |
99 return reader_mode_prefs_.get(); | |
nyquist
2014/06/23 16:03:05
This could probably just delegate to the DomDistil
smaslo
2014/06/23 22:14:32
Done.
| |
100 } | |
101 | |
96 } // namespace dom_distiller | 102 } // namespace dom_distiller |
OLD | NEW |