OLD | NEW |
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_PROFILES_PROFILE_IO_DATA_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/net/chrome_url_request_context.h" | 13 #include "chrome/browser/net/chrome_url_request_context.h" |
| 14 #include "chrome/browser/prefs/pref_member.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "net/base/cookie_monster.h" | 16 #include "net/base/cookie_monster.h" |
16 | 17 |
17 class CommandLine; | 18 class CommandLine; |
18 class ChromeAppCacheService; | 19 class ChromeAppCacheService; |
19 class ChromeBlobStorageContext; | 20 class ChromeBlobStorageContext; |
20 class ChromeURLRequestContext; | 21 class ChromeURLRequestContext; |
21 class ChromeURLRequestContextGetter; | 22 class ChromeURLRequestContextGetter; |
22 class ExtensionInfoMap; | 23 class ExtensionInfoMap; |
23 namespace fileapi { | 24 namespace fileapi { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 static void InitializeProfileParams(Profile* profile, ProfileParams* params); | 126 static void InitializeProfileParams(Profile* profile, ProfileParams* params); |
126 static void ApplyProfileParamsToContext(const ProfileParams& profile_params, | 127 static void ApplyProfileParamsToContext(const ProfileParams& profile_params, |
127 ChromeURLRequestContext* context); | 128 ChromeURLRequestContext* context); |
128 | 129 |
129 // Lazy initializes the ProfileIOData object the first time a request context | 130 // Lazy initializes the ProfileIOData object the first time a request context |
130 // is requested. The lazy logic is implemented here. The actual initialization | 131 // is requested. The lazy logic is implemented here. The actual initialization |
131 // is done in LazyInitializeInternal(), implemented by subtypes. Static helper | 132 // is done in LazyInitializeInternal(), implemented by subtypes. Static helper |
132 // functions have been provided to assist in common operations. | 133 // functions have been provided to assist in common operations. |
133 void LazyInitialize() const; | 134 void LazyInitialize() const; |
134 | 135 |
| 136 // Called when the profile is destroyed. |
| 137 void ShutdownOnUIThread(); |
| 138 |
| 139 BooleanPrefMember* enable_referrers() const { |
| 140 return &enable_referrers_; |
| 141 } |
| 142 |
| 143 private: |
135 // -------------------------------------------- | 144 // -------------------------------------------- |
136 // Virtual interface for subtypes to implement: | 145 // Virtual interface for subtypes to implement: |
137 // -------------------------------------------- | 146 // -------------------------------------------- |
138 | 147 |
139 // Does the actual initialization of the ProfileIOData subtype. Subtypes | 148 // Does the actual initialization of the ProfileIOData subtype. Subtypes |
140 // should use the static helper functions above to implement this. | 149 // should use the static helper functions above to implement this. |
141 virtual void LazyInitializeInternal() const = 0; | 150 virtual void LazyInitializeInternal() const = 0; |
142 | 151 |
143 // Does an on-demand initialization of a RequestContext for the given | 152 // Does an on-demand initialization of a RequestContext for the given |
144 // isolated app. | 153 // isolated app. |
145 virtual scoped_refptr<RequestContext> InitializeAppRequestContext( | 154 virtual scoped_refptr<RequestContext> InitializeAppRequestContext( |
146 scoped_refptr<ChromeURLRequestContext> main_context, | 155 scoped_refptr<ChromeURLRequestContext> main_context, |
147 const std::string& app_id) const = 0; | 156 const std::string& app_id) const = 0; |
148 | 157 |
149 // These functions are used to transfer ownership of the lazily initialized | 158 // These functions are used to transfer ownership of the lazily initialized |
150 // context from ProfileIOData to the URLRequestContextGetter. | 159 // context from ProfileIOData to the URLRequestContextGetter. |
151 virtual scoped_refptr<ChromeURLRequestContext> | 160 virtual scoped_refptr<ChromeURLRequestContext> |
152 AcquireMainRequestContext() const = 0; | 161 AcquireMainRequestContext() const = 0; |
153 virtual scoped_refptr<ChromeURLRequestContext> | 162 virtual scoped_refptr<ChromeURLRequestContext> |
154 AcquireMediaRequestContext() const = 0; | 163 AcquireMediaRequestContext() const = 0; |
155 virtual scoped_refptr<ChromeURLRequestContext> | 164 virtual scoped_refptr<ChromeURLRequestContext> |
156 AcquireExtensionsRequestContext() const = 0; | 165 AcquireExtensionsRequestContext() const = 0; |
157 virtual scoped_refptr<ChromeURLRequestContext> | 166 virtual scoped_refptr<ChromeURLRequestContext> |
158 AcquireIsolatedAppRequestContext( | 167 AcquireIsolatedAppRequestContext( |
159 scoped_refptr<ChromeURLRequestContext> main_context, | 168 scoped_refptr<ChromeURLRequestContext> main_context, |
160 const std::string& app_id) const = 0; | 169 const std::string& app_id) const = 0; |
161 | 170 |
| 171 mutable BooleanPrefMember enable_referrers_; |
162 mutable bool initialized_; | 172 mutable bool initialized_; |
163 | 173 |
164 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 174 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
165 }; | 175 }; |
166 | 176 |
167 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 177 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
OLD | NEW |