OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_DISTILLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_DISTILLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_DISTILLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_DISTILLER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/feature_list.h" | 11 #include "base/feature_list.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
15 | 16 |
16 namespace net { | 17 namespace net { |
17 class URLRequestContextGetter; | 18 class URLRequestContextGetter; |
18 } | 19 } |
19 | 20 |
20 // This class controls the rendering of the distilled contents | 21 // This class controls the rendering of the distilled contents |
21 // generated by a source web contents | 22 // generated by a source web contents |
22 class PrintPreviewDistiller { | 23 class PrintPreviewDistiller { |
23 public: | 24 public: |
24 static const base::Feature kFeature; | 25 static const base::Feature kFeature; |
25 | 26 |
26 static bool IsEnabled(); | 27 static bool IsEnabled(); |
27 | 28 |
28 PrintPreviewDistiller(content::WebContents* source_web_contents, | 29 PrintPreviewDistiller(content::WebContents* source_web_contents, |
29 base::Closure on_failed_callback, | 30 base::Closure on_failed_callback, |
30 scoped_ptr<base::DictionaryValue> settings); | 31 std::unique_ptr<base::DictionaryValue> settings); |
31 ~PrintPreviewDistiller(); | 32 ~PrintPreviewDistiller(); |
32 | 33 |
33 private: | 34 private: |
34 class WebContentsDelegateImpl; | 35 class WebContentsDelegateImpl; |
35 | 36 |
36 // Create the web contents with a default | 37 // Create the web contents with a default |
37 // size. |session_storage_namespace| indicates the namespace that | 38 // size. |session_storage_namespace| indicates the namespace that |
38 // the distiller content renderer's page should be part of. | 39 // the distiller content renderer's page should be part of. |
39 void CreateDestinationWebContents( | 40 void CreateDestinationWebContents( |
40 content::SessionStorageNamespace* session_storage_namespace, | 41 content::SessionStorageNamespace* session_storage_namespace, |
41 content::WebContents* source_web_contents, | 42 content::WebContents* source_web_contents, |
42 scoped_ptr<base::DictionaryValue> settings, | 43 std::unique_ptr<base::DictionaryValue> settings, |
43 base::Closure on_failed_callback); | 44 base::Closure on_failed_callback); |
44 | 45 |
45 content::WebContents* CreateWebContents( | 46 content::WebContents* CreateWebContents( |
46 content::SessionStorageNamespace* session_storage_namespace, | 47 content::SessionStorageNamespace* session_storage_namespace, |
47 content::WebContents* source_web_contents); | 48 content::WebContents* source_web_contents); |
48 | 49 |
49 // The distilled rendered WebContents; may be null. | 50 // The distilled rendered WebContents; may be null. |
50 scoped_ptr<content::WebContents> web_contents_; | 51 std::unique_ptr<content::WebContents> web_contents_; |
51 | 52 |
52 scoped_ptr<WebContentsDelegateImpl> web_contents_delegate_; | 53 std::unique_ptr<WebContentsDelegateImpl> web_contents_delegate_; |
53 | 54 |
54 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDistiller); | 55 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDistiller); |
55 }; | 56 }; |
56 | 57 |
57 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_DISTILLER_H_ | 58 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_DISTILLER_H_ |
OLD | NEW |