Chromium Code Reviews| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 #include "chrome/common/chrome_switches.h" | 76 #include "chrome/common/chrome_switches.h" |
| 77 #include "chrome/common/chrome_version_info.h" | 77 #include "chrome/common/chrome_version_info.h" |
| 78 #include "chrome/common/extensions/extension_permission_set.h" | 78 #include "chrome/common/extensions/extension_permission_set.h" |
| 79 #include "chrome/common/pref_names.h" | 79 #include "chrome/common/pref_names.h" |
| 80 #include "chrome/common/url_constants.h" | 80 #include "chrome/common/url_constants.h" |
| 81 #include "content/public/browser/browser_thread.h" | 81 #include "content/public/browser/browser_thread.h" |
| 82 #include "content/public/browser/host_zoom_map.h" | 82 #include "content/public/browser/host_zoom_map.h" |
| 83 #include "content/public/browser/notification_service.h" | 83 #include "content/public/browser/notification_service.h" |
| 84 #include "content/public/browser/user_metrics.h" | 84 #include "content/public/browser/user_metrics.h" |
| 85 #include "grit/chromium_strings.h" | 85 #include "grit/chromium_strings.h" |
| 86 #include "grit/generated_resources.h" | |
| 86 #include "ui/base/l10n/l10n_util.h" | 87 #include "ui/base/l10n/l10n_util.h" |
| 87 | 88 |
| 88 #if defined(OS_WIN) | 89 #if defined(OS_WIN) |
| 89 #include "chrome/installer/util/install_util.h" | 90 #include "chrome/installer/util/install_util.h" |
| 90 #elif defined(OS_CHROMEOS) | 91 #elif defined(OS_CHROMEOS) |
| 91 #include "chrome/browser/chromeos/enterprise_extension_observer.h" | 92 #include "chrome/browser/chromeos/enterprise_extension_observer.h" |
| 92 #endif | 93 #endif |
| 93 | 94 |
| 94 #if defined(OS_CHROMEOS) | 95 #if defined(OS_CHROMEOS) |
| 95 #include "chrome/browser/chromeos/locale_change_guard.h" | 96 #include "chrome/browser/chromeos/locale_change_guard.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 promo_resource_service_ = new PromoResourceService(this); | 436 promo_resource_service_ = new PromoResourceService(this); |
| 436 promo_resource_service_->StartAfterDelay(); | 437 promo_resource_service_->StartAfterDelay(); |
| 437 #endif | 438 #endif |
| 438 } | 439 } |
| 439 | 440 |
| 440 void ProfileImpl::InitRegisteredProtocolHandlers() { | 441 void ProfileImpl::InitRegisteredProtocolHandlers() { |
| 441 if (protocol_handler_registry_) | 442 if (protocol_handler_registry_) |
| 442 return; | 443 return; |
| 443 protocol_handler_registry_ = new ProtocolHandlerRegistry(this, | 444 protocol_handler_registry_ = new ProtocolHandlerRegistry(this, |
| 444 new ProtocolHandlerRegistry::Delegate()); | 445 new ProtocolHandlerRegistry::Delegate()); |
| 446 | |
| 447 // Install predefined protocol handlers. | |
| 448 InstallDefaultProtocolHandlers(); | |
| 449 | |
| 445 protocol_handler_registry_->Load(); | 450 protocol_handler_registry_->Load(); |
| 446 } | 451 } |
| 447 | 452 |
| 453 void ProfileImpl::InstallDefaultProtocolHandlers() { | |
| 454 #if defined(OS_CHROMEOS) | |
| 455 protocol_handler_registry_->AddDefaultHandler( | |
| 456 ProtocolHandler::CreateProtocolHandler( | |
| 457 "mailto", | |
| 458 GURL(l10n_util::GetStringUTF8(IDS_GOOGLE_MAILTO_HANDLER_URL)), | |
|
tony
2012/04/27 22:17:15
Why do the URLs have / repeated in the grd file?
| |
| 459 l10n_util::GetStringUTF16(IDS_GOOGLE_MAILTO_HANDLER_NAME))); | |
| 460 protocol_handler_registry_->AddDefaultHandler( | |
| 461 ProtocolHandler::CreateProtocolHandler( | |
| 462 "webcal", | |
| 463 GURL(l10n_util::GetStringUTF8(IDS_GOOGLE_WEBCAL_HANDLER_URL)), | |
| 464 l10n_util::GetStringUTF16(IDS_GOOGLE_WEBCAL_HANDLER_NAME))); | |
| 465 #endif | |
| 466 } | |
| 467 | |
| 448 FilePath ProfileImpl::last_selected_directory() { | 468 FilePath ProfileImpl::last_selected_directory() { |
| 449 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); | 469 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); |
| 450 } | 470 } |
| 451 | 471 |
| 452 void ProfileImpl::set_last_selected_directory(const FilePath& path) { | 472 void ProfileImpl::set_last_selected_directory(const FilePath& path) { |
| 453 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); | 473 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); |
| 454 } | 474 } |
| 455 | 475 |
| 456 ProfileImpl::~ProfileImpl() { | 476 ProfileImpl::~ProfileImpl() { |
| 457 content::NotificationService::current()->Notify( | 477 content::NotificationService::current()->Notify( |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1158 if (!path.empty()) | 1178 if (!path.empty()) |
| 1159 *cache_path = path; | 1179 *cache_path = path; |
| 1160 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1180 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1161 prefs_->GetInteger(prefs::kDiskCacheSize); | 1181 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1162 } | 1182 } |
| 1163 | 1183 |
| 1164 base::Callback<ChromeURLDataManagerBackend*(void)> | 1184 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 1165 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1185 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
| 1166 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1186 return io_data_.GetChromeURLDataManagerBackendGetter(); |
| 1167 } | 1187 } |
| OLD | NEW |