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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_distiller.cc

Issue 1920563002: Only trigger navigation in distiller if in print preview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 #include "chrome/browser/ui/webui/print_preview/print_preview_distiller.h" 5 #include "chrome/browser/ui/webui/print_preview/print_preview_distiller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 content::RenderFrameHost* render_frame_host) override { 129 content::RenderFrameHost* render_frame_host) override {
130 // When a new RenderFrame is created for a distilled rendering 130 // When a new RenderFrame is created for a distilled rendering
131 // WebContents, tell the new RenderFrame it's being used for 131 // WebContents, tell the new RenderFrame it's being used for
132 // prerendering before any navigations occur. Note that this is 132 // prerendering before any navigations occur. Note that this is
133 // always triggered before the first navigation, so there's no 133 // always triggered before the first navigation, so there's no
134 // need to send the message just after the WebContents is created. 134 // need to send the message just after the WebContents is created.
135 render_frame_host->Send(new PrerenderMsg_SetIsPrerendering( 135 render_frame_host->Send(new PrerenderMsg_SetIsPrerendering(
136 render_frame_host->GetRoutingID(), true)); 136 render_frame_host->GetRoutingID(), true));
137 } 137 }
138 138
139 void DidFinishLoad(content::RenderFrameHost* render_frame_host,
140 const GURL& validated_url) override {
141 // Notify distiller that print preview is using it.
142 dom_distiller::RunIsolatedJavaScript(web_contents()->GetMainFrame(),
143 "var is_print_preview_distiller = true;");
144 }
145
139 void DoPrintPreview() { 146 void DoPrintPreview() {
140 RenderViewHost* rvh = web_contents()->GetRenderViewHost(); 147 RenderViewHost* rvh = web_contents()->GetRenderViewHost();
141 rvh->Send(new PrintMsg_InitiatePrintPreview(rvh->GetRoutingID(), false)); 148 rvh->Send(new PrintMsg_InitiatePrintPreview(rvh->GetRoutingID(), false));
142 rvh->Send(new PrintMsg_PrintPreview(rvh->GetRoutingID(), *settings_)); 149 rvh->Send(new PrintMsg_PrintPreview(rvh->GetRoutingID(), *settings_));
143 } 150 }
144 151
145 void DidGetRedirectForResourceRequest( 152 void DidGetRedirectForResourceRequest(
146 content::RenderFrameHost* render_frame_host, 153 content::RenderFrameHost* render_frame_host,
147 const content::ResourceRedirectDetails& details) override { 154 const content::ResourceRedirectDetails& details) override {
148 if (details.resource_type != content::RESOURCE_TYPE_MAIN_FRAME) 155 if (details.resource_type != content::RESOURCE_TYPE_MAIN_FRAME)
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 WebContents* source_web_contents) { 283 WebContents* source_web_contents) {
277 // TODO(ajwong): Remove the temporary map once prerendering is aware of 284 // TODO(ajwong): Remove the temporary map once prerendering is aware of
278 // multiple session storage namespaces per tab. 285 // multiple session storage namespaces per tab.
279 content::SessionStorageNamespaceMap session_storage_namespace_map; 286 content::SessionStorageNamespaceMap session_storage_namespace_map;
280 Profile* profile = 287 Profile* profile =
281 Profile::FromBrowserContext(source_web_contents->GetBrowserContext()); 288 Profile::FromBrowserContext(source_web_contents->GetBrowserContext());
282 session_storage_namespace_map[std::string()] = session_storage_namespace; 289 session_storage_namespace_map[std::string()] = session_storage_namespace;
283 return WebContents::CreateWithSessionStorage( 290 return WebContents::CreateWithSessionStorage(
284 WebContents::CreateParams(profile), session_storage_namespace_map); 291 WebContents::CreateParams(profile), session_storage_namespace_map);
285 } 292 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698