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 #ifndef CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ |
6 #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ | 6 #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 14 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
15 #include "chrome/browser/extensions/context_menu_matcher.h" | |
16 #include "chrome/browser/extensions/menu_manager.h" | |
17 #include "components/renderer_context_menu/context_menu_content_type.h" | 15 #include "components/renderer_context_menu/context_menu_content_type.h" |
18 #include "components/renderer_context_menu/render_view_context_menu_base.h" | 16 #include "components/renderer_context_menu/render_view_context_menu_base.h" |
19 #include "components/renderer_context_menu/render_view_context_menu_observer.h" | 17 #include "components/renderer_context_menu/render_view_context_menu_observer.h" |
20 #include "components/renderer_context_menu/render_view_context_menu_proxy.h" | 18 #include "components/renderer_context_menu/render_view_context_menu_proxy.h" |
21 #include "content/public/common/context_menu_params.h" | 19 #include "content/public/common/context_menu_params.h" |
22 #include "ui/base/models/simple_menu_model.h" | 20 #include "ui/base/models/simple_menu_model.h" |
23 #include "ui/base/window_open_disposition.h" | 21 #include "ui/base/window_open_disposition.h" |
24 | 22 |
| 23 #if defined(ENABLE_EXTENSIONS) |
| 24 #include "chrome/browser/extensions/context_menu_matcher.h" |
| 25 #include "chrome/browser/extensions/menu_manager.h" |
| 26 #endif |
| 27 |
25 class PrintPreviewContextMenuObserver; | 28 class PrintPreviewContextMenuObserver; |
26 class Profile; | 29 class Profile; |
27 class SpellingMenuObserver; | 30 class SpellingMenuObserver; |
28 class SpellCheckerSubMenuObserver; | 31 class SpellCheckerSubMenuObserver; |
29 | 32 |
30 namespace content { | 33 namespace content { |
31 class RenderFrameHost; | 34 class RenderFrameHost; |
32 class WebContents; | 35 class WebContents; |
33 } | 36 } |
34 | 37 |
(...skipping 18 matching lines...) Expand all Loading... |
53 | 56 |
54 ~RenderViewContextMenu() override; | 57 ~RenderViewContextMenu() override; |
55 | 58 |
56 // SimpleMenuModel::Delegate: | 59 // SimpleMenuModel::Delegate: |
57 bool IsCommandIdChecked(int command_id) const override; | 60 bool IsCommandIdChecked(int command_id) const override; |
58 bool IsCommandIdEnabled(int command_id) const override; | 61 bool IsCommandIdEnabled(int command_id) const override; |
59 void ExecuteCommand(int command_id, int event_flags) override; | 62 void ExecuteCommand(int command_id, int event_flags) override; |
60 | 63 |
61 protected: | 64 protected: |
62 Profile* GetProfile(); | 65 Profile* GetProfile(); |
| 66 |
| 67 #if defined(ENABLE_EXTENSIONS) |
63 extensions::ContextMenuMatcher extension_items_; | 68 extensions::ContextMenuMatcher extension_items_; |
| 69 #endif |
64 | 70 |
65 private: | 71 private: |
66 friend class RenderViewContextMenuTest; | 72 friend class RenderViewContextMenuTest; |
67 friend class RenderViewContextMenuPrefsTest; | 73 friend class RenderViewContextMenuPrefsTest; |
68 | 74 |
69 static bool IsDevToolsURL(const GURL& url); | 75 static bool IsDevToolsURL(const GURL& url); |
70 static bool IsInternalResourcesURL(const GURL& url); | 76 static bool IsInternalResourcesURL(const GURL& url); |
| 77 #if defined(ENABLE_EXTENSIONS) |
71 static bool ExtensionContextAndPatternMatch( | 78 static bool ExtensionContextAndPatternMatch( |
72 const content::ContextMenuParams& params, | 79 const content::ContextMenuParams& params, |
73 const extensions::MenuItem::ContextList& contexts, | 80 const extensions::MenuItem::ContextList& contexts, |
74 const extensions::URLPatternSet& target_url_patterns); | 81 const extensions::URLPatternSet& target_url_patterns); |
75 static bool MenuItemMatchesParams(const content::ContextMenuParams& params, | 82 static bool MenuItemMatchesParams(const content::ContextMenuParams& params, |
76 const extensions::MenuItem* item); | 83 const extensions::MenuItem* item); |
| 84 #endif |
77 | 85 |
78 // RenderViewContextMenuBase: | 86 // RenderViewContextMenuBase: |
79 void InitMenu() override; | 87 void InitMenu() override; |
80 void RecordShownItem(int id) override; | 88 void RecordShownItem(int id) override; |
81 void RecordUsedItem(int id) override; | 89 void RecordUsedItem(int id) override; |
82 #if defined(ENABLE_PLUGINS) | 90 #if defined(ENABLE_PLUGINS) |
83 void HandleAuthorizeAllPlugins() override; | 91 void HandleAuthorizeAllPlugins() override; |
84 #endif | 92 #endif |
85 void NotifyMenuShown() override; | 93 void NotifyMenuShown() override; |
86 void NotifyURLOpened(const GURL& url, | 94 void NotifyURLOpened(const GURL& url, |
(...skipping 11 matching lines...) Expand all Loading... |
98 void AppendVideoItems(); | 106 void AppendVideoItems(); |
99 void AppendMediaItems(); | 107 void AppendMediaItems(); |
100 void AppendPluginItems(); | 108 void AppendPluginItems(); |
101 void AppendPageItems(); | 109 void AppendPageItems(); |
102 void AppendFrameItems(); | 110 void AppendFrameItems(); |
103 void AppendCopyItem(); | 111 void AppendCopyItem(); |
104 void AppendPrintItem(); | 112 void AppendPrintItem(); |
105 void AppendRotationItems(); | 113 void AppendRotationItems(); |
106 void AppendEditableItems(); | 114 void AppendEditableItems(); |
107 void AppendSearchProvider(); | 115 void AppendSearchProvider(); |
| 116 #if defined(ENABLE_EXTENSIONS) |
108 void AppendAllExtensionItems(); | 117 void AppendAllExtensionItems(); |
109 void AppendCurrentExtensionItems(); | 118 void AppendCurrentExtensionItems(); |
| 119 #endif |
110 void AppendPrintPreviewItems(); | 120 void AppendPrintPreviewItems(); |
111 void AppendSearchWebForImageItems(); | 121 void AppendSearchWebForImageItems(); |
112 void AppendSpellingSuggestionsSubMenu(); | 122 void AppendSpellingSuggestionsSubMenu(); |
113 void AppendSpellcheckOptionsSubMenu(); | 123 void AppendSpellcheckOptionsSubMenu(); |
114 void AppendProtocolHandlerSubMenu(); | 124 void AppendProtocolHandlerSubMenu(); |
115 | 125 |
116 // Copy to the clipboard an image located at a point in the RenderView | 126 // Copy to the clipboard an image located at a point in the RenderView |
117 void CopyImageAt(int x, int y); | 127 void CopyImageAt(int x, int y); |
118 | 128 |
119 // Get an image located at a point in the RenderView for search. | 129 // Get an image located at a point in the RenderView for search. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 165 |
156 #if defined(ENABLE_FULL_PRINTING) | 166 #if defined(ENABLE_FULL_PRINTING) |
157 // An observer that disables menu items when print preview is active. | 167 // An observer that disables menu items when print preview is active. |
158 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; | 168 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; |
159 #endif | 169 #endif |
160 | 170 |
161 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); | 171 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); |
162 }; | 172 }; |
163 | 173 |
164 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ | 174 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ |
OLD | NEW |