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

Side by Side Diff: chrome/browser/extensions/extension_cookies_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 // Defines the Chrome Extensions Cookies API functions for accessing internet 5 // Defines the Chrome Extensions Cookies API functions for accessing internet
6 // cookies, as specified in chrome/common/extensions/api/extension_api.json. 6 // cookies, as specified in chrome/common/extensions/api/extension_api.json.
7 7
8 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_ 8 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_
9 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_ 9 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_
10 #pragma once 10 #pragma once
11 11
12 #include <string> 12 #include <string>
13 13
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "chrome/browser/extensions/extension_function.h" 16 #include "chrome/browser/extensions/extension_function.h"
17 #include "chrome/browser/net/chrome_cookie_notification_details.h" 17 #include "chrome/browser/net/chrome_cookie_notification_details.h"
18 #include "content/common/notification_observer.h" 18 #include "content/common/notification_observer.h"
19 #include "content/common/notification_registrar.h" 19 #include "content/common/notification_registrar.h"
20 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
21 #include "net/base/cookie_monster.h" 21 #include "net/base/cookie_monster.h"
22 22
23 namespace base {
23 class DictionaryValue; 24 class DictionaryValue;
25 }
24 26
25 namespace net { 27 namespace net {
26 class URLRequestContextGetter; 28 class URLRequestContextGetter;
27 } 29 }
28 30
29 // Observes CookieMonster notifications and routes them as events to the 31 // Observes CookieMonster notifications and routes them as events to the
30 // extension system. 32 // extension system.
31 class ExtensionCookiesEventRouter : public NotificationObserver { 33 class ExtensionCookiesEventRouter : public NotificationObserver {
32 public: 34 public:
33 explicit ExtensionCookiesEventRouter(Profile* profile); 35 explicit ExtensionCookiesEventRouter(Profile* profile);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // concurrently accessed from multiple threads. They modify |result_| and other 69 // concurrently accessed from multiple threads. They modify |result_| and other
68 // member variables directly. 70 // member variables directly.
69 // See chrome/browser/extensions/extension_function.h for more information. 71 // See chrome/browser/extensions/extension_function.h for more information.
70 class CookiesFunction : public AsyncExtensionFunction { 72 class CookiesFunction : public AsyncExtensionFunction {
71 protected: 73 protected:
72 // Looks for a 'url' value in the given details dictionary and constructs a 74 // Looks for a 'url' value in the given details dictionary and constructs a
73 // GURL from it. Returns false and assigns the internal error_ value if the 75 // GURL from it. Returns false and assigns the internal error_ value if the
74 // URL is invalid or isn't found in the dictionary. If check_host_permissions 76 // URL is invalid or isn't found in the dictionary. If check_host_permissions
75 // is true, the URL is also checked against the extension's host permissions, 77 // is true, the URL is also checked against the extension's host permissions,
76 // and if there is no permission for the URL, this function returns false. 78 // and if there is no permission for the URL, this function returns false.
77 bool ParseUrl(const DictionaryValue* details, GURL* url, 79 bool ParseUrl(const base::DictionaryValue* details, GURL* url,
78 bool check_host_permissions); 80 bool check_host_permissions);
79 81
80 // Checks the given details dictionary for a 'storeId' value, and retrieves 82 // Checks the given details dictionary for a 'storeId' value, and retrieves
81 // the cookie store context and the store ID associated with it. If the 83 // the cookie store context and the store ID associated with it. If the
82 // 'storeId' value isn't found in the dictionary, the current execution 84 // 'storeId' value isn't found in the dictionary, the current execution
83 // context's cookie store context is retrieved. Returns false on error and 85 // context's cookie store context is retrieved. Returns false on error and
84 // assigns the internal error_ value if that occurs. 86 // assigns the internal error_ value if that occurs.
85 // At least one of the output parameters store and store_id should be 87 // At least one of the output parameters store and store_id should be
86 // non-NULL. 88 // non-NULL.
87 bool ParseStoreContext(const DictionaryValue* details, 89 bool ParseStoreContext(const base::DictionaryValue* details,
88 net::URLRequestContextGetter** context, 90 net::URLRequestContextGetter** context,
89 std::string* store_id); 91 std::string* store_id);
90 }; 92 };
91 93
92 // Implements the cookies.get() extension function. 94 // Implements the cookies.get() extension function.
93 class GetCookieFunction : public CookiesFunction { 95 class GetCookieFunction : public CookiesFunction {
94 public: 96 public:
95 GetCookieFunction(); 97 GetCookieFunction();
96 virtual ~GetCookieFunction(); 98 virtual ~GetCookieFunction();
97 virtual bool RunImpl(); 99 virtual bool RunImpl();
(...skipping 14 matching lines...) Expand all
112 public: 114 public:
113 GetAllCookiesFunction(); 115 GetAllCookiesFunction();
114 virtual ~GetAllCookiesFunction(); 116 virtual ~GetAllCookiesFunction();
115 virtual bool RunImpl(); 117 virtual bool RunImpl();
116 DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAll") 118 DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAll")
117 119
118 private: 120 private:
119 void GetAllCookiesOnIOThread(); 121 void GetAllCookiesOnIOThread();
120 void RespondOnUIThread(); 122 void RespondOnUIThread();
121 123
122 DictionaryValue* details_; 124 base::DictionaryValue* details_;
123 GURL url_; 125 GURL url_;
124 std::string store_id_; 126 std::string store_id_;
125 scoped_refptr<net::URLRequestContextGetter> store_context_; 127 scoped_refptr<net::URLRequestContextGetter> store_context_;
126 }; 128 };
127 129
128 // Implements the cookies.set() extension function. 130 // Implements the cookies.set() extension function.
129 class SetCookieFunction : public CookiesFunction { 131 class SetCookieFunction : public CookiesFunction {
130 public: 132 public:
131 SetCookieFunction(); 133 SetCookieFunction();
132 virtual ~SetCookieFunction(); 134 virtual ~SetCookieFunction();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // Implements the cookies.getAllCookieStores() extension function. 174 // Implements the cookies.getAllCookieStores() extension function.
173 class GetAllCookieStoresFunction : public CookiesFunction { 175 class GetAllCookieStoresFunction : public CookiesFunction {
174 public: 176 public:
175 virtual bool RunImpl(); 177 virtual bool RunImpl();
176 // GetAllCookieStoresFunction is sync. 178 // GetAllCookieStoresFunction is sync.
177 virtual void Run(); 179 virtual void Run();
178 DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAllCookieStores") 180 DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAllCookieStores")
179 }; 181 };
180 182
181 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_ 183 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_context_menu_api.h ('k') | chrome/browser/extensions/extension_cookies_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698