OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/profile.h" | 5 #include "chrome/browser/profile.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 ChromeURLRequestContext* request_context_; | 529 ChromeURLRequestContext* request_context_; |
530 | 530 |
531 ChromeURLRequestContext* extensions_request_context_; | 531 ChromeURLRequestContext* extensions_request_context_; |
532 | 532 |
533 // Use a seperate appcache service for OTR. | 533 // Use a seperate appcache service for OTR. |
534 ChromeAppCacheService* appcache_service_; | 534 ChromeAppCacheService* appcache_service_; |
535 | 535 |
536 // The download manager that only stores downloaded items in memory. | 536 // The download manager that only stores downloaded items in memory. |
537 scoped_refptr<DownloadManager> download_manager_; | 537 scoped_refptr<DownloadManager> download_manager_; |
538 | 538 |
539 scoped_refptr<BrowserThemeProvider> theme_provider_; | |
540 | |
541 // Use a special WebKit context for OTR browsing. | 539 // Use a special WebKit context for OTR browsing. |
542 scoped_refptr<WebKitContext> webkit_context_; | 540 scoped_refptr<WebKitContext> webkit_context_; |
543 | 541 |
544 // We don't want SSLHostState from the OTR profile to leak back to the main | 542 // We don't want SSLHostState from the OTR profile to leak back to the main |
545 // profile because then the main profile would learn some of the host names | 543 // profile because then the main profile would learn some of the host names |
546 // the user visited while OTR. | 544 // the user visited while OTR. |
547 scoped_ptr<SSLHostState> ssl_host_state_; | 545 scoped_ptr<SSLHostState> ssl_host_state_; |
548 | 546 |
549 // The StrictTransportSecurityState that only stores enabled sites in memory. | 547 // The StrictTransportSecurityState that only stores enabled sites in memory. |
550 scoped_refptr<net::StrictTransportSecurityState> | 548 scoped_refptr<net::StrictTransportSecurityState> |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 // TemplateURLModel schedules a task on the WebDataService from its | 716 // TemplateURLModel schedules a task on the WebDataService from its |
719 // destructor. Delete it first to ensure the task gets scheduled before we | 717 // destructor. Delete it first to ensure the task gets scheduled before we |
720 // shut down the database. | 718 // shut down the database. |
721 template_url_model_.reset(); | 719 template_url_model_.reset(); |
722 | 720 |
723 // The download manager queries the history system and should be deleted | 721 // The download manager queries the history system and should be deleted |
724 // before the history is shutdown so it can properly cancel all requests. | 722 // before the history is shutdown so it can properly cancel all requests. |
725 download_manager_ = NULL; | 723 download_manager_ = NULL; |
726 | 724 |
727 // The theme provider provides bitmaps to whoever wants them. | 725 // The theme provider provides bitmaps to whoever wants them. |
728 theme_provider_ = NULL; | 726 theme_provider_.reset(); |
729 | 727 |
730 // The ThumbnailStore saves thumbnails used by the NTP. Call Shutdown to | 728 // The ThumbnailStore saves thumbnails used by the NTP. Call Shutdown to |
731 // save any new thumbnails to disk and release its reference to the | 729 // save any new thumbnails to disk and release its reference to the |
732 // HistoryService. | 730 // HistoryService. |
733 if (thumbnail_store_.get()) | 731 if (thumbnail_store_.get()) |
734 thumbnail_store_->Shutdown(); | 732 thumbnail_store_->Shutdown(); |
735 | 733 |
736 // Remove pref observers. | 734 // Remove pref observers. |
737 PrefService* prefs = GetPrefs(); | 735 PrefService* prefs = GetPrefs(); |
738 prefs->RemovePrefObserver(prefs::kSpellCheckDictionary, this); | 736 prefs->RemovePrefObserver(prefs::kSpellCheckDictionary, this); |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 return download_manager_.get(); | 1103 return download_manager_.get(); |
1106 } | 1104 } |
1107 | 1105 |
1108 bool ProfileImpl::HasCreatedDownloadManager() const { | 1106 bool ProfileImpl::HasCreatedDownloadManager() const { |
1109 return created_download_manager_; | 1107 return created_download_manager_; |
1110 } | 1108 } |
1111 | 1109 |
1112 void ProfileImpl::InitThemes() { | 1110 void ProfileImpl::InitThemes() { |
1113 if (!created_theme_provider_) { | 1111 if (!created_theme_provider_) { |
1114 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 1112 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) |
1115 scoped_refptr<BrowserThemeProvider> themes(new GtkThemeProvider); | 1113 theme_provider_.reset(new GtkThemeProvider); |
1116 #else | 1114 #else |
1117 scoped_refptr<BrowserThemeProvider> themes(new BrowserThemeProvider); | 1115 theme_provider_.reset(new BrowserThemeProvider); |
1118 #endif | 1116 #endif |
1119 themes->Init(this); | 1117 theme_provider_->Init(this); |
1120 created_theme_provider_ = true; | 1118 created_theme_provider_ = true; |
1121 theme_provider_.swap(themes); | |
1122 } | 1119 } |
1123 } | 1120 } |
1124 | 1121 |
1125 void ProfileImpl::SetTheme(Extension* extension) { | 1122 void ProfileImpl::SetTheme(Extension* extension) { |
1126 InitThemes(); | 1123 InitThemes(); |
1127 theme_provider_.get()->SetTheme(extension); | 1124 theme_provider_.get()->SetTheme(extension); |
1128 } | 1125 } |
1129 | 1126 |
1130 void ProfileImpl::SetNativeTheme() { | 1127 void ProfileImpl::SetNativeTheme() { |
1131 InitThemes(); | 1128 InitThemes(); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 #endif | 1376 #endif |
1380 return NULL; | 1377 return NULL; |
1381 } | 1378 } |
1382 | 1379 |
1383 void ProfileImpl::InitSyncService() { | 1380 void ProfileImpl::InitSyncService() { |
1384 #ifdef CHROME_PERSONALIZATION | 1381 #ifdef CHROME_PERSONALIZATION |
1385 sync_service_.reset(new ProfileSyncService(this)); | 1382 sync_service_.reset(new ProfileSyncService(this)); |
1386 sync_service_->Initialize(); | 1383 sync_service_->Initialize(); |
1387 #endif | 1384 #endif |
1388 } | 1385 } |
OLD | NEW |