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

Side by Side Diff: chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h

Issue 359493005: Extend contextMenus API to support browser/page actions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added context strings, page action implementation Created 6 years, 5 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 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 // Definition of helper functions for the ContextMenus API. 5 // Definition of helper functions for the ContextMenus API.
6 6
7 #ifndef CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENUS_CONTEXT_MENUS_API_HELPERS_H_ 7 #ifndef CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENUS_CONTEXT_MENUS_API_HELPERS_H_
8 #define CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENUS_CONTEXT_MENUS_API_HELPERS_H_ 8 #define CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENUS_CONTEXT_MENUS_API_HELPERS_H_
9 9
10 #include "chrome/browser/extensions/menu_manager.h" 10 #include "chrome/browser/extensions/menu_manager.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 case PropertyWithEnumT::CONTEXTS_TYPE_AUDIO: 82 case PropertyWithEnumT::CONTEXTS_TYPE_AUDIO:
83 contexts.Add(extensions::MenuItem::AUDIO); 83 contexts.Add(extensions::MenuItem::AUDIO);
84 break; 84 break;
85 case PropertyWithEnumT::CONTEXTS_TYPE_FRAME: 85 case PropertyWithEnumT::CONTEXTS_TYPE_FRAME:
86 contexts.Add(extensions::MenuItem::FRAME); 86 contexts.Add(extensions::MenuItem::FRAME);
87 break; 87 break;
88 case PropertyWithEnumT::CONTEXTS_TYPE_LAUNCHER: 88 case PropertyWithEnumT::CONTEXTS_TYPE_LAUNCHER:
89 // Not available for <webview>. 89 // Not available for <webview>.
90 contexts.Add(extensions::MenuItem::LAUNCHER); 90 contexts.Add(extensions::MenuItem::LAUNCHER);
91 break; 91 break;
92 case PropertyWithEnumT::CONTEXTS_TYPE_BROWSER_ACTION:
93 contexts.Add(extensions::MenuItem::BROWSER_ACTION);
94 break;
95 case PropertyWithEnumT::CONTEXTS_TYPE_PAGE_ACTION:
96 contexts.Add(extensions::MenuItem::PAGE_ACTION);
97 break;
gpdavis 2014/06/28 00:05:41 This is the reason I added the browser_action and
92 case PropertyWithEnumT::CONTEXTS_TYPE_NONE: 98 case PropertyWithEnumT::CONTEXTS_TYPE_NONE:
93 NOTREACHED(); 99 NOTREACHED();
94 } 100 }
95 } 101 }
96 return contexts; 102 return contexts;
97 } 103 }
98 104
99 template<typename PropertyWithEnumT> 105 template<typename PropertyWithEnumT>
100 MenuItem::Type GetType(const PropertyWithEnumT& property, 106 MenuItem::Type GetType(const PropertyWithEnumT& property,
101 MenuItem::Type default_type) { 107 MenuItem::Type default_type) {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 return false; 308 return false;
303 309
304 menu_manager->WriteToStorage(extension, item_id.extension_key); 310 menu_manager->WriteToStorage(extension, item_id.extension_key);
305 return true; 311 return true;
306 } 312 }
307 313
308 } // namespace context_menus_api_helpers 314 } // namespace context_menus_api_helpers
309 } // namespace extensions 315 } // namespace extensions
310 316
311 #endif // CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENUS_CONTEXT_MENUS_API_HELPERS _H_ 317 #endif // CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENUS_CONTEXT_MENUS_API_HELPERS _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698