OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "apps/app_load_service.h" | 11 #include "apps/app_load_service.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/prefs/pref_member.h" | 15 #include "base/prefs/pref_member.h" |
16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "chrome/app/chrome_command_ids.h" | 22 #include "chrome/app/chrome_command_ids.h" |
23 #include "chrome/browser/app_mode/app_mode_utils.h" | 23 #include "chrome/browser/app_mode/app_mode_utils.h" |
24 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 24 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
25 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 25 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
26 #include "chrome/browser/autocomplete/autocomplete_input.h" | |
27 #include "chrome/browser/autocomplete/autocomplete_match.h" | 26 #include "chrome/browser/autocomplete/autocomplete_match.h" |
28 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/chrome_notification_types.h" | 28 #include "chrome/browser/chrome_notification_types.h" |
30 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 29 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
31 #include "chrome/browser/devtools/devtools_window.h" | 30 #include "chrome/browser/devtools/devtools_window.h" |
32 #include "chrome/browser/download/download_service.h" | 31 #include "chrome/browser/download/download_service.h" |
33 #include "chrome/browser/download/download_service_factory.h" | 32 #include "chrome/browser/download/download_service_factory.h" |
34 #include "chrome/browser/download/download_stats.h" | 33 #include "chrome/browser/download/download_stats.h" |
35 #include "chrome/browser/extensions/devtools_util.h" | 34 #include "chrome/browser/extensions/devtools_util.h" |
36 #include "chrome/browser/extensions/extension_service.h" | 35 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 22 matching lines...) Expand all Loading... |
59 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 58 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
60 #include "chrome/common/chrome_constants.h" | 59 #include "chrome/common/chrome_constants.h" |
61 #include "chrome/common/chrome_switches.h" | 60 #include "chrome/common/chrome_switches.h" |
62 #include "chrome/common/content_restriction.h" | 61 #include "chrome/common/content_restriction.h" |
63 #include "chrome/common/net/url_util.h" | 62 #include "chrome/common/net/url_util.h" |
64 #include "chrome/common/pref_names.h" | 63 #include "chrome/common/pref_names.h" |
65 #include "chrome/common/render_messages.h" | 64 #include "chrome/common/render_messages.h" |
66 #include "chrome/common/spellcheck_messages.h" | 65 #include "chrome/common/spellcheck_messages.h" |
67 #include "chrome/common/url_constants.h" | 66 #include "chrome/common/url_constants.h" |
68 #include "components/google/core/browser/google_util.h" | 67 #include "components/google/core/browser/google_util.h" |
| 68 #include "components/metrics/proto/omnibox_input_type.pb.h" |
69 #include "components/translate/core/browser/translate_download_manager.h" | 69 #include "components/translate/core/browser/translate_download_manager.h" |
70 #include "components/translate/core/browser/translate_manager.h" | 70 #include "components/translate/core/browser/translate_manager.h" |
71 #include "components/translate/core/browser/translate_prefs.h" | 71 #include "components/translate/core/browser/translate_prefs.h" |
72 #include "content/public/browser/child_process_security_policy.h" | 72 #include "content/public/browser/child_process_security_policy.h" |
73 #include "content/public/browser/download_manager.h" | 73 #include "content/public/browser/download_manager.h" |
74 #include "content/public/browser/download_save_info.h" | 74 #include "content/public/browser/download_save_info.h" |
75 #include "content/public/browser/download_url_parameters.h" | 75 #include "content/public/browser/download_url_parameters.h" |
76 #include "content/public/browser/navigation_details.h" | 76 #include "content/public/browser/navigation_details.h" |
77 #include "content/public/browser/navigation_entry.h" | 77 #include "content/public/browser/navigation_entry.h" |
78 #include "content/public/browser/notification_service.h" | 78 #include "content/public/browser/notification_service.h" |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 base::TrimWhitespace(params_.selection_text, base::TRIM_ALL, | 967 base::TrimWhitespace(params_.selection_text, base::TRIM_ALL, |
968 ¶ms_.selection_text); | 968 ¶ms_.selection_text); |
969 if (params_.selection_text.empty()) | 969 if (params_.selection_text.empty()) |
970 return; | 970 return; |
971 | 971 |
972 base::ReplaceChars(params_.selection_text, AutocompleteMatch::kInvalidChars, | 972 base::ReplaceChars(params_.selection_text, AutocompleteMatch::kInvalidChars, |
973 base::ASCIIToUTF16(" "), ¶ms_.selection_text); | 973 base::ASCIIToUTF16(" "), ¶ms_.selection_text); |
974 | 974 |
975 AutocompleteMatch match; | 975 AutocompleteMatch match; |
976 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( | 976 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( |
977 params_.selection_text, false, false, AutocompleteInput::INVALID_SPEC, | 977 params_.selection_text, false, false, |
978 &match, NULL); | 978 metrics::OmniboxEventProto::INVALID_SPEC, &match, NULL); |
979 selection_navigation_url_ = match.destination_url; | 979 selection_navigation_url_ = match.destination_url; |
980 if (!selection_navigation_url_.is_valid()) | 980 if (!selection_navigation_url_.is_valid()) |
981 return; | 981 return; |
982 | 982 |
983 base::string16 printable_selection_text = PrintableSelectionText(); | 983 base::string16 printable_selection_text = PrintableSelectionText(); |
984 EscapeAmpersands(&printable_selection_text); | 984 EscapeAmpersands(&printable_selection_text); |
985 | 985 |
986 if (AutocompleteMatch::IsSearchType(match.type)) { | 986 if (AutocompleteMatch::IsSearchType(match.type)) { |
987 const TemplateURL* const default_provider = | 987 const TemplateURL* const default_provider = |
988 TemplateURLServiceFactory::GetForProfile(profile_)-> | 988 TemplateURLServiceFactory::GetForProfile(profile_)-> |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 source_web_contents_->GetRenderViewHost()-> | 1994 source_web_contents_->GetRenderViewHost()-> |
1995 ExecuteMediaPlayerActionAtLocation(location, action); | 1995 ExecuteMediaPlayerActionAtLocation(location, action); |
1996 } | 1996 } |
1997 | 1997 |
1998 void RenderViewContextMenu::PluginActionAt( | 1998 void RenderViewContextMenu::PluginActionAt( |
1999 const gfx::Point& location, | 1999 const gfx::Point& location, |
2000 const WebPluginAction& action) { | 2000 const WebPluginAction& action) { |
2001 source_web_contents_->GetRenderViewHost()-> | 2001 source_web_contents_->GetRenderViewHost()-> |
2002 ExecutePluginActionAtLocation(location, action); | 2002 ExecutePluginActionAtLocation(location, action); |
2003 } | 2003 } |
OLD | NEW |