Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: components/dom_distiller/core/distiller_page.h

Issue 1879613003: Convert //components/dom_distiller from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_PAGE_H_ 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_PAGE_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_PAGE_H_ 6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_PAGE_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "third_party/dom_distiller_js/dom_distiller.pb.h" 15 #include "third_party/dom_distiller_js/dom_distiller.pb.h"
16 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 namespace dom_distiller { 19 namespace dom_distiller {
20 20
21 class SourcePageHandle { 21 class SourcePageHandle {
22 public: 22 public:
23 virtual ~SourcePageHandle() {} 23 virtual ~SourcePageHandle() {}
24 }; 24 };
25 25
26 // Injects JavaScript into a page, and uses it to extract and return long-form 26 // Injects JavaScript into a page, and uses it to extract and return long-form
27 // content. The class can be reused to load and distill multiple pages, 27 // content. The class can be reused to load and distill multiple pages,
28 // following the state transitions described along with the class's states. 28 // following the state transitions described along with the class's states.
29 // Constructing a DistillerPage should be cheap, as some of the instances can be 29 // Constructing a DistillerPage should be cheap, as some of the instances can be
30 // thrown away without ever being used. 30 // thrown away without ever being used.
31 class DistillerPage { 31 class DistillerPage {
32 public: 32 public:
33 typedef base::Callback< 33 typedef base::Callback<void(
34 void(scoped_ptr<proto::DomDistillerResult> distilled_page, 34 std::unique_ptr<proto::DomDistillerResult> distilled_page,
35 bool distillation_successful)> DistillerPageCallback; 35 bool distillation_successful)>
36 DistillerPageCallback;
36 37
37 DistillerPage(); 38 DistillerPage();
38 virtual ~DistillerPage(); 39 virtual ~DistillerPage();
39 40
40 // Loads a URL. |OnDistillationDone| is called when the load completes or 41 // Loads a URL. |OnDistillationDone| is called when the load completes or
41 // fails. May be called when the distiller is idle. Callers can assume that, 42 // fails. May be called when the distiller is idle. Callers can assume that,
42 // for a given |url| and |options|, any DistillerPage implementation will 43 // for a given |url| and |options|, any DistillerPage implementation will
43 // extract the same content. 44 // extract the same content.
44 void DistillPage(const GURL& url, 45 void DistillPage(const GURL& url,
45 const proto::DomDistillerOptions options, 46 const proto::DomDistillerOptions options,
(...skipping 22 matching lines...) Expand all
68 }; 69 };
69 70
70 // Factory for generating a |DistillerPage|. 71 // Factory for generating a |DistillerPage|.
71 class DistillerPageFactory { 72 class DistillerPageFactory {
72 public: 73 public:
73 virtual ~DistillerPageFactory(); 74 virtual ~DistillerPageFactory();
74 75
75 // Constructs and returns a new DistillerPage. The implementation of this 76 // Constructs and returns a new DistillerPage. The implementation of this
76 // should be very cheap, since the pages can be thrown away without being 77 // should be very cheap, since the pages can be thrown away without being
77 // used. 78 // used.
78 virtual scoped_ptr<DistillerPage> CreateDistillerPage( 79 virtual std::unique_ptr<DistillerPage> CreateDistillerPage(
79 const gfx::Size& render_view_size) const = 0; 80 const gfx::Size& render_view_size) const = 0;
80 virtual scoped_ptr<DistillerPage> CreateDistillerPageWithHandle( 81 virtual std::unique_ptr<DistillerPage> CreateDistillerPageWithHandle(
81 scoped_ptr<SourcePageHandle> handle) const = 0; 82 std::unique_ptr<SourcePageHandle> handle) const = 0;
82 }; 83 };
83 84
84 } // namespace dom_distiller 85 } // namespace dom_distiller
85 86
86 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_PAGE_H_ 87 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_PAGE_H_
OLDNEW
« no previous file with comments | « components/dom_distiller/core/distiller.cc ('k') | components/dom_distiller/core/distiller_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698