blob: 1ef234c0013e150815aae6963578d464dba8f590 [file] [log] [blame]
license.botbf09a502008-08-24 00:55:551// 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.commit09911bf2008-07-26 23:55:294
5#include "chrome/browser/profile.h"
6
7#include "base/command_line.h"
[email protected]04fba9a92008-10-28 17:25:258#include "base/file_path.h"
initial.commit09911bf2008-07-26 23:55:299#include "base/file_util.h"
initial.commit09911bf2008-07-26 23:55:2910#include "base/path_service.h"
11#include "base/scoped_ptr.h"
12#include "base/string_util.h"
[email protected]a9afddb2009-02-12 17:49:4213#include "chrome/browser/bookmarks/bookmark_model.h"
initial.commit09911bf2008-07-26 23:55:2914#include "chrome/browser/browser_list.h"
15#include "chrome/browser/browser_process.h"
[email protected]b7f05882009-02-22 01:21:5616#include "chrome/browser/download/download_manager.h"
[email protected]bb28e062009-02-27 17:19:1817#include "chrome/browser/extensions/extension_error_reporter.h"
[email protected]481e1a42009-05-06 20:56:0518#include "chrome/browser/extensions/extension_process_manager.h"
[email protected]6014d672008-12-05 00:38:2519#include "chrome/browser/extensions/extensions_service.h"
[email protected]0938d3c2009-01-09 20:37:3520#include "chrome/browser/extensions/user_script_master.h"
[email protected]a9afddb2009-02-12 17:49:4221#include "chrome/browser/history/history.h"
[email protected]6ab9b202008-12-23 22:34:5022#include "chrome/browser/net/chrome_url_request_context.h"
initial.commit09911bf2008-07-26 23:55:2923#include "chrome/browser/profile_manager.h"
[email protected]8c8657d62009-01-16 18:31:2624#include "chrome/browser/renderer_host/render_process_host.h"
[email protected]1132436e2009-04-08 20:06:3325#include "chrome/browser/search_engines/template_url_fetcher.h"
[email protected]f63ae312009-02-04 17:58:4626#include "chrome/browser/search_engines/template_url_model.h"
[email protected]85e921fb82009-02-11 23:19:4427#include "chrome/browser/sessions/session_service.h"
[email protected]bd580a252009-02-12 01:16:3028#include "chrome/browser/sessions/tab_restore_service.h"
[email protected]f0a644292009-02-25 23:32:4729#include "chrome/browser/spellchecker.h"
[email protected]1132436e2009-04-08 20:06:3330#include "chrome/browser/ssl/ssl_host_state.h"
[email protected]4a190632009-05-09 01:07:4231#include "chrome/browser/browser_theme_provider.h"
initial.commit09911bf2008-07-26 23:55:2932#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]47accfd62009-05-14 18:46:2137#include "chrome/common/net/cookie_monster_sqlite.h"
initial.commit09911bf2008-07-26 23:55:2938#include "chrome/common/notification_service.h"
39#include "chrome/common/pref_names.h"
[email protected]f7011fcb2009-01-28 21:54:3240#include "chrome/common/render_messages.h"
[email protected]f90f5c512009-02-18 19:10:5841#include "grit/locale_settings.h"
[email protected]a9cea7542009-05-20 04:30:2342#include "net/base/force_tls_state.h"
initial.commit09911bf2008-07-26 23:55:2943
[email protected]e1acf6f2008-10-27 20:43:3344using base::Time;
45using base::TimeDelta;
46
initial.commit09911bf2008-07-26 23:55:2947// Delay, in milliseconds, before we explicitly create the SessionService.
48static const int kCreateSessionServiceDelayMS = 500;
49
50// A pointer to the request context for the default profile. See comments on
51// Profile::GetDefaultRequestContext.
52URLRequestContext* Profile::default_request_context_;
53
[email protected]47accfd62009-05-14 18:46:2154static void CleanupRequestContext(ChromeURLRequestContext* context) {
55 if (context) {
56 context->CleanupOnUIThread();
57
58 // Clean up request context on IO thread.
59 g_browser_process->io_thread()->message_loop()->ReleaseSoon(FROM_HERE,
60 context);
61 }
62}
63
[email protected]34cc84f2009-02-13 10:04:3564// static
initial.commit09911bf2008-07-26 23:55:2965void Profile::RegisterUserPrefs(PrefService* prefs) {
[email protected]430d3f72008-10-27 17:56:5566 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true);
initial.commit09911bf2008-07-26 23:55:2967 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true);
68 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true);
[email protected]74c8b422009-03-11 00:34:1269 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string.
[email protected]e7244d82008-10-29 18:13:2670 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary,
71 IDS_SPELLCHECK_DICTIONARY);
72 prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true);
[email protected]f93fe782009-02-19 01:26:1373 prefs->RegisterBooleanPref(prefs::kEnableUserScripts, false);
[email protected]4a190632009-05-09 01:07:4274 prefs->RegisterStringPref(prefs::kCurrentThemeID, L"");
75 prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages);
76 prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors);
77 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints);
[email protected]f93fe782009-02-19 01:26:1378 prefs->RegisterBooleanPref(prefs::kEnableExtensions, false);
initial.commit09911bf2008-07-26 23:55:2979}
80
[email protected]34cc84f2009-02-13 10:04:3581// static
[email protected]f7011fcb2009-01-28 21:54:3282Profile* Profile::CreateProfile(const FilePath& path) {
initial.commit09911bf2008-07-26 23:55:2983 return new ProfileImpl(path);
84}
85
[email protected]34cc84f2009-02-13 10:04:3586// static
initial.commit09911bf2008-07-26 23:55:2987URLRequestContext* Profile::GetDefaultRequestContext() {
88 return default_request_context_;
89}
90
91
initial.commit09911bf2008-07-26 23:55:2992////////////////////////////////////////////////////////////////////////////////
93//
94// OffTheRecordProfileImpl is a profile subclass that wraps an existing profile
[email protected]4a190632009-05-09 01:07:4295// to make it suitable for the off the record mode.
initial.commit09911bf2008-07-26 23:55:2996//
97////////////////////////////////////////////////////////////////////////////////
98class OffTheRecordProfileImpl : public Profile,
99 public NotificationObserver {
100 public:
101 explicit OffTheRecordProfileImpl(Profile* real_profile)
102 : profile_(real_profile),
[email protected]363347b2009-03-13 20:06:57103 media_request_context_(NULL),
[email protected]47accfd62009-05-14 18:46:21104 extensions_request_context_(NULL),
initial.commit09911bf2008-07-26 23:55:29105 start_time_(Time::Now()) {
[email protected]6ab9b202008-12-23 22:34:50106 request_context_ = ChromeURLRequestContext::CreateOffTheRecord(this);
initial.commit09911bf2008-07-26 23:55:29107 request_context_->AddRef();
[email protected]481e1a42009-05-06 20:56:05108
109 extension_process_manager_.reset(new ExtensionProcessManager(this));
110
initial.commit09911bf2008-07-26 23:55:29111 // Register for browser close notifications so we can detect when the last
112 // off-the-record window is closed, in which case we can clean our states
113 // (cookies, downloads...).
[email protected]88cf3292009-05-22 01:48:43114 registrar_.Add(this, NotificationType::BROWSER_CLOSED,
115 NotificationService::AllSources());
initial.commit09911bf2008-07-26 23:55:29116 }
117
118 virtual ~OffTheRecordProfileImpl() {
[email protected]47accfd62009-05-14 18:46:21119 CleanupRequestContext(request_context_);
120 CleanupRequestContext(media_request_context_);
121 CleanupRequestContext(extensions_request_context_);
initial.commit09911bf2008-07-26 23:55:29122 }
123
[email protected]f7011fcb2009-01-28 21:54:32124 virtual FilePath GetPath() { return profile_->GetPath(); }
initial.commit09911bf2008-07-26 23:55:29125
126 virtual bool IsOffTheRecord() {
127 return true;
128 }
129
130 virtual Profile* GetOffTheRecordProfile() {
131 return this;
132 }
133
[email protected]860f55492009-03-27 19:50:59134 virtual void DestroyOffTheRecordProfile() {
135 // Suicide is bad!
136 NOTREACHED();
137 }
138
initial.commit09911bf2008-07-26 23:55:29139 virtual Profile* GetOriginalProfile() {
140 return profile_;
141 }
142
143 virtual VisitedLinkMaster* GetVisitedLinkMaster() {
[email protected]7fb6c862009-03-13 02:51:49144 // We don't provide access to the VisitedLinkMaster when we're OffTheRecord
145 // because we don't want to leak the sites that the user has visited before.
146 return NULL;
initial.commit09911bf2008-07-26 23:55:29147 }
148
[email protected]6014d672008-12-05 00:38:25149 virtual ExtensionsService* GetExtensionsService() {
150 return profile_->GetExtensionsService();
151 }
152
[email protected]0938d3c2009-01-09 20:37:35153 virtual UserScriptMaster* GetUserScriptMaster() {
154 return profile_->GetUserScriptMaster();
[email protected]04fba9a92008-10-28 17:25:25155 }
156
[email protected]481e1a42009-05-06 20:56:05157 virtual ExtensionProcessManager* GetExtensionProcessManager() {
158 return extension_process_manager_.get();
159 }
160
[email protected]34cc84f2009-02-13 10:04:35161 virtual SSLHostState* GetSSLHostState() {
162 if (!ssl_host_state_.get())
163 ssl_host_state_.reset(new SSLHostState());
164
165 DCHECK(ssl_host_state_->CalledOnValidThread());
166 return ssl_host_state_.get();
167 }
168
[email protected]a9cea7542009-05-20 04:30:23169 virtual net::ForceTLSState* GetForceTLSState() {
170 if (!force_tls_state_.get())
171 force_tls_state_.reset(new net::ForceTLSState());
172
173 return force_tls_state_.get();
174 }
175
initial.commit09911bf2008-07-26 23:55:29176 virtual HistoryService* GetHistoryService(ServiceAccessType sat) {
177 if (sat == EXPLICIT_ACCESS) {
178 return profile_->GetHistoryService(sat);
179 } else {
180 NOTREACHED() << "This profile is OffTheRecord";
181 return NULL;
182 }
183 }
184
initial.commit09911bf2008-07-26 23:55:29185 virtual WebDataService* GetWebDataService(ServiceAccessType sat) {
186 if (sat == EXPLICIT_ACCESS) {
187 return profile_->GetWebDataService(sat);
188 } else {
189 NOTREACHED() << "This profile is OffTheRecord";
190 return NULL;
191 }
192 }
193
194 virtual PrefService* GetPrefs() {
195 return profile_->GetPrefs();
196 }
197
198 virtual TemplateURLModel* GetTemplateURLModel() {
199 return profile_->GetTemplateURLModel();
200 }
201
202 virtual TemplateURLFetcher* GetTemplateURLFetcher() {
203 return profile_->GetTemplateURLFetcher();
204 }
205
206 virtual DownloadManager* GetDownloadManager() {
207 if (!download_manager_.get()) {
208 scoped_refptr<DownloadManager> dlm(new DownloadManager);
209 dlm->Init(this);
210 download_manager_.swap(dlm);
211 }
212 return download_manager_.get();
213 }
214
215 virtual bool HasCreatedDownloadManager() const {
216 return (download_manager_.get() != NULL);
217 }
218
[email protected]4a190632009-05-09 01:07:42219 virtual void InitThemes() {
220 GetOriginalProfile()->InitThemes();
221 }
222
223 virtual void SetTheme(Extension* extension) {
224 GetOriginalProfile()->SetTheme(extension);
225 }
226
227 virtual void ClearTheme() {
228 GetOriginalProfile()->ClearTheme();
229 }
230
231 virtual ThemeProvider* GetThemeProvider() {
232 return GetOriginalProfile()->GetThemeProvider();
233 }
234
initial.commit09911bf2008-07-26 23:55:29235 virtual URLRequestContext* GetRequestContext() {
236 return request_context_;
237 }
238
[email protected]e7f29642009-03-02 22:53:18239 virtual URLRequestContext* GetRequestContextForMedia() {
240 if (!media_request_context_) {
241 FilePath cache_path = GetPath();
[email protected]e3edeba2009-03-23 18:57:14242
243 // Override the cache location if specified by the user.
244 const std::wstring user_cache_dir(
245 CommandLine::ForCurrentProcess()->GetSwitchValue(
246 switches::kDiskCacheDir));
247 if (!user_cache_dir.empty()) {
248 cache_path = FilePath::FromWStringHack(user_cache_dir);
249 }
250
[email protected]4e7b5dbb2009-03-25 00:09:23251 cache_path = cache_path.Append(chrome::kOffTheRecordMediaCacheDirname);
[email protected]e7f29642009-03-02 22:53:18252 media_request_context_ =
253 ChromeURLRequestContext::CreateOffTheRecordForMedia(
254 this, cache_path);
255 media_request_context_->AddRef();
256
257 DCHECK(media_request_context_->cookie_store());
258 }
259 return media_request_context_;
260 }
261
[email protected]47accfd62009-05-14 18:46:21262 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.commit09911bf2008-07-26 23:55:29274 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.commit09911bf2008-07-26 23:55:29304 virtual bool DidLastSessionExitCleanly() {
305 return profile_->DidLastSessionExitCleanly();
306 }
307
[email protected]d8e41ed2008-09-11 15:22:32308 virtual BookmarkModel* GetBookmarkModel() {
309 return profile_->GetBookmarkModel();
initial.commit09911bf2008-07-26 23:55:29310 }
311
[email protected]3a453fa2008-08-15 18:46:34312#ifdef CHROME_PERSONALIZATION
[email protected]57d3d0a2008-09-24 00:50:07313 virtual ProfilePersonalization* GetProfilePersonalization() {
[email protected]3a453fa2008-08-15 18:46:34314 return profile_->GetProfilePersonalization();
315 }
316#endif
317
initial.commit09911bf2008-07-26 23:55:29318 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]e7244d82008-10-29 18:13:26332 virtual void ResetTabRestoreService() {
[email protected]20930852008-10-15 19:30:41333 }
334
[email protected]e7244d82008-10-29 18:13:26335 virtual void ReinitializeSpellChecker() {
336 profile_->ReinitializeSpellChecker();
initial.commit09911bf2008-07-26 23:55:29337 }
338
339 virtual SpellChecker* GetSpellChecker() {
340 return profile_->GetSpellChecker();
341 }
342
343 virtual void MarkAsCleanShutdown() {
344 }
345
[email protected]bdbc87c2009-01-25 05:08:54346 virtual void InitExtensions() {
347 NOTREACHED();
348 }
349
initial.commit09911bf2008-07-26 23:55:29350 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]bfd04a62009-02-01 18:16:56359 DCHECK_EQ(NotificationType::BROWSER_CLOSED, type.value);
initial.commit09911bf2008-07-26 23:55:29360 // 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]88cf3292009-05-22 01:48:43372 NotificationRegistrar registrar_;
373
initial.commit09911bf2008-07-26 23:55:29374 // The real underlying profile.
375 Profile* profile_;
376
[email protected]6ab9b202008-12-23 22:34:50377 // The context to use for requests made from this OTR session.
378 ChromeURLRequestContext* request_context_;
initial.commit09911bf2008-07-26 23:55:29379
[email protected]e7f29642009-03-02 22:53:18380 // The context for requests for media resources.
381 ChromeURLRequestContext* media_request_context_;
382
[email protected]47accfd62009-05-14 18:46:21383 ChromeURLRequestContext* extensions_request_context_;
384
initial.commit09911bf2008-07-26 23:55:29385 // The download manager that only stores downloaded items in memory.
386 scoped_refptr<DownloadManager> download_manager_;
387
[email protected]4a190632009-05-09 01:07:42388 // The download manager that only stores downloaded items in memory.
389 scoped_refptr<BrowserThemeProvider> theme_provider_;
390
[email protected]34cc84f2009-02-13 10:04:35391 // We don't want SSLHostState from the OTR profile to leak back to the main
392 // profile because then the main profile would learn some of the host names
393 // the user visited while OTR.
394 scoped_ptr<SSLHostState> ssl_host_state_;
395
[email protected]a9cea7542009-05-20 04:30:23396 // The ForceTLSState that only stores enabled sites in memory.
397 scoped_ptr<net::ForceTLSState> force_tls_state_;
398
[email protected]481e1a42009-05-06 20:56:05399 // Extensions run in a different context in incognito mode.
400 scoped_ptr<ExtensionProcessManager> extension_process_manager_;
401
initial.commit09911bf2008-07-26 23:55:29402 // Time we were started.
403 Time start_time_;
404
405 DISALLOW_EVIL_CONSTRUCTORS(OffTheRecordProfileImpl);
406};
407
[email protected]f7011fcb2009-01-28 21:54:32408ProfileImpl::ProfileImpl(const FilePath& path)
initial.commit09911bf2008-07-26 23:55:29409 : path_(path),
[email protected]f7011fcb2009-01-28 21:54:32410 request_context_(NULL),
[email protected]363347b2009-03-13 20:06:57411 media_request_context_(NULL),
[email protected]47accfd62009-05-14 18:46:21412 extensions_request_context_(NULL),
[email protected]f7011fcb2009-01-28 21:54:32413 history_service_created_(false),
414 created_web_data_service_(false),
415 created_download_manager_(false),
[email protected]4a190632009-05-09 01:07:42416 created_theme_provider_(false),
[email protected]f7011fcb2009-01-28 21:54:32417 start_time_(Time::Now()),
418 spellchecker_(NULL),
initial.commit09911bf2008-07-26 23:55:29419 shutdown_session_service_(false) {
420 DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
421 "profile files to the root directory!";
[email protected]2d316662008-09-03 18:18:14422 create_session_service_timer_.Start(
423 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this,
424 &ProfileImpl::EnsureSessionServiceCreated);
[email protected]bdbc87c2009-01-25 05:08:54425
[email protected]481e1a42009-05-06 20:56:05426 extension_process_manager_.reset(new ExtensionProcessManager(this));
427
[email protected]e7244d82008-10-29 18:13:26428 PrefService* prefs = GetPrefs();
429 prefs->AddPrefObserver(prefs::kSpellCheckDictionary, this);
430 prefs->AddPrefObserver(prefs::kEnableSpellCheck, this);
[email protected]380ab462009-04-24 01:23:58431
432#ifdef CHROME_PERSONALIZATION
433 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableP13n))
434 personalization_.reset(Personalization::CreateProfilePersonalization(this));
435#endif
436
[email protected]1351b6a2009-04-09 20:13:22437#if defined(OS_LINUX)
438 // TODO(port): Remove ifdef when the Linux splash page is not needed.
439 prefs->transient()->SetString(prefs::kHomePage, "about:linux-splash");
440 prefs->transient()->SetBoolean(prefs::kHomePageIsNewTabPage, false);
441#endif
[email protected]4a190632009-05-09 01:07:42442
443 // Listen for theme installation.
[email protected]88cf3292009-05-22 01:48:43444 registrar_.Add(this, NotificationType::THEME_INSTALLED,
445 NotificationService::AllSources());
initial.commit09911bf2008-07-26 23:55:29446}
447
[email protected]bdbc87c2009-01-25 05:08:54448void ProfileImpl::InitExtensions() {
[email protected]8c756ac2009-01-30 23:36:41449 if (user_script_master_ || extensions_service_)
450 return; // Already initialized.
451
[email protected]bdbc87c2009-01-25 05:08:54452 const CommandLine* command_line = CommandLine::ForCurrentProcess();
[email protected]f93fe782009-02-19 01:26:13453 PrefService* prefs = GetPrefs();
[email protected]bdbc87c2009-01-25 05:08:54454 bool user_scripts_enabled =
[email protected]f0a51fb52009-03-05 12:46:38455 command_line->HasSwitch(switches::kEnableUserScripts) ||
[email protected]f93fe782009-02-19 01:26:13456 prefs->GetBoolean(prefs::kEnableUserScripts);
[email protected]a9afddb2009-02-12 17:49:42457 bool extensions_enabled =
[email protected]f0a51fb52009-03-05 12:46:38458 command_line->HasSwitch(switches::kEnableExtensions) ||
[email protected]f93fe782009-02-19 01:26:13459 prefs->GetBoolean(prefs::kEnableExtensions);
[email protected]bdbc87c2009-01-25 05:08:54460
[email protected]f7011fcb2009-01-28 21:54:32461 FilePath script_dir;
[email protected]bdbc87c2009-01-25 05:08:54462 if (user_scripts_enabled) {
[email protected]0cd957b2009-03-06 20:13:23463 if (command_line->HasSwitch(switches::kUserScriptsDir)) {
464 std::wstring path_string =
465 command_line->GetSwitchValue(switches::kUserScriptsDir);
466 script_dir = FilePath::FromWStringHack(path_string);
467 } else {
468 script_dir = GetPath();
469 script_dir = script_dir.Append(chrome::kUserScriptsDirname);
470 }
[email protected]bdbc87c2009-01-25 05:08:54471 }
472
[email protected]bb28e062009-02-27 17:19:18473 ExtensionErrorReporter::Init(true); // allow noisy errors.
[email protected]bdbc87c2009-01-25 05:08:54474 user_script_master_ = new UserScriptMaster(
[email protected]f7011fcb2009-01-28 21:54:32475 g_browser_process->file_thread()->message_loop(), script_dir);
[email protected]894bb502009-05-21 22:39:57476 extensions_service_ = new ExtensionsService(
477 this, MessageLoop::current(),
478 g_browser_process->file_thread()->message_loop(),
479 std::string()); // Use default registry path
[email protected]bdbc87c2009-01-25 05:08:54480
481 // If we have extensions, the extension service will kick off the first scan
482 // after extensions are loaded. Otherwise, we need to do that now.
483 if (extensions_enabled)
484 extensions_service_->Init();
485 else if (user_scripts_enabled)
486 user_script_master_->StartScan();
487}
488
initial.commit09911bf2008-07-26 23:55:29489ProfileImpl::~ProfileImpl() {
[email protected]169627b2008-12-06 19:30:19490 tab_restore_service_ = NULL;
initial.commit09911bf2008-07-26 23:55:29491
492 StopCreateSessionServiceTimer();
493 // TemplateURLModel schedules a task on the WebDataService from its
494 // destructor. Delete it first to ensure the task gets scheduled before we
495 // shut down the database.
496 template_url_model_.reset();
497
498 // The download manager queries the history system and should be deleted
499 // before the history is shutdown so it can properly cancel all requests.
500 download_manager_ = NULL;
501
[email protected]4a190632009-05-09 01:07:42502 // The theme provider provides bitmaps to whoever wants them.
503 theme_provider_ = NULL;
504
[email protected]e7244d82008-10-29 18:13:26505 // Remove pref observers.
506 PrefService* prefs = GetPrefs();
507 prefs->RemovePrefObserver(prefs::kSpellCheckDictionary, this);
508 prefs->RemovePrefObserver(prefs::kEnableSpellCheck, this);
509
[email protected]3a453fa2008-08-15 18:46:34510#ifdef CHROME_PERSONALIZATION
[email protected]57d3d0a2008-09-24 00:50:07511 personalization_.reset();
[email protected]3a453fa2008-08-15 18:46:34512#endif
513
initial.commit09911bf2008-07-26 23:55:29514 // Both HistoryService and WebDataService maintain threads for background
515 // processing. Its possible each thread still has tasks on it that have
516 // increased the ref count of the service. In such a situation, when we
517 // decrement the refcount, it won't be 0, and the threads/databases aren't
518 // properly shut down. By explicitly calling Cleanup/Shutdown we ensure the
519 // databases are properly closed.
520 if (web_data_service_.get())
521 web_data_service_->Shutdown();
522
523 if (history_service_.get())
524 history_service_->Cleanup();
525
526 // The I/O thread may be NULL during testing.
[email protected]ab820df2008-08-26 05:55:10527 base::Thread* io_thread = g_browser_process->io_thread();
initial.commit09911bf2008-07-26 23:55:29528
529 if (spellchecker_) {
530 // The spellchecker must be deleted on the I/O thread. During testing, we
531 // don't have an I/O thread.
532 if (io_thread)
533 io_thread->message_loop()->ReleaseSoon(FROM_HERE, spellchecker_);
534 else
535 spellchecker_->Release();
536 }
537
[email protected]47accfd62009-05-14 18:46:21538 if (default_request_context_ == request_context_)
539 default_request_context_ = NULL;
[email protected]6ab9b202008-12-23 22:34:50540
[email protected]47accfd62009-05-14 18:46:21541 CleanupRequestContext(request_context_);
542 CleanupRequestContext(media_request_context_);
543 CleanupRequestContext(extensions_request_context_);
[email protected]1e744f22009-04-08 01:00:17544
[email protected]d8e41ed2008-09-11 15:22:32545 // HistoryService may call into the BookmarkModel, as such we need to
546 // delete HistoryService before the BookmarkModel. The destructor for
[email protected]90ef13132008-08-27 03:27:46547 // HistoryService will join with HistoryService's backend thread so that
548 // by the time the destructor has finished we're sure it will no longer call
[email protected]d8e41ed2008-09-11 15:22:32549 // into the BookmarkModel.
[email protected]90ef13132008-08-27 03:27:46550 history_service_ = NULL;
551 bookmark_bar_model_.reset();
552
initial.commit09911bf2008-07-26 23:55:29553 MarkAsCleanShutdown();
554}
555
[email protected]f7011fcb2009-01-28 21:54:32556FilePath ProfileImpl::GetPath() {
initial.commit09911bf2008-07-26 23:55:29557 return path_;
558}
559
560bool ProfileImpl::IsOffTheRecord() {
561 return false;
562}
563
564Profile* ProfileImpl::GetOffTheRecordProfile() {
565 if (!off_the_record_profile_.get()) {
566 scoped_ptr<OffTheRecordProfileImpl> p(new OffTheRecordProfileImpl(this));
567 off_the_record_profile_.swap(p);
568 }
569 return off_the_record_profile_.get();
570}
571
[email protected]860f55492009-03-27 19:50:59572void ProfileImpl::DestroyOffTheRecordProfile() {
573 off_the_record_profile_.reset();
574}
575
initial.commit09911bf2008-07-26 23:55:29576Profile* ProfileImpl::GetOriginalProfile() {
577 return this;
578}
579
[email protected]176aa482008-11-14 03:25:15580static void BroadcastNewHistoryTable(base::SharedMemory* table_memory) {
initial.commit09911bf2008-07-26 23:55:29581 if (!table_memory)
582 return;
583
584 // send to all RenderProcessHosts
585 for (RenderProcessHost::iterator i = RenderProcessHost::begin();
586 i != RenderProcessHost::end(); i++) {
587 if (!i->second->channel())
588 continue;
589
[email protected]176aa482008-11-14 03:25:15590 base::SharedMemoryHandle new_table;
[email protected]f7011fcb2009-01-28 21:54:32591 base::ProcessHandle process = i->second->process().handle();
initial.commit09911bf2008-07-26 23:55:29592 if (!process) {
593 // process can be null if it's started with the --single-process flag.
[email protected]f7011fcb2009-01-28 21:54:32594 process = base::Process::Current().handle();
initial.commit09911bf2008-07-26 23:55:29595 }
596
597 table_memory->ShareToProcess(process, &new_table);
598 IPC::Message* msg = new ViewMsg_VisitedLink_NewTable(new_table);
599 i->second->channel()->Send(msg);
600 }
601}
602
603VisitedLinkMaster* ProfileImpl::GetVisitedLinkMaster() {
604 if (!visited_link_master_.get()) {
605 scoped_ptr<VisitedLinkMaster> visited_links(
606 new VisitedLinkMaster(g_browser_process->file_thread(),
607 BroadcastNewHistoryTable, this));
608 if (!visited_links->Init())
609 return NULL;
610 visited_link_master_.swap(visited_links);
611 }
612
613 return visited_link_master_.get();
614}
615
[email protected]6014d672008-12-05 00:38:25616ExtensionsService* ProfileImpl::GetExtensionsService() {
617 return extensions_service_.get();
618}
619
[email protected]0938d3c2009-01-09 20:37:35620UserScriptMaster* ProfileImpl::GetUserScriptMaster() {
[email protected]0938d3c2009-01-09 20:37:35621 return user_script_master_.get();
[email protected]04fba9a92008-10-28 17:25:25622}
623
[email protected]481e1a42009-05-06 20:56:05624ExtensionProcessManager* ProfileImpl::GetExtensionProcessManager() {
625 return extension_process_manager_.get();
626}
627
[email protected]34cc84f2009-02-13 10:04:35628SSLHostState* ProfileImpl::GetSSLHostState() {
629 if (!ssl_host_state_.get())
630 ssl_host_state_.reset(new SSLHostState());
631
632 DCHECK(ssl_host_state_->CalledOnValidThread());
633 return ssl_host_state_.get();
634}
635
[email protected]a9cea7542009-05-20 04:30:23636net::ForceTLSState* ProfileImpl::GetForceTLSState() {
637 if (!force_tls_state_.get())
638 force_tls_state_.reset(new net::ForceTLSState());
639
640 return force_tls_state_.get();
641}
642
initial.commit09911bf2008-07-26 23:55:29643PrefService* ProfileImpl::GetPrefs() {
644 if (!prefs_.get()) {
[email protected]6faa0e0d2009-04-28 06:50:36645 prefs_.reset(new PrefService(GetPrefFilePath(),
646 g_browser_process->file_thread()));
initial.commit09911bf2008-07-26 23:55:29647
648 // The Profile class and ProfileManager class may read some prefs so
649 // register known prefs as soon as possible.
650 Profile::RegisterUserPrefs(prefs_.get());
651 ProfileManager::RegisterUserPrefs(prefs_.get());
652
653 // The last session exited cleanly if there is no pref for
654 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true.
655 last_session_exited_cleanly_ =
656 prefs_->GetBoolean(prefs::kSessionExitedCleanly);
657 // Mark the session as open.
658 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false);
659 // Make sure we save to disk that the session has opened.
[email protected]6faa0e0d2009-04-28 06:50:36660 prefs_->ScheduleSavePersistentPrefs();
initial.commit09911bf2008-07-26 23:55:29661 }
662
663 return prefs_.get();
664}
665
[email protected]f7011fcb2009-01-28 21:54:32666FilePath ProfileImpl::GetPrefFilePath() {
667 FilePath pref_file_path = path_;
668 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename);
initial.commit09911bf2008-07-26 23:55:29669 return pref_file_path;
670}
671
672URLRequestContext* ProfileImpl::GetRequestContext() {
673 if (!request_context_) {
[email protected]f7011fcb2009-01-28 21:54:32674 FilePath cookie_path = GetPath();
675 cookie_path = cookie_path.Append(chrome::kCookieFilename);
676 FilePath cache_path = GetPath();
[email protected]2b2830a2009-02-07 01:58:42677
678 // Override the cache location if specified by the user.
679 const std::wstring user_cache_dir(
680 CommandLine::ForCurrentProcess()->GetSwitchValue(
681 switches::kDiskCacheDir));
682 if (!user_cache_dir.empty()) {
683 cache_path = FilePath::FromWStringHack(user_cache_dir);
684 }
685
[email protected]f7011fcb2009-01-28 21:54:32686 cache_path = cache_path.Append(chrome::kCacheDirname);
[email protected]6ab9b202008-12-23 22:34:50687 request_context_ = ChromeURLRequestContext::CreateOriginal(
688 this, cookie_path, cache_path);
initial.commit09911bf2008-07-26 23:55:29689 request_context_->AddRef();
690
[email protected]6ab9b202008-12-23 22:34:50691 // The first request context is always a normal (non-OTR) request context.
692 // Even when Chromium is started in OTR mode, a normal profile is always
693 // created first.
694 if (!default_request_context_) {
695 default_request_context_ = request_context_;
696 NotificationService::current()->Notify(
[email protected]bfd04a62009-02-01 18:16:56697 NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE,
[email protected]6ab9b202008-12-23 22:34:50698 NotificationService::AllSources(), NotificationService::NoDetails());
699 }
700
initial.commit09911bf2008-07-26 23:55:29701 DCHECK(request_context_->cookie_store());
702 }
703
704 return request_context_;
705}
706
[email protected]e7f29642009-03-02 22:53:18707URLRequestContext* ProfileImpl::GetRequestContextForMedia() {
708 if (!media_request_context_) {
709 FilePath cache_path = GetPath();
[email protected]e3edeba2009-03-23 18:57:14710
711 // Override the cache location if specified by the user.
712 const std::wstring user_cache_dir(
713 CommandLine::ForCurrentProcess()->GetSwitchValue(
714 switches::kDiskCacheDir));
715 if (!user_cache_dir.empty()) {
716 cache_path = FilePath::FromWStringHack(user_cache_dir);
717 }
718
[email protected]4e7b5dbb2009-03-25 00:09:23719 cache_path = cache_path.Append(chrome::kMediaCacheDirname);
[email protected]e7f29642009-03-02 22:53:18720 media_request_context_ = ChromeURLRequestContext::CreateOriginalForMedia(
721 this, cache_path);
722 media_request_context_->AddRef();
723
724 DCHECK(media_request_context_->cookie_store());
725 }
726
727 return media_request_context_;
728}
729
[email protected]47accfd62009-05-14 18:46:21730URLRequestContext* ProfileImpl::GetRequestContextForExtensions() {
731 if (!extensions_request_context_) {
732 FilePath cookie_path = GetPath();
733 cookie_path = cookie_path.Append(chrome::kExtensionsCookieFilename);
734
735 extensions_request_context_ =
736 ChromeURLRequestContext::CreateOriginalForExtensions(this, cookie_path);
737 extensions_request_context_->AddRef();
738
739 DCHECK(extensions_request_context_->cookie_store());
740 }
741
742 return extensions_request_context_;
743}
744
initial.commit09911bf2008-07-26 23:55:29745HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) {
746 if (!history_service_created_) {
[email protected]90ef13132008-08-27 03:27:46747 history_service_created_ = true;
initial.commit09911bf2008-07-26 23:55:29748 scoped_refptr<HistoryService> history(new HistoryService(this));
[email protected]d8e41ed2008-09-11 15:22:32749 if (!history->Init(GetPath(), GetBookmarkModel()))
initial.commit09911bf2008-07-26 23:55:29750 return NULL;
751 history_service_.swap(history);
initial.commit09911bf2008-07-26 23:55:29752
753 // Send out the notification that the history service was created.
754 NotificationService::current()->
[email protected]bfd04a62009-02-01 18:16:56755 Notify(NotificationType::HISTORY_CREATED, Source<Profile>(this),
initial.commit09911bf2008-07-26 23:55:29756 Details<HistoryService>(history_service_.get()));
757 }
758 return history_service_.get();
759}
760
initial.commit09911bf2008-07-26 23:55:29761TemplateURLModel* ProfileImpl::GetTemplateURLModel() {
762 if (!template_url_model_.get())
763 template_url_model_.reset(new TemplateURLModel(this));
764 return template_url_model_.get();
765}
766
767TemplateURLFetcher* ProfileImpl::GetTemplateURLFetcher() {
768 if (!template_url_fetcher_.get())
769 template_url_fetcher_.reset(new TemplateURLFetcher(this));
770 return template_url_fetcher_.get();
771}
772
773WebDataService* ProfileImpl::GetWebDataService(ServiceAccessType sat) {
774 if (!created_web_data_service_)
775 CreateWebDataService();
776 return web_data_service_.get();
777}
778
779void ProfileImpl::CreateWebDataService() {
780 DCHECK(!created_web_data_service_ && web_data_service_.get() == NULL);
781 created_web_data_service_ = true;
782 scoped_refptr<WebDataService> wds(new WebDataService());
783 if (!wds->Init(GetPath()))
784 return;
785 web_data_service_.swap(wds);
786}
787
788DownloadManager* ProfileImpl::GetDownloadManager() {
789 if (!created_download_manager_) {
790 scoped_refptr<DownloadManager> dlm(new DownloadManager);
791 dlm->Init(this);
792 created_download_manager_ = true;
793 download_manager_.swap(dlm);
794 }
795 return download_manager_.get();
796}
797
798bool ProfileImpl::HasCreatedDownloadManager() const {
799 return created_download_manager_;
800}
801
[email protected]4a190632009-05-09 01:07:42802void ProfileImpl::InitThemes() {
803 if (!created_theme_provider_) {
804 scoped_refptr<BrowserThemeProvider> themes(new BrowserThemeProvider);
805 themes->Init(this);
806 created_theme_provider_ = true;
807 theme_provider_.swap(themes);
808 }
809}
810
811void ProfileImpl::SetTheme(Extension* extension) {
812 InitThemes();
813 theme_provider_.get()->SetTheme(extension);
814}
815
816void ProfileImpl::ClearTheme() {
817 InitThemes();
818 theme_provider_.get()->UseDefaultTheme();
819}
820
821ThemeProvider* ProfileImpl::GetThemeProvider() {
822 InitThemes();
823 return theme_provider_.get();
824}
825
initial.commit09911bf2008-07-26 23:55:29826SessionService* ProfileImpl::GetSessionService() {
827 if (!session_service_.get() && !shutdown_session_service_) {
828 session_service_ = new SessionService(this);
829 session_service_->ResetFromCurrentBrowsers();
830 }
831 return session_service_.get();
832}
833
834void ProfileImpl::ShutdownSessionService() {
835 if (shutdown_session_service_)
836 return;
837
838 // We're about to exit, force creation of the session service if it hasn't
839 // been created yet. We do this to ensure session state matches the point in
840 // time the user exited.
841 GetSessionService();
842 shutdown_session_service_ = true;
843 session_service_ = NULL;
844}
845
846bool ProfileImpl::HasSessionService() const {
847 return (session_service_.get() != NULL);
848}
849
850std::wstring ProfileImpl::GetName() {
851 return GetPrefs()->GetString(prefs::kProfileName);
852}
853void ProfileImpl::SetName(const std::wstring& name) {
854 GetPrefs()->SetString(prefs::kProfileName, name);
855}
856
857std::wstring ProfileImpl::GetID() {
858 return GetPrefs()->GetString(prefs::kProfileID);
859}
860void ProfileImpl::SetID(const std::wstring& id) {
861 GetPrefs()->SetString(prefs::kProfileID, id);
862}
863
initial.commit09911bf2008-07-26 23:55:29864bool ProfileImpl::DidLastSessionExitCleanly() {
865 // last_session_exited_cleanly_ is set when the preferences are loaded. Force
866 // it to be set by asking for the prefs.
867 GetPrefs();
868 return last_session_exited_cleanly_;
869}
870
[email protected]d8e41ed2008-09-11 15:22:32871BookmarkModel* ProfileImpl::GetBookmarkModel() {
[email protected]90ef13132008-08-27 03:27:46872 if (!bookmark_bar_model_.get()) {
[email protected]d8e41ed2008-09-11 15:22:32873 bookmark_bar_model_.reset(new BookmarkModel(this));
[email protected]90ef13132008-08-27 03:27:46874 bookmark_bar_model_->Load();
875 }
initial.commit09911bf2008-07-26 23:55:29876 return bookmark_bar_model_.get();
877}
878
879bool ProfileImpl::IsSameProfile(Profile* profile) {
880 if (profile == static_cast<Profile*>(this))
881 return true;
882 OffTheRecordProfileImpl* otr_profile = off_the_record_profile_.get();
883 return otr_profile && profile == static_cast<Profile*>(otr_profile);
884}
885
886Time ProfileImpl::GetStartTime() const {
887 return start_time_;
888}
889
890TabRestoreService* ProfileImpl::GetTabRestoreService() {
891 if (!tab_restore_service_.get())
[email protected]169627b2008-12-06 19:30:19892 tab_restore_service_ = new TabRestoreService(this);
initial.commit09911bf2008-07-26 23:55:29893 return tab_restore_service_.get();
894}
895
896void ProfileImpl::ResetTabRestoreService() {
[email protected]169627b2008-12-06 19:30:19897 tab_restore_service_ = NULL;
initial.commit09911bf2008-07-26 23:55:29898}
899
[email protected]a9afddb2009-02-12 17:49:42900// To be run in the IO thread to notify all resource message filters that the
[email protected]20930852008-10-15 19:30:41901// spellchecker has changed.
902class NotifySpellcheckerChangeTask : public Task {
903 public:
904 NotifySpellcheckerChangeTask(
[email protected]e7244d82008-10-29 18:13:26905 Profile* profile,
906 const SpellcheckerReinitializedDetails& spellchecker)
[email protected]20930852008-10-15 19:30:41907 : profile_(profile),
908 spellchecker_(spellchecker) {
909 }
910
911 private:
912 void Run(void) {
913 NotificationService::current()->Notify(
[email protected]bfd04a62009-02-01 18:16:56914 NotificationType::SPELLCHECKER_REINITIALIZED,
[email protected]20930852008-10-15 19:30:41915 Source<Profile>(profile_),
916 Details<SpellcheckerReinitializedDetails>(&spellchecker_));
917 }
918
919 Profile* profile_;
920 SpellcheckerReinitializedDetails spellchecker_;
921};
922
[email protected]e7244d82008-10-29 18:13:26923void ProfileImpl::InitializeSpellChecker(bool need_to_broadcast) {
[email protected]20930852008-10-15 19:30:41924 // The I/O thread may be NULL during testing.
925 base::Thread* io_thread = g_browser_process->io_thread();
926 if (spellchecker_) {
927 // The spellchecker must be deleted on the I/O thread.
928 // A dummy variable to aid in logical clarity.
929 SpellChecker* last_spellchecker = spellchecker_;
930
931 if (io_thread)
932 io_thread->message_loop()->ReleaseSoon(FROM_HERE, last_spellchecker);
933 else // during testing, we don't have an I/O thread
934 last_spellchecker->Release();
[email protected]20930852008-10-15 19:30:41935 }
936
[email protected]20930852008-10-15 19:30:41937 // Retrieve the (perhaps updated recently) dictionary name from preferences.
938 PrefService* prefs = GetPrefs();
[email protected]e7244d82008-10-29 18:13:26939 bool enable_spellcheck = prefs->GetBoolean(prefs::kEnableSpellCheck);
[email protected]20930852008-10-15 19:30:41940
[email protected]e7244d82008-10-29 18:13:26941 if (enable_spellcheck) {
[email protected]bd17b702009-02-25 20:44:08942 FilePath dict_dir;
[email protected]e7244d82008-10-29 18:13:26943 PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir);
[email protected]a9afddb2009-02-12 17:49:42944 // Note that, as the object pointed to by previously by spellchecker_
[email protected]e7244d82008-10-29 18:13:26945 // is being deleted in the io thread, the spellchecker_ can be made to point
946 // to a new object (RE-initialized) in parallel in this UI thread.
[email protected]4b4d1adc2008-12-10 22:28:58947 spellchecker_ = new SpellChecker(dict_dir,
[email protected]74c8b422009-03-11 00:34:12948 WideToASCII(prefs->GetString(prefs::kSpellCheckDictionary)),
949 GetRequestContext(),
[email protected]bd17b702009-02-25 20:44:08950 FilePath());
[email protected]e7244d82008-10-29 18:13:26951 spellchecker_->AddRef(); // Manual refcounting.
952 } else {
953 spellchecker_ = NULL;
954 }
[email protected]20930852008-10-15 19:30:41955
956 if (need_to_broadcast && io_thread) { // Notify resource message filters.
957 SpellcheckerReinitializedDetails scoped_spellchecker;
958 scoped_spellchecker.spellchecker = spellchecker_;
[email protected]e7244d82008-10-29 18:13:26959 if (io_thread) {
960 io_thread->message_loop()->PostTask(
[email protected]a9afddb2009-02-12 17:49:42961 FROM_HERE,
[email protected]e7244d82008-10-29 18:13:26962 new NotifySpellcheckerChangeTask(this, scoped_spellchecker));
963 }
[email protected]20930852008-10-15 19:30:41964 }
965}
966
[email protected]e7244d82008-10-29 18:13:26967void ProfileImpl::ReinitializeSpellChecker() {
968 InitializeSpellChecker(true);
969}
970
initial.commit09911bf2008-07-26 23:55:29971SpellChecker* ProfileImpl::GetSpellChecker() {
972 if (!spellchecker_) {
[email protected]20930852008-10-15 19:30:41973 // This is where spellchecker gets initialized. Note that this is being
974 // initialized in the ui_thread. However, this is not a problem as long as
975 // it is *used* in the io thread.
[email protected]34cc84f2009-02-13 10:04:35976 // TODO(sidchat): One day, change everything so that spellchecker gets
[email protected]20930852008-10-15 19:30:41977 // initialized in the IO thread itself.
[email protected]e7244d82008-10-29 18:13:26978 InitializeSpellChecker(false);
initial.commit09911bf2008-07-26 23:55:29979 }
[email protected]20930852008-10-15 19:30:41980
initial.commit09911bf2008-07-26 23:55:29981 return spellchecker_;
982}
983
984void ProfileImpl::MarkAsCleanShutdown() {
985 if (prefs_.get()) {
986 // The session cleanly exited, set kSessionExitedCleanly appropriately.
987 prefs_->SetBoolean(prefs::kSessionExitedCleanly, true);
988
989 // NOTE: If you change what thread this writes on, be sure and update
990 // ChromeFrame::EndSession().
[email protected]6faa0e0d2009-04-28 06:50:36991 prefs_->SavePersistentPrefs();
initial.commit09911bf2008-07-26 23:55:29992 }
993}
994
[email protected]e7244d82008-10-29 18:13:26995void ProfileImpl::Observe(NotificationType type,
996 const NotificationSource& source,
997 const NotificationDetails& details) {
[email protected]bfd04a62009-02-01 18:16:56998 if (NotificationType::PREF_CHANGED == type) {
[email protected]e7244d82008-10-29 18:13:26999 std::wstring* pref_name_in = Details<std::wstring>(details).ptr();
1000 PrefService* prefs = Source<PrefService>(source).ptr();
1001 DCHECK(pref_name_in && prefs);
1002 if (*pref_name_in == prefs::kSpellCheckDictionary ||
1003 *pref_name_in == prefs::kEnableSpellCheck) {
1004 InitializeSpellChecker(true);
1005 }
[email protected]4a190632009-05-09 01:07:421006 } else if (NotificationType::THEME_INSTALLED == type) {
1007 Extension* extension = Details<Extension>(details).ptr();
1008 SetTheme(extension);
[email protected]e7244d82008-10-29 18:13:261009 }
1010}
1011
initial.commit09911bf2008-07-26 23:55:291012void ProfileImpl::StopCreateSessionServiceTimer() {
[email protected]2d316662008-09-03 18:18:141013 create_session_service_timer_.Stop();
initial.commit09911bf2008-07-26 23:55:291014}
[email protected]3a453fa2008-08-15 18:46:341015
1016#ifdef CHROME_PERSONALIZATION
[email protected]57d3d0a2008-09-24 00:50:071017ProfilePersonalization* ProfileImpl::GetProfilePersonalization() {
[email protected]57d3d0a2008-09-24 00:50:071018 return personalization_.get();
[email protected]3a453fa2008-08-15 18:46:341019}
license.botbf09a502008-08-24 00:55:551020#endif