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

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

Issue 227006: Move some more methods from WebViewDelegate to WebViewClient.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 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/api/public/WebViewClient.h » ('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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 /*static*/ 268 /*static*/
269 void RenderView::SetNextPageID(int32 next_page_id) { 269 void RenderView::SetNextPageID(int32 next_page_id) {
270 // This method should only be called during process startup, and the given 270 // This method should only be called during process startup, and the given
271 // page id had better not exceed our current next page id! 271 // page id had better not exceed our current next page id!
272 DCHECK_EQ(next_page_id_, 1); 272 DCHECK_EQ(next_page_id_, 1);
273 DCHECK(next_page_id >= next_page_id_); 273 DCHECK(next_page_id >= next_page_id_);
274 next_page_id_ = next_page_id; 274 next_page_id_ = next_page_id;
275 } 275 }
276 276
277 void RenderView::UserMetricsRecordAction(const std::wstring& action) {
278 Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action));
279 }
280
277 void RenderView::PluginCrashed(base::ProcessId pid, 281 void RenderView::PluginCrashed(base::ProcessId pid,
278 const FilePath& plugin_path) { 282 const FilePath& plugin_path) {
279 Send(new ViewHostMsg_CrashedPlugin(routing_id_, pid, plugin_path)); 283 Send(new ViewHostMsg_CrashedPlugin(routing_id_, pid, plugin_path));
280 } 284 }
281 285
282 void RenderView::Init(gfx::NativeViewId parent_hwnd, 286 void RenderView::Init(gfx::NativeViewId parent_hwnd,
283 base::WaitableEvent* modal_dialog_event, 287 base::WaitableEvent* modal_dialog_event,
284 int32 opener_id, 288 int32 opener_id,
285 const RendererPreferences& renderer_prefs, 289 const RendererPreferences& renderer_prefs,
286 SharedRenderViewCounter* counter, 290 SharedRenderViewCounter* counter,
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 1510
1507 void RenderView::didExecuteCommand(const WebString& command_name) { 1511 void RenderView::didExecuteCommand(const WebString& command_name) {
1508 const std::wstring& name = UTF16ToWideHack(command_name); 1512 const std::wstring& name = UTF16ToWideHack(command_name);
1509 if (StartsWith(name, L"Move", true) || 1513 if (StartsWith(name, L"Move", true) ||
1510 StartsWith(name, L"Insert", true) || 1514 StartsWith(name, L"Insert", true) ||
1511 StartsWith(name, L"Delete", true)) 1515 StartsWith(name, L"Delete", true))
1512 return; 1516 return;
1513 UserMetricsRecordAction(name); 1517 UserMetricsRecordAction(name);
1514 } 1518 }
1515 1519
1520 void RenderView::spellCheck(
1521 const WebString& text, int& misspelled_offset, int& misspelled_length) {
1522 EnsureDocumentTag();
1523 Send(new ViewHostMsg_SpellCheck(
1524 routing_id_, UTF16ToWideHack(text), document_tag_,
1525 &misspelled_offset, &misspelled_length));
1526 }
1527
1528 WebString RenderView::autoCorrectWord(const WebKit::WebString& word) {
1529 std::wstring autocorrect_word;
1530 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
1531 if (command_line.HasSwitch(switches::kAutoSpellCorrect)) {
1532 EnsureDocumentTag();
1533 Send(new ViewHostMsg_GetAutoCorrectWord(
1534 routing_id_, UTF16ToWideHack(word), document_tag_, &autocorrect_word));
1535 }
1536 return WideToUTF16Hack(autocorrect_word);
1537 }
1538
1539 void RenderView::updateSpellingUIWithMisspelledWord(const WebString& word) {
1540 Send(new ViewHostMsg_UpdateSpellingPanelWithMisspelledWord(
1541 routing_id_, UTF16ToWideHack(word)));
1542 }
1543
1516 void RenderView::runModalAlertDialog( 1544 void RenderView::runModalAlertDialog(
1517 WebFrame* frame, const WebString& message) { 1545 WebFrame* frame, const WebString& message) {
1518 RunJavaScriptMessage(MessageBoxFlags::kIsJavascriptAlert, 1546 RunJavaScriptMessage(MessageBoxFlags::kIsJavascriptAlert,
1519 UTF16ToWideHack(message), 1547 UTF16ToWideHack(message),
1520 std::wstring(), 1548 std::wstring(),
1521 frame->url(), 1549 frame->url(),
1522 NULL); 1550 NULL);
1523 } 1551 }
1524 1552
1525 bool RenderView::runModalConfirmDialog( 1553 bool RenderView::runModalConfirmDialog(
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 -1, 2694 -1,
2667 selection_rect, 2695 selection_rect,
2668 active_match_ordinal, 2696 active_match_ordinal,
2669 false)); 2697 false));
2670 } 2698 }
2671 2699
2672 bool RenderView::WasOpenedByUserGesture() const { 2700 bool RenderView::WasOpenedByUserGesture() const {
2673 return opened_by_user_gesture_; 2701 return opened_by_user_gesture_;
2674 } 2702 }
2675 2703
2676 void RenderView::SpellCheck(const std::wstring& word,
2677 int* misspell_location,
2678 int* misspell_length) {
2679 EnsureDocumentTag();
2680 Send(new ViewHostMsg_SpellCheck(
2681 routing_id_, word, document_tag_, misspell_location, misspell_length));
2682 }
2683
2684 std::wstring RenderView::GetAutoCorrectWord(
2685 const std::wstring& misspelled_word) {
2686 std::wstring autocorrect_word;
2687 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
2688 if (command_line.HasSwitch(switches::kAutoSpellCorrect)) {
2689 EnsureDocumentTag();
2690 Send(new ViewHostMsg_GetAutoCorrectWord(
2691 routing_id_, misspelled_word, document_tag_, &autocorrect_word));
2692 }
2693 return autocorrect_word;
2694 }
2695
2696 void RenderView::ShowSpellingUI(bool show) {
2697 Send(new ViewHostMsg_ShowSpellingPanel(routing_id_, show));
2698 }
2699
2700 void RenderView::UpdateSpellingUIWithMisspelledWord(const std::wstring& word) {
2701 Send(new ViewHostMsg_UpdateSpellingPanelWithMisspelledWord(
2702 routing_id_, word));
2703 }
2704
2705 void RenderView::UserMetricsRecordAction(const std::wstring& action) {
2706 Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action));
2707 }
2708
2709 void RenderView::DnsPrefetch(const std::vector<std::string>& host_names) { 2704 void RenderView::DnsPrefetch(const std::vector<std::string>& host_names) {
2710 Send(new ViewHostMsg_DnsPrefetch(host_names)); 2705 Send(new ViewHostMsg_DnsPrefetch(host_names));
2711 } 2706 }
2712 2707
2713 void RenderView::OnZoom(int function) { 2708 void RenderView::OnZoom(int function) {
2714 static const bool kZoomIsTextOnly = false; 2709 static const bool kZoomIsTextOnly = false;
2715 switch (function) { 2710 switch (function) {
2716 case PageZoom::SMALLER: 2711 case PageZoom::SMALLER:
2717 webview()->ZoomOut(kZoomIsTextOnly); 2712 webview()->ZoomOut(kZoomIsTextOnly);
2718 break; 2713 break;
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
3574 // TODO(darin): There's actually no reason for this to be here. We should 3569 // TODO(darin): There's actually no reason for this to be here. We should
3575 // have the browser side manage the document tag. 3570 // have the browser side manage the document tag.
3576 #if defined(OS_MACOSX) 3571 #if defined(OS_MACOSX)
3577 if (!has_document_tag_) { 3572 if (!has_document_tag_) {
3578 // Make the call to get the tag. 3573 // Make the call to get the tag.
3579 Send(new ViewHostMsg_GetDocumentTag(routing_id_, &document_tag_)); 3574 Send(new ViewHostMsg_GetDocumentTag(routing_id_, &document_tag_));
3580 has_document_tag_ = true; 3575 has_document_tag_ = true;
3581 } 3576 }
3582 #endif 3577 #endif
3583 } 3578 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | webkit/api/public/WebViewClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698