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