| 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 #ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/string16.h" | 16 #include "base/string16.h" |
| 17 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 17 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 18 #include "chrome/browser/extensions/extension_menu_manager.h" | 18 #include "chrome/browser/extensions/extension_menu_manager.h" |
| 19 #include "chrome/browser/tab_contents/render_view_context_menu_observer.h" | 19 #include "chrome/browser/tab_contents/render_view_context_menu_observer.h" |
| 20 #include "content/public/common/context_menu_params.h" | 20 #include "content/public/common/context_menu_params.h" |
| 21 #include "content/public/common/page_transition_types.h" | 21 #include "content/public/common/page_transition_types.h" |
| 22 #include "ui/base/models/simple_menu_model.h" | 22 #include "ui/base/models/simple_menu_model.h" |
| 23 #include "webkit/glue/window_open_disposition.h" | 23 #include "webkit/glue/window_open_disposition.h" |
| 24 | 24 |
| 25 class ExtensionMenuItem; | 25 class ExtensionMenuItem; |
| 26 class PrintPreviewContextMenuObserver; | 26 class PrintPreviewContextMenuObserver; |
| 27 class Profile; | 27 class Profile; |
| 28 class RenderViewHost; | |
| 29 class SpellingMenuObserver; | 28 class SpellingMenuObserver; |
| 30 class SpellCheckerSubMenuObserver; | 29 class SpellCheckerSubMenuObserver; |
| 31 | 30 |
| 32 namespace content { | 31 namespace content { |
| 32 class RenderViewHost; |
| 33 class WebContents; | 33 class WebContents; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace gfx { | 36 namespace gfx { |
| 37 class Point; | 37 class Point; |
| 38 } | 38 } |
| 39 | 39 |
| 40 namespace WebKit { | 40 namespace WebKit { |
| 41 struct WebMediaPlayerAction; | 41 struct WebMediaPlayerAction; |
| 42 struct WebPluginAction; | 42 struct WebPluginAction; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 ui::MenuModel* model) = 0; | 105 ui::MenuModel* model) = 0; |
| 106 | 106 |
| 107 // Update the status and text of the specified context-menu item. | 107 // Update the status and text of the specified context-menu item. |
| 108 virtual void UpdateMenuItem(int command_id, | 108 virtual void UpdateMenuItem(int command_id, |
| 109 bool enabled, | 109 bool enabled, |
| 110 bool hidden, | 110 bool hidden, |
| 111 const string16& title) = 0; | 111 const string16& title) = 0; |
| 112 | 112 |
| 113 // Retrieve the RenderViewHost (or Profile) instance associated with a context | 113 // Retrieve the RenderViewHost (or Profile) instance associated with a context |
| 114 // menu, respectively. | 114 // menu, respectively. |
| 115 virtual RenderViewHost* GetRenderViewHost() const = 0; | 115 virtual content::RenderViewHost* GetRenderViewHost() const = 0; |
| 116 virtual Profile* GetProfile() const = 0; | 116 virtual Profile* GetProfile() const = 0; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate, | 119 class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate, |
| 120 public RenderViewContextMenuProxy { | 120 public RenderViewContextMenuProxy { |
| 121 public: | 121 public: |
| 122 static const size_t kMaxExtensionItemTitleLength; | 122 static const size_t kMaxExtensionItemTitleLength; |
| 123 static const size_t kMaxSelectionTextLength; | 123 static const size_t kMaxSelectionTextLength; |
| 124 | 124 |
| 125 RenderViewContextMenu(content::WebContents* web_contents, | 125 RenderViewContextMenu(content::WebContents* web_contents, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 145 virtual void AddMenuItem(int command_id, const string16& title) OVERRIDE; | 145 virtual void AddMenuItem(int command_id, const string16& title) OVERRIDE; |
| 146 virtual void AddCheckItem(int command_id, const string16& title) OVERRIDE; | 146 virtual void AddCheckItem(int command_id, const string16& title) OVERRIDE; |
| 147 virtual void AddSeparator() OVERRIDE; | 147 virtual void AddSeparator() OVERRIDE; |
| 148 virtual void AddSubMenu(int command_id, | 148 virtual void AddSubMenu(int command_id, |
| 149 const string16& label, | 149 const string16& label, |
| 150 ui::MenuModel* model) OVERRIDE; | 150 ui::MenuModel* model) OVERRIDE; |
| 151 virtual void UpdateMenuItem(int command_id, | 151 virtual void UpdateMenuItem(int command_id, |
| 152 bool enabled, | 152 bool enabled, |
| 153 bool hidden, | 153 bool hidden, |
| 154 const string16& title) OVERRIDE; | 154 const string16& title) OVERRIDE; |
| 155 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; | 155 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE; |
| 156 virtual Profile* GetProfile() const OVERRIDE; | 156 virtual Profile* GetProfile() const OVERRIDE; |
| 157 | 157 |
| 158 protected: | 158 protected: |
| 159 void InitMenu(); | 159 void InitMenu(); |
| 160 | 160 |
| 161 // Platform specific functions. | 161 // Platform specific functions. |
| 162 virtual void PlatformInit() = 0; | 162 virtual void PlatformInit() = 0; |
| 163 virtual bool GetAcceleratorForCommandId( | 163 virtual bool GetAcceleratorForCommandId( |
| 164 int command_id, | 164 int command_id, |
| 165 ui::Accelerator* accelerator) = 0; | 165 ui::Accelerator* accelerator) = 0; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // An observer that disables menu items when print preview is active. | 286 // An observer that disables menu items when print preview is active. |
| 287 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; | 287 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; |
| 288 | 288 |
| 289 // Our observers. | 289 // Our observers. |
| 290 mutable ObserverList<RenderViewContextMenuObserver> observers_; | 290 mutable ObserverList<RenderViewContextMenuObserver> observers_; |
| 291 | 291 |
| 292 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); | 292 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); |
| 293 }; | 293 }; |
| 294 | 294 |
| 295 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 295 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
| OLD | NEW |