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 "base/callback.h" | 8 #include "base/callback_forward.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "content/public/browser/web_contents_observer.h" | |
Lei Zhang
2015/08/14 05:44:35
nit: not used
| |
13 | 12 |
14 namespace net { | 13 namespace content { |
15 class URLRequestContextGetter; | 14 class WebContents; |
Lei Zhang
2015/08/14 05:44:35
nit: not used
| |
16 } | 15 } |
17 | 16 |
18 // This class controls the rendering of the distilled contents | 17 // This class controls the rendering of the distilled contents |
19 // generated by a source web contents | 18 // generated by a source web contents |
20 class PrintPreviewDistiller { | 19 class PrintPreviewDistiller { |
21 public: | 20 public: |
22 PrintPreviewDistiller(content::WebContents* source_web_contents, | 21 PrintPreviewDistiller(content::WebContents* source_web_contents, |
23 base::Closure on_failed_callback, | 22 const base::Closure& on_failed_callback, |
Lei Zhang
2015/08/14 05:44:35
pass callbacks by const ref
| |
24 scoped_ptr<base::DictionaryValue> settings); | 23 scoped_ptr<base::DictionaryValue> settings); |
25 ~PrintPreviewDistiller(); | 24 ~PrintPreviewDistiller(); |
26 | 25 |
27 private: | 26 private: |
28 class WebContentsDelegateImpl; | 27 class WebContentsDelegateImpl; |
29 | 28 |
30 // Create the web contents with a default | 29 // Create the web contents with a default size. |
31 // size. |session_storage_namespace| indicates the namespace that | |
32 // the distiller content renderer's page should be part of. | |
33 void CreateDestinationWebContents( | 30 void CreateDestinationWebContents( |
34 content::SessionStorageNamespace* session_storage_namespace, | |
35 content::WebContents* source_web_contents, | 31 content::WebContents* source_web_contents, |
36 scoped_ptr<base::DictionaryValue> settings, | 32 scoped_ptr<base::DictionaryValue> settings, |
37 base::Closure on_failed_callback); | 33 const base::Closure& on_failed_callback); |
38 | 34 |
39 content::WebContents* CreateWebContents( | 35 // The WebContents for the distilled rendering; may be null. |
40 content::SessionStorageNamespace* session_storage_namespace, | |
41 content::WebContents* source_web_contents); | |
42 | |
43 // The distilled rendered WebContents; may be null. | |
44 scoped_ptr<content::WebContents> web_contents_; | 36 scoped_ptr<content::WebContents> web_contents_; |
45 | 37 |
46 scoped_ptr<WebContentsDelegateImpl> web_contents_delegate_; | 38 scoped_ptr<WebContentsDelegateImpl> web_contents_delegate_; |
47 | 39 |
48 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDistiller); | 40 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDistiller); |
49 }; | 41 }; |
50 | 42 |
51 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_DISTILLER_H_ | 43 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_DISTILLER_H_ |
OLD | NEW |