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

Side by Side Diff: chrome/browser/extensions/api/context_menu/context_menu_api.h

Issue 10664037: Moved ExtensionMenuManager and ExtensionMenuItem into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merged with latest master Created 8 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/context_menu/context_menu_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_EXTENSIONS_API_CONTEXT_MENU_CONTEXT_MENU_API_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENU_CONTEXT_MENU_API_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENU_CONTEXT_MENU_API_H__ 6 #define CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENU_CONTEXT_MENU_API_H__
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/extensions/extension_function.h" 9 #include "chrome/browser/extensions/extension_function.h"
10 #include "chrome/browser/extensions/extension_menu_manager.h" 10 #include "chrome/browser/extensions/menu_manager.h"
11 #include "chrome/common/extensions/url_pattern_set.h" 11 #include "chrome/common/extensions/url_pattern_set.h"
12 12
13 class ExtensionMenuItem; 13 class MenuItem;
14 14
15 namespace base { 15 namespace base {
16 class DictionaryValue; 16 class DictionaryValue;
17 } 17 }
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 class ExtensionContextMenuFunction : public SyncExtensionFunction { 21 class ExtensionContextMenuFunction : public SyncExtensionFunction {
22 protected: 22 protected:
23 virtual ~ExtensionContextMenuFunction() {} 23 virtual ~ExtensionContextMenuFunction() {}
24 24
25 // Helper function to read and parse a list of menu item contexts. 25 // Helper function to read and parse a list of menu item contexts.
26 bool ParseContexts(const base::DictionaryValue& properties, 26 bool ParseContexts(const base::DictionaryValue& properties,
27 const char* key, 27 const char* key,
28 ExtensionMenuItem::ContextList* result); 28 MenuItem::ContextList* result);
29 29
30 // Looks in properties for the "type" key, and reads the value in |result|. On 30 // Looks in properties for the "type" key, and reads the value in |result|. On
31 // error, returns false and puts an error message into error_. If the key is 31 // error, returns false and puts an error message into error_. If the key is
32 // not present, |result| is set to |default_value| and the return value is 32 // not present, |result| is set to |default_value| and the return value is
33 // true. 33 // true.
34 bool ParseType(const base::DictionaryValue& properties, 34 bool ParseType(const base::DictionaryValue& properties,
35 const ExtensionMenuItem::Type& default_value, 35 const MenuItem::Type& default_value,
36 ExtensionMenuItem::Type* result); 36 MenuItem::Type* result);
37 37
38 // Helper to read and parse the "checked" property. 38 // Helper to read and parse the "checked" property.
39 bool ParseChecked(ExtensionMenuItem::Type type, 39 bool ParseChecked(MenuItem::Type type,
40 const base::DictionaryValue& properties, 40 const base::DictionaryValue& properties,
41 bool default_value, 41 bool default_value,
42 bool* checked); 42 bool* checked);
43 43
44 // Helper to read an ID from the Value*. The ID can be either a string or 44 // Helper to read an ID from the Value*. The ID can be either a string or
45 // integer. 45 // integer.
46 bool ParseID(const Value* value, 46 bool ParseID(const Value* value, MenuItem::Id* result);
47 ExtensionMenuItem::Id* result);
48 47
49 // If the parentId key was specified in properties, this will try looking up 48 // If the parentId key was specified in properties, this will try looking up
50 // an ExtensionMenuItem with that id and set it into |result|. Returns false 49 // an MenuItem with that id and set it into |result|. Returns false
51 // on error, with an explanation written into error_. Note that if the 50 // on error, with an explanation written into error_. Note that if the
52 // parentId key is not in properties, this will return true and leave |result| 51 // parentId key is not in properties, this will return true and leave |result|
53 // unset. Also, it is considered an error if the item found has a type other 52 // unset. Also, it is considered an error if the item found has a type other
54 // than NORMAL. 53 // than NORMAL.
55 bool GetParent(const base::DictionaryValue& properties, 54 bool GetParent(const base::DictionaryValue& properties,
56 const ExtensionMenuManager& manager, 55 const MenuManager& manager,
57 ExtensionMenuItem** result); 56 MenuItem** result);
58 }; 57 };
59 58
60 class CreateContextMenuFunction : public ExtensionContextMenuFunction { 59 class CreateContextMenuFunction : public ExtensionContextMenuFunction {
61 public: 60 public:
62 DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.create") 61 DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.create")
63 62
64 protected: 63 protected:
65 virtual ~CreateContextMenuFunction() {} 64 virtual ~CreateContextMenuFunction() {}
66 65
67 // ExtensionFunction: 66 // ExtensionFunction:
(...skipping 29 matching lines...) Expand all
97 protected: 96 protected:
98 virtual ~RemoveAllContextMenusFunction() {} 97 virtual ~RemoveAllContextMenusFunction() {}
99 98
100 // ExtensionFunction: 99 // ExtensionFunction:
101 virtual bool RunImpl() OVERRIDE; 100 virtual bool RunImpl() OVERRIDE;
102 }; 101 };
103 102
104 } // namespace extensions 103 } // namespace extensions
105 104
106 #endif // CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENU_CONTEXT_MENU_API_H__ 105 #endif // CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENU_CONTEXT_MENU_API_H__
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/context_menu/context_menu_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698