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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_DISTILLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_DISTILLER_H_
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/values.h"
12 #include "content/public/browser/web_contents_observer.h"
15 class URLRequestContextGetter
;
18 // This class controls the rendering of the distilled contents
19 // generated by a source web contents
20 class PrintPreviewDistiller
{
22 PrintPreviewDistiller(content::WebContents
* source_web_contents
,
23 base::Closure on_failed_callback
,
24 scoped_ptr
<base::DictionaryValue
> settings
);
25 ~PrintPreviewDistiller();
28 class WebContentsDelegateImpl
;
30 // Create the web contents with a default
31 // size. |session_storage_namespace| indicates the namespace that
32 // the distiller content renderer's page should be part of.
33 void CreateDestinationWebContents(
34 content::SessionStorageNamespace
* session_storage_namespace
,
35 content::WebContents
* source_web_contents
,
36 scoped_ptr
<base::DictionaryValue
> settings
,
37 base::Closure on_failed_callback
);
39 content::WebContents
* CreateWebContents(
40 content::SessionStorageNamespace
* session_storage_namespace
,
41 content::WebContents
* source_web_contents
);
43 // The distilled rendered WebContents; may be null.
44 scoped_ptr
<content::WebContents
> web_contents_
;
46 scoped_ptr
<WebContentsDelegateImpl
> web_contents_delegate_
;
48 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDistiller
);
51 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_DISTILLER_H_