Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu.h

Issue 9382037: Move ContextMenuParams struct from webkit/glue to content/public/common. The reasons are: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/page_transition_types.h" 21 #include "content/public/common/page_transition_types.h"
21 #include "ui/base/models/simple_menu_model.h" 22 #include "ui/base/models/simple_menu_model.h"
22 #include "webkit/glue/context_menu.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; 28 class RenderViewHost;
29 class SpellingMenuObserver; 29 class SpellingMenuObserver;
30 class SpellCheckerSubMenuObserver; 30 class SpellCheckerSubMenuObserver;
31 31
32 namespace content { 32 namespace content {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 virtual Profile* GetProfile() const = 0; 115 virtual Profile* GetProfile() const = 0;
116 }; 116 };
117 117
118 class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate, 118 class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate,
119 public RenderViewContextMenuProxy { 119 public RenderViewContextMenuProxy {
120 public: 120 public:
121 static const size_t kMaxExtensionItemTitleLength; 121 static const size_t kMaxExtensionItemTitleLength;
122 static const size_t kMaxSelectionTextLength; 122 static const size_t kMaxSelectionTextLength;
123 123
124 RenderViewContextMenu(content::WebContents* web_contents, 124 RenderViewContextMenu(content::WebContents* web_contents,
125 const ContextMenuParams& params); 125 const content::ContextMenuParams& params);
126 126
127 virtual ~RenderViewContextMenu(); 127 virtual ~RenderViewContextMenu();
128 128
129 // Initializes the context menu. 129 // Initializes the context menu.
130 void Init(); 130 void Init();
131 131
132 // Provide access to the menu model for ExternalTabContainer. 132 // Provide access to the menu model for ExternalTabContainer.
133 const ui::MenuModel& menu_model() const { return menu_model_; } 133 const ui::MenuModel& menu_model() const { return menu_model_; }
134 134
135 // SimpleMenuModel::Delegate implementation. 135 // SimpleMenuModel::Delegate implementation.
(...skipping 23 matching lines...) Expand all
159 // Platform specific functions. 159 // Platform specific functions.
160 virtual void PlatformInit() = 0; 160 virtual void PlatformInit() = 0;
161 virtual bool GetAcceleratorForCommandId( 161 virtual bool GetAcceleratorForCommandId(
162 int command_id, 162 int command_id,
163 ui::Accelerator* accelerator) = 0; 163 ui::Accelerator* accelerator) = 0;
164 virtual void LookUpInDictionary(); 164 virtual void LookUpInDictionary();
165 165
166 // Attempts to get an ExtensionMenuItem given the id of a context menu item. 166 // Attempts to get an ExtensionMenuItem given the id of a context menu item.
167 ExtensionMenuItem* GetExtensionMenuItem(int id) const; 167 ExtensionMenuItem* GetExtensionMenuItem(int id) const;
168 168
169 ContextMenuParams params_; 169 content::ContextMenuParams params_;
170 content::WebContents* source_web_contents_; 170 content::WebContents* source_web_contents_;
171 Profile* profile_; 171 Profile* profile_;
172 172
173 ui::SimpleMenuModel menu_model_; 173 ui::SimpleMenuModel menu_model_;
174 174
175 // True if we are showing for an external tab contents. The default is false. 175 // True if we are showing for an external tab contents. The default is false.
176 bool external_; 176 bool external_;
177 177
178 178
179 // Maps the id from a context menu item to the ExtensionMenuItem's internal 179 // Maps the id from a context menu item to the ExtensionMenuItem's internal
180 // id. 180 // id.
181 std::map<int, ExtensionMenuItem::Id> extension_item_map_; 181 std::map<int, ExtensionMenuItem::Id> extension_item_map_;
182 182
183 private: 183 private:
184 friend class RenderViewContextMenuTest; 184 friend class RenderViewContextMenuTest;
185 185
186 static bool IsDevToolsURL(const GURL& url); 186 static bool IsDevToolsURL(const GURL& url);
187 static bool IsInternalResourcesURL(const GURL& url); 187 static bool IsInternalResourcesURL(const GURL& url);
188 static bool ExtensionContextAndPatternMatch( 188 static bool ExtensionContextAndPatternMatch(
189 const ContextMenuParams& params, 189 const content::ContextMenuParams& params,
190 ExtensionMenuItem::ContextList contexts, 190 ExtensionMenuItem::ContextList contexts,
191 const URLPatternSet& target_url_patterns); 191 const URLPatternSet& target_url_patterns);
192 static ExtensionMenuItem::List GetRelevantExtensionItems( 192 static ExtensionMenuItem::List GetRelevantExtensionItems(
193 const ExtensionMenuItem::List& items, 193 const ExtensionMenuItem::List& items,
194 const ContextMenuParams& params, 194 const content::ContextMenuParams& params,
195 Profile* profile, 195 Profile* profile,
196 bool can_cross_incognito); 196 bool can_cross_incognito);
197 197
198 // Gets the extension (if any) associated with the TabContents that we're in. 198 // Gets the extension (if any) associated with the TabContents that we're in.
199 const Extension* GetExtension() const; 199 const Extension* GetExtension() const;
200 void AppendPlatformAppItems(const Extension* platform_app); 200 void AppendPlatformAppItems(const Extension* platform_app);
201 void AppendPopupExtensionItems(); 201 void AppendPopupExtensionItems();
202 bool AppendCustomItems(); 202 bool AppendCustomItems();
203 void AppendDeveloperItems(); 203 void AppendDeveloperItems();
204 void AppendLinkItems(); 204 void AppendLinkItems();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 // An observer that disables menu items when print preview is active. 284 // An observer that disables menu items when print preview is active.
285 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; 285 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_;
286 286
287 // Our observers. 287 // Our observers.
288 mutable ObserverList<RenderViewContextMenuObserver> observers_; 288 mutable ObserverList<RenderViewContextMenuObserver> observers_;
289 289
290 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); 290 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu);
291 }; 291 };
292 292
293 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ 293 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698