| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/profiles/profile.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/file_system/browser_file_system_helper.h" | 23 #include "chrome/browser/file_system/browser_file_system_helper.h" |
| 24 #include "chrome/browser/in_process_webkit/webkit_context.h" | 24 #include "chrome/browser/in_process_webkit/webkit_context.h" |
| 25 #include "chrome/browser/net/chrome_url_request_context.h" | 25 #include "chrome/browser/net/chrome_url_request_context.h" |
| 26 #include "chrome/browser/notifications/desktop_notification_service.h" | 26 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 27 #include "chrome/browser/ssl/ssl_host_state.h" | 27 #include "chrome/browser/ssl/ssl_host_state.h" |
| 28 #include "chrome/browser/sync/profile_sync_service.h" | 28 #include "chrome/browser/sync/profile_sync_service.h" |
| 29 #include "chrome/browser/themes/browser_theme_provider.h" | 29 #include "chrome/browser/themes/browser_theme_provider.h" |
| 30 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 30 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
| 31 #include "chrome/common/chrome_constants.h" | 31 #include "chrome/common/chrome_constants.h" |
| 32 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
| 33 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/json_pref_store.h" | 34 #include "chrome/common/json_pref_store.h" |
| 34 #include "chrome/common/notification_service.h" | 35 #include "chrome/common/notification_service.h" |
| 35 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 36 #include "chrome/common/render_messages.h" | 37 #include "chrome/common/render_messages.h" |
| 37 #include "grit/browser_resources.h" | 38 #include "grit/browser_resources.h" |
| 38 #include "grit/locale_settings.h" | 39 #include "grit/locale_settings.h" |
| 39 #include "net/base/transport_security_state.h" | 40 #include "net/base/transport_security_state.h" |
| 40 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
| 41 #include "webkit/database/database_tracker.h" | 42 #include "webkit/database/database_tracker.h" |
| 42 | 43 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 prefs->RegisterStringPref(prefs::kApplicationLocaleOverride, ""); | 116 prefs->RegisterStringPref(prefs::kApplicationLocaleOverride, ""); |
| 116 prefs->RegisterStringPref(prefs::kApplicationLocaleAccepted, ""); | 117 prefs->RegisterStringPref(prefs::kApplicationLocaleAccepted, ""); |
| 117 #endif | 118 #endif |
| 118 } | 119 } |
| 119 | 120 |
| 120 // static | 121 // static |
| 121 URLRequestContextGetter* Profile::GetDefaultRequestContext() { | 122 URLRequestContextGetter* Profile::GetDefaultRequestContext() { |
| 122 return default_request_context_; | 123 return default_request_context_; |
| 123 } | 124 } |
| 124 | 125 |
| 126 bool Profile::IsGuestSession() { |
| 127 #if defined(OS_CHROMEOS) |
| 128 static bool is_guest_session = |
| 129 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); |
| 130 return is_guest_session; |
| 131 #else |
| 132 return false; |
| 133 #endif |
| 134 } |
| 135 |
| 125 bool Profile::IsSyncAccessible() { | 136 bool Profile::IsSyncAccessible() { |
| 126 ProfileSyncService* syncService = GetProfileSyncService(); | 137 ProfileSyncService* syncService = GetProfileSyncService(); |
| 127 return syncService && !syncService->IsManaged(); | 138 return syncService && !syncService->IsManaged(); |
| 128 } | 139 } |
| 129 | 140 |
| 130 //////////////////////////////////////////////////////////////////////////////// | 141 //////////////////////////////////////////////////////////////////////////////// |
| 131 // | 142 // |
| 132 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile | 143 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile |
| 133 // to make it suitable for the off the record mode. | 144 // to make it suitable for the off the record mode. |
| 134 // | 145 // |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 scoped_ptr<BackgroundContentsService> background_contents_service_; | 690 scoped_ptr<BackgroundContentsService> background_contents_service_; |
| 680 | 691 |
| 681 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; | 692 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
| 682 | 693 |
| 683 // The file_system context for this profile. | 694 // The file_system context for this profile. |
| 684 scoped_refptr<fileapi::SandboxedFileSystemContext> file_system_context_; | 695 scoped_refptr<fileapi::SandboxedFileSystemContext> file_system_context_; |
| 685 | 696 |
| 686 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); | 697 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); |
| 687 }; | 698 }; |
| 688 | 699 |
| 700 #if defined(OS_CHROMEOS) |
| 701 // Special case of the OffTheRecordProfileImpl which is used while Guest |
| 702 // session in CrOS. |
| 703 class GuestSessionProfile : public OffTheRecordProfileImpl { |
| 704 public: |
| 705 explicit GuestSessionProfile(Profile* real_profile) |
| 706 : OffTheRecordProfileImpl(real_profile) { |
| 707 } |
| 708 |
| 709 virtual PersonalDataManager* GetPersonalDataManager() { |
| 710 return GetOriginalProfile()->GetPersonalDataManager(); |
| 711 } |
| 712 }; |
| 713 #endif |
| 714 |
| 689 Profile* Profile::CreateOffTheRecordProfile() { | 715 Profile* Profile::CreateOffTheRecordProfile() { |
| 716 #if defined(OS_CHROMEOS) |
| 717 if (Profile::IsGuestSession()) |
| 718 return new GuestSessionProfile(this); |
| 719 #endif |
| 690 return new OffTheRecordProfileImpl(this); | 720 return new OffTheRecordProfileImpl(this); |
| 691 } | 721 } |
| OLD | NEW |