Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: chrome/browser/ui/webui/print_preview/hidden_print_preview.h

Issue 1125343004: Add a "Simplify Page" option to the print preview dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify version of the HiddenPrintPreview and solved issues pointed out by the last review Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 no (c)
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_HIDDEN_PRINT_PREVIEW_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HIDDEN_PRINT_PREVIEW_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/observer_list.h"
11 #include "base/values.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14 #include "content/public/browser/web_contents_observer.h"
15 #include "content/public/common/referrer.h"
16 #include "ui/gfx/geometry/size.h"
17
18 class Profile;
19 class PrintPreviewUI;
20
21 namespace net {
22 class URLRequestContextGetter;
23 }
24
25 class HiddenPrintPreview : public content::NotificationObserver,
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 Please explain purpose of this class here.
26 public content::WebContentsObserver,
27 public base::SupportsWeakPtr<HiddenPrintPreview> {
28 public:
29 HiddenPrintPreview(
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 HiddenPrintPreview -> PrintPreviewDistiller
30 content::WebContents* target_web_contents,
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 misaligned please run "git cl format"
31 PrintPreviewUI* print_preview_ui,
32 scoped_ptr<base::DictionaryValue> settings);
33 ~HiddenPrintPreview() override;
34
35 // Start rendering the contents in the prerendered state. |size|
36 // indicates the rectangular dimensions that the hidden renderer's page should
37 // be. |session_storage_namespace| indicates the namespace that the hidden
38 // renderer's page should be part of.
39 virtual void StartRendering(
40 const gfx::Size& size,
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 why is this virtual?
41 content::SessionStorageNamespace* session_storage_namespace);
42
43 // content::WebContentsObserver implementation.
44 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
45 void DidStopLoading() override;
46 void DocumentLoadedInFrame(
47 content::RenderFrameHost* render_frame_host) override;
48 void DidStartProvisionalLoadForFrame(
49 content::RenderFrameHost* render_frame_host,
50 const GURL& validated_url,
51 bool is_error_page,
52 bool is_iframe_srcdoc) override;
53 void DidFinishLoad(content::RenderFrameHost* render_frame_host,
54 const GURL& validated_url) override;
55 void DidNavigateMainFrame(
56 const content::LoadCommittedDetails& details,
57 const content::FrameNavigateParams& params) override;
58 void DidGetRedirectForResourceRequest(
59 content::RenderFrameHost* render_frame_host,
60 const content::ResourceRedirectDetails& details) override;
61
62 void RenderProcessGone(base::TerminationStatus status) override;
63
64 // content::NotificationObserver
65 void Observe(int type,
66 const content::NotificationSource& source,
67 const content::NotificationDetails& details) override;
68
69 // Sets the final status, calls OnDestroy and adds |this| to the
70 // PrerenderManager's pending deletes list.
71 void Destroy();
72
73 private:
74 class WebContentsDelegateImpl;
75
76 content::WebContents* CreateWebContents(
77 content::SessionStorageNamespace* session_storage_namespace);
78
79 // The hidden rendered WebContents; may be null.
80 scoped_ptr<content::WebContents> web_contents_;
81
82 // The session storage namespace id for use in matching. We must save it
83 // rather than get it from the RenderViewHost since in the control group
84 // we won't have a RenderViewHost.
85 int64 session_storage_namespace_id_;
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 unused
86
87 // The profile being used
88 Profile* profile_;
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 remove please
89
90 content::NotificationRegistrar notification_registrar_;
91
92 // True when the main frame has finished loading.
93 bool has_finished_loading_;
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 unused
94
95 // Tracks whether or not rendering has been cancelled by calling Destroy.
96 // Used solely to prevent double deletion.
97 bool rendering_has_been_cancelled_;
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 unused
98
99 scoped_ptr<WebContentsDelegateImpl> web_contents_delegate_;
100
101 // The size of the WebView from the launching page.
102 gfx::Size size_;
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 it's always same, please remove and create constan
103
104 // The WebContents that contains the original page.
105 content::WebContents* target_web_contents_;
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 if you can AddProxyDialogForWebContents in constru
106
107 // Settings to pass during generation of the print preview.
108 scoped_ptr<base::DictionaryValue> settings_;
109
110 // The UI for the print preview that owns this hidden print preview generator.
111 PrintPreviewUI* print_preview_ui_;
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:31 replace with callback
112
113 DISALLOW_COPY_AND_ASSIGN(HiddenPrintPreview);
114 };
115
116 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HIDDEN_PRINT_PREVIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698