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