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 "chrome/browser/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/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 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" | 48 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" |
49 #include "chrome/browser/tab_contents/spelling_menu_observer.h" | 49 #include "chrome/browser/tab_contents/spelling_menu_observer.h" |
50 #include "chrome/browser/translate/translate_manager.h" | 50 #include "chrome/browser/translate/translate_manager.h" |
51 #include "chrome/browser/translate/translate_prefs.h" | 51 #include "chrome/browser/translate/translate_prefs.h" |
52 #include "chrome/browser/translate/translate_tab_helper.h" | 52 #include "chrome/browser/translate/translate_tab_helper.h" |
53 #include "chrome/browser/ui/browser.h" | 53 #include "chrome/browser/ui/browser.h" |
54 #include "chrome/browser/ui/browser_commands.h" | 54 #include "chrome/browser/ui/browser_commands.h" |
55 #include "chrome/browser/ui/browser_finder.h" | 55 #include "chrome/browser/ui/browser_finder.h" |
56 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 56 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
57 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 57 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
58 #include "chrome/browser/view_type_utils.h" | |
59 #include "chrome/common/chrome_constants.h" | 58 #include "chrome/common/chrome_constants.h" |
60 #include "chrome/common/chrome_notification_types.h" | 59 #include "chrome/common/chrome_notification_types.h" |
61 #include "chrome/common/chrome_switches.h" | 60 #include "chrome/common/chrome_switches.h" |
62 #include "chrome/common/extensions/extension.h" | 61 #include "chrome/common/extensions/extension.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/print_messages.h" | 64 #include "chrome/common/print_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 "content/public/browser/child_process_security_policy.h" | 67 #include "content/public/browser/child_process_security_policy.h" |
69 #include "content/public/browser/download_manager.h" | 68 #include "content/public/browser/download_manager.h" |
70 #include "content/public/browser/download_save_info.h" | 69 #include "content/public/browser/download_save_info.h" |
71 #include "content/public/browser/download_url_parameters.h" | 70 #include "content/public/browser/download_url_parameters.h" |
72 #include "content/public/browser/navigation_details.h" | 71 #include "content/public/browser/navigation_details.h" |
73 #include "content/public/browser/navigation_entry.h" | 72 #include "content/public/browser/navigation_entry.h" |
74 #include "content/public/browser/notification_service.h" | 73 #include "content/public/browser/notification_service.h" |
75 #include "content/public/browser/render_process_host.h" | 74 #include "content/public/browser/render_process_host.h" |
76 #include "content/public/browser/render_view_host.h" | 75 #include "content/public/browser/render_view_host.h" |
77 #include "content/public/browser/render_widget_host_view.h" | 76 #include "content/public/browser/render_widget_host_view.h" |
78 #include "content/public/browser/user_metrics.h" | 77 #include "content/public/browser/user_metrics.h" |
79 #include "content/public/browser/web_contents.h" | 78 #include "content/public/browser/web_contents.h" |
80 #include "content/public/common/content_restriction.h" | 79 #include "content/public/common/content_restriction.h" |
81 #include "content/public/common/ssl_status.h" | 80 #include "content/public/common/ssl_status.h" |
| 81 #include "extensions/browser/view_type_utils.h" |
82 #include "grit/generated_resources.h" | 82 #include "grit/generated_resources.h" |
83 #include "net/base/escape.h" | 83 #include "net/base/escape.h" |
84 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 84 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
85 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" | 85 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" |
86 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginAction.h" | 86 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginAction.h" |
87 #include "ui/base/clipboard/clipboard.h" | 87 #include "ui/base/clipboard/clipboard.h" |
88 #include "ui/base/l10n/l10n_util.h" | 88 #include "ui/base/l10n/l10n_util.h" |
89 #include "ui/base/text/text_elider.h" | 89 #include "ui/base/text/text_elider.h" |
90 #include "ui/gfx/favicon_size.h" | 90 #include "ui/gfx/favicon_size.h" |
91 #include "webkit/glue/webmenuitem.h" | 91 #include "webkit/glue/webmenuitem.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 base::TimeTicks::Now() - begin); | 405 base::TimeTicks::Now() - begin); |
406 UMA_HISTOGRAM_COUNTS("Extensions.ContextMenus_ItemCount", index); | 406 UMA_HISTOGRAM_COUNTS("Extensions.ContextMenus_ItemCount", index); |
407 } | 407 } |
408 | 408 |
409 void RenderViewContextMenu::InitMenu() { | 409 void RenderViewContextMenu::InitMenu() { |
410 if (chrome::IsRunningInForcedAppMode()) { | 410 if (chrome::IsRunningInForcedAppMode()) { |
411 AppendAppModeItems(); | 411 AppendAppModeItems(); |
412 return; | 412 return; |
413 } | 413 } |
414 | 414 |
415 chrome::ViewType view_type = chrome::GetViewType(source_web_contents_); | 415 extensions::ViewType view_type = |
416 if (view_type == chrome::VIEW_TYPE_APP_SHELL) { | 416 extensions::GetViewType(source_web_contents_); |
| 417 if (view_type == extensions::VIEW_TYPE_APP_SHELL) { |
417 AppendPlatformAppItems(); | 418 AppendPlatformAppItems(); |
418 return; | 419 return; |
419 } else if (view_type == chrome::VIEW_TYPE_EXTENSION_POPUP) { | 420 } else if (view_type == extensions::VIEW_TYPE_EXTENSION_POPUP) { |
420 AppendPopupExtensionItems(); | 421 AppendPopupExtensionItems(); |
421 return; | 422 return; |
422 } else if (view_type == chrome::VIEW_TYPE_PANEL) { | 423 } else if (view_type == extensions::VIEW_TYPE_PANEL) { |
423 AppendPanelItems(); | 424 AppendPanelItems(); |
424 return; | 425 return; |
425 } | 426 } |
426 | 427 |
427 const bool has_link = !params_.unfiltered_link_url.is_empty(); | 428 const bool has_link = !params_.unfiltered_link_url.is_empty(); |
428 const bool has_selection = !params_.selection_text.empty(); | 429 const bool has_selection = !params_.selection_text.empty(); |
429 | 430 |
430 if (AppendCustomItems()) { | 431 if (AppendCustomItems()) { |
431 // If there's a selection, don't early return when there are custom items, | 432 // If there's a selection, don't early return when there are custom items, |
432 // but fall through to adding the normal ones after the custom ones. | 433 // but fall through to adding the normal ones after the custom ones. |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 source_web_contents_->GetRenderViewHost()-> | 1891 source_web_contents_->GetRenderViewHost()-> |
1891 ExecuteMediaPlayerActionAtLocation(location, action); | 1892 ExecuteMediaPlayerActionAtLocation(location, action); |
1892 } | 1893 } |
1893 | 1894 |
1894 void RenderViewContextMenu::PluginActionAt( | 1895 void RenderViewContextMenu::PluginActionAt( |
1895 const gfx::Point& location, | 1896 const gfx::Point& location, |
1896 const WebPluginAction& action) { | 1897 const WebPluginAction& action) { |
1897 source_web_contents_->GetRenderViewHost()-> | 1898 source_web_contents_->GetRenderViewHost()-> |
1898 ExecutePluginActionAtLocation(location, action); | 1899 ExecutePluginActionAtLocation(location, action); |
1899 } | 1900 } |
OLD | NEW |