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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) | 412 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) |
413 IPC_MESSAGE_HANDLER(ViewMsg_EnableIntrinsicWidthChangedMode, | 413 IPC_MESSAGE_HANDLER(ViewMsg_EnableIntrinsicWidthChangedMode, |
414 OnEnableIntrinsicWidthChangedMode) | 414 OnEnableIntrinsicWidthChangedMode) |
415 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) | 415 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) |
416 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserWindowId, | 416 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserWindowId, |
417 OnUpdateBrowserWindowId) | 417 OnUpdateBrowserWindowId) |
418 IPC_MESSAGE_HANDLER(ViewMsg_NotifyRenderViewType, | 418 IPC_MESSAGE_HANDLER(ViewMsg_NotifyRenderViewType, |
419 OnNotifyRendererViewType) | 419 OnNotifyRendererViewType) |
420 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) | 420 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) |
421 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) | 421 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) |
| 422 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, |
| 423 OnSetEditCommandsForNextKeyEvent); |
422 | 424 |
423 // Have the super handle all other messages. | 425 // Have the super handle all other messages. |
424 IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message)) | 426 IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message)) |
425 IPC_END_MESSAGE_MAP() | 427 IPC_END_MESSAGE_MAP() |
426 } | 428 } |
427 | 429 |
428 void RenderView::SendThumbnail() { | 430 void RenderView::SendThumbnail() { |
429 WebFrame* main_frame = webview()->GetMainFrame(); | 431 WebFrame* main_frame = webview()->GetMainFrame(); |
430 if (!main_frame) | 432 if (!main_frame) |
431 return; | 433 return; |
(...skipping 2942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3374 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); | 3376 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); |
3375 } | 3377 } |
3376 | 3378 |
3377 void RenderView::Print(WebFrame* frame, bool script_initiated) { | 3379 void RenderView::Print(WebFrame* frame, bool script_initiated) { |
3378 DCHECK(frame); | 3380 DCHECK(frame); |
3379 if (print_helper_.get() == NULL) { | 3381 if (print_helper_.get() == NULL) { |
3380 print_helper_.reset(new PrintWebViewHelper(this)); | 3382 print_helper_.reset(new PrintWebViewHelper(this)); |
3381 } | 3383 } |
3382 print_helper_->Print(frame, script_initiated); | 3384 print_helper_->Print(frame, script_initiated); |
3383 } | 3385 } |
| 3386 |
| 3387 void RenderView::OnSetEditCommandsForNextKeyEvent( |
| 3388 const EditCommands& edit_commands) { |
| 3389 edit_commands_ = edit_commands; |
| 3390 } |
| 3391 |
| 3392 void RenderView::DidHandleKeyEvent() { |
| 3393 edit_commands_.clear(); |
| 3394 } |
| 3395 |
| 3396 bool RenderView::HandleCurrentKeyboardEvent() { |
| 3397 if (edit_commands_.empty()) |
| 3398 return false; |
| 3399 |
| 3400 WebFrame* frame = webview()->GetFocusedFrame(); |
| 3401 if (!frame) |
| 3402 return false; |
| 3403 |
| 3404 EditCommands::iterator it = edit_commands_.begin(); |
| 3405 EditCommands::iterator end = edit_commands_.end(); |
| 3406 |
| 3407 for (; it != end; ++it) { |
| 3408 if (!frame->executeCommand(WebString::fromUTF8(it->name), |
| 3409 WebString::fromUTF8(it->value))) |
| 3410 break; |
| 3411 } |
| 3412 |
| 3413 return true; |
| 3414 } |
OLD | NEW |