| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "app/theme_provider.h" | 8 #include "app/theme_provider.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/env_var.h" | 10 #include "base/env_var.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 // static | 269 // static |
| 270 Profile* Profile::CreateProfile(const FilePath& path) { | 270 Profile* Profile::CreateProfile(const FilePath& path) { |
| 271 return new ProfileImpl(path); | 271 return new ProfileImpl(path); |
| 272 } | 272 } |
| 273 | 273 |
| 274 // static | 274 // static |
| 275 URLRequestContextGetter* Profile::GetDefaultRequestContext() { | 275 URLRequestContextGetter* Profile::GetDefaultRequestContext() { |
| 276 return default_request_context_; | 276 return default_request_context_; |
| 277 } | 277 } |
| 278 | 278 |
| 279 bool Profile::IsSyncAccessible() { |
| 280 ProfileSyncService* syncService = GetProfileSyncService(); |
| 281 return syncService && !syncService->IsManaged(); |
| 282 } |
| 283 |
| 279 #if defined(OS_WIN) | 284 #if defined(OS_WIN) |
| 280 #include "chrome/browser/password_manager/password_store_win.h" | 285 #include "chrome/browser/password_manager/password_store_win.h" |
| 281 #elif defined(OS_MACOSX) | 286 #elif defined(OS_MACOSX) |
| 282 #include "chrome/browser/keychain_mac.h" | 287 #include "chrome/browser/keychain_mac.h" |
| 283 #include "chrome/browser/password_manager/password_store_mac.h" | 288 #include "chrome/browser/password_manager/password_store_mac.h" |
| 284 #elif defined(OS_POSIX) && !defined(OS_CHROMEOS) | 289 #elif defined(OS_POSIX) && !defined(OS_CHROMEOS) |
| 285 #include "base/xdg_util.h" | 290 #include "base/xdg_util.h" |
| 286 #include "chrome/browser/password_manager/native_backend_gnome_x.h" | 291 #include "chrome/browser/password_manager/native_backend_gnome_x.h" |
| 287 #include "chrome/browser/password_manager/native_backend_kwallet_x.h" | 292 #include "chrome/browser/password_manager/native_backend_kwallet_x.h" |
| 288 #include "chrome/browser/password_manager/password_store_x.h" | 293 #include "chrome/browser/password_manager/password_store_x.h" |
| (...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 registrar_.Remove(this, NotificationType::BOOKMARK_MODEL_LOADED, | 1628 registrar_.Remove(this, NotificationType::BOOKMARK_MODEL_LOADED, |
| 1624 Source<Profile>(this)); | 1629 Source<Profile>(this)); |
| 1625 } | 1630 } |
| 1626 } | 1631 } |
| 1627 | 1632 |
| 1628 void ProfileImpl::StopCreateSessionServiceTimer() { | 1633 void ProfileImpl::StopCreateSessionServiceTimer() { |
| 1629 create_session_service_timer_.Stop(); | 1634 create_session_service_timer_.Stop(); |
| 1630 } | 1635 } |
| 1631 | 1636 |
| 1632 ProfileSyncService* ProfileImpl::GetProfileSyncService() { | 1637 ProfileSyncService* ProfileImpl::GetProfileSyncService() { |
| 1633 if (!ProfileSyncService::IsSyncEnabled()) { | |
| 1634 return NULL; | |
| 1635 } | |
| 1636 if (!sync_service_.get()) | 1638 if (!sync_service_.get()) |
| 1637 InitSyncService(); | 1639 InitSyncService(); |
| 1638 return sync_service_.get(); | 1640 return sync_service_.get(); |
| 1639 } | 1641 } |
| 1640 | 1642 |
| 1641 CloudPrintProxyService* ProfileImpl::GetCloudPrintProxyService() { | 1643 CloudPrintProxyService* ProfileImpl::GetCloudPrintProxyService() { |
| 1642 if (!cloud_print_proxy_service_.get()) | 1644 if (!cloud_print_proxy_service_.get()) |
| 1643 InitCloudPrintProxyService(); | 1645 InitCloudPrintProxyService(); |
| 1644 return cloud_print_proxy_service_.get(); | 1646 return cloud_print_proxy_service_.get(); |
| 1645 } | 1647 } |
| 1646 | 1648 |
| 1647 void ProfileImpl::InitSyncService() { | 1649 void ProfileImpl::InitSyncService() { |
| 1648 profile_sync_factory_.reset( | 1650 profile_sync_factory_.reset( |
| 1649 new ProfileSyncFactoryImpl(this, CommandLine::ForCurrentProcess())); | 1651 new ProfileSyncFactoryImpl(this, CommandLine::ForCurrentProcess())); |
| 1650 sync_service_.reset( | 1652 sync_service_.reset( |
| 1651 profile_sync_factory_->CreateProfileSyncService()); | 1653 profile_sync_factory_->CreateProfileSyncService()); |
| 1652 sync_service_->Initialize(); | 1654 sync_service_->Initialize(); |
| 1653 } | 1655 } |
| 1654 | 1656 |
| 1655 void ProfileImpl::InitCloudPrintProxyService() { | 1657 void ProfileImpl::InitCloudPrintProxyService() { |
| 1656 cloud_print_proxy_service_.reset(new CloudPrintProxyService(this)); | 1658 cloud_print_proxy_service_.reset(new CloudPrintProxyService(this)); |
| 1657 cloud_print_proxy_service_->Initialize(); | 1659 cloud_print_proxy_service_->Initialize(); |
| 1658 } | 1660 } |
| OLD | NEW |