OLD | NEW |
---|---|
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 CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 class IndexedDBContext; | 37 class IndexedDBContext; |
38 class ResourceContext; | 38 class ResourceContext; |
39 class SiteInstance; | 39 class SiteInstance; |
40 class StoragePartition; | 40 class StoragePartition; |
41 | 41 |
42 // This class holds the context needed for a browsing session. | 42 // This class holds the context needed for a browsing session. |
43 // It lives on the UI thread. All these methods must only be called on the UI | 43 // It lives on the UI thread. All these methods must only be called on the UI |
44 // thread. | 44 // thread. |
45 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 45 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { |
46 public: | 46 public: |
47 // Used in ForEachStoragePartition(). The first argument is the partition id. | |
48 // The second argument is the StoragePartition object for that partition id. | |
49 typedef base::Callback<void(StoragePartition*)> StoragePartitionCallback; | |
50 | |
51 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); | 47 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); |
52 | 48 |
53 // Returns BrowserContext specific external mount points. It may return NULL | 49 // Returns BrowserContext specific external mount points. It may return NULL |
54 // if the context doesn't have any BrowserContext specific external mount | 50 // if the context doesn't have any BrowserContext specific external mount |
55 // points. Currenty, non-NULL value is returned only on ChromeOS. | 51 // points. Currenty, non-NULL value is returned only on ChromeOS. |
56 static fileapi::ExternalMountPoints* GetMountPoints(BrowserContext* context); | 52 static fileapi::ExternalMountPoints* GetMountPoints(BrowserContext* context); |
57 | 53 |
58 static content::StoragePartition* GetStoragePartition( | 54 static content::StoragePartition* GetStoragePartition( |
59 BrowserContext* browser_context, SiteInstance* site_instance); | 55 BrowserContext* browser_context, SiteInstance* site_instance); |
60 static content::StoragePartition* GetStoragePartitionForSite( | 56 static content::StoragePartition* GetStoragePartitionForSite( |
61 BrowserContext* browser_context, const GURL& site); | 57 BrowserContext* browser_context, const GURL& site); |
58 typedef base::Callback<void(StoragePartition*)> StoragePartitionCallback; | |
Takashi Toyoshima
2013/07/12 12:45:50
Move here to follow style guide, and remove commen
| |
62 static void ForEachStoragePartition( | 59 static void ForEachStoragePartition( |
63 BrowserContext* browser_context, | 60 BrowserContext* browser_context, |
64 const StoragePartitionCallback& callback); | 61 const StoragePartitionCallback& callback); |
65 static void AsyncObliterateStoragePartition( | 62 static void AsyncObliterateStoragePartition( |
66 BrowserContext* browser_context, | 63 BrowserContext* browser_context, |
67 const GURL& site, | 64 const GURL& site, |
68 const base::Closure& on_gc_required); | 65 const base::Closure& on_gc_required); |
69 | 66 |
70 // This function clears the contents of |active_paths| but does not take | 67 // This function clears the contents of |active_paths| but does not take |
71 // ownership of the pointer. | 68 // ownership of the pointer. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 | 118 |
122 // Returns the request context for media resources associated with this | 119 // Returns the request context for media resources associated with this |
123 // context and renderer process. | 120 // context and renderer process. |
124 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 121 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
125 int renderer_child_id) = 0; | 122 int renderer_child_id) = 0; |
126 virtual net::URLRequestContextGetter* | 123 virtual net::URLRequestContextGetter* |
127 GetMediaRequestContextForStoragePartition( | 124 GetMediaRequestContextForStoragePartition( |
128 const base::FilePath& partition_path, | 125 const base::FilePath& partition_path, |
129 bool in_memory) = 0; | 126 bool in_memory) = 0; |
130 | 127 |
128 typedef base::Callback<void(bool)> MIDISysExPermissionCallback; | |
129 // Requests a permission to use system exclusive messages in MIDI events. | |
jam
2013/07/12 16:06:35
nit: a blank line above this would aid readability
Takashi Toyoshima
2013/07/12 16:37:30
Done.
| |
130 // |callback| will be invoked when the request is resolved. | |
131 virtual void RequestMIDISysExPermission( | |
132 int render_process_id, | |
133 int render_view_id, | |
134 const GURL& requesting_frame, | |
135 const MIDISysExPermissionCallback& callback) = 0; | |
136 | |
131 // Returns the resource context. | 137 // Returns the resource context. |
132 virtual ResourceContext* GetResourceContext() = 0; | 138 virtual ResourceContext* GetResourceContext() = 0; |
133 | 139 |
134 // Returns the DownloadManagerDelegate for this context. This will be called | 140 // Returns the DownloadManagerDelegate for this context. This will be called |
135 // once per context. The embedder owns the delegate and is responsible for | 141 // once per context. The embedder owns the delegate and is responsible for |
136 // ensuring that it outlives DownloadManager. It's valid to return NULL. | 142 // ensuring that it outlives DownloadManager. It's valid to return NULL. |
137 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0; | 143 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0; |
138 | 144 |
139 // Returns the geolocation permission context for this context. It's valid to | 145 // Returns the geolocation permission context for this context. It's valid to |
140 // return NULL, in which case geolocation requests will always be allowed. | 146 // return NULL, in which case geolocation requests will always be allowed. |
(...skipping 12 matching lines...) Expand all Loading... | |
153 struct hash<content::BrowserContext*> { | 159 struct hash<content::BrowserContext*> { |
154 std::size_t operator()(content::BrowserContext* const& p) const { | 160 std::size_t operator()(content::BrowserContext* const& p) const { |
155 return reinterpret_cast<std::size_t>(p); | 161 return reinterpret_cast<std::size_t>(p); |
156 } | 162 } |
157 }; | 163 }; |
158 | 164 |
159 } // namespace BASE_HASH_NAMESPACE | 165 } // namespace BASE_HASH_NAMESPACE |
160 #endif | 166 #endif |
161 | 167 |
162 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 168 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
OLD | NEW |