| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include "chrome/common/spellcheck_messages.h" | 61 #include "chrome/common/spellcheck_messages.h" |
| 62 #include "chrome/common/url_constants.h" | 62 #include "chrome/common/url_constants.h" |
| 63 #include "content/browser/download/download_types.h" | 63 #include "content/browser/download/download_types.h" |
| 64 #include "content/public/browser/child_process_security_policy.h" | 64 #include "content/public/browser/child_process_security_policy.h" |
| 65 #include "content/public/browser/download_manager.h" | 65 #include "content/public/browser/download_manager.h" |
| 66 #include "content/public/browser/navigation_details.h" | 66 #include "content/public/browser/navigation_details.h" |
| 67 #include "content/public/browser/navigation_entry.h" | 67 #include "content/public/browser/navigation_entry.h" |
| 68 #include "content/public/browser/notification_service.h" | 68 #include "content/public/browser/notification_service.h" |
| 69 #include "content/public/browser/render_view_host.h" | 69 #include "content/public/browser/render_view_host.h" |
| 70 #include "content/public/browser/render_widget_host_view.h" | 70 #include "content/public/browser/render_widget_host_view.h" |
| 71 #include "content/public/browser/speech_input_preferences.h" | 71 #include "content/public/browser/speech_recognition_preferences.h" |
| 72 #include "content/public/browser/user_metrics.h" | 72 #include "content/public/browser/user_metrics.h" |
| 73 #include "content/public/browser/web_contents.h" | 73 #include "content/public/browser/web_contents.h" |
| 74 #include "content/public/common/content_restriction.h" | 74 #include "content/public/common/content_restriction.h" |
| 75 #include "content/public/common/ssl_status.h" | 75 #include "content/public/common/ssl_status.h" |
| 76 #include "grit/generated_resources.h" | 76 #include "grit/generated_resources.h" |
| 77 #include "net/base/escape.h" | 77 #include "net/base/escape.h" |
| 78 #include "net/base/net_util.h" | 78 #include "net/base/net_util.h" |
| 79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
| 80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" | 80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" |
| 81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginAction.h" | 81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginAction.h" |
| (...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 if (id == IDC_WRITING_DIRECTION_LTR) | 1408 if (id == IDC_WRITING_DIRECTION_LTR) |
| 1409 return params_.writing_direction_left_to_right & | 1409 return params_.writing_direction_left_to_right & |
| 1410 WebContextMenuData::CheckableMenuItemChecked; | 1410 WebContextMenuData::CheckableMenuItemChecked; |
| 1411 if (id == IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY) | 1411 if (id == IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY) |
| 1412 return false; | 1412 return false; |
| 1413 #endif // OS_MACOSX | 1413 #endif // OS_MACOSX |
| 1414 | 1414 |
| 1415 // Check box for menu item 'Block offensive words'. | 1415 // Check box for menu item 'Block offensive words'. |
| 1416 if (id == IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES) { | 1416 if (id == IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES) { |
| 1417 return profile_->GetPrefs()->GetBoolean( | 1417 return profile_->GetPrefs()->GetBoolean( |
| 1418 prefs::kSpeechInputFilterProfanities); | 1418 prefs::kSpeechRecognitionFilterProfanities); |
| 1419 } | 1419 } |
| 1420 | 1420 |
| 1421 return false; | 1421 return false; |
| 1422 } | 1422 } |
| 1423 | 1423 |
| 1424 void RenderViewContextMenu::ExecuteCommand(int id) { | 1424 void RenderViewContextMenu::ExecuteCommand(int id) { |
| 1425 return ExecuteCommand(id, 0); | 1425 return ExecuteCommand(id, 0); |
| 1426 } | 1426 } |
| 1427 | 1427 |
| 1428 void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { | 1428 void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1844 // Takes ownership of |template_url|. | 1844 // Takes ownership of |template_url|. |
| 1845 tab_contents_wrapper->search_engine_tab_helper()->delegate()-> | 1845 tab_contents_wrapper->search_engine_tab_helper()->delegate()-> |
| 1846 ConfirmAddSearchProvider(template_url.release(), profile_); | 1846 ConfirmAddSearchProvider(template_url.release(), profile_); |
| 1847 } | 1847 } |
| 1848 break; | 1848 break; |
| 1849 } | 1849 } |
| 1850 | 1850 |
| 1851 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES: { | 1851 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES: { |
| 1852 PrefService* prefs = profile_->GetPrefs(); | 1852 PrefService* prefs = profile_->GetPrefs(); |
| 1853 const bool filter = !prefs->GetBoolean( | 1853 const bool filter = !prefs->GetBoolean( |
| 1854 prefs::kSpeechInputFilterProfanities); | 1854 prefs::kSpeechRecognitionFilterProfanities); |
| 1855 prefs->SetBoolean(prefs::kSpeechInputFilterProfanities, filter); | 1855 prefs->SetBoolean(prefs::kSpeechRecognitionFilterProfanities, filter); |
| 1856 profile_->GetSpeechInputPreferences()->SetFilterProfanities(filter); | 1856 profile_->GetSpeechRecognitionPreferences()->SetFilterProfanities(filter); |
| 1857 break; | 1857 break; |
| 1858 } | 1858 } |
| 1859 | 1859 |
| 1860 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT: { | 1860 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT: { |
| 1861 GURL url(chrome::kSpeechInputAboutURL); | 1861 GURL url(chrome::kSpeechInputAboutURL); |
| 1862 GURL localized_url = google_util::AppendGoogleLocaleParam(url); | 1862 GURL localized_url = google_util::AppendGoogleLocaleParam(url); |
| 1863 // Open URL with no referrer field (because user clicked on menu item). | 1863 // Open URL with no referrer field (because user clicked on menu item). |
| 1864 OpenURL(localized_url, GURL(), 0, NEW_FOREGROUND_TAB, | 1864 OpenURL(localized_url, GURL(), 0, NEW_FOREGROUND_TAB, |
| 1865 content::PAGE_TRANSITION_LINK); | 1865 content::PAGE_TRANSITION_LINK); |
| 1866 break; | 1866 break; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 source_web_contents_->GetRenderViewHost()-> | 1997 source_web_contents_->GetRenderViewHost()-> |
| 1998 ExecuteMediaPlayerActionAtLocation(location, action); | 1998 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1999 } | 1999 } |
| 2000 | 2000 |
| 2001 void RenderViewContextMenu::PluginActionAt( | 2001 void RenderViewContextMenu::PluginActionAt( |
| 2002 const gfx::Point& location, | 2002 const gfx::Point& location, |
| 2003 const WebPluginAction& action) { | 2003 const WebPluginAction& action) { |
| 2004 source_web_contents_->GetRenderViewHost()-> | 2004 source_web_contents_->GetRenderViewHost()-> |
| 2005 ExecutePluginActionAtLocation(location, action); | 2005 ExecutePluginActionAtLocation(location, action); |
| 2006 } | 2006 } |
| OLD | NEW |