OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/profile.h" | 5 #include "chrome/browser/profile.h" |
6 | 6 |
7 #include "app/theme_provider.h" | 7 #include "app/theme_provider.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // The I/O thread may be NULL during testing. | 140 // The I/O thread may be NULL during testing. |
141 base::Thread* io_thread = g_browser_process->io_thread(); | 141 base::Thread* io_thread = g_browser_process->io_thread(); |
142 if (io_thread) | 142 if (io_thread) |
143 io_thread->message_loop()->ReleaseSoon(FROM_HERE, appcache_service); | 143 io_thread->message_loop()->ReleaseSoon(FROM_HERE, appcache_service); |
144 else | 144 else |
145 appcache_service->Release(); | 145 appcache_service->Release(); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 // static | 149 // static |
| 150 const ProfileId Profile::InvalidProfileId = static_cast<ProfileId>(0); |
| 151 |
| 152 // static |
150 void Profile::RegisterUserPrefs(PrefService* prefs) { | 153 void Profile::RegisterUserPrefs(PrefService* prefs) { |
151 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true); | 154 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true); |
152 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true); | 155 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true); |
153 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true); | 156 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true); |
154 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. | 157 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. |
155 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, | 158 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, |
156 IDS_SPELLCHECK_DICTIONARY); | 159 IDS_SPELLCHECK_DICTIONARY); |
157 prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true); | 160 prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true); |
158 prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true); | 161 prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true); |
159 prefs->RegisterBooleanPref(prefs::kEnableUserScripts, false); | 162 prefs->RegisterBooleanPref(prefs::kEnableUserScripts, false); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 registrar_.Add(this, NotificationType::BROWSER_CLOSED, | 223 registrar_.Add(this, NotificationType::BROWSER_CLOSED, |
221 NotificationService::AllSources()); | 224 NotificationService::AllSources()); |
222 } | 225 } |
223 | 226 |
224 virtual ~OffTheRecordProfileImpl() { | 227 virtual ~OffTheRecordProfileImpl() { |
225 CleanupRequestContext(request_context_); | 228 CleanupRequestContext(request_context_); |
226 CleanupRequestContext(extensions_request_context_); | 229 CleanupRequestContext(extensions_request_context_); |
227 CleanupAppCacheService(appcache_service_); | 230 CleanupAppCacheService(appcache_service_); |
228 } | 231 } |
229 | 232 |
| 233 virtual ProfileId GetRuntimeId() { |
| 234 return reinterpret_cast<ProfileId>(this); |
| 235 } |
| 236 |
230 virtual FilePath GetPath() { return profile_->GetPath(); } | 237 virtual FilePath GetPath() { return profile_->GetPath(); } |
231 | 238 |
232 virtual bool IsOffTheRecord() { | 239 virtual bool IsOffTheRecord() { |
233 return true; | 240 return true; |
234 } | 241 } |
235 | 242 |
236 virtual Profile* GetOffTheRecordProfile() { | 243 virtual Profile* GetOffTheRecordProfile() { |
237 return this; | 244 return this; |
238 } | 245 } |
239 | 246 |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 favicon_service_ = NULL; | 798 favicon_service_ = NULL; |
792 | 799 |
793 extension_message_service_->ProfileDestroyed(); | 800 extension_message_service_->ProfileDestroyed(); |
794 | 801 |
795 if (extensions_service_) | 802 if (extensions_service_) |
796 extensions_service_->ProfileDestroyed(); | 803 extensions_service_->ProfileDestroyed(); |
797 | 804 |
798 MarkAsCleanShutdown(); | 805 MarkAsCleanShutdown(); |
799 } | 806 } |
800 | 807 |
| 808 ProfileId ProfileImpl::GetRuntimeId() { |
| 809 return reinterpret_cast<ProfileId>(this); |
| 810 } |
| 811 |
801 FilePath ProfileImpl::GetPath() { | 812 FilePath ProfileImpl::GetPath() { |
802 return path_; | 813 return path_; |
803 } | 814 } |
804 | 815 |
805 bool ProfileImpl::IsOffTheRecord() { | 816 bool ProfileImpl::IsOffTheRecord() { |
806 return false; | 817 return false; |
807 } | 818 } |
808 | 819 |
809 Profile* ProfileImpl::GetOffTheRecordProfile() { | 820 Profile* ProfileImpl::GetOffTheRecordProfile() { |
810 if (!off_the_record_profile_.get()) { | 821 if (!off_the_record_profile_.get()) { |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 #endif | 1383 #endif |
1373 return NULL; | 1384 return NULL; |
1374 } | 1385 } |
1375 | 1386 |
1376 void ProfileImpl::InitSyncService() { | 1387 void ProfileImpl::InitSyncService() { |
1377 #ifdef CHROME_PERSONALIZATION | 1388 #ifdef CHROME_PERSONALIZATION |
1378 sync_service_.reset(new ProfileSyncService(this)); | 1389 sync_service_.reset(new ProfileSyncService(this)); |
1379 sync_service_->Initialize(); | 1390 sync_service_->Initialize(); |
1380 #endif | 1391 #endif |
1381 } | 1392 } |
OLD | NEW |