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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 125082: Add Print Selection support to Chrome. This change is fairly involved since ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_view.h ('k') | webkit/glue/webview_impl.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) 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 332
333 // If this is developer tools renderer intercept tools messages first. 333 // If this is developer tools renderer intercept tools messages first.
334 if (devtools_client_.get() && devtools_client_->OnMessageReceived(message)) 334 if (devtools_client_.get() && devtools_client_->OnMessageReceived(message))
335 return; 335 return;
336 if (devtools_agent_.get() && devtools_agent_->OnMessageReceived(message)) 336 if (devtools_agent_.get() && devtools_agent_->OnMessageReceived(message))
337 return; 337 return;
338 338
339 IPC_BEGIN_MESSAGE_MAP(RenderView, message) 339 IPC_BEGIN_MESSAGE_MAP(RenderView, message)
340 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, SendThumbnail) 340 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, SendThumbnail)
341 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) 341 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages)
342 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone)
342 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) 343 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate)
343 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) 344 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop)
344 IPC_MESSAGE_HANDLER(ViewMsg_LoadAlternateHTMLText, OnLoadAlternateHTMLText) 345 IPC_MESSAGE_HANDLER(ViewMsg_LoadAlternateHTMLText, OnLoadAlternateHTMLText)
345 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) 346 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
346 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) 347 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo)
347 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) 348 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo)
348 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) 349 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut)
349 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) 350 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy)
350 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) 351 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste)
351 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) 352 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 } 448 }
448 449
449 void RenderView::OnPrintPages() { 450 void RenderView::OnPrintPages() {
450 DCHECK(webview()); 451 DCHECK(webview());
451 if (webview()) { 452 if (webview()) {
452 // The renderer own the control flow as if it was a window.print() call. 453 // The renderer own the control flow as if it was a window.print() call.
453 ScriptedPrint(webview()->GetMainFrame()); 454 ScriptedPrint(webview()->GetMainFrame());
454 } 455 }
455 } 456 }
456 457
458 void RenderView::OnPrintingDone(int document_cookie, bool success) {
459 // Ignoring document cookie here since only one print job can be outstanding
460 // per renderer and document_cookie is 0 when printing is successful.
461 DCHECK(print_helper_.get());
462 if (print_helper_.get() != NULL) {
463 print_helper_->DidFinishPrinting(success);
464 }
465 }
466
457 void RenderView::CapturePageInfo(int load_id, bool preliminary_capture) { 467 void RenderView::CapturePageInfo(int load_id, bool preliminary_capture) {
458 if (load_id != page_id_) 468 if (load_id != page_id_)
459 return; // this capture call is no longer relevant due to navigation 469 return; // this capture call is no longer relevant due to navigation
460 if (load_id == last_indexed_page_id_) 470 if (load_id == last_indexed_page_id_)
461 return; // we already indexed this page 471 return; // we already indexed this page
462 472
463 if (!webview()) 473 if (!webview())
464 return; 474 return;
465 475
466 WebFrame* main_frame = webview()->GetMainFrame(); 476 WebFrame* main_frame = webview()->GetMainFrame();
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 // Save the updated IME status and mark the input focus has been updated. 2220 // Save the updated IME status and mark the input focus has been updated.
2211 // The IME status is to be sent to a browser process next time when 2221 // The IME status is to be sent to a browser process next time when
2212 // the input caret is rendered. 2222 // the input caret is rendered.
2213 if (!ime_control_busy_) { 2223 if (!ime_control_busy_) {
2214 ime_control_updated_ = true; 2224 ime_control_updated_ = true;
2215 ime_control_new_state_ = enabled; 2225 ime_control_new_state_ = enabled;
2216 } 2226 }
2217 } 2227 }
2218 2228
2219 void RenderView::ScriptedPrint(WebFrame* frame) { 2229 void RenderView::ScriptedPrint(WebFrame* frame) {
2220 print_render_view_.reset(new PrintWebViewHelper(this)); 2230 if (print_helper_.get() == NULL) {
2221 print_render_view_->SyncPrint(frame); 2231 print_helper_.reset(new PrintWebViewHelper(this));
2222 print_render_view_.reset(); 2232 }
2233 print_helper_->SyncPrint(frame);
2223 } 2234 }
2224 2235
2225 void RenderView::WebInspectorOpened(int num_resources) { 2236 void RenderView::WebInspectorOpened(int num_resources) {
2226 Send(new ViewHostMsg_InspectElement_Reply(routing_id_, num_resources)); 2237 Send(new ViewHostMsg_InspectElement_Reply(routing_id_, num_resources));
2227 } 2238 }
2228 2239
2229 void RenderView::UserMetricsRecordAction(const std::wstring& action) { 2240 void RenderView::UserMetricsRecordAction(const std::wstring& action) {
2230 Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action)); 2241 Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action));
2231 } 2242 }
2232 2243
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
2859 scoped_ptr<PasswordForm> password_form( 2870 scoped_ptr<PasswordForm> password_form(
2860 PasswordFormDomManager::CreatePasswordForm(form)); 2871 PasswordFormDomManager::CreatePasswordForm(form));
2861 if (password_form.get()) 2872 if (password_form.get())
2862 password_forms.push_back(*password_form); 2873 password_forms.push_back(*password_form);
2863 } 2874 }
2864 } 2875 }
2865 2876
2866 if (!password_forms.empty()) 2877 if (!password_forms.empty())
2867 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); 2878 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms));
2868 } 2879 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | webkit/glue/webview_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698