OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 #include "chrome/browser/chromeos/enterprise_extension_observer.h" | 91 #include "chrome/browser/chromeos/enterprise_extension_observer.h" |
92 #endif | 92 #endif |
93 | 93 |
94 #if defined(OS_CHROMEOS) | 94 #if defined(OS_CHROMEOS) |
95 #include "chrome/browser/chromeos/locale_change_guard.h" | 95 #include "chrome/browser/chromeos/locale_change_guard.h" |
96 #include "chrome/browser/chromeos/login/user_manager.h" | 96 #include "chrome/browser/chromeos/login/user_manager.h" |
97 #include "chrome/browser/chromeos/preferences.h" | 97 #include "chrome/browser/chromeos/preferences.h" |
98 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 98 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
99 #endif | 99 #endif |
100 | 100 |
101 #if !defined(OS_ANDROID) | |
102 #include "chrome/browser/usb/usb_service.h" | |
103 #endif // !defined(OS_ANDROID) | |
miket_OOO
2012/04/25 21:24:36
This include approximately duplicates the one in t
| |
104 | |
101 using base::Time; | 105 using base::Time; |
102 using base::TimeDelta; | 106 using base::TimeDelta; |
103 using content::BrowserThread; | 107 using content::BrowserThread; |
104 using content::DownloadManager; | 108 using content::DownloadManager; |
105 using content::HostZoomMap; | 109 using content::HostZoomMap; |
106 using content::UserMetricsAction; | 110 using content::UserMetricsAction; |
107 | 111 |
108 namespace { | 112 namespace { |
109 | 113 |
110 // Constrict us to a very specific platform and architecture to make sure | 114 // Constrict us to a very specific platform and architecture to make sure |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 // HistoryService will join with HistoryService's backend thread so that | 526 // HistoryService will join with HistoryService's backend thread so that |
523 // by the time the destructor has finished we're sure it will no longer call | 527 // by the time the destructor has finished we're sure it will no longer call |
524 // into the BookmarkModel. | 528 // into the BookmarkModel. |
525 history_service_ = NULL; | 529 history_service_ = NULL; |
526 bookmark_bar_model_.reset(); | 530 bookmark_bar_model_.reset(); |
527 | 531 |
528 // FaviconService depends on HistoryServce so make sure we delete | 532 // FaviconService depends on HistoryServce so make sure we delete |
529 // HistoryService first. | 533 // HistoryService first. |
530 favicon_service_.reset(); | 534 favicon_service_.reset(); |
531 | 535 |
536 if (usb_service_.get()) | |
537 usb_service_->Cleanup(); | |
538 usb_service_.reset(NULL); | |
miket_OOO
2012/04/25 21:24:36
Might as well put the reset inside the block. A fe
| |
539 | |
532 if (pref_proxy_config_tracker_.get()) | 540 if (pref_proxy_config_tracker_.get()) |
533 pref_proxy_config_tracker_->DetachFromPrefService(); | 541 pref_proxy_config_tracker_->DetachFromPrefService(); |
534 | 542 |
535 if (protocol_handler_registry_) | 543 if (protocol_handler_registry_) |
536 protocol_handler_registry_->Finalize(); | 544 protocol_handler_registry_->Finalize(); |
537 | 545 |
538 if (host_content_settings_map_) | 546 if (host_content_settings_map_) |
539 host_content_settings_map_->ShutdownOnUIThread(); | 547 host_content_settings_map_->ShutdownOnUIThread(); |
540 | 548 |
541 // This causes the Preferences file to be written to disk. | 549 // This causes the Preferences file to be written to disk. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
656 ChromeVersionService::OnProfileLoaded(prefs_.get(), is_new_profile); | 664 ChromeVersionService::OnProfileLoaded(prefs_.get(), is_new_profile); |
657 DoFinalInit(is_new_profile); | 665 DoFinalInit(is_new_profile); |
658 } | 666 } |
659 | 667 |
660 bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) { | 668 bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) { |
661 Version profile_version(ChromeVersionService::GetVersion(prefs_.get())); | 669 Version profile_version(ChromeVersionService::GetVersion(prefs_.get())); |
662 Version arg_version(version); | 670 Version arg_version(version); |
663 return (profile_version.CompareTo(arg_version) >= 0); | 671 return (profile_version.CompareTo(arg_version) >= 0); |
664 } | 672 } |
665 | 673 |
674 #if !defined(OS_ANDROID) | |
675 UsbService* ProfileImpl::GetUsbService() { | |
676 if (!usb_service_.get()) { | |
677 usb_service_.reset(new UsbService()); | |
678 } | |
679 return usb_service_.get(); | |
680 } | |
681 #endif // !defined(OS_ANDROID) | |
682 | |
666 PrefService* ProfileImpl::GetPrefs() { | 683 PrefService* ProfileImpl::GetPrefs() { |
667 DCHECK(prefs_.get()); // Should explicitly be initialized. | 684 DCHECK(prefs_.get()); // Should explicitly be initialized. |
668 return prefs_.get(); | 685 return prefs_.get(); |
669 } | 686 } |
670 | 687 |
671 PrefService* ProfileImpl::GetOffTheRecordPrefs() { | 688 PrefService* ProfileImpl::GetOffTheRecordPrefs() { |
672 if (!otr_prefs_.get()) { | 689 if (!otr_prefs_.get()) { |
673 // The new ExtensionPrefStore is ref_counted and the new PrefService | 690 // The new ExtensionPrefStore is ref_counted and the new PrefService |
674 // stores a reference so that we do not leak memory here. | 691 // stores a reference so that we do not leak memory here. |
675 otr_prefs_.reset(GetPrefs()->CreateIncognitoPrefService( | 692 otr_prefs_.reset(GetPrefs()->CreateIncognitoPrefService( |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1158 if (!path.empty()) | 1175 if (!path.empty()) |
1159 *cache_path = path; | 1176 *cache_path = path; |
1160 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1177 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1161 prefs_->GetInteger(prefs::kDiskCacheSize); | 1178 prefs_->GetInteger(prefs::kDiskCacheSize); |
1162 } | 1179 } |
1163 | 1180 |
1164 base::Callback<ChromeURLDataManagerBackend*(void)> | 1181 base::Callback<ChromeURLDataManagerBackend*(void)> |
1165 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1182 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
1166 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1183 return io_data_.GetChromeURLDataManagerBackendGetter(); |
1167 } | 1184 } |
OLD | NEW |