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

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

Issue 261012: Committing change 255087 for Roger:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 2 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
« no previous file with comments | « chrome/browser/browsing_instance.cc ('k') | chrome/browser/profile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_PROFILE_H_ 7 #ifndef CHROME_BROWSER_PROFILE_H_
8 #define CHROME_BROWSER_PROFILE_H_ 8 #define CHROME_BROWSER_PROFILE_H_
9 9
10 #include <set> 10 #include <set>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 class TemplateURLModel; 53 class TemplateURLModel;
54 class ThemeProvider; 54 class ThemeProvider;
55 class ThumbnailStore; 55 class ThumbnailStore;
56 class URLRequestContext; 56 class URLRequestContext;
57 class UserScriptMaster; 57 class UserScriptMaster;
58 class VisitedLinkMaster; 58 class VisitedLinkMaster;
59 class VisitedLinkEventListener; 59 class VisitedLinkEventListener;
60 class WebDataService; 60 class WebDataService;
61 class WebKitContext; 61 class WebKitContext;
62 62
63 typedef intptr_t ProfileId;
64
63 class Profile { 65 class Profile {
64 public: 66 public:
65 // Profile services are accessed with the following parameter. This parameter 67 // Profile services are accessed with the following parameter. This parameter
66 // defines what the caller plans to do with the service. 68 // defines what the caller plans to do with the service.
67 // The caller is responsible for not performing any operation that would 69 // The caller is responsible for not performing any operation that would
68 // result in persistent implicit records while using an OffTheRecord profile. 70 // result in persistent implicit records while using an OffTheRecord profile.
69 // This flag allows the profile to perform an additional check. 71 // This flag allows the profile to perform an additional check.
70 // 72 //
71 // It also gives us an opportunity to perform further checks in the future. We 73 // It also gives us an opportunity to perform further checks in the future. We
72 // could, for example, return an history service that only allow some specific 74 // could, for example, return an history service that only allow some specific
73 // methods. 75 // methods.
74 enum ServiceAccessType { 76 enum ServiceAccessType {
75 // The caller plans to perform a read or write that takes place as a result 77 // The caller plans to perform a read or write that takes place as a result
76 // of the user input. Use this flag when the operation you are doing can be 78 // of the user input. Use this flag when the operation you are doing can be
77 // performed while off the record. (ex: creating a bookmark) 79 // performed while off the record. (ex: creating a bookmark)
78 // 80 //
79 // Since EXPLICIT_ACCESS means "as a result of a user action", this request 81 // Since EXPLICIT_ACCESS means "as a result of a user action", this request
80 // always succeeds. 82 // always succeeds.
81 EXPLICIT_ACCESS, 83 EXPLICIT_ACCESS,
82 84
83 // The caller plans to call a method that will permanently change some data 85 // The caller plans to call a method that will permanently change some data
84 // in the profile, as part of Chrome's implicit data logging. Use this flag 86 // in the profile, as part of Chrome's implicit data logging. Use this flag
85 // when you are about to perform an operation which is incompatible with the 87 // when you are about to perform an operation which is incompatible with the
86 // off the record mode. 88 // off the record mode.
87 IMPLICIT_ACCESS 89 IMPLICIT_ACCESS
88 }; 90 };
91
92 // Value that represents no profile Id.
93 static const ProfileId InvalidProfileId;
94
89 Profile() : restored_last_session_(false) {} 95 Profile() : restored_last_session_(false) {}
90 virtual ~Profile() {} 96 virtual ~Profile() {}
91 97
92 // Profile prefs are registered as soon as the prefs are loaded for the first 98 // Profile prefs are registered as soon as the prefs are loaded for the first
93 // time. 99 // time.
94 static void RegisterUserPrefs(PrefService* prefs); 100 static void RegisterUserPrefs(PrefService* prefs);
95 101
96 // Create a new profile given a path. 102 // Create a new profile given a path.
97 static Profile* CreateProfile(const FilePath& path); 103 static Profile* CreateProfile(const FilePath& path);
98 104
99 // Returns the request context for the "default" profile. This may be called 105 // Returns the request context for the "default" profile. This may be called
100 // from any thread. This CAN return NULL if a first request context has not 106 // from any thread. This CAN return NULL if a first request context has not
101 // yet been created. If necessary, listen on the UI thread for 107 // yet been created. If necessary, listen on the UI thread for
102 // NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE. 108 // NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE.
103 // 109 //
104 // The returned object is ref'd by the profile. Callers who AddRef() it (to 110 // The returned object is ref'd by the profile. Callers who AddRef() it (to
105 // keep it alive longer than the profile) must Release() it on the I/O thread. 111 // keep it alive longer than the profile) must Release() it on the I/O thread.
106 static URLRequestContext* GetDefaultRequestContext(); 112 static URLRequestContext* GetDefaultRequestContext();
107 113
114 // Returns a unique Id that can be used to identify this profile at runtime.
115 // This Id is not persistent and will not survive a restart of the browser.
116 virtual ProfileId GetRuntimeId() = 0;
117
108 // Returns the path of the directory where this profile's data is stored. 118 // Returns the path of the directory where this profile's data is stored.
109 virtual FilePath GetPath() = 0; 119 virtual FilePath GetPath() = 0;
110 120
111 // Return whether this profile is off the record. Default is false. 121 // Return whether this profile is off the record. Default is false.
112 virtual bool IsOffTheRecord() = 0; 122 virtual bool IsOffTheRecord() = 0;
113 123
114 // Return the off the record version of this profile. The returned pointer 124 // Return the off the record version of this profile. The returned pointer
115 // is owned by the receiving profile. If the receiving profile is off the 125 // is owned by the receiving profile. If the receiving profile is off the
116 // record, the same profile is returned. 126 // record, the same profile is returned.
117 virtual Profile* GetOffTheRecordProfile() = 0; 127 virtual Profile* GetOffTheRecordProfile() = 0;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 374
365 class OffTheRecordProfileImpl; 375 class OffTheRecordProfileImpl;
366 376
367 // The default profile implementation. 377 // The default profile implementation.
368 class ProfileImpl : public Profile, 378 class ProfileImpl : public Profile,
369 public NotificationObserver { 379 public NotificationObserver {
370 public: 380 public:
371 virtual ~ProfileImpl(); 381 virtual ~ProfileImpl();
372 382
373 // Profile implementation. 383 // Profile implementation.
384 virtual ProfileId GetRuntimeId();
374 virtual FilePath GetPath(); 385 virtual FilePath GetPath();
375 virtual bool IsOffTheRecord(); 386 virtual bool IsOffTheRecord();
376 virtual Profile* GetOffTheRecordProfile(); 387 virtual Profile* GetOffTheRecordProfile();
377 virtual void DestroyOffTheRecordProfile(); 388 virtual void DestroyOffTheRecordProfile();
378 virtual Profile* GetOriginalProfile(); 389 virtual Profile* GetOriginalProfile();
379 virtual ChromeAppCacheService* GetAppCacheService(); 390 virtual ChromeAppCacheService* GetAppCacheService();
380 virtual VisitedLinkMaster* GetVisitedLinkMaster(); 391 virtual VisitedLinkMaster* GetVisitedLinkMaster();
381 virtual UserScriptMaster* GetUserScriptMaster(); 392 virtual UserScriptMaster* GetUserScriptMaster();
382 virtual SSLHostState* GetSSLHostState(); 393 virtual SSLHostState* GetSSLHostState();
383 virtual net::StrictTransportSecurityState* GetStrictTransportSecurityState(); 394 virtual net::StrictTransportSecurityState* GetStrictTransportSecurityState();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 // GetSessionService won't recreate the SessionService. 541 // GetSessionService won't recreate the SessionService.
531 bool shutdown_session_service_; 542 bool shutdown_session_service_;
532 543
533 #if defined(OS_CHROMEOS) 544 #if defined(OS_CHROMEOS)
534 Touchpad touchpad_; 545 Touchpad touchpad_;
535 #endif 546 #endif
536 547
537 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); 548 DISALLOW_COPY_AND_ASSIGN(ProfileImpl);
538 }; 549 };
539 550
540 #if defined(COMPILER_GCC)
541 namespace __gnu_cxx {
542
543 template<>
544 struct hash<Profile*> {
545 std::size_t operator()(Profile* const& p) const {
546 return reinterpret_cast<std::size_t>(p);
547 }
548 };
549
550 } // namespace __gnu_cxx
551 #endif
552
553 // This struct is used to pass the spellchecker object through the notification 551 // This struct is used to pass the spellchecker object through the notification
554 // SPELLCHECKER_REINITIALIZED. This is used as the details for the notification 552 // SPELLCHECKER_REINITIALIZED. This is used as the details for the notification
555 // service. 553 // service.
556 struct SpellcheckerReinitializedDetails { 554 struct SpellcheckerReinitializedDetails {
557 scoped_refptr<SpellChecker> spellchecker; 555 scoped_refptr<SpellChecker> spellchecker;
558 }; 556 };
559 557
560 #endif // CHROME_BROWSER_PROFILE_H_ 558 #endif // CHROME_BROWSER_PROFILE_H_
OLDNEW
« no previous file with comments | « chrome/browser/browsing_instance.cc ('k') | chrome/browser/profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698