Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors |
[email protected] | 7e856dde | 2014-03-15 00:34:05 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_DOM_DISTILLER_LAZY_DOM_DISTILLER_SERVICE_H_ |
| 6 | #define CHROME_BROWSER_DOM_DISTILLER_LAZY_DOM_DISTILLER_SERVICE_H_ |
| 7 | |
dcheng | c0e39d57 | 2016-04-19 06:15:17 | [diff] [blame] | 8 | #include <memory> |
| 9 | |
Keishi Hattori | 0e45c02 | 2021-11-27 09:25:52 | [diff] [blame] | 10 | #include "base/memory/raw_ptr.h" |
Evan Stade | eb9d25f | 2019-10-03 16:21:11 | [diff] [blame] | 11 | #include "base/supports_user_data.h" |
[email protected] | 7e856dde | 2014-03-15 00:34:05 | [diff] [blame] | 12 | #include "components/dom_distiller/core/dom_distiller_service.h" |
| 13 | #include "components/dom_distiller/core/task_tracker.h" |
[email protected] | 7e856dde | 2014-03-15 00:34:05 | [diff] [blame] | 14 | |
| 15 | class Profile; |
| 16 | |
| 17 | namespace dom_distiller { |
| 18 | |
[email protected] | 7e856dde | 2014-03-15 00:34:05 | [diff] [blame] | 19 | // A class which helps with lazy instantiation of the DomDistillerService, using |
Evan Stade | eb9d25f | 2019-10-03 16:21:11 | [diff] [blame] | 20 | // the BrowserContextKeyedServiceFactory for it. This class is owned by Profile. |
[email protected] | 7e856dde | 2014-03-15 00:34:05 | [diff] [blame] | 21 | class LazyDomDistillerService : public DomDistillerServiceInterface, |
Evan Stade | eb9d25f | 2019-10-03 16:21:11 | [diff] [blame] | 22 | public base::SupportsUserData::Data { |
[email protected] | 7e856dde | 2014-03-15 00:34:05 | [diff] [blame] | 23 | public: |
Evan Stade | eb9d25f | 2019-10-03 16:21:11 | [diff] [blame] | 24 | // Creates and returns an instance for |profile|. This does not pass ownership |
| 25 | // of the returned pointer. |
| 26 | static LazyDomDistillerService* Create(Profile* profile); |
| 27 | |
Peter Boström | 53c6c595 | 2021-09-17 09:41:26 | [diff] [blame] | 28 | LazyDomDistillerService(const LazyDomDistillerService&) = delete; |
| 29 | LazyDomDistillerService& operator=(const LazyDomDistillerService&) = delete; |
| 30 | |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 31 | ~LazyDomDistillerService() override; |
[email protected] | 7e856dde | 2014-03-15 00:34:05 | [diff] [blame] | 32 | |
[email protected] | 7e856dde | 2014-03-15 00:34:05 | [diff] [blame] | 33 | // DomDistillerServiceInterface implementation: |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 34 | std::unique_ptr<ViewerHandle> ViewUrl( |
| 35 | ViewRequestDelegate* delegate, |
| 36 | std::unique_ptr<DistillerPage> distiller_page, |
| 37 | const GURL& url) override; |
| 38 | std::unique_ptr<DistillerPage> CreateDefaultDistillerPage( |
mostynb | 01d8b10e | 2014-10-13 09:44:44 | [diff] [blame] | 39 | const gfx::Size& render_view_size) override; |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 40 | std::unique_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( |
| 41 | std::unique_ptr<SourcePageHandle> handle) override; |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 42 | DistilledPagePrefs* GetDistilledPagePrefs() override; |
Miyoung Shin | 9dc67ba | 2019-11-08 14:04:33 | [diff] [blame] | 43 | DistillerUIHandle* GetDistillerUIHandle() override; |
|