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

Side by Side Diff: chrome/renderer/printing/print_web_view_helper.h

Issue 510253002: Try to use URL and title of the printed frame for header and footer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Thu Aug 28 00:07:06 PDT 2014 Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/renderer/printing/print_web_view_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ 5 #ifndef CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_
6 #define CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ 6 #define CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 static void ComputePageLayoutInPointsForCss( 266 static void ComputePageLayoutInPointsForCss(
267 blink::WebFrame* frame, 267 blink::WebFrame* frame,
268 int page_index, 268 int page_index,
269 const PrintMsg_Print_Params& default_params, 269 const PrintMsg_Print_Params& default_params,
270 bool ignore_css_margins, 270 bool ignore_css_margins,
271 double* scale_factor, 271 double* scale_factor,
272 PageSizeMargins* page_layout_in_points); 272 PageSizeMargins* page_layout_in_points);
273 273
274 // Given the |device| and |canvas| to draw on, prints the appropriate headers 274 // Given the |device| and |canvas| to draw on, prints the appropriate headers
275 // and footers using strings from |header_footer_info| on to the canvas. 275 // and footers using strings from |header_footer_info| on to the canvas.
276 static void PrintHeaderAndFooter( 276 static void PrintHeaderAndFooter(blink::WebCanvas* canvas,
277 blink::WebCanvas* canvas, 277 int page_number,
278 int page_number, 278 int total_pages,
279 int total_pages, 279 const blink::WebFrame& source_frame,
280 float webkit_scale_factor, 280 float webkit_scale_factor,
281 const PageSizeMargins& page_layout_in_points, 281 const PageSizeMargins& page_layout_in_points,
282 const base::DictionaryValue& header_footer_info, 282 const PrintMsg_Print_Params& params);
283 const PrintMsg_Print_Params& params);
284 283
285 bool GetPrintFrame(blink::WebLocalFrame** frame); 284 bool GetPrintFrame(blink::WebLocalFrame** frame);
286 285
287 // Script Initiated Printing ------------------------------------------------ 286 // Script Initiated Printing ------------------------------------------------
288 287
289 // Return true if script initiated printing is currently 288 // Return true if script initiated printing is currently
290 // allowed. |user_initiated| should be true when a user event triggered the 289 // allowed. |user_initiated| should be true when a user event triggered the
291 // script, most likely by pressing a print button on the page. 290 // script, most likely by pressing a print button on the page.
292 bool IsScriptInitiatedPrintAllowed(blink::WebFrame* frame, 291 bool IsScriptInitiatedPrintAllowed(blink::WebFrame* frame,
293 bool user_initiated); 292 bool user_initiated);
(...skipping 26 matching lines...) Expand all
320 // Used for scripted initiated printing blocking. 319 // Used for scripted initiated printing blocking.
321 bool is_scripted_printing_blocked_; 320 bool is_scripted_printing_blocked_;
322 321
323 // Let the browser process know of a printing failure. Only set to false when 322 // Let the browser process know of a printing failure. Only set to false when
324 // the failure came from the browser in the first place. 323 // the failure came from the browser in the first place.
325 bool notify_browser_of_print_failure_; 324 bool notify_browser_of_print_failure_;
326 325
327 // True, when printing from print preview. 326 // True, when printing from print preview.
328 bool print_for_preview_; 327 bool print_for_preview_;
329 328
330 // Strings generated by the browser process to be printed as headers and
331 // footers if requested by the user.
332 scoped_ptr<base::DictionaryValue> header_footer_info_;
333
334 // Keeps track of the state of print preview between messages. 329 // Keeps track of the state of print preview between messages.
335 // TODO(vitalybuka): Create PrintPreviewContext when needed and delete after 330 // TODO(vitalybuka): Create PrintPreviewContext when needed and delete after
336 // use. Now it's interaction with various messages is confusing. 331 // use. Now it's interaction with various messages is confusing.
337 class PrintPreviewContext { 332 class PrintPreviewContext {
338 public: 333 public:
339 PrintPreviewContext(); 334 PrintPreviewContext();
340 ~PrintPreviewContext(); 335 ~PrintPreviewContext();
341 336
342 // Initializes the print preview context. Need to be called to set 337 // Initializes the print preview context. Need to be called to set
343 // the |web_frame| / |web_node| to generate the print preview for. 338 // the |web_frame| / |web_node| to generate the print preview for.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // hangs because RequestPrintPreview is called before DidStopLoading() is 445 // hangs because RequestPrintPreview is called before DidStopLoading() is
451 // called. This is a store for the RequestPrintPreview() call and its 446 // called. This is a store for the RequestPrintPreview() call and its
452 // parameters so that it can be invoked after DidStopLoading. 447 // parameters so that it can be invoked after DidStopLoading.
453 base::Closure on_stop_loading_closure_; 448 base::Closure on_stop_loading_closure_;
454 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); 449 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper);
455 }; 450 };
456 451
457 } // namespace printing 452 } // namespace printing
458 453
459 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ 454 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/printing/print_web_view_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698