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

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

Issue 169093009: Separate out logic to handle different category/group of context menu items from RVContextMenu class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@work-mmm-refactor1
Patch Set: fix incorrect dcheck + platform app logic Created 6 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
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 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/tab_contents/menu_category_base.h"
17 #include "chrome/browser/tab_contents/render_view_context_menu_observer.h" 18 #include "chrome/browser/tab_contents/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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 const ui::MenuModel& menu_model() const { return menu_model_; } 144 const ui::MenuModel& menu_model() const { return menu_model_; }
144 145
145 // SimpleMenuModel::Delegate implementation. 146 // SimpleMenuModel::Delegate implementation.
146 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 147 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
147 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 148 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
148 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; 149 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
149 virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE; 150 virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE;
150 virtual void MenuClosed(ui::SimpleMenuModel* source) OVERRIDE; 151 virtual void MenuClosed(ui::SimpleMenuModel* source) OVERRIDE;
151 152
152 // RenderViewContextMenuDelegate implementation. 153 // RenderViewContextMenuProxy implementation.
153 virtual void AddMenuItem(int command_id, 154 virtual void AddMenuItem(int command_id,
154 const base::string16& title) OVERRIDE; 155 const base::string16& title) OVERRIDE;
155 virtual void AddCheckItem(int command_id, 156 virtual void AddCheckItem(int command_id,
156 const base::string16& title) OVERRIDE; 157 const base::string16& title) OVERRIDE;
157 virtual void AddSeparator() OVERRIDE; 158 virtual void AddSeparator() OVERRIDE;
158 virtual void AddSubMenu(int command_id, 159 virtual void AddSubMenu(int command_id,
159 const base::string16& label, 160 const base::string16& label,
160 ui::MenuModel* model) OVERRIDE; 161 ui::MenuModel* model) OVERRIDE;
161 virtual void UpdateMenuItem(int command_id, 162 virtual void UpdateMenuItem(int command_id,
162 bool enabled, 163 bool enabled,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
Avi (use Gerrit) 2014/02/22 01:37:45 blank line above this
lazyboy 2014/02/24 23:45:00 Done.
211 void AppendDeveloperItems(); 208 void AppendDeveloperItems();
209 void AppendDevtoolsForUnpackedExtensions();
212 void AppendLinkItems(); 210 void AppendLinkItems();
213 void AppendImageItems(); 211 void AppendImageItems();
214 void AppendAudioItems(); 212 void AppendAudioItems();
215 void AppendVideoItems(); 213 void AppendVideoItems();
216 void AppendMediaItems(); 214 void AppendMediaItems();
217 void AppendPluginItems(); 215 void AppendPluginItems();
218 void AppendPageItems(); 216 void AppendPageItems();
219 void AppendFrameItems(); 217 void AppendFrameItems();
220 void AppendCopyItem(); 218 void AppendCopyItem();
221 void AppendPrintItem(); 219 void AppendPrintItem();
222 void AppendEditableItems(); 220 void AppendEditableItems();
223 void AppendSearchProvider(); 221 void AppendSearchProvider();
224 void AppendAllExtensionItems(); 222 void AppendAllExtensionItems();
223 void AppendCurrentExtensionItems();
224 void AppendPrintPreviewItems();
225 void AppendSearchWebForImageItems();
225 void AppendSpellingSuggestionsSubMenu(); 226 void AppendSpellingSuggestionsSubMenu();
226 void AppendSpellcheckOptionsSubMenu(); 227 void AppendSpellcheckOptionsSubMenu();
227 void AppendSpeechInputOptionsSubMenu(); 228 void AppendSpeechInputOptionsSubMenu();
228 void AppendProtocolHandlerSubMenu(); 229 void AppendProtocolHandlerSubMenu();
229 230
230 // Opens the specified URL string in a new tab. The |frame_id| specifies the 231 // 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 232 // 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). 233 // independent of that frame (e.g. protocol handler settings).
233 void OpenURL(const GURL& url, const GURL& referrer, int64 frame_id, 234 void OpenURL(const GURL& url, const GURL& referrer, int64 frame_id,
234 WindowOpenDisposition disposition, 235 WindowOpenDisposition disposition,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; 281 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_;
281 #endif 282 #endif
282 283
283 // Our observers. 284 // Our observers.
284 mutable ObserverList<RenderViewContextMenuObserver> observers_; 285 mutable ObserverList<RenderViewContextMenuObserver> observers_;
285 286
286 // Whether a command has been executed. Used to track whether menu observers 287 // Whether a command has been executed. Used to track whether menu observers
287 // should be notified of menu closing without execution. 288 // should be notified of menu closing without execution.
288 bool command_executed_; 289 bool command_executed_;
289 290
290 // Whether or not the menu was triggered for a browser plugin guest. 291 scoped_ptr<MenuCategoryBase> menu_category_;
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 292
297 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); 293 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu);
298 }; 294 };
299 295
300 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ 296 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698