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

Side by Side Diff: content/browser/renderer_host/render_view_host.cc

Issue 7086005: Context menu for "Voice recognition options" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Context menu for "Voice recognition options" only appears when input-field has x-webkit-speech Created 9 years, 5 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/renderer_host/render_view_host.h" 5 #include "content/browser/renderer_host/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/google/google_util.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #include "content/browser/browser_message_filter.h" 20 #include "content/browser/browser_message_filter.h"
20 #include "content/browser/child_process_security_policy.h" 21 #include "content/browser/child_process_security_policy.h"
21 #include "content/browser/content_browser_client.h" 22 #include "content/browser/content_browser_client.h"
22 #include "content/browser/cross_site_request_manager.h" 23 #include "content/browser/cross_site_request_manager.h"
23 #include "content/browser/host_zoom_map.h" 24 #include "content/browser/host_zoom_map.h"
24 #include "content/browser/in_process_webkit/session_storage_namespace.h" 25 #include "content/browser/in_process_webkit/session_storage_namespace.h"
25 #include "content/browser/renderer_host/render_process_host.h" 26 #include "content/browser/renderer_host/render_process_host.h"
26 #include "content/browser/renderer_host/render_view_host_delegate.h" 27 #include "content/browser/renderer_host/render_view_host_delegate.h"
27 #include "content/browser/renderer_host/render_view_host_observer.h" 28 #include "content/browser/renderer_host/render_view_host_observer.h"
(...skipping 28 matching lines...) Expand all
56 using WebKit::WebDragOperationsMask; 57 using WebKit::WebDragOperationsMask;
57 using WebKit::WebInputEvent; 58 using WebKit::WebInputEvent;
58 using WebKit::WebMediaPlayerAction; 59 using WebKit::WebMediaPlayerAction;
59 using WebKit::WebTextDirection; 60 using WebKit::WebTextDirection;
60 61
61 namespace { 62 namespace {
62 63
63 // Delay to wait on closing the tab for a beforeunload/unload handler to fire. 64 // Delay to wait on closing the tab for a beforeunload/unload handler to fire.
64 const int kUnloadTimeoutMS = 1000; 65 const int kUnloadTimeoutMS = 1000;
65 66
67 // The URL to be opened when the "About Voice Recognition" menu item is clicked.
68 // TODO(gshires): Replace with actual URL when proper help page is posted.
69 const char kSpeechInputAboutUrl[] =
70 #if defined(OS_CHROMEOS)
Satish 2011/07/19 08:22:39 any reason why we need two different urls here? If
gshires 2011/07/19 22:56:31 No need to differentiate. I made this consistent w
71 "https://www.google.com/support/chromeos/";
72 #else
73 "https://www.google.com/support/chrome/";
74 #endif
66 } // namespace 75 } // namespace
67 76
68 /////////////////////////////////////////////////////////////////////////////// 77 ///////////////////////////////////////////////////////////////////////////////
69 // RenderViewHost, public: 78 // RenderViewHost, public:
70 79
71 // static 80 // static
72 RenderViewHost* RenderViewHost::FromID(int render_process_id, 81 RenderViewHost* RenderViewHost::FromID(int render_process_id,
73 int render_view_id) { 82 int render_view_id) {
74 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id); 83 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id);
75 if (!process) 84 if (!process)
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 void RenderViewHost::Delete() { 513 void RenderViewHost::Delete() {
505 Send(new ViewMsg_Delete(routing_id())); 514 Send(new ViewMsg_Delete(routing_id()));
506 UserMetrics::RecordAction(UserMetricsAction("DeleteSelection")); 515 UserMetrics::RecordAction(UserMetricsAction("DeleteSelection"));
507 } 516 }
508 517
509 void RenderViewHost::SelectAll() { 518 void RenderViewHost::SelectAll() {
510 Send(new ViewMsg_SelectAll(routing_id())); 519 Send(new ViewMsg_SelectAll(routing_id()));
511 UserMetrics::RecordAction(UserMetricsAction("SelectAll")); 520 UserMetrics::RecordAction(UserMetricsAction("SelectAll"));
512 } 521 }
513 522
523 void RenderViewHost::SpeechInputAbout() {
524 GURL about_url(kSpeechInputAboutUrl);
525 GURL localized_about_url = google_util::AppendGoogleLocaleParam(about_url);
526 // Open URL with no referrer field (because user clicked on menu item).
527 delegate_->RequestOpenURL(localized_about_url, GURL(), NEW_FOREGROUND_TAB);
528 }
529
514 void RenderViewHost::JavaScriptDialogClosed(IPC::Message* reply_msg, 530 void RenderViewHost::JavaScriptDialogClosed(IPC::Message* reply_msg,
515 bool success, 531 bool success,
516 const string16& user_input) { 532 const string16& user_input) {
517 process()->set_ignore_input_events(false); 533 process()->set_ignore_input_events(false);
518 bool is_waiting = 534 bool is_waiting =
519 is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_; 535 is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_;
520 if (is_waiting) 536 if (is_waiting)
521 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); 537 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
522 538
523 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, 539 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg,
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 if (view) { 1329 if (view) {
1314 view->ShowPopupMenu(params.bounds, 1330 view->ShowPopupMenu(params.bounds,
1315 params.item_height, 1331 params.item_height,
1316 params.item_font_size, 1332 params.item_font_size,
1317 params.selected_item, 1333 params.selected_item,
1318 params.popup_items, 1334 params.popup_items,
1319 params.right_aligned); 1335 params.right_aligned);
1320 } 1336 }
1321 } 1337 }
1322 #endif 1338 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698