| 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" | 15 #include "chrome/browser/extensions/context_menu_matcher.h" |
| 16 #include "chrome/browser/extensions/menu_manager.h" | 16 #include "chrome/browser/extensions/menu_manager.h" |
| 17 #include "chrome/browser/renderer_context_menu/context_menu_content_type.h" |
| 17 #include "chrome/browser/renderer_context_menu/render_view_context_menu_observer
.h" | 18 #include "chrome/browser/renderer_context_menu/render_view_context_menu_observer
.h" |
| 18 #include "content/public/common/context_menu_params.h" | 19 #include "content/public/common/context_menu_params.h" |
| 19 #include "content/public/common/page_transition_types.h" | 20 #include "content/public/common/page_transition_types.h" |
| 20 #include "ui/base/models/simple_menu_model.h" | 21 #include "ui/base/models/simple_menu_model.h" |
| 21 #include "ui/base/window_open_disposition.h" | 22 #include "ui/base/window_open_disposition.h" |
| 22 | 23 |
| 23 class PrintPreviewContextMenuObserver; | 24 class PrintPreviewContextMenuObserver; |
| 24 class Profile; | 25 class Profile; |
| 25 class SpellingMenuObserver; | 26 class SpellingMenuObserver; |
| 26 class SpellCheckerSubMenuObserver; | 27 class SpellCheckerSubMenuObserver; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 static bool ExtensionContextAndPatternMatch( | 197 static bool ExtensionContextAndPatternMatch( |
| 197 const content::ContextMenuParams& params, | 198 const content::ContextMenuParams& params, |
| 198 extensions::MenuItem::ContextList contexts, | 199 extensions::MenuItem::ContextList contexts, |
| 199 const extensions::URLPatternSet& target_url_patterns); | 200 const extensions::URLPatternSet& target_url_patterns); |
| 200 static bool MenuItemMatchesParams( | 201 static bool MenuItemMatchesParams( |
| 201 const content::ContextMenuParams& params, | 202 const content::ContextMenuParams& params, |
| 202 const extensions::MenuItem* item); | 203 const extensions::MenuItem* item); |
| 203 | 204 |
| 204 // Gets the extension (if any) associated with the WebContents that we're in. | 205 // Gets the extension (if any) associated with the WebContents that we're in. |
| 205 const extensions::Extension* GetExtension() const; | 206 const extensions::Extension* GetExtension() const; |
| 206 void AppendAppModeItems(); | |
| 207 void AppendPlatformAppItems(); | |
| 208 void AppendPopupExtensionItems(); | |
| 209 void AppendPanelItems(); | |
| 210 bool AppendCustomItems(); | 207 bool AppendCustomItems(); |
| 208 |
| 211 void AppendDeveloperItems(); | 209 void AppendDeveloperItems(); |
| 210 void AppendDevtoolsForUnpackedExtensions(); |
| 212 void AppendLinkItems(); | 211 void AppendLinkItems(); |
| 213 void AppendImageItems(); | 212 void AppendImageItems(); |
| 214 void AppendAudioItems(); | 213 void AppendAudioItems(); |
| 215 void AppendVideoItems(); | 214 void AppendVideoItems(); |
| 216 void AppendMediaItems(); | 215 void AppendMediaItems(); |
| 217 void AppendPluginItems(); | 216 void AppendPluginItems(); |
| 218 void AppendPageItems(); | 217 void AppendPageItems(); |
| 219 void AppendFrameItems(); | 218 void AppendFrameItems(); |
| 220 void AppendCopyItem(); | 219 void AppendCopyItem(); |
| 221 void AppendPrintItem(); | 220 void AppendPrintItem(); |
| 222 void AppendEditableItems(); | 221 void AppendEditableItems(); |
| 223 void AppendSearchProvider(); | 222 void AppendSearchProvider(); |
| 224 void AppendAllExtensionItems(); | 223 void AppendAllExtensionItems(); |
| 224 void AppendCurrentExtensionItems(); |
| 225 void AppendPrintPreviewItems(); |
| 226 void AppendSearchWebForImageItems(); |
| 225 void AppendSpellingSuggestionsSubMenu(); | 227 void AppendSpellingSuggestionsSubMenu(); |
| 226 void AppendSpellcheckOptionsSubMenu(); | 228 void AppendSpellcheckOptionsSubMenu(); |
| 227 void AppendSpeechInputOptionsSubMenu(); | 229 void AppendSpeechInputOptionsSubMenu(); |
| 228 void AppendProtocolHandlerSubMenu(); | 230 void AppendProtocolHandlerSubMenu(); |
| 229 | 231 |
| 230 // Opens the specified URL string in a new tab. The |frame_id| specifies the | 232 // Opens the specified URL string in a new tab. The |frame_id| specifies the |
| 231 // frame in which the context menu was displayed, or 0 if the menu action is | 233 // frame in which the context menu was displayed, or 0 if the menu action is |
| 232 // independent of that frame (e.g. protocol handler settings). | 234 // independent of that frame (e.g. protocol handler settings). |
| 233 void OpenURL(const GURL& url, const GURL& referrer, int64 frame_id, | 235 void OpenURL(const GURL& url, const GURL& referrer, int64 frame_id, |
| 234 WindowOpenDisposition disposition, | 236 WindowOpenDisposition disposition, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; | 282 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; |
| 281 #endif | 283 #endif |
| 282 | 284 |
| 283 // Our observers. | 285 // Our observers. |
| 284 mutable ObserverList<RenderViewContextMenuObserver> observers_; | 286 mutable ObserverList<RenderViewContextMenuObserver> observers_; |
| 285 | 287 |
| 286 // Whether a command has been executed. Used to track whether menu observers | 288 // Whether a command has been executed. Used to track whether menu observers |
| 287 // should be notified of menu closing without execution. | 289 // should be notified of menu closing without execution. |
| 288 bool command_executed_; | 290 bool command_executed_; |
| 289 | 291 |
| 290 // Whether or not the menu was triggered for a browser plugin guest. | 292 scoped_ptr<ContextMenuContentType> content_type_; |
| 291 // Guests are rendered inside chrome apps, but have most of the actions | |
| 292 // that a regular web page has. | |
| 293 // Currently actions/items that are suppressed from guests are: searching, | |
| 294 // printing, speech and instant. | |
| 295 bool is_guest_; | |
| 296 | 293 |
| 297 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); | 294 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); |
| 298 }; | 295 }; |
| 299 | 296 |
| 300 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ | 297 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ |
| OLD | NEW |