Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 if (!CaptureThumbnail(webview(), kThumbnailWidth, kThumbnailHeight, | 444 if (!CaptureThumbnail(webview(), kThumbnailWidth, kThumbnailHeight, |
| 445 &thumbnail, &score)) | 445 &thumbnail, &score)) |
| 446 return; | 446 return; |
| 447 | 447 |
| 448 // send the thumbnail message to the browser process | 448 // send the thumbnail message to the browser process |
| 449 Send(new ViewHostMsg_Thumbnail(routing_id_, url, score, thumbnail)); | 449 Send(new ViewHostMsg_Thumbnail(routing_id_, url, score, thumbnail)); |
| 450 } | 450 } |
| 451 | 451 |
| 452 void RenderView::OnPrintPages() { | 452 void RenderView::OnPrintPages() { |
| 453 DCHECK(webview()); | 453 DCHECK(webview()); |
| 454 if (webview()) | 454 if (webview()) { |
| 455 Print(webview()->GetMainFrame(), false); | 455 // If the user has selected text in the currently focused frame we print |
| 456 // only that frame (this makes print selection work for multiple frames). | |
| 457 if (webview()->GetFocusedFrame()->HasSelection()) | |
| 458 Print(webview()->GetFocusedFrame(), false); | |
| 459 else | |
| 460 Print(webview()->GetMainFrame(), false); | |
| 461 } | |
| 456 } | 462 } |
| 457 | 463 |
| 458 void RenderView::OnPrintingDone(int document_cookie, bool success) { | 464 void RenderView::OnPrintingDone(int document_cookie, bool success) { |
| 459 // Ignoring document cookie here since only one print job can be outstanding | 465 // Ignoring document cookie here since only one print job can be outstanding |
| 460 // per renderer and document_cookie is 0 when printing is successful. | 466 // per renderer and document_cookie is 0 when printing is successful. |
| 461 DCHECK(print_helper_.get()); | 467 DCHECK(print_helper_.get()); |
| 462 if (print_helper_.get() != NULL) { | 468 if (print_helper_.get() != NULL) { |
| 463 print_helper_->DidFinishPrinting(success); | 469 print_helper_->DidFinishPrinting(success); |
| 464 } | 470 } |
| 465 } | 471 } |
| (...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2302 // Save the updated IME status and mark the input focus has been updated. | 2308 // Save the updated IME status and mark the input focus has been updated. |
| 2303 // The IME status is to be sent to a browser process next time when | 2309 // The IME status is to be sent to a browser process next time when |
| 2304 // the input caret is rendered. | 2310 // the input caret is rendered. |
| 2305 if (!ime_control_busy_) { | 2311 if (!ime_control_busy_) { |
| 2306 ime_control_updated_ = true; | 2312 ime_control_updated_ = true; |
| 2307 ime_control_new_state_ = enabled; | 2313 ime_control_new_state_ = enabled; |
| 2308 } | 2314 } |
| 2309 } | 2315 } |
| 2310 | 2316 |
| 2311 void RenderView::ScriptedPrint(WebFrame* frame) { | 2317 void RenderView::ScriptedPrint(WebFrame* frame) { |
| 2312 Print(frame, true); | 2318 DCHECK(webview()); |
| 2319 if (webview()) { | |
| 2320 // Print the full page - not just the frame the javascript is running from. | |
| 2321 Print(webview()->GetMainFrame(), true); | |
|
darin (slow to review)
2009/09/16 16:28:50
this seems like it is introducing a potential web
M-A Ruel
2009/09/16 16:35:03
That is interesting, I didn't realize that change.
| |
| 2322 } | |
| 2313 } | 2323 } |
| 2314 | 2324 |
| 2315 void RenderView::UserMetricsRecordAction(const std::wstring& action) { | 2325 void RenderView::UserMetricsRecordAction(const std::wstring& action) { |
| 2316 Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action)); | 2326 Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action)); |
| 2317 } | 2327 } |
| 2318 | 2328 |
| 2319 void RenderView::DnsPrefetch(const std::vector<std::string>& host_names) { | 2329 void RenderView::DnsPrefetch(const std::vector<std::string>& host_names) { |
| 2320 Send(new ViewHostMsg_DnsPrefetch(host_names)); | 2330 Send(new ViewHostMsg_DnsPrefetch(host_names)); |
| 2321 } | 2331 } |
| 2322 | 2332 |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3048 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); | 3058 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); |
| 3049 } | 3059 } |
| 3050 | 3060 |
| 3051 void RenderView::Print(WebFrame* frame, bool script_initiated) { | 3061 void RenderView::Print(WebFrame* frame, bool script_initiated) { |
| 3052 DCHECK(frame); | 3062 DCHECK(frame); |
| 3053 if (print_helper_.get() == NULL) { | 3063 if (print_helper_.get() == NULL) { |
| 3054 print_helper_.reset(new PrintWebViewHelper(this)); | 3064 print_helper_.reset(new PrintWebViewHelper(this)); |
| 3055 } | 3065 } |
| 3056 print_helper_->Print(frame, script_initiated); | 3066 print_helper_->Print(frame, script_initiated); |
| 3057 } | 3067 } |
| OLD | NEW |