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

Side by Side Diff: chrome/browser/extensions/extension_context_menu_api.h

Issue 7259019: Move base/values.h into the base namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_EXTENSION_CONTEXT_MENU_API_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_API_H__
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_API_H__ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_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/extension_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;
14
15 namespace base {
13 class DictionaryValue; 16 class DictionaryValue;
14 class ExtensionMenuItem; 17 }
15 18
16 class ExtensionContextMenuFunction : public SyncExtensionFunction { 19 class ExtensionContextMenuFunction : public SyncExtensionFunction {
17 public: 20 public:
18 virtual ~ExtensionContextMenuFunction() {} 21 virtual ~ExtensionContextMenuFunction() {}
19 22
20 protected: 23 protected:
21 // Helper function to read and parse a list of menu item contexts. 24 // Helper function to read and parse a list of menu item contexts.
22 bool ParseContexts(const DictionaryValue& properties, 25 bool ParseContexts(const base::DictionaryValue& properties,
23 const char* key, 26 const char* key,
24 ExtensionMenuItem::ContextList* result); 27 ExtensionMenuItem::ContextList* result);
25 28
26 // Looks in properties for the "type" key, and reads the value in |result|. On 29 // Looks in properties for the "type" key, and reads the value in |result|. On
27 // error, returns false and puts an error message into error_. If the key is 30 // error, returns false and puts an error message into error_. If the key is
28 // not present, |result| is set to |default_value| and the return value is 31 // not present, |result| is set to |default_value| and the return value is
29 // true. 32 // true.
30 bool ParseType(const DictionaryValue& properties, 33 bool ParseType(const base::DictionaryValue& properties,
31 const ExtensionMenuItem::Type& default_value, 34 const ExtensionMenuItem::Type& default_value,
32 ExtensionMenuItem::Type* result); 35 ExtensionMenuItem::Type* result);
33 36
34 // Helper to read and parse the "checked" property. 37 // Helper to read and parse the "checked" property.
35 bool ParseChecked(ExtensionMenuItem::Type type, 38 bool ParseChecked(ExtensionMenuItem::Type type,
36 const DictionaryValue& properties, 39 const base::DictionaryValue& properties,
37 bool default_value, 40 bool default_value,
38 bool* checked); 41 bool* checked);
39 42
40 // Helper to read in a set of url patterns from a property with the given key 43 // Helper to read in a set of url patterns from a property with the given key
41 // name. 44 // name.
42 bool ParseURLPatterns(const DictionaryValue& properties, 45 bool ParseURLPatterns(const base::DictionaryValue& properties,
43 const char* key, 46 const char* key,
44 URLPatternSet* result); 47 URLPatternSet* result);
45 48
46 // Reads in any document and targetUrl patterns from |properties| and sets 49 // Reads in any document and targetUrl patterns from |properties| and sets
47 // them on |item|. 50 // them on |item|.
48 bool SetURLPatterns(const DictionaryValue& properties, 51 bool SetURLPatterns(const base::DictionaryValue& properties,
49 ExtensionMenuItem* item); 52 ExtensionMenuItem* item);
50 53
51 // If the parentId key was specified in properties, this will try looking up 54 // If the parentId key was specified in properties, this will try looking up
52 // an ExtensionMenuItem with that id and set it into |result|. Returns false 55 // an ExtensionMenuItem with that id and set it into |result|. Returns false
53 // on error, with an explanation written into error_. Note that if the 56 // on error, with an explanation written into error_. Note that if the
54 // parentId key is not in properties, this will return true and leave |result| 57 // parentId key is not in properties, this will return true and leave |result|
55 // unset. Also, it is considered an error if the item found has a type other 58 // unset. Also, it is considered an error if the item found has a type other
56 // than NORMAL. 59 // than NORMAL.
57 bool GetParent(const DictionaryValue& properties, 60 bool GetParent(const base::DictionaryValue& properties,
58 const ExtensionMenuManager& manager, 61 const ExtensionMenuManager& manager,
59 ExtensionMenuItem** result); 62 ExtensionMenuItem** result);
60 }; 63 };
61 64
62 class CreateContextMenuFunction : public ExtensionContextMenuFunction { 65 class CreateContextMenuFunction : public ExtensionContextMenuFunction {
63 virtual ~CreateContextMenuFunction() {} 66 virtual ~CreateContextMenuFunction() {}
64 virtual bool RunImpl(); 67 virtual bool RunImpl();
65 DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.create") 68 DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.create")
66 }; 69 };
67 70
68 class UpdateContextMenuFunction : public ExtensionContextMenuFunction { 71 class UpdateContextMenuFunction : public ExtensionContextMenuFunction {
69 virtual ~UpdateContextMenuFunction() {} 72 virtual ~UpdateContextMenuFunction() {}
70 virtual bool RunImpl(); 73 virtual bool RunImpl();
71 DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.update") 74 DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.update")
72 }; 75 };
73 76
74 class RemoveContextMenuFunction : public ExtensionContextMenuFunction { 77 class RemoveContextMenuFunction : public ExtensionContextMenuFunction {
75 virtual ~RemoveContextMenuFunction() {} 78 virtual ~RemoveContextMenuFunction() {}
76 virtual bool RunImpl(); 79 virtual bool RunImpl();
77 DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.remove") 80 DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.remove")
78 }; 81 };
79 82
80 class RemoveAllContextMenusFunction : public ExtensionContextMenuFunction { 83 class RemoveAllContextMenusFunction : public ExtensionContextMenuFunction {
81 virtual ~RemoveAllContextMenusFunction() {} 84 virtual ~RemoveAllContextMenusFunction() {}
82 virtual bool RunImpl(); 85 virtual bool RunImpl();
83 DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.removeAll") 86 DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.removeAll")
84 }; 87 };
85 88
86 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_API_H__ 89 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_API_H__
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_content_settings_store.h ('k') | chrome/browser/extensions/extension_cookies_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698