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

Side by Side Diff: components/printing/renderer/print_web_view_helper.cc

Issue 1274653003: Fixing URL on footer when print previewing selection only (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | no next file » | 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 #include "components/printing/renderer/print_web_view_helper.h" 5 #include "components/printing/renderer/print_web_view_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 scoped_ptr<base::DictionaryValue> options(new base::DictionaryValue()); 513 scoped_ptr<base::DictionaryValue> options(new base::DictionaryValue());
514 options.reset(new base::DictionaryValue()); 514 options.reset(new base::DictionaryValue());
515 options->SetDouble(kSettingHeaderFooterDate, base::Time::Now().ToJsTime()); 515 options->SetDouble(kSettingHeaderFooterDate, base::Time::Now().ToJsTime());
516 options->SetDouble("width", page_size.width); 516 options->SetDouble("width", page_size.width);
517 options->SetDouble("height", page_size.height); 517 options->SetDouble("height", page_size.height);
518 options->SetDouble("topMargin", page_layout.margin_top); 518 options->SetDouble("topMargin", page_layout.margin_top);
519 options->SetDouble("bottomMargin", page_layout.margin_bottom); 519 options->SetDouble("bottomMargin", page_layout.margin_bottom);
520 options->SetString("pageNumber", 520 options->SetString("pageNumber",
521 base::StringPrintf("%d/%d", page_number, total_pages)); 521 base::StringPrintf("%d/%d", page_number, total_pages));
522 522
523 // Fallback to initiator URL and title if it's empty for printed frame. 523 options->SetString("url", params.url);
524 base::string16 url = source_frame.document().url().string();
525 options->SetString("url", url.empty() ? params.url : url);
526 base::string16 title = source_frame.document().title(); 524 base::string16 title = source_frame.document().title();
527 options->SetString("title", title.empty() ? params.title : title); 525 options->SetString("title", title.empty() ? params.title : title);
528 526
529 ExecuteScript(frame, kPageSetupScriptFormat, *options); 527 ExecuteScript(frame, kPageSetupScriptFormat, *options);
530 528
531 blink::WebPrintParams webkit_params(page_size); 529 blink::WebPrintParams webkit_params(page_size);
532 webkit_params.printerDPI = GetDPI(&params); 530 webkit_params.printerDPI = GetDPI(&params);
533 531
534 frame->printBegin(webkit_params); 532 frame->printBegin(webkit_params);
535 frame->printPage(0, canvas); 533 frame->printPage(0, canvas);
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 blink::WebConsoleMessage::LevelWarning, message)); 2095 blink::WebConsoleMessage::LevelWarning, message));
2098 return false; 2096 return false;
2099 } 2097 }
2100 2098
2101 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2099 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2102 // Reset counter on successful print. 2100 // Reset counter on successful print.
2103 count_ = 0; 2101 count_ = 0;
2104 } 2102 }
2105 2103
2106 } // namespace printing 2104 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698