Index: chrome/browser/ui/webui/print_preview/hidden_print_preview.h |
diff --git a/chrome/browser/ui/webui/print_preview/hidden_print_preview.h b/chrome/browser/ui/webui/print_preview/hidden_print_preview.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6dce165a0d34f0ced208462afa253c7db571aa62 |
--- /dev/null |
+++ b/chrome/browser/ui/webui/print_preview/hidden_print_preview.h |
@@ -0,0 +1,116 @@ |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
no (c)
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HIDDEN_PRINT_PREVIEW_H_ |
+#define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HIDDEN_PRINT_PREVIEW_H_ |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/observer_list.h" |
+#include "base/values.h" |
+#include "content/public/browser/notification_observer.h" |
+#include "content/public/browser/notification_registrar.h" |
+#include "content/public/browser/web_contents_observer.h" |
+#include "content/public/common/referrer.h" |
+#include "ui/gfx/geometry/size.h" |
+ |
+class Profile; |
+class PrintPreviewUI; |
+ |
+namespace net { |
+class URLRequestContextGetter; |
+} |
+ |
+class HiddenPrintPreview : public content::NotificationObserver, |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
Please explain purpose of this class here.
|
+ public content::WebContentsObserver, |
+ public base::SupportsWeakPtr<HiddenPrintPreview> { |
+public: |
+ HiddenPrintPreview( |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
HiddenPrintPreview -> PrintPreviewDistiller
|
+ content::WebContents* target_web_contents, |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
misaligned
please run "git cl format"
|
+ PrintPreviewUI* print_preview_ui, |
+ scoped_ptr<base::DictionaryValue> settings); |
+ ~HiddenPrintPreview() override; |
+ |
+ // Start rendering the contents in the prerendered state. |size| |
+ // indicates the rectangular dimensions that the hidden renderer's page should |
+ // be. |session_storage_namespace| indicates the namespace that the hidden |
+ // renderer's page should be part of. |
+ virtual void StartRendering( |
+ const gfx::Size& size, |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
why is this virtual?
|
+ content::SessionStorageNamespace* session_storage_namespace); |
+ |
+ // content::WebContentsObserver implementation. |
+ void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; |
+ void DidStopLoading() override; |
+ void DocumentLoadedInFrame( |
+ content::RenderFrameHost* render_frame_host) override; |
+ void DidStartProvisionalLoadForFrame( |
+ content::RenderFrameHost* render_frame_host, |
+ const GURL& validated_url, |
+ bool is_error_page, |
+ bool is_iframe_srcdoc) override; |
+ void DidFinishLoad(content::RenderFrameHost* render_frame_host, |
+ const GURL& validated_url) override; |
+ void DidNavigateMainFrame( |
+ const content::LoadCommittedDetails& details, |
+ const content::FrameNavigateParams& params) override; |
+ void DidGetRedirectForResourceRequest( |
+ content::RenderFrameHost* render_frame_host, |
+ const content::ResourceRedirectDetails& details) override; |
+ |
+ void RenderProcessGone(base::TerminationStatus status) override; |
+ |
+ // content::NotificationObserver |
+ void Observe(int type, |
+ const content::NotificationSource& source, |
+ const content::NotificationDetails& details) override; |
+ |
+ // Sets the final status, calls OnDestroy and adds |this| to the |
+ // PrerenderManager's pending deletes list. |
+ void Destroy(); |
+ |
+ private: |
+ class WebContentsDelegateImpl; |
+ |
+ content::WebContents* CreateWebContents( |
+ content::SessionStorageNamespace* session_storage_namespace); |
+ |
+ // The hidden rendered WebContents; may be null. |
+ scoped_ptr<content::WebContents> web_contents_; |
+ |
+ // The session storage namespace id for use in matching. We must save it |
+ // rather than get it from the RenderViewHost since in the control group |
+ // we won't have a RenderViewHost. |
+ int64 session_storage_namespace_id_; |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
unused
|
+ |
+ // The profile being used |
+ Profile* profile_; |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
remove please
|
+ |
+ content::NotificationRegistrar notification_registrar_; |
+ |
+ // True when the main frame has finished loading. |
+ bool has_finished_loading_; |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
unused
|
+ |
+ // Tracks whether or not rendering has been cancelled by calling Destroy. |
+ // Used solely to prevent double deletion. |
+ bool rendering_has_been_cancelled_; |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
unused
|
+ |
+ scoped_ptr<WebContentsDelegateImpl> web_contents_delegate_; |
+ |
+ // The size of the WebView from the launching page. |
+ gfx::Size size_; |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
it's always same, please remove and create constan
|
+ |
+ // The WebContents that contains the original page. |
+ content::WebContents* target_web_contents_; |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
if you can AddProxyDialogForWebContents in constru
|
+ |
+ // Settings to pass during generation of the print preview. |
+ scoped_ptr<base::DictionaryValue> settings_; |
+ |
+ // The UI for the print preview that owns this hidden print preview generator. |
+ PrintPreviewUI* print_preview_ui_; |
Vitaly Buka (NO REVIEWS)
2015/07/13 07:00:31
replace with callback
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(HiddenPrintPreview); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HIDDEN_PRINT_PREVIEW_H_ |