blob: c55c5afb7e79797d987508ca15e2f639393d5122 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2014 The Chromium Authors
[email protected]7e856dde2014-03-15 00:34:052// 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
dchengc0e39d572016-04-19 06:15:178#include <memory>
9
Keishi Hattori0e45c022021-11-27 09:25:5210#include "base/memory/raw_ptr.h"
Evan Stadeeb9d25f2019-10-03 16:21:1111#include "base/supports_user_data.h"
[email protected]7e856dde2014-03-15 00:34:0512#include "components/dom_distiller/core/dom_distiller_service.h"
13#include "components/dom_distiller/core/task_tracker.h"
[email protected]7e856dde2014-03-15 00:34:0514
15class Profile;
16
17namespace dom_distiller {
18
[email protected]7e856dde2014-03-15 00:34:0519// A class which helps with lazy instantiation of the DomDistillerService, using
Evan Stadeeb9d25f2019-10-03 16:21:1120// the BrowserContextKeyedServiceFactory for it. This class is owned by Profile.
[email protected]7e856dde2014-03-15 00:34:0521class LazyDomDistillerService : public DomDistillerServiceInterface,
Evan Stadeeb9d25f2019-10-03 16:21:1122 public base::SupportsUserData::Data {
[email protected]7e856dde2014-03-15 00:34:0523 public:
Evan Stadeeb9d25f2019-10-03 16:21:1124 // 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öm53c6c5952021-09-17 09:41:2628 LazyDomDistillerService(const LazyDomDistillerService&) = delete;
29 LazyDomDistillerService& operator=(const LazyDomDistillerService&) = delete;
30
Daniel Chenga542fca2014-10-21 09:51:2931 ~LazyDomDistillerService() override;
[email protected]7e856dde2014-03-15 00:34:0532
[email protected]7e856dde2014-03-15 00:34:0533 // DomDistillerServiceInterface implementation:
dcheng4af48582016-04-19 00:29:3534 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(
mostynb01d8b10e2014-10-13 09:44:4439 const gfx::Size& render_view_size) override;
dcheng4af48582016-04-19 00:29:3540 std::unique_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle(
41 std::unique_ptr<SourcePageHandle> handle) override;
Daniel Chenga542fca2014-10-21 09:51:2942 DistilledPagePrefs* GetDistilledPagePrefs() override;
Miyoung Shin9dc67ba2019-11-08 14:04:3343 DistillerUIHandle* GetDistillerUIHandle() override;