license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
| 5 | #include "chrome/browser/profile.h" |
| 6 | |
| 7 | #include "base/command_line.h" |
[email protected] | 04fba9a9 | 2008-10-28 17:25:25 | [diff] [blame] | 8 | #include "base/file_path.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 9 | #include "base/file_util.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 10 | #include "base/path_service.h" |
| 11 | #include "base/scoped_ptr.h" |
| 12 | #include "base/string_util.h" |
[email protected] | a9afddb | 2009-02-12 17:49:42 | [diff] [blame] | 13 | #include "chrome/browser/bookmarks/bookmark_model.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 14 | #include "chrome/browser/browser_list.h" |
| 15 | #include "chrome/browser/browser_process.h" |
[email protected] | b7f0588 | 2009-02-22 01:21:56 | [diff] [blame] | 16 | #include "chrome/browser/download/download_manager.h" |
[email protected] | 481e1a4 | 2009-05-06 20:56:05 | [diff] [blame] | 17 | #include "chrome/browser/extensions/extension_process_manager.h" |
[email protected] | 6014d67 | 2008-12-05 00:38:25 | [diff] [blame] | 18 | #include "chrome/browser/extensions/extensions_service.h" |
[email protected] | 0938d3c | 2009-01-09 20:37:35 | [diff] [blame] | 19 | #include "chrome/browser/extensions/user_script_master.h" |
[email protected] | a9afddb | 2009-02-12 17:49:42 | [diff] [blame] | 20 | #include "chrome/browser/history/history.h" |
[email protected] | 6ab9b20 | 2008-12-23 22:34:50 | [diff] [blame] | 21 | #include "chrome/browser/net/chrome_url_request_context.h" |
[email protected] | e69d3395 | 2009-06-03 22:00:41 | [diff] [blame^] | 22 | #include "chrome/browser/password_manager/password_store_default.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 23 | #include "chrome/browser/profile_manager.h" |
[email protected] | 8c8657d6 | 2009-01-16 18:31:26 | [diff] [blame] | 24 | #include "chrome/browser/renderer_host/render_process_host.h" |
[email protected] | 1132436e | 2009-04-08 20:06:33 | [diff] [blame] | 25 | #include "chrome/browser/search_engines/template_url_fetcher.h" |
[email protected] | f63ae31 | 2009-02-04 17:58:46 | [diff] [blame] | 26 | #include "chrome/browser/search_engines/template_url_model.h" |
[email protected] | 85e921fb8 | 2009-02-11 23:19:44 | [diff] [blame] | 27 | #include "chrome/browser/sessions/session_service.h" |
[email protected] | bd580a25 | 2009-02-12 01:16:30 | [diff] [blame] | 28 | #include "chrome/browser/sessions/tab_restore_service.h" |
[email protected] | f0a64429 | 2009-02-25 23:32:47 | [diff] [blame] | 29 | #include "chrome/browser/spellchecker.h" |
[email protected] | 1132436e | 2009-04-08 20:06:33 | [diff] [blame] | 30 | #include "chrome/browser/ssl/ssl_host_state.h" |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 31 | #include "chrome/browser/browser_theme_provider.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 32 | #include "chrome/browser/visitedlink_master.h" |
| 33 | #include "chrome/browser/webdata/web_data_service.h" |
| 34 | #include "chrome/common/chrome_constants.h" |
| 35 | #include "chrome/common/chrome_paths.h" |
| 36 | #include "chrome/common/chrome_switches.h" |
[email protected] | 5b1a0e2 | 2009-05-26 19:00:58 | [diff] [blame] | 37 | #include "chrome/common/extensions/extension_error_reporter.h" |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 38 | #include "chrome/common/net/cookie_monster_sqlite.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 39 | #include "chrome/common/notification_service.h" |
| 40 | #include "chrome/common/pref_names.h" |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 41 | #include "chrome/common/render_messages.h" |
[email protected] | f90f5c51 | 2009-02-18 19:10:58 | [diff] [blame] | 42 | #include "grit/locale_settings.h" |
[email protected] | a9cea754 | 2009-05-20 04:30:23 | [diff] [blame] | 43 | #include "net/base/force_tls_state.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 44 | |
[email protected] | e1acf6f | 2008-10-27 20:43:33 | [diff] [blame] | 45 | using base::Time; |
| 46 | using base::TimeDelta; |
| 47 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 48 | // Delay, in milliseconds, before we explicitly create the SessionService. |
| 49 | static const int kCreateSessionServiceDelayMS = 500; |
| 50 | |
| 51 | // A pointer to the request context for the default profile. See comments on |
| 52 | // Profile::GetDefaultRequestContext. |
| 53 | URLRequestContext* Profile::default_request_context_; |
| 54 | |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 55 | static void CleanupRequestContext(ChromeURLRequestContext* context) { |
| 56 | if (context) { |
| 57 | context->CleanupOnUIThread(); |
| 58 | |
| 59 | // Clean up request context on IO thread. |
| 60 | g_browser_process->io_thread()->message_loop()->ReleaseSoon(FROM_HERE, |
| 61 | context); |
| 62 | } |
| 63 | } |
| 64 | |
[email protected] | 34cc84f | 2009-02-13 10:04:35 | [diff] [blame] | 65 | // static |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 66 | void Profile::RegisterUserPrefs(PrefService* prefs) { |
[email protected] | 430d3f7 | 2008-10-27 17:56:55 | [diff] [blame] | 67 | prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 68 | prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true); |
| 69 | prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true); |
[email protected] | 74c8b42 | 2009-03-11 00:34:12 | [diff] [blame] | 70 | // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 71 | prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, |
| 72 | IDS_SPELLCHECK_DICTIONARY); |
| 73 | prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true); |
[email protected] | 154a433 | 2009-06-03 20:20:58 | [diff] [blame] | 74 | prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true); |
[email protected] | f93fe78 | 2009-02-19 01:26:13 | [diff] [blame] | 75 | prefs->RegisterBooleanPref(prefs::kEnableUserScripts, false); |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 76 | prefs->RegisterStringPref(prefs::kCurrentThemeID, L""); |
| 77 | prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages); |
| 78 | prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors); |
| 79 | prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints); |
[email protected] | 7895ea2 | 2009-06-02 20:53:50 | [diff] [blame] | 80 | prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties); |
[email protected] | f93fe78 | 2009-02-19 01:26:13 | [diff] [blame] | 81 | prefs->RegisterBooleanPref(prefs::kEnableExtensions, false); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 82 | } |
| 83 | |
[email protected] | 34cc84f | 2009-02-13 10:04:35 | [diff] [blame] | 84 | // static |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 85 | Profile* Profile::CreateProfile(const FilePath& path) { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 86 | return new ProfileImpl(path); |
| 87 | } |
| 88 | |
[email protected] | 34cc84f | 2009-02-13 10:04:35 | [diff] [blame] | 89 | // static |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 90 | URLRequestContext* Profile::GetDefaultRequestContext() { |
| 91 | return default_request_context_; |
| 92 | } |
| 93 | |
[email protected] | e69d3395 | 2009-06-03 22:00:41 | [diff] [blame^] | 94 | #if defined(OS_LINUX) |
| 95 | // Temporarily disabled while we figure some stuff out. |
| 96 | // http://code.google.com/p/chromium/issues/detail?id=12351 |
| 97 | // #include "chrome/browser/password_manager/password_store_gnome.h" |
| 98 | // #include "chrome/browser/password_manager/password_store_kwallet.h" |
| 99 | #elif defined(OS_WIN) |
| 100 | #include "chrome/browser/password_manager/password_store_win.h" |
| 101 | #endif |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 102 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 103 | //////////////////////////////////////////////////////////////////////////////// |
| 104 | // |
| 105 | // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 106 | // to make it suitable for the off the record mode. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 107 | // |
| 108 | //////////////////////////////////////////////////////////////////////////////// |
| 109 | class OffTheRecordProfileImpl : public Profile, |
| 110 | public NotificationObserver { |
| 111 | public: |
| 112 | explicit OffTheRecordProfileImpl(Profile* real_profile) |
| 113 | : profile_(real_profile), |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 114 | extensions_request_context_(NULL), |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 115 | start_time_(Time::Now()) { |
[email protected] | 6ab9b20 | 2008-12-23 22:34:50 | [diff] [blame] | 116 | request_context_ = ChromeURLRequestContext::CreateOffTheRecord(this); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 117 | request_context_->AddRef(); |
[email protected] | 481e1a4 | 2009-05-06 20:56:05 | [diff] [blame] | 118 | |
| 119 | extension_process_manager_.reset(new ExtensionProcessManager(this)); |
| 120 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 121 | // Register for browser close notifications so we can detect when the last |
| 122 | // off-the-record window is closed, in which case we can clean our states |
| 123 | // (cookies, downloads...). |
[email protected] | 88cf329 | 2009-05-22 01:48:43 | [diff] [blame] | 124 | registrar_.Add(this, NotificationType::BROWSER_CLOSED, |
| 125 | NotificationService::AllSources()); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | virtual ~OffTheRecordProfileImpl() { |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 129 | CleanupRequestContext(request_context_); |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 130 | CleanupRequestContext(extensions_request_context_); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 131 | } |
| 132 | |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 133 | virtual FilePath GetPath() { return profile_->GetPath(); } |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 134 | |
| 135 | virtual bool IsOffTheRecord() { |
| 136 | return true; |
| 137 | } |
| 138 | |
| 139 | virtual Profile* GetOffTheRecordProfile() { |
| 140 | return this; |
| 141 | } |
| 142 | |
[email protected] | 860f5549 | 2009-03-27 19:50:59 | [diff] [blame] | 143 | virtual void DestroyOffTheRecordProfile() { |
| 144 | // Suicide is bad! |
| 145 | NOTREACHED(); |
| 146 | } |
| 147 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 148 | virtual Profile* GetOriginalProfile() { |
| 149 | return profile_; |
| 150 | } |
| 151 | |
| 152 | virtual VisitedLinkMaster* GetVisitedLinkMaster() { |
[email protected] | 7fb6c86 | 2009-03-13 02:51:49 | [diff] [blame] | 153 | // We don't provide access to the VisitedLinkMaster when we're OffTheRecord |
| 154 | // because we don't want to leak the sites that the user has visited before. |
| 155 | return NULL; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 156 | } |
| 157 | |
[email protected] | 6014d67 | 2008-12-05 00:38:25 | [diff] [blame] | 158 | virtual ExtensionsService* GetExtensionsService() { |
| 159 | return profile_->GetExtensionsService(); |
| 160 | } |
| 161 | |
[email protected] | 0938d3c | 2009-01-09 20:37:35 | [diff] [blame] | 162 | virtual UserScriptMaster* GetUserScriptMaster() { |
| 163 | return profile_->GetUserScriptMaster(); |
[email protected] | 04fba9a9 | 2008-10-28 17:25:25 | [diff] [blame] | 164 | } |
| 165 | |
[email protected] | 481e1a4 | 2009-05-06 20:56:05 | [diff] [blame] | 166 | virtual ExtensionProcessManager* GetExtensionProcessManager() { |
| 167 | return extension_process_manager_.get(); |
| 168 | } |
| 169 | |
[email protected] | 34cc84f | 2009-02-13 10:04:35 | [diff] [blame] | 170 | virtual SSLHostState* GetSSLHostState() { |
| 171 | if (!ssl_host_state_.get()) |
| 172 | ssl_host_state_.reset(new SSLHostState()); |
| 173 | |
| 174 | DCHECK(ssl_host_state_->CalledOnValidThread()); |
| 175 | return ssl_host_state_.get(); |
| 176 | } |
| 177 | |
[email protected] | a9cea754 | 2009-05-20 04:30:23 | [diff] [blame] | 178 | virtual net::ForceTLSState* GetForceTLSState() { |
| 179 | if (!force_tls_state_.get()) |
| 180 | force_tls_state_.reset(new net::ForceTLSState()); |
| 181 | |
| 182 | return force_tls_state_.get(); |
| 183 | } |
| 184 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 185 | virtual HistoryService* GetHistoryService(ServiceAccessType sat) { |
| 186 | if (sat == EXPLICIT_ACCESS) { |
| 187 | return profile_->GetHistoryService(sat); |
| 188 | } else { |
| 189 | NOTREACHED() << "This profile is OffTheRecord"; |
| 190 | return NULL; |
| 191 | } |
| 192 | } |
| 193 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 194 | virtual WebDataService* GetWebDataService(ServiceAccessType sat) { |
| 195 | if (sat == EXPLICIT_ACCESS) { |
| 196 | return profile_->GetWebDataService(sat); |
| 197 | } else { |
| 198 | NOTREACHED() << "This profile is OffTheRecord"; |
| 199 | return NULL; |
| 200 | } |
| 201 | } |
| 202 | |
[email protected] | e69d3395 | 2009-06-03 22:00:41 | [diff] [blame^] | 203 | virtual PasswordStore* GetPasswordStore(ServiceAccessType sat) { |
| 204 | if (sat == EXPLICIT_ACCESS) { |
| 205 | return profile_->GetPasswordStore(sat); |
| 206 | } else { |
| 207 | NOTREACHED() << "This profile is OffTheRecord"; |
| 208 | return NULL; |
| 209 | } |
| 210 | } |
| 211 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 212 | virtual PrefService* GetPrefs() { |
| 213 | return profile_->GetPrefs(); |
| 214 | } |
| 215 | |
| 216 | virtual TemplateURLModel* GetTemplateURLModel() { |
| 217 | return profile_->GetTemplateURLModel(); |
| 218 | } |
| 219 | |
| 220 | virtual TemplateURLFetcher* GetTemplateURLFetcher() { |
| 221 | return profile_->GetTemplateURLFetcher(); |
| 222 | } |
| 223 | |
| 224 | virtual DownloadManager* GetDownloadManager() { |
| 225 | if (!download_manager_.get()) { |
| 226 | scoped_refptr<DownloadManager> dlm(new DownloadManager); |
| 227 | dlm->Init(this); |
| 228 | download_manager_.swap(dlm); |
| 229 | } |
| 230 | return download_manager_.get(); |
| 231 | } |
| 232 | |
| 233 | virtual bool HasCreatedDownloadManager() const { |
| 234 | return (download_manager_.get() != NULL); |
| 235 | } |
| 236 | |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 237 | virtual void InitThemes() { |
| 238 | GetOriginalProfile()->InitThemes(); |
| 239 | } |
| 240 | |
| 241 | virtual void SetTheme(Extension* extension) { |
| 242 | GetOriginalProfile()->SetTheme(extension); |
| 243 | } |
| 244 | |
| 245 | virtual void ClearTheme() { |
| 246 | GetOriginalProfile()->ClearTheme(); |
| 247 | } |
| 248 | |
| 249 | virtual ThemeProvider* GetThemeProvider() { |
| 250 | return GetOriginalProfile()->GetThemeProvider(); |
| 251 | } |
| 252 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 253 | virtual URLRequestContext* GetRequestContext() { |
| 254 | return request_context_; |
| 255 | } |
| 256 | |
[email protected] | e7f2964 | 2009-03-02 22:53:18 | [diff] [blame] | 257 | virtual URLRequestContext* GetRequestContextForMedia() { |
[email protected] | d14c7ac | 2009-05-29 20:38:11 | [diff] [blame] | 258 | // In OTR mode, media request context is the same as the original one. |
| 259 | return request_context_; |
[email protected] | e7f2964 | 2009-03-02 22:53:18 | [diff] [blame] | 260 | } |
| 261 | |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 262 | URLRequestContext* GetRequestContextForExtensions() { |
| 263 | if (!extensions_request_context_) { |
| 264 | extensions_request_context_ = |
| 265 | ChromeURLRequestContext::CreateOffTheRecordForExtensions(this); |
| 266 | extensions_request_context_->AddRef(); |
| 267 | |
| 268 | DCHECK(extensions_request_context_->cookie_store()); |
| 269 | } |
| 270 | |
| 271 | return extensions_request_context_; |
| 272 | } |
| 273 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 274 | virtual SessionService* GetSessionService() { |
| 275 | // Don't save any sessions when off the record. |
| 276 | return NULL; |
| 277 | } |
| 278 | |
| 279 | virtual void ShutdownSessionService() { |
| 280 | // We don't allow a session service, nothing to do. |
| 281 | } |
| 282 | |
| 283 | virtual bool HasSessionService() const { |
| 284 | // We never have a session service. |
| 285 | return false; |
| 286 | } |
| 287 | |
| 288 | virtual std::wstring GetName() { |
| 289 | return profile_->GetName(); |
| 290 | } |
| 291 | |
| 292 | virtual void SetName(const std::wstring& name) { |
| 293 | profile_->SetName(name); |
| 294 | } |
| 295 | |
| 296 | virtual std::wstring GetID() { |
| 297 | return profile_->GetID(); |
| 298 | } |
| 299 | |
| 300 | virtual void SetID(const std::wstring& id) { |
| 301 | profile_->SetID(id); |
| 302 | } |
| 303 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 304 | virtual bool DidLastSessionExitCleanly() { |
| 305 | return profile_->DidLastSessionExitCleanly(); |
| 306 | } |
| 307 | |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 308 | virtual BookmarkModel* GetBookmarkModel() { |
| 309 | return profile_->GetBookmarkModel(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 310 | } |
| 311 | |
[email protected] | 3a453fa | 2008-08-15 18:46:34 | [diff] [blame] | 312 | #ifdef CHROME_PERSONALIZATION |
[email protected] | 57d3d0a | 2008-09-24 00:50:07 | [diff] [blame] | 313 | virtual ProfilePersonalization* GetProfilePersonalization() { |
[email protected] | 3a453fa | 2008-08-15 18:46:34 | [diff] [blame] | 314 | return profile_->GetProfilePersonalization(); |
| 315 | } |
| 316 | #endif |
| 317 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 318 | virtual bool IsSameProfile(Profile* profile) { |
| 319 | if (profile == static_cast<Profile*>(this)) |
| 320 | return true; |
| 321 | return profile == profile_; |
| 322 | } |
| 323 | |
| 324 | virtual Time GetStartTime() const { |
| 325 | return start_time_; |
| 326 | } |
| 327 | |
| 328 | virtual TabRestoreService* GetTabRestoreService() { |
| 329 | return NULL; |
| 330 | } |
| 331 | |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 332 | virtual void ResetTabRestoreService() { |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 333 | } |
| 334 | |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 335 | virtual void ReinitializeSpellChecker() { |
| 336 | profile_->ReinitializeSpellChecker(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | virtual SpellChecker* GetSpellChecker() { |
| 340 | return profile_->GetSpellChecker(); |
| 341 | } |
| 342 | |
| 343 | virtual void MarkAsCleanShutdown() { |
| 344 | } |
| 345 | |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 346 | virtual void InitExtensions() { |
| 347 | NOTREACHED(); |
| 348 | } |
| 349 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 350 | virtual void ExitedOffTheRecordMode() { |
| 351 | // Drop our download manager so we forget about all the downloads made |
| 352 | // in off-the-record mode. |
| 353 | download_manager_ = NULL; |
| 354 | } |
| 355 | |
| 356 | virtual void Observe(NotificationType type, |
| 357 | const NotificationSource& source, |
| 358 | const NotificationDetails& details) { |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 359 | DCHECK_EQ(NotificationType::BROWSER_CLOSED, type.value); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 360 | // We are only interested in OTR browser closing. |
| 361 | if (Source<Browser>(source)->profile() != this) |
| 362 | return; |
| 363 | |
| 364 | // Let's check if we still have an Off The Record window opened. |
| 365 | // Note that we check against 1 as this notification is sent before the |
| 366 | // browser window is actually removed from the list. |
| 367 | if (BrowserList::GetBrowserCount(this) <= 1) |
| 368 | ExitedOffTheRecordMode(); |
| 369 | } |
| 370 | |
| 371 | private: |
[email protected] | 88cf329 | 2009-05-22 01:48:43 | [diff] [blame] | 372 | NotificationRegistrar registrar_; |
| 373 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 374 | // The real underlying profile. |
| 375 | Profile* profile_; |
| 376 | |
[email protected] | 6ab9b20 | 2008-12-23 22:34:50 | [diff] [blame] | 377 | // The context to use for requests made from this OTR session. |
| 378 | ChromeURLRequestContext* request_context_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 379 | |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 380 | ChromeURLRequestContext* extensions_request_context_; |
| 381 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 382 | // The download manager that only stores downloaded items in memory. |
| 383 | scoped_refptr<DownloadManager> download_manager_; |
| 384 | |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 385 | // The download manager that only stores downloaded items in memory. |
| 386 | scoped_refptr<BrowserThemeProvider> theme_provider_; |
| 387 | |
[email protected] | 34cc84f | 2009-02-13 10:04:35 | [diff] [blame] | 388 | // We don't want SSLHostState from the OTR profile to leak back to the main |
| 389 | // profile because then the main profile would learn some of the host names |
| 390 | // the user visited while OTR. |
| 391 | scoped_ptr<SSLHostState> ssl_host_state_; |
| 392 | |
[email protected] | a9cea754 | 2009-05-20 04:30:23 | [diff] [blame] | 393 | // The ForceTLSState that only stores enabled sites in memory. |
| 394 | scoped_ptr<net::ForceTLSState> force_tls_state_; |
| 395 | |
[email protected] | 481e1a4 | 2009-05-06 20:56:05 | [diff] [blame] | 396 | // Extensions run in a different context in incognito mode. |
| 397 | scoped_ptr<ExtensionProcessManager> extension_process_manager_; |
| 398 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 399 | // Time we were started. |
| 400 | Time start_time_; |
| 401 | |
| 402 | DISALLOW_EVIL_CONSTRUCTORS(OffTheRecordProfileImpl); |
| 403 | }; |
| 404 | |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 405 | ProfileImpl::ProfileImpl(const FilePath& path) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 406 | : path_(path), |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 407 | request_context_(NULL), |
[email protected] | 363347b | 2009-03-13 20:06:57 | [diff] [blame] | 408 | media_request_context_(NULL), |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 409 | extensions_request_context_(NULL), |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 410 | history_service_created_(false), |
| 411 | created_web_data_service_(false), |
[email protected] | e69d3395 | 2009-06-03 22:00:41 | [diff] [blame^] | 412 | created_password_store_(false), |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 413 | created_download_manager_(false), |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 414 | created_theme_provider_(false), |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 415 | start_time_(Time::Now()), |
| 416 | spellchecker_(NULL), |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 417 | shutdown_session_service_(false) { |
| 418 | DCHECK(!path.empty()) << "Using an empty path will attempt to write " << |
| 419 | "profile files to the root directory!"; |
[email protected] | 2d31666 | 2008-09-03 18:18:14 | [diff] [blame] | 420 | create_session_service_timer_.Start( |
| 421 | TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
| 422 | &ProfileImpl::EnsureSessionServiceCreated); |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 423 | |
[email protected] | 481e1a4 | 2009-05-06 20:56:05 | [diff] [blame] | 424 | extension_process_manager_.reset(new ExtensionProcessManager(this)); |
| 425 | |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 426 | PrefService* prefs = GetPrefs(); |
| 427 | prefs->AddPrefObserver(prefs::kSpellCheckDictionary, this); |
| 428 | prefs->AddPrefObserver(prefs::kEnableSpellCheck, this); |
[email protected] | 154a433 | 2009-06-03 20:20:58 | [diff] [blame] | 429 | prefs->AddPrefObserver(prefs::kEnableAutoSpellCorrect, this); |
[email protected] | 380ab46 | 2009-04-24 01:23:58 | [diff] [blame] | 430 | |
| 431 | #ifdef CHROME_PERSONALIZATION |
| 432 | if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableP13n)) |
| 433 | personalization_.reset(Personalization::CreateProfilePersonalization(this)); |
| 434 | #endif |
| 435 | |
[email protected] | 1351b6a | 2009-04-09 20:13:22 | [diff] [blame] | 436 | #if defined(OS_LINUX) |
| 437 | // TODO(port): Remove ifdef when the Linux splash page is not needed. |
| 438 | prefs->transient()->SetString(prefs::kHomePage, "about:linux-splash"); |
| 439 | prefs->transient()->SetBoolean(prefs::kHomePageIsNewTabPage, false); |
| 440 | #endif |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 441 | |
| 442 | // Listen for theme installation. |
[email protected] | 88cf329 | 2009-05-22 01:48:43 | [diff] [blame] | 443 | registrar_.Add(this, NotificationType::THEME_INSTALLED, |
| 444 | NotificationService::AllSources()); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 445 | } |
| 446 | |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 447 | void ProfileImpl::InitExtensions() { |
[email protected] | 8c756ac | 2009-01-30 23:36:41 | [diff] [blame] | 448 | if (user_script_master_ || extensions_service_) |
| 449 | return; // Already initialized. |
| 450 | |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 451 | const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
[email protected] | f93fe78 | 2009-02-19 01:26:13 | [diff] [blame] | 452 | PrefService* prefs = GetPrefs(); |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 453 | bool user_scripts_enabled = |
[email protected] | f0a51fb5 | 2009-03-05 12:46:38 | [diff] [blame] | 454 | command_line->HasSwitch(switches::kEnableUserScripts) || |
[email protected] | f93fe78 | 2009-02-19 01:26:13 | [diff] [blame] | 455 | prefs->GetBoolean(prefs::kEnableUserScripts); |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 456 | |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 457 | FilePath script_dir; |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 458 | if (user_scripts_enabled) { |
[email protected] | 0cd957b | 2009-03-06 20:13:23 | [diff] [blame] | 459 | if (command_line->HasSwitch(switches::kUserScriptsDir)) { |
| 460 | std::wstring path_string = |
| 461 | command_line->GetSwitchValue(switches::kUserScriptsDir); |
| 462 | script_dir = FilePath::FromWStringHack(path_string); |
| 463 | } else { |
| 464 | script_dir = GetPath(); |
| 465 | script_dir = script_dir.Append(chrome::kUserScriptsDirname); |
| 466 | } |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 467 | } |
| 468 | |
[email protected] | bb28e06 | 2009-02-27 17:19:18 | [diff] [blame] | 469 | ExtensionErrorReporter::Init(true); // allow noisy errors. |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 470 | user_script_master_ = new UserScriptMaster( |
[email protected] | 9197f3b | 2009-06-02 00:49:27 | [diff] [blame] | 471 | g_browser_process->file_thread()->message_loop(), |
| 472 | script_dir); |
[email protected] | 894bb50 | 2009-05-21 22:39:57 | [diff] [blame] | 473 | extensions_service_ = new ExtensionsService( |
| 474 | this, MessageLoop::current(), |
| 475 | g_browser_process->file_thread()->message_loop(), |
| 476 | std::string()); // Use default registry path |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 477 | |
[email protected] | 9197f3b | 2009-06-02 00:49:27 | [diff] [blame] | 478 | extensions_service_->Init(); |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 479 | } |
| 480 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 481 | ProfileImpl::~ProfileImpl() { |
[email protected] | 169627b | 2008-12-06 19:30:19 | [diff] [blame] | 482 | tab_restore_service_ = NULL; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 483 | |
| 484 | StopCreateSessionServiceTimer(); |
| 485 | // TemplateURLModel schedules a task on the WebDataService from its |
| 486 | // destructor. Delete it first to ensure the task gets scheduled before we |
| 487 | // shut down the database. |
| 488 | template_url_model_.reset(); |
| 489 | |
| 490 | // The download manager queries the history system and should be deleted |
| 491 | // before the history is shutdown so it can properly cancel all requests. |
| 492 | download_manager_ = NULL; |
| 493 | |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 494 | // The theme provider provides bitmaps to whoever wants them. |
| 495 | theme_provider_ = NULL; |
| 496 | |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 497 | // Remove pref observers. |
| 498 | PrefService* prefs = GetPrefs(); |
| 499 | prefs->RemovePrefObserver(prefs::kSpellCheckDictionary, this); |
| 500 | prefs->RemovePrefObserver(prefs::kEnableSpellCheck, this); |
[email protected] | 154a433 | 2009-06-03 20:20:58 | [diff] [blame] | 501 | prefs->RemovePrefObserver(prefs::kEnableAutoSpellCorrect, this); |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 502 | |
[email protected] | 3a453fa | 2008-08-15 18:46:34 | [diff] [blame] | 503 | #ifdef CHROME_PERSONALIZATION |
[email protected] | 57d3d0a | 2008-09-24 00:50:07 | [diff] [blame] | 504 | personalization_.reset(); |
[email protected] | 3a453fa | 2008-08-15 18:46:34 | [diff] [blame] | 505 | #endif |
| 506 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 507 | // Both HistoryService and WebDataService maintain threads for background |
| 508 | // processing. Its possible each thread still has tasks on it that have |
| 509 | // increased the ref count of the service. In such a situation, when we |
| 510 | // decrement the refcount, it won't be 0, and the threads/databases aren't |
| 511 | // properly shut down. By explicitly calling Cleanup/Shutdown we ensure the |
| 512 | // databases are properly closed. |
| 513 | if (web_data_service_.get()) |
| 514 | web_data_service_->Shutdown(); |
| 515 | |
| 516 | if (history_service_.get()) |
| 517 | history_service_->Cleanup(); |
| 518 | |
| 519 | // The I/O thread may be NULL during testing. |
[email protected] | ab820df | 2008-08-26 05:55:10 | [diff] [blame] | 520 | base::Thread* io_thread = g_browser_process->io_thread(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 521 | |
| 522 | if (spellchecker_) { |
| 523 | // The spellchecker must be deleted on the I/O thread. During testing, we |
| 524 | // don't have an I/O thread. |
| 525 | if (io_thread) |
| 526 | io_thread->message_loop()->ReleaseSoon(FROM_HERE, spellchecker_); |
| 527 | else |
| 528 | spellchecker_->Release(); |
| 529 | } |
| 530 | |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 531 | if (default_request_context_ == request_context_) |
| 532 | default_request_context_ = NULL; |
[email protected] | 6ab9b20 | 2008-12-23 22:34:50 | [diff] [blame] | 533 | |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 534 | CleanupRequestContext(request_context_); |
| 535 | CleanupRequestContext(media_request_context_); |
| 536 | CleanupRequestContext(extensions_request_context_); |
[email protected] | 1e744f2 | 2009-04-08 01:00:17 | [diff] [blame] | 537 | |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 538 | // HistoryService may call into the BookmarkModel, as such we need to |
| 539 | // delete HistoryService before the BookmarkModel. The destructor for |
[email protected] | 90ef1313 | 2008-08-27 03:27:46 | [diff] [blame] | 540 | // HistoryService will join with HistoryService's backend thread so that |
| 541 | // by the time the destructor has finished we're sure it will no longer call |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 542 | // into the BookmarkModel. |
[email protected] | 90ef1313 | 2008-08-27 03:27:46 | [diff] [blame] | 543 | history_service_ = NULL; |
| 544 | bookmark_bar_model_.reset(); |
| 545 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 546 | MarkAsCleanShutdown(); |
| 547 | } |
| 548 | |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 549 | FilePath ProfileImpl::GetPath() { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 550 | return path_; |
| 551 | } |
| 552 | |
| 553 | bool ProfileImpl::IsOffTheRecord() { |
| 554 | return false; |
| 555 | } |
| 556 | |
| 557 | Profile* ProfileImpl::GetOffTheRecordProfile() { |
| 558 | if (!off_the_record_profile_.get()) { |
| 559 | scoped_ptr<OffTheRecordProfileImpl> p(new OffTheRecordProfileImpl(this)); |
| 560 | off_the_record_profile_.swap(p); |
| 561 | } |
| 562 | return off_the_record_profile_.get(); |
| 563 | } |
| 564 | |
[email protected] | 860f5549 | 2009-03-27 19:50:59 | [diff] [blame] | 565 | void ProfileImpl::DestroyOffTheRecordProfile() { |
| 566 | off_the_record_profile_.reset(); |
| 567 | } |
| 568 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 569 | Profile* ProfileImpl::GetOriginalProfile() { |
| 570 | return this; |
| 571 | } |
| 572 | |
[email protected] | 176aa48 | 2008-11-14 03:25:15 | [diff] [blame] | 573 | static void BroadcastNewHistoryTable(base::SharedMemory* table_memory) { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 574 | if (!table_memory) |
| 575 | return; |
| 576 | |
| 577 | // send to all RenderProcessHosts |
| 578 | for (RenderProcessHost::iterator i = RenderProcessHost::begin(); |
| 579 | i != RenderProcessHost::end(); i++) { |
| 580 | if (!i->second->channel()) |
| 581 | continue; |
| 582 | |
[email protected] | 176aa48 | 2008-11-14 03:25:15 | [diff] [blame] | 583 | base::SharedMemoryHandle new_table; |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 584 | base::ProcessHandle process = i->second->process().handle(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 585 | if (!process) { |
| 586 | // process can be null if it's started with the --single-process flag. |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 587 | process = base::Process::Current().handle(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 588 | } |
| 589 | |
| 590 | table_memory->ShareToProcess(process, &new_table); |
| 591 | IPC::Message* msg = new ViewMsg_VisitedLink_NewTable(new_table); |
| 592 | i->second->channel()->Send(msg); |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | VisitedLinkMaster* ProfileImpl::GetVisitedLinkMaster() { |
| 597 | if (!visited_link_master_.get()) { |
| 598 | scoped_ptr<VisitedLinkMaster> visited_links( |
| 599 | new VisitedLinkMaster(g_browser_process->file_thread(), |
| 600 | BroadcastNewHistoryTable, this)); |
| 601 | if (!visited_links->Init()) |
| 602 | return NULL; |
| 603 | visited_link_master_.swap(visited_links); |
| 604 | } |
| 605 | |
| 606 | return visited_link_master_.get(); |
| 607 | } |
| 608 | |
[email protected] | 6014d67 | 2008-12-05 00:38:25 | [diff] [blame] | 609 | ExtensionsService* ProfileImpl::GetExtensionsService() { |
| 610 | return extensions_service_.get(); |
| 611 | } |
| 612 | |
[email protected] | 0938d3c | 2009-01-09 20:37:35 | [diff] [blame] | 613 | UserScriptMaster* ProfileImpl::GetUserScriptMaster() { |
[email protected] | 0938d3c | 2009-01-09 20:37:35 | [diff] [blame] | 614 | return user_script_master_.get(); |
[email protected] | 04fba9a9 | 2008-10-28 17:25:25 | [diff] [blame] | 615 | } |
| 616 | |
[email protected] | 481e1a4 | 2009-05-06 20:56:05 | [diff] [blame] | 617 | ExtensionProcessManager* ProfileImpl::GetExtensionProcessManager() { |
| 618 | return extension_process_manager_.get(); |
| 619 | } |
| 620 | |
[email protected] | 34cc84f | 2009-02-13 10:04:35 | [diff] [blame] | 621 | SSLHostState* ProfileImpl::GetSSLHostState() { |
| 622 | if (!ssl_host_state_.get()) |
| 623 | ssl_host_state_.reset(new SSLHostState()); |
| 624 | |
| 625 | DCHECK(ssl_host_state_->CalledOnValidThread()); |
| 626 | return ssl_host_state_.get(); |
| 627 | } |
| 628 | |
[email protected] | a9cea754 | 2009-05-20 04:30:23 | [diff] [blame] | 629 | net::ForceTLSState* ProfileImpl::GetForceTLSState() { |
| 630 | if (!force_tls_state_.get()) |
| 631 | force_tls_state_.reset(new net::ForceTLSState()); |
| 632 | |
| 633 | return force_tls_state_.get(); |
| 634 | } |
| 635 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 636 | PrefService* ProfileImpl::GetPrefs() { |
| 637 | if (!prefs_.get()) { |
[email protected] | 6faa0e0d | 2009-04-28 06:50:36 | [diff] [blame] | 638 | prefs_.reset(new PrefService(GetPrefFilePath(), |
| 639 | g_browser_process->file_thread())); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 640 | |
| 641 | // The Profile class and ProfileManager class may read some prefs so |
| 642 | // register known prefs as soon as possible. |
| 643 | Profile::RegisterUserPrefs(prefs_.get()); |
| 644 | ProfileManager::RegisterUserPrefs(prefs_.get()); |
| 645 | |
| 646 | // The last session exited cleanly if there is no pref for |
| 647 | // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. |
| 648 | last_session_exited_cleanly_ = |
| 649 | prefs_->GetBoolean(prefs::kSessionExitedCleanly); |
| 650 | // Mark the session as open. |
| 651 | prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); |
| 652 | // Make sure we save to disk that the session has opened. |
[email protected] | 6faa0e0d | 2009-04-28 06:50:36 | [diff] [blame] | 653 | prefs_->ScheduleSavePersistentPrefs(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 654 | } |
| 655 | |
| 656 | return prefs_.get(); |
| 657 | } |
| 658 | |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 659 | FilePath ProfileImpl::GetPrefFilePath() { |
| 660 | FilePath pref_file_path = path_; |
| 661 | pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 662 | return pref_file_path; |
| 663 | } |
| 664 | |
| 665 | URLRequestContext* ProfileImpl::GetRequestContext() { |
| 666 | if (!request_context_) { |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 667 | FilePath cookie_path = GetPath(); |
| 668 | cookie_path = cookie_path.Append(chrome::kCookieFilename); |
| 669 | FilePath cache_path = GetPath(); |
[email protected] | 2b2830a | 2009-02-07 01:58:42 | [diff] [blame] | 670 | |
| 671 | // Override the cache location if specified by the user. |
| 672 | const std::wstring user_cache_dir( |
| 673 | CommandLine::ForCurrentProcess()->GetSwitchValue( |
| 674 | switches::kDiskCacheDir)); |
| 675 | if (!user_cache_dir.empty()) { |
| 676 | cache_path = FilePath::FromWStringHack(user_cache_dir); |
| 677 | } |
| 678 | |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 679 | cache_path = cache_path.Append(chrome::kCacheDirname); |
[email protected] | 6ab9b20 | 2008-12-23 22:34:50 | [diff] [blame] | 680 | request_context_ = ChromeURLRequestContext::CreateOriginal( |
| 681 | this, cookie_path, cache_path); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 682 | request_context_->AddRef(); |
| 683 | |
[email protected] | 6ab9b20 | 2008-12-23 22:34:50 | [diff] [blame] | 684 | // The first request context is always a normal (non-OTR) request context. |
| 685 | // Even when Chromium is started in OTR mode, a normal profile is always |
| 686 | // created first. |
| 687 | if (!default_request_context_) { |
| 688 | default_request_context_ = request_context_; |
| 689 | NotificationService::current()->Notify( |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 690 | NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, |
[email protected] | 6ab9b20 | 2008-12-23 22:34:50 | [diff] [blame] | 691 | NotificationService::AllSources(), NotificationService::NoDetails()); |
| 692 | } |
| 693 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 694 | DCHECK(request_context_->cookie_store()); |
| 695 | } |
| 696 | |
| 697 | return request_context_; |
| 698 | } |
| 699 | |
[email protected] | e7f2964 | 2009-03-02 22:53:18 | [diff] [blame] | 700 | URLRequestContext* ProfileImpl::GetRequestContextForMedia() { |
| 701 | if (!media_request_context_) { |
| 702 | FilePath cache_path = GetPath(); |
[email protected] | e3edeba | 2009-03-23 18:57:14 | [diff] [blame] | 703 | |
| 704 | // Override the cache location if specified by the user. |
| 705 | const std::wstring user_cache_dir( |
| 706 | CommandLine::ForCurrentProcess()->GetSwitchValue( |
| 707 | switches::kDiskCacheDir)); |
| 708 | if (!user_cache_dir.empty()) { |
| 709 | cache_path = FilePath::FromWStringHack(user_cache_dir); |
| 710 | } |
| 711 | |
[email protected] | 4e7b5dbb | 2009-03-25 00:09:23 | [diff] [blame] | 712 | cache_path = cache_path.Append(chrome::kMediaCacheDirname); |
[email protected] | e7f2964 | 2009-03-02 22:53:18 | [diff] [blame] | 713 | media_request_context_ = ChromeURLRequestContext::CreateOriginalForMedia( |
| 714 | this, cache_path); |
| 715 | media_request_context_->AddRef(); |
| 716 | |
| 717 | DCHECK(media_request_context_->cookie_store()); |
| 718 | } |
| 719 | |
| 720 | return media_request_context_; |
| 721 | } |
| 722 | |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 723 | URLRequestContext* ProfileImpl::GetRequestContextForExtensions() { |
| 724 | if (!extensions_request_context_) { |
| 725 | FilePath cookie_path = GetPath(); |
| 726 | cookie_path = cookie_path.Append(chrome::kExtensionsCookieFilename); |
| 727 | |
| 728 | extensions_request_context_ = |
| 729 | ChromeURLRequestContext::CreateOriginalForExtensions(this, cookie_path); |
| 730 | extensions_request_context_->AddRef(); |
| 731 | |
| 732 | DCHECK(extensions_request_context_->cookie_store()); |
| 733 | } |
| 734 | |
| 735 | return extensions_request_context_; |
| 736 | } |
| 737 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 738 | HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) { |
| 739 | if (!history_service_created_) { |
[email protected] | 90ef1313 | 2008-08-27 03:27:46 | [diff] [blame] | 740 | history_service_created_ = true; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 741 | scoped_refptr<HistoryService> history(new HistoryService(this)); |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 742 | if (!history->Init(GetPath(), GetBookmarkModel())) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 743 | return NULL; |
| 744 | history_service_.swap(history); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 745 | |
| 746 | // Send out the notification that the history service was created. |
| 747 | NotificationService::current()-> |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 748 | Notify(NotificationType::HISTORY_CREATED, Source<Profile>(this), |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 749 | Details<HistoryService>(history_service_.get())); |
| 750 | } |
| 751 | return history_service_.get(); |
| 752 | } |
| 753 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 754 | TemplateURLModel* ProfileImpl::GetTemplateURLModel() { |
| 755 | if (!template_url_model_.get()) |
| 756 | template_url_model_.reset(new TemplateURLModel(this)); |
| 757 | return template_url_model_.get(); |
| 758 | } |
| 759 | |
| 760 | TemplateURLFetcher* ProfileImpl::GetTemplateURLFetcher() { |
| 761 | if (!template_url_fetcher_.get()) |
| 762 | template_url_fetcher_.reset(new TemplateURLFetcher(this)); |
| 763 | return template_url_fetcher_.get(); |
| 764 | } |
| 765 | |
| 766 | WebDataService* ProfileImpl::GetWebDataService(ServiceAccessType sat) { |
| 767 | if (!created_web_data_service_) |
| 768 | CreateWebDataService(); |
| 769 | return web_data_service_.get(); |
| 770 | } |
| 771 | |
| 772 | void ProfileImpl::CreateWebDataService() { |
| 773 | DCHECK(!created_web_data_service_ && web_data_service_.get() == NULL); |
| 774 | created_web_data_service_ = true; |
| 775 | scoped_refptr<WebDataService> wds(new WebDataService()); |
| 776 | if (!wds->Init(GetPath())) |
| 777 | return; |
| 778 | web_data_service_.swap(wds); |
| 779 | } |
| 780 | |
[email protected] | e69d3395 | 2009-06-03 22:00:41 | [diff] [blame^] | 781 | PasswordStore* ProfileImpl::GetPasswordStore(ServiceAccessType sat) { |
| 782 | if (!created_password_store_) |
| 783 | CreatePasswordStore(); |
| 784 | return password_store_.get(); |
| 785 | } |
| 786 | |
| 787 | void ProfileImpl::CreatePasswordStore() { |
| 788 | DCHECK(!created_password_store_ && password_store_.get() == NULL); |
| 789 | created_password_store_ = true; |
| 790 | scoped_refptr<PasswordStore> ps; |
| 791 | #if defined(OS_LINUX) |
| 792 | // Temporarily disabled while we figure some stuff out. |
| 793 | // http://code.google.com/p/chromium/issues/detail?id=12351 |
| 794 | // if (getenv("KDE_FULL_SESSION")) { |
| 795 | // ps = new PasswordStoreKWallet(); |
| 796 | // } else { |
| 797 | // ps = new PasswordStoreGnome(); |
| 798 | // } |
| 799 | NOTIMPLEMENTED(); |
| 800 | #elif defined(OS_WIN) |
| 801 | ps = new PasswordStoreWin(GetWebDataService(Profile::IMPLICIT_ACCESS)); |
| 802 | #else |
| 803 | NOTIMPLEMENTED(); |
| 804 | #endif |
| 805 | if (!ps || !ps->Init()) { |
| 806 | // Try falling back to the default password manager |
| 807 | LOG(WARNING) << "Could not initialise native password manager - " |
| 808 | "falling back to default"; |
| 809 | ps = new PasswordStoreDefault(GetWebDataService(Profile::IMPLICIT_ACCESS)); |
| 810 | if (!ps->Init()) |
| 811 | return; |
| 812 | } |
| 813 | password_store_.swap(ps); |
| 814 | } |
| 815 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 816 | DownloadManager* ProfileImpl::GetDownloadManager() { |
| 817 | if (!created_download_manager_) { |
| 818 | scoped_refptr<DownloadManager> dlm(new DownloadManager); |
| 819 | dlm->Init(this); |
| 820 | created_download_manager_ = true; |
| 821 | download_manager_.swap(dlm); |
| 822 | } |
| 823 | return download_manager_.get(); |
| 824 | } |
| 825 | |
| 826 | bool ProfileImpl::HasCreatedDownloadManager() const { |
| 827 | return created_download_manager_; |
| 828 | } |
| 829 | |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 830 | void ProfileImpl::InitThemes() { |
| 831 | if (!created_theme_provider_) { |
| 832 | scoped_refptr<BrowserThemeProvider> themes(new BrowserThemeProvider); |
| 833 | themes->Init(this); |
| 834 | created_theme_provider_ = true; |
| 835 | theme_provider_.swap(themes); |
| 836 | } |
| 837 | } |
| 838 | |
| 839 | void ProfileImpl::SetTheme(Extension* extension) { |
| 840 | InitThemes(); |
| 841 | theme_provider_.get()->SetTheme(extension); |
| 842 | } |
| 843 | |
| 844 | void ProfileImpl::ClearTheme() { |
| 845 | InitThemes(); |
| 846 | theme_provider_.get()->UseDefaultTheme(); |
| 847 | } |
| 848 | |
| 849 | ThemeProvider* ProfileImpl::GetThemeProvider() { |
| 850 | InitThemes(); |
| 851 | return theme_provider_.get(); |
| 852 | } |
| 853 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 854 | SessionService* ProfileImpl::GetSessionService() { |
| 855 | if (!session_service_.get() && !shutdown_session_service_) { |
| 856 | session_service_ = new SessionService(this); |
| 857 | session_service_->ResetFromCurrentBrowsers(); |
| 858 | } |
| 859 | return session_service_.get(); |
| 860 | } |
| 861 | |
| 862 | void ProfileImpl::ShutdownSessionService() { |
| 863 | if (shutdown_session_service_) |
| 864 | return; |
| 865 | |
| 866 | // We're about to exit, force creation of the session service if it hasn't |
| 867 | // been created yet. We do this to ensure session state matches the point in |
| 868 | // time the user exited. |
| 869 | GetSessionService(); |
| 870 | shutdown_session_service_ = true; |
| 871 | session_service_ = NULL; |
| 872 | } |
| 873 | |
| 874 | bool ProfileImpl::HasSessionService() const { |
| 875 | return (session_service_.get() != NULL); |
| 876 | } |
| 877 | |
| 878 | std::wstring ProfileImpl::GetName() { |
| 879 | return GetPrefs()->GetString(prefs::kProfileName); |
| 880 | } |
| 881 | void ProfileImpl::SetName(const std::wstring& name) { |
| 882 | GetPrefs()->SetString(prefs::kProfileName, name); |
| 883 | } |
| 884 | |
| 885 | std::wstring ProfileImpl::GetID() { |
| 886 | return GetPrefs()->GetString(prefs::kProfileID); |
| 887 | } |
| 888 | void ProfileImpl::SetID(const std::wstring& id) { |
| 889 | GetPrefs()->SetString(prefs::kProfileID, id); |
| 890 | } |
| 891 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 892 | bool ProfileImpl::DidLastSessionExitCleanly() { |
| 893 | // last_session_exited_cleanly_ is set when the preferences are loaded. Force |
| 894 | // it to be set by asking for the prefs. |
| 895 | GetPrefs(); |
| 896 | return last_session_exited_cleanly_; |
| 897 | } |
| 898 | |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 899 | BookmarkModel* ProfileImpl::GetBookmarkModel() { |
[email protected] | 90ef1313 | 2008-08-27 03:27:46 | [diff] [blame] | 900 | if (!bookmark_bar_model_.get()) { |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 901 | bookmark_bar_model_.reset(new BookmarkModel(this)); |
[email protected] | 90ef1313 | 2008-08-27 03:27:46 | [diff] [blame] | 902 | bookmark_bar_model_->Load(); |
| 903 | } |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 904 | return bookmark_bar_model_.get(); |
| 905 | } |
| 906 | |
| 907 | bool ProfileImpl::IsSameProfile(Profile* profile) { |
| 908 | if (profile == static_cast<Profile*>(this)) |
| 909 | return true; |
| 910 | OffTheRecordProfileImpl* otr_profile = off_the_record_profile_.get(); |
| 911 | return otr_profile && profile == static_cast<Profile*>(otr_profile); |
| 912 | } |
| 913 | |
| 914 | Time ProfileImpl::GetStartTime() const { |
| 915 | return start_time_; |
| 916 | } |
| 917 | |
| 918 | TabRestoreService* ProfileImpl::GetTabRestoreService() { |
| 919 | if (!tab_restore_service_.get()) |
[email protected] | 169627b | 2008-12-06 19:30:19 | [diff] [blame] | 920 | tab_restore_service_ = new TabRestoreService(this); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 921 | return tab_restore_service_.get(); |
| 922 | } |
| 923 | |
| 924 | void ProfileImpl::ResetTabRestoreService() { |
[email protected] | 169627b | 2008-12-06 19:30:19 | [diff] [blame] | 925 | tab_restore_service_ = NULL; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 926 | } |
| 927 | |
[email protected] | a9afddb | 2009-02-12 17:49:42 | [diff] [blame] | 928 | // To be run in the IO thread to notify all resource message filters that the |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 929 | // spellchecker has changed. |
| 930 | class NotifySpellcheckerChangeTask : public Task { |
| 931 | public: |
| 932 | NotifySpellcheckerChangeTask( |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 933 | Profile* profile, |
| 934 | const SpellcheckerReinitializedDetails& spellchecker) |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 935 | : profile_(profile), |
| 936 | spellchecker_(spellchecker) { |
| 937 | } |
| 938 | |
| 939 | private: |
| 940 | void Run(void) { |
| 941 | NotificationService::current()->Notify( |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 942 | NotificationType::SPELLCHECKER_REINITIALIZED, |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 943 | Source<Profile>(profile_), |
| 944 | Details<SpellcheckerReinitializedDetails>(&spellchecker_)); |
| 945 | } |
| 946 | |
| 947 | Profile* profile_; |
| 948 | SpellcheckerReinitializedDetails spellchecker_; |
| 949 | }; |
| 950 | |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 951 | void ProfileImpl::InitializeSpellChecker(bool need_to_broadcast) { |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 952 | // The I/O thread may be NULL during testing. |
| 953 | base::Thread* io_thread = g_browser_process->io_thread(); |
| 954 | if (spellchecker_) { |
| 955 | // The spellchecker must be deleted on the I/O thread. |
| 956 | // A dummy variable to aid in logical clarity. |
| 957 | SpellChecker* last_spellchecker = spellchecker_; |
| 958 | |
| 959 | if (io_thread) |
| 960 | io_thread->message_loop()->ReleaseSoon(FROM_HERE, last_spellchecker); |
| 961 | else // during testing, we don't have an I/O thread |
| 962 | last_spellchecker->Release(); |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 963 | } |
| 964 | |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 965 | // Retrieve the (perhaps updated recently) dictionary name from preferences. |
| 966 | PrefService* prefs = GetPrefs(); |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 967 | bool enable_spellcheck = prefs->GetBoolean(prefs::kEnableSpellCheck); |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 968 | |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 969 | if (enable_spellcheck) { |
[email protected] | bd17b70 | 2009-02-25 20:44:08 | [diff] [blame] | 970 | FilePath dict_dir; |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 971 | PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); |
[email protected] | a9afddb | 2009-02-12 17:49:42 | [diff] [blame] | 972 | // Note that, as the object pointed to by previously by spellchecker_ |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 973 | // is being deleted in the io thread, the spellchecker_ can be made to point |
| 974 | // to a new object (RE-initialized) in parallel in this UI thread. |
[email protected] | 4b4d1adc | 2008-12-10 22:28:58 | [diff] [blame] | 975 | spellchecker_ = new SpellChecker(dict_dir, |
[email protected] | 74c8b42 | 2009-03-11 00:34:12 | [diff] [blame] | 976 | WideToASCII(prefs->GetString(prefs::kSpellCheckDictionary)), |
| 977 | GetRequestContext(), |
[email protected] | bd17b70 | 2009-02-25 20:44:08 | [diff] [blame] | 978 | FilePath()); |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 979 | spellchecker_->AddRef(); // Manual refcounting. |
| 980 | } else { |
| 981 | spellchecker_ = NULL; |
| 982 | } |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 983 | |
[email protected] | 154a433 | 2009-06-03 20:20:58 | [diff] [blame] | 984 | // Set auto spell correct status for spellchecker. |
| 985 | if (spellchecker_) { |
| 986 | spellchecker_->EnableAutoSpellCorrect( |
| 987 | prefs->GetBoolean(prefs::kEnableAutoSpellCorrect)); |
| 988 | } |
| 989 | |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 990 | if (need_to_broadcast && io_thread) { // Notify resource message filters. |
| 991 | SpellcheckerReinitializedDetails scoped_spellchecker; |
| 992 | scoped_spellchecker.spellchecker = spellchecker_; |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 993 | if (io_thread) { |
| 994 | io_thread->message_loop()->PostTask( |
[email protected] | a9afddb | 2009-02-12 17:49:42 | [diff] [blame] | 995 | FROM_HERE, |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 996 | new NotifySpellcheckerChangeTask(this, scoped_spellchecker)); |
| 997 | } |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 998 | } |
| 999 | } |
| 1000 | |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 1001 | void ProfileImpl::ReinitializeSpellChecker() { |
| 1002 | InitializeSpellChecker(true); |
| 1003 | } |
| 1004 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 1005 | SpellChecker* ProfileImpl::GetSpellChecker() { |
| 1006 | if (!spellchecker_) { |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 1007 | // This is where spellchecker gets initialized. Note that this is being |
| 1008 | // initialized in the ui_thread. However, this is not a problem as long as |
| 1009 | // it is *used* in the io thread. |
[email protected] | 34cc84f | 2009-02-13 10:04:35 | [diff] [blame] | 1010 | // TODO(sidchat): One day, change everything so that spellchecker gets |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 1011 | // initialized in the IO thread itself. |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 1012 | InitializeSpellChecker(false); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 1013 | } |
[email protected] | 2093085 | 2008-10-15 19:30:41 | [diff] [blame] | 1014 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 1015 | return spellchecker_; |
| 1016 | } |
| 1017 | |
| 1018 | void ProfileImpl::MarkAsCleanShutdown() { |
| 1019 | if (prefs_.get()) { |
| 1020 | // The session cleanly exited, set kSessionExitedCleanly appropriately. |
| 1021 | prefs_->SetBoolean(prefs::kSessionExitedCleanly, true); |
| 1022 | |
| 1023 | // NOTE: If you change what thread this writes on, be sure and update |
| 1024 | // ChromeFrame::EndSession(). |
[email protected] | 6faa0e0d | 2009-04-28 06:50:36 | [diff] [blame] | 1025 | prefs_->SavePersistentPrefs(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 1026 | } |
| 1027 | } |
| 1028 | |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 1029 | void ProfileImpl::Observe(NotificationType type, |
| 1030 | const NotificationSource& source, |
| 1031 | const NotificationDetails& details) { |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 1032 | if (NotificationType::PREF_CHANGED == type) { |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 1033 | std::wstring* pref_name_in = Details<std::wstring>(details).ptr(); |
| 1034 | PrefService* prefs = Source<PrefService>(source).ptr(); |
| 1035 | DCHECK(pref_name_in && prefs); |
| 1036 | if (*pref_name_in == prefs::kSpellCheckDictionary || |
[email protected] | 154a433 | 2009-06-03 20:20:58 | [diff] [blame] | 1037 | *pref_name_in == prefs::kEnableSpellCheck || |
| 1038 | *pref_name_in == prefs::kEnableAutoSpellCorrect) { |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 1039 | InitializeSpellChecker(true); |
| 1040 | } |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 1041 | } else if (NotificationType::THEME_INSTALLED == type) { |
| 1042 | Extension* extension = Details<Extension>(details).ptr(); |
| 1043 | SetTheme(extension); |
[email protected] | e7244d8 | 2008-10-29 18:13:26 | [diff] [blame] | 1044 | } |
| 1045 | } |
| 1046 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 1047 | void ProfileImpl::StopCreateSessionServiceTimer() { |
[email protected] | 2d31666 | 2008-09-03 18:18:14 | [diff] [blame] | 1048 | create_session_service_timer_.Stop(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 1049 | } |
[email protected] | 3a453fa | 2008-08-15 18:46:34 | [diff] [blame] | 1050 | |
| 1051 | #ifdef CHROME_PERSONALIZATION |
[email protected] | 57d3d0a | 2008-09-24 00:50:07 | [diff] [blame] | 1052 | ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { |
[email protected] | 57d3d0a | 2008-09-24 00:50:07 | [diff] [blame] | 1053 | return personalization_.get(); |
[email protected] | 3a453fa | 2008-08-15 18:46:34 | [diff] [blame] | 1054 | } |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 1055 | #endif |