Chromium Code Reviews

Side by Side Diff: chrome/browser/net/chrome_url_request_context.h

Issue 1383001: Hook up extension apps notification permission, take two (Closed)
Patch Set: pre commit Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_NET_CHROME_URL_REQUEST_CONTEXT_H_ 5 #ifndef CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_
6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ 6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/linked_ptr.h" 9 #include "base/linked_ptr.h"
10 #include "net/base/cookie_monster.h" 10 #include "net/base/cookie_monster.h"
(...skipping 26 matching lines...)
37 // All methods of this class must be called from the IO thread, 37 // All methods of this class must be called from the IO thread,
38 // including the constructor and destructor. 38 // including the constructor and destructor.
39 class ChromeURLRequestContext : public URLRequestContext { 39 class ChromeURLRequestContext : public URLRequestContext {
40 public: 40 public:
41 // Maintains some extension-related state we need on the IO thread. 41 // Maintains some extension-related state we need on the IO thread.
42 // TODO(aa): It would be cool if the Extension objects in ExtensionsService 42 // TODO(aa): It would be cool if the Extension objects in ExtensionsService
43 // could be immutable and ref-counted so that we could use them directly from 43 // could be immutable and ref-counted so that we could use them directly from
44 // both threads. There is only a small amount of mutable state in Extension. 44 // both threads. There is only a small amount of mutable state in Extension.
45 struct ExtensionInfo { 45 struct ExtensionInfo {
46 ExtensionInfo(const FilePath& path, const std::string& default_locale, 46 ExtensionInfo(const FilePath& path, const std::string& default_locale,
47 const Extension::URLPatternList& extent, 47 const ExtensionExtent& extent,
48 const std::vector<std::string>& api_permissions) 48 const std::vector<std::string>& api_permissions)
49 : path(path), default_locale(default_locale), 49 : path(path), default_locale(default_locale),
50 extent(extent), api_permissions(api_permissions) { 50 extent(extent), api_permissions(api_permissions) {
51 } 51 }
52 FilePath path; 52 FilePath path;
53 std::string default_locale; 53 std::string default_locale;
54 Extension::URLPatternList extent; 54 ExtensionExtent extent;
55 std::vector<std::string> api_permissions; 55 std::vector<std::string> api_permissions;
56 }; 56 };
57 57
58 // Map of extension info by extension id. 58 // Map of extension info by extension id.
59 typedef std::map<std::string, linked_ptr<ExtensionInfo> > ExtensionInfoMap; 59 typedef std::map<std::string, linked_ptr<ExtensionInfo> > ExtensionInfoMap;
60 60
61 ChromeURLRequestContext(); 61 ChromeURLRequestContext();
62 62
63 // Gets the path to the directory for the specified extension. 63 // Gets the path to the directory for the specified extension.
64 FilePath GetPathForExtension(const std::string& id); 64 FilePath GetPathForExtension(const std::string& id);
65 65
66 // Returns an empty string if the extension with |id| doesn't have a default 66 // Returns an empty string if the extension with |id| doesn't have a default
67 // locale. 67 // locale.
68 std::string GetDefaultLocaleForExtension(const std::string& id); 68 std::string GetDefaultLocaleForExtension(const std::string& id);
69 69
70 // Determine whether a URL has access to the specified extension permission. 70 // Determine whether a URL has access to the specified extension permission.
71 // TODO(aa): This will eventually have to take an additional parameter: the
72 // ID of a specific extension to check, since |url| could show up in multiple
73 // extensions.
74 bool CheckURLAccessToExtensionPermission(const GURL& url, 71 bool CheckURLAccessToExtensionPermission(const GURL& url,
75 const std::string& application_id,
76 const char* permission_name); 72 const char* permission_name);
77 73
78 // Gets the path to the directory user scripts are stored in. 74 // Gets the path to the directory user scripts are stored in.
79 FilePath user_script_dir_path() const { 75 FilePath user_script_dir_path() const {
80 return user_script_dir_path_; 76 return user_script_dir_path_;
81 } 77 }
82 78
83 // Gets the appcache service to be used for requests in this context. 79 // Gets the appcache service to be used for requests in this context.
84 // May be NULL if requests for this context aren't subject to appcaching. 80 // May be NULL if requests for this context aren't subject to appcaching.
85 ChromeAppCacheService* appcache_service() const { 81 ChromeAppCacheService* appcache_service() const {
(...skipping 307 matching lines...)
393 IOThread* const io_thread_; 389 IOThread* const io_thread_;
394 390
395 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextFactory); 391 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextFactory);
396 }; 392 };
397 393
398 // Creates a proxy configuration using the overrides specified on the command 394 // Creates a proxy configuration using the overrides specified on the command
399 // line. Returns NULL if the system defaults should be used instead. 395 // line. Returns NULL if the system defaults should be used instead.
400 net::ProxyConfig* CreateProxyConfig(const CommandLine& command_line); 396 net::ProxyConfig* CreateProxyConfig(const CommandLine& command_line);
401 397
402 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ 398 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service.cc ('k') | chrome/browser/net/chrome_url_request_context.cc » ('j') | no next file with comments »

Powered by Google App Engine