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

Side by Side Diff: chrome/browser/profiles/profile.h

Issue 7438002: Deprecate Profile::GetDefaultRequestContext(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix other references. 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 // This class gathers state related to a single user profile. 5 // This class gathers state related to a single user profile.
6 6
7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_H_ 7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_H_
8 #define CHROME_BROWSER_PROFILES_PROFILE_H_ 8 #define CHROME_BROWSER_PROFILES_PROFILE_H_
9 #pragma once 9 #pragma once
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "chrome/browser/net/preconnect.h" // TODO: remove this.
15 #include "chrome/common/extensions/extension.h" 16 #include "chrome/common/extensions/extension.h"
16 17
17 namespace base { 18 namespace base {
18 class Time; 19 class Time;
19 } 20 }
20 21
22 namespace chrome_browser_net_websocket_experiment {
23 class WebSocketExperimentTask;
24 }
25
26 namespace chromeos {
27 class LibCrosServiceLibraryImpl;
28 class ResetDefaultProxyConfigServiceTask;
29 }
30
21 namespace content { 31 namespace content {
22 class ResourceContext; 32 class ResourceContext;
23 } 33 }
24 34
25 namespace fileapi { 35 namespace fileapi {
26 class FileSystemContext; 36 class FileSystemContext;
27 class SandboxedFileSystemContext; 37 class SandboxedFileSystemContext;
28 } 38 }
29 39
30 namespace history { 40 namespace history {
31 class TopSites; 41 class TopSites;
32 } 42 }
33 43
34 namespace net { 44 namespace net {
35 class TransportSecurityState; 45 class TransportSecurityState;
36 class SSLConfigService; 46 class SSLConfigService;
37 } 47 }
38 48
39 49
40 namespace prerender { 50 namespace prerender {
41 class PrerenderManager; 51 class PrerenderManager;
42 } 52 }
43 53
44 namespace quota { 54 namespace quota {
45 class QuotaManager; 55 class QuotaManager;
46 } 56 }
47 57
58 namespace speech_input {
59 class SpeechRecognizer;
60 }
61
48 namespace webkit_database { 62 namespace webkit_database {
49 class DatabaseTracker; 63 class DatabaseTracker;
50 } 64 }
51 65
52 class AutocompleteClassifier; 66 class AutocompleteClassifier;
53 class BookmarkModel; 67 class BookmarkModel;
54 class BrowserSignin; 68 class BrowserSignin;
55 class ChromeAppCacheService; 69 class ChromeAppCacheService;
56 class ChromeBlobStorageContext; 70 class ChromeBlobStorageContext;
57 class ChromeURLDataManager; 71 class ChromeURLDataManager;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // incognito mode. 150 // incognito mode.
137 IMPLICIT_ACCESS 151 IMPLICIT_ACCESS
138 }; 152 };
139 153
140 class Delegate { 154 class Delegate {
141 public: 155 public:
142 // Called when creation of the profile is finished. 156 // Called when creation of the profile is finished.
143 virtual void OnProfileCreated(Profile* profile, bool success) = 0; 157 virtual void OnProfileCreated(Profile* profile, bool success) = 0;
144 }; 158 };
145 159
160 // Whitelist access to deprecated API in order to prevent new regressions.
161 class Deprecated {
162 private:
163 friend bool IsGoogleGAIACookieInstalled();
164 friend void chrome_browser_net::PreconnectOnIOThread(
165 const GURL&,
166 chrome_browser_net::UrlInfo::ResolutionMotivation,
167 int);
168
169 friend class AutofillDownloadManager;
170 friend class ChromePluginMessageFilter;
171 friend class DefaultGeolocationArbitratorDependencyFactory;
172 friend class DevToolsHttpProtocolHandler;
173 friend class DevToolsUI;
174 friend class LiveSyncTest;
175 friend class MetricsService;
176 friend class ResolveProxyMsgHelper;
177 friend class SafeBrowsingServiceTestHelper;
178 friend class SdchDictionaryFetcher;
179 friend class Toolbar5Importer;
180 friend class TranslateManager;
181 friend class
182 chrome_browser_net_websocket_experiment::WebSocketExperimentTask;
183 friend class chromeos::LibCrosServiceLibraryImpl;
184 friend class chromeos::ResetDefaultProxyConfigServiceTask;
185 friend class speech_input::SpeechRecognizer;
186
187 static net::URLRequestContextGetter* GetDefaultRequestContext() {
188 return Profile::GetDefaultRequestContext();
189 }
190 };
191
146 // Key used to bind profile to the widget with which it is associated. 192 // Key used to bind profile to the widget with which it is associated.
147 static const char* kProfileKey; 193 static const char* const kProfileKey;
148 194
149 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) 195 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX)
150 // Value that represents no local profile id. 196 // Value that represents no local profile id.
151 static const LocalProfileId kInvalidLocalProfileId; 197 static const LocalProfileId kInvalidLocalProfileId;
152 #endif 198 #endif
153 199
154 Profile(); 200 Profile();
155 virtual ~Profile() {} 201 virtual ~Profile() {}
156 202
157 // Profile prefs are registered as soon as the prefs are loaded for the first 203 // Profile prefs are registered as soon as the prefs are loaded for the first
158 // time. 204 // time.
159 static void RegisterUserPrefs(PrefService* prefs); 205 static void RegisterUserPrefs(PrefService* prefs);
160 206
161 // Create a new profile given a path. 207 // Create a new profile given a path.
162 static Profile* CreateProfile(const FilePath& path); 208 static Profile* CreateProfile(const FilePath& path);
163 209
164 // Same as above, but uses async initialization. 210 // Same as above, but uses async initialization.
165 static Profile* CreateProfileAsync(const FilePath& path, 211 static Profile* CreateProfileAsync(const FilePath& path,
166 Delegate* delegate); 212 Delegate* delegate);
167 213
168 // Returns the request context for the "default" profile. This may be called
169 // from any thread. This CAN return NULL if a first request context has not
170 // yet been created. If necessary, listen on the UI thread for
171 // NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE.
172 static net::URLRequestContextGetter* GetDefaultRequestContext();
173
174 // Returns the name associated with this profile. This name is displayed in 214 // Returns the name associated with this profile. This name is displayed in
175 // the browser frame. 215 // the browser frame.
176 virtual std::string GetProfileName() = 0; 216 virtual std::string GetProfileName() = 0;
177 217
178 // Returns the path of the directory where this profile's data is stored. 218 // Returns the path of the directory where this profile's data is stored.
179 virtual FilePath GetPath() = 0; 219 virtual FilePath GetPath() = 0;
180 220
181 // Return whether this profile is incognito. Default is false. 221 // Return whether this profile is incognito. Default is false.
182 virtual bool IsOffTheRecord() = 0; 222 virtual bool IsOffTheRecord() = 0;
183 223
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 601
562 // Creates an OffTheRecordProfile which points to this Profile. 602 // Creates an OffTheRecordProfile which points to this Profile.
563 Profile* CreateOffTheRecordProfile(); 603 Profile* CreateOffTheRecordProfile();
564 604
565 protected: 605 protected:
566 friend class OffTheRecordProfileImpl; 606 friend class OffTheRecordProfileImpl;
567 607
568 static net::URLRequestContextGetter* default_request_context_; 608 static net::URLRequestContextGetter* default_request_context_;
569 609
570 private: 610 private:
611 // ***DEPRECATED**: You should be passing in the specific profile's
612 // URLRequestContextGetter or using the system URLRequestContextGetter.
613 //
614 // Returns the request context for the "default" profile. This may be called
615 // from any thread. This CAN return NULL if a first request context has not
616 // yet been created. If necessary, listen on the UI thread for
617 // NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE.
618 static net::URLRequestContextGetter* GetDefaultRequestContext();
619
571 bool restored_last_session_; 620 bool restored_last_session_;
572 621
573 // Accessibility events will only be propagated when the pause 622 // Accessibility events will only be propagated when the pause
574 // level is zero. PauseAccessibilityEvents and ResumeAccessibilityEvents 623 // level is zero. PauseAccessibilityEvents and ResumeAccessibilityEvents
575 // increment and decrement the level, respectively, rather than set it to 624 // increment and decrement the level, respectively, rather than set it to
576 // true or false, so that calls can be nested. 625 // true or false, so that calls can be nested.
577 int accessibility_pause_level_; 626 int accessibility_pause_level_;
578 }; 627 };
579 628
580 #if defined(COMPILER_GCC) 629 #if defined(COMPILER_GCC)
581 namespace __gnu_cxx { 630 namespace __gnu_cxx {
582 631
583 template<> 632 template<>
584 struct hash<Profile*> { 633 struct hash<Profile*> {
585 std::size_t operator()(Profile* const& p) const { 634 std::size_t operator()(Profile* const& p) const {
586 return reinterpret_cast<std::size_t>(p); 635 return reinterpret_cast<std::size_t>(p);
587 } 636 }
588 }; 637 };
589 638
590 } // namespace __gnu_cxx 639 } // namespace __gnu_cxx
591 #endif 640 #endif
592 641
593 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ 642 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698