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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) | 347 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) |
348 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) | 348 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) |
349 IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellCheck, OnToggleSpellCheck) | 349 IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellCheck, OnToggleSpellCheck) |
350 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) | 350 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) |
351 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) | 351 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) |
352 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 352 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
353 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) | 353 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) |
354 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 354 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
355 IPC_MESSAGE_HANDLER(ViewMsg_DeterminePageText, OnDeterminePageText) | 355 IPC_MESSAGE_HANDLER(ViewMsg_DeterminePageText, OnDeterminePageText) |
356 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 356 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
357 IPC_MESSAGE_HANDLER(ViewMsg_InsertText, OnInsertText) | |
358 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 357 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
359 IPC_MESSAGE_HANDLER(ViewMsg_SetupDevToolsClient, OnSetupDevToolsClient) | 358 IPC_MESSAGE_HANDLER(ViewMsg_SetupDevToolsClient, OnSetupDevToolsClient) |
360 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavIcon, OnDownloadFavIcon) | 359 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavIcon, OnDownloadFavIcon) |
361 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 360 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
362 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) | 361 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) |
363 IPC_MESSAGE_HANDLER(ViewMsg_AddMessageToConsole, OnAddMessageToConsole) | 362 IPC_MESSAGE_HANDLER(ViewMsg_AddMessageToConsole, OnAddMessageToConsole) |
364 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) | 363 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) |
365 IPC_MESSAGE_HANDLER(ViewMsg_UploadFile, OnUploadFileRequest) | 364 IPC_MESSAGE_HANDLER(ViewMsg_UploadFile, OnUploadFileRequest) |
366 IPC_MESSAGE_HANDLER(ViewMsg_FormFill, OnFormFill) | 365 IPC_MESSAGE_HANDLER(ViewMsg_FormFill, OnFormFill) |
367 IPC_MESSAGE_HANDLER(ViewMsg_FillPasswordForm, OnFillPasswordForm) | 366 IPC_MESSAGE_HANDLER(ViewMsg_FillPasswordForm, OnFillPasswordForm) |
(...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2567 webview()->ResetZoom(); | 2566 webview()->ResetZoom(); |
2568 break; | 2567 break; |
2569 case PageZoom::LARGER: | 2568 case PageZoom::LARGER: |
2570 webview()->ZoomIn(kZoomIsTextOnly); | 2569 webview()->ZoomIn(kZoomIsTextOnly); |
2571 break; | 2570 break; |
2572 default: | 2571 default: |
2573 NOTREACHED(); | 2572 NOTREACHED(); |
2574 } | 2573 } |
2575 } | 2574 } |
2576 | 2575 |
2577 void RenderView::OnInsertText(const string16& text) { | |
2578 WebFrame* frame = webview()->GetFocusedFrame(); | |
2579 if (!frame) | |
2580 return; | |
2581 frame->insertText(text); | |
2582 } | |
2583 | |
2584 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { | 2576 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { |
2585 webview()->SetPageEncoding(encoding_name); | 2577 webview()->SetPageEncoding(encoding_name); |
2586 } | 2578 } |
2587 | 2579 |
2588 void RenderView::NavigateBackForwardSoon(int offset) { | 2580 void RenderView::NavigateBackForwardSoon(int offset) { |
2589 history_back_list_count_ += offset; | 2581 history_back_list_count_ += offset; |
2590 history_forward_list_count_ -= offset; | 2582 history_forward_list_count_ -= offset; |
2591 | 2583 |
2592 Send(new ViewHostMsg_GoToEntryAtOffset(routing_id_, offset)); | 2584 Send(new ViewHostMsg_GoToEntryAtOffset(routing_id_, offset)); |
2593 } | 2585 } |
(...skipping 26 matching lines...) Expand all Loading... |
2620 } | 2612 } |
2621 | 2613 |
2622 void RenderView::UpdateInspectorSettings(const std::wstring& raw_settings) { | 2614 void RenderView::UpdateInspectorSettings(const std::wstring& raw_settings) { |
2623 Send(new ViewHostMsg_UpdateInspectorSettings(routing_id_, raw_settings)); | 2615 Send(new ViewHostMsg_UpdateInspectorSettings(routing_id_, raw_settings)); |
2624 } | 2616 } |
2625 | 2617 |
2626 WebDevToolsAgentDelegate* RenderView::GetWebDevToolsAgentDelegate() { | 2618 WebDevToolsAgentDelegate* RenderView::GetWebDevToolsAgentDelegate() { |
2627 return devtools_agent_.get(); | 2619 return devtools_agent_.get(); |
2628 } | 2620 } |
2629 | 2621 |
2630 void RenderView::PasteFromSelectionClipboard() { | |
2631 Send(new ViewHostMsg_PasteFromSelectionClipboard(routing_id_)); | |
2632 } | |
2633 | |
2634 WebFrame* RenderView::GetChildFrame(const std::wstring& xpath) const { | 2622 WebFrame* RenderView::GetChildFrame(const std::wstring& xpath) const { |
2635 if (xpath.empty()) | 2623 if (xpath.empty()) |
2636 return webview()->GetMainFrame(); | 2624 return webview()->GetMainFrame(); |
2637 | 2625 |
2638 // xpath string can represent a frame deep down the tree (across multiple | 2626 // xpath string can represent a frame deep down the tree (across multiple |
2639 // frame DOMs). | 2627 // frame DOMs). |
2640 // Example, /html/body/table/tbody/tr/td/iframe\n/frameset/frame[0] | 2628 // Example, /html/body/table/tbody/tr/td/iframe\n/frameset/frame[0] |
2641 // should break into 2 xpaths | 2629 // should break into 2 xpaths |
2642 // /html/body/table/tbody/tr/td/iframe & /frameset/frame[0] | 2630 // /html/body/table/tbody/tr/td/iframe & /frameset/frame[0] |
2643 | 2631 |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3388 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); | 3376 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); |
3389 } | 3377 } |
3390 | 3378 |
3391 void RenderView::Print(WebFrame* frame, bool script_initiated) { | 3379 void RenderView::Print(WebFrame* frame, bool script_initiated) { |
3392 DCHECK(frame); | 3380 DCHECK(frame); |
3393 if (print_helper_.get() == NULL) { | 3381 if (print_helper_.get() == NULL) { |
3394 print_helper_.reset(new PrintWebViewHelper(this)); | 3382 print_helper_.reset(new PrintWebViewHelper(this)); |
3395 } | 3383 } |
3396 print_helper_->Print(frame, script_initiated); | 3384 print_helper_->Print(frame, script_initiated); |
3397 } | 3385 } |
OLD | NEW |