| 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.h" | 5 #include "chrome/browser/profiles/profile.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/browser/sync/profile_sync_service.h" | 11 #include "chrome/browser/sync/profile_sync_service.h" |
| 12 #include "chrome/browser/sync/sync_prefs.h" | 12 #include "chrome/browser/sync/sync_prefs.h" |
| 13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "components/user_prefs/pref_registry_syncable.h" | 15 #include "components/user_prefs/pref_registry_syncable.h" |
| 16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 17 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
| 18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 #include "content/public/browser/web_ui.h" | 19 #include "content/public/browser/web_ui.h" |
| 20 | 20 |
| 21 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
| 22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chromeos/chromeos_switches.h" | |
| 25 #endif | 24 #endif |
| 26 | 25 |
| 27 Profile::Profile() | 26 Profile::Profile() |
| 28 : restored_last_session_(false), | 27 : restored_last_session_(false), |
| 29 sent_destroyed_notification_(false), | 28 sent_destroyed_notification_(false), |
| 30 accessibility_pause_level_(0) { | 29 accessibility_pause_level_(0) { |
| 31 } | 30 } |
| 32 | 31 |
| 33 Profile::~Profile() { | 32 Profile::~Profile() { |
| 34 } | 33 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 std::string Profile::GetDebugName() { | 122 std::string Profile::GetDebugName() { |
| 124 std::string name = GetPath().BaseName().MaybeAsASCII(); | 123 std::string name = GetPath().BaseName().MaybeAsASCII(); |
| 125 if (name.empty()) { | 124 if (name.empty()) { |
| 126 name = "UnknownProfile"; | 125 name = "UnknownProfile"; |
| 127 } | 126 } |
| 128 return name; | 127 return name; |
| 129 } | 128 } |
| 130 | 129 |
| 131 bool Profile::IsGuestSession() const { | 130 bool Profile::IsGuestSession() const { |
| 132 #if defined(OS_CHROMEOS) | 131 #if defined(OS_CHROMEOS) |
| 133 static bool is_guest_session = CommandLine::ForCurrentProcess()->HasSwitch( | 132 static bool is_guest_session = |
| 134 chromeos::switches::kGuestSession); | 133 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); |
| 135 return is_guest_session; | 134 return is_guest_session; |
| 136 #else | 135 #else |
| 137 return false; | 136 return false; |
| 138 #endif | 137 #endif |
| 139 } | 138 } |
| 140 | 139 |
| 141 bool Profile::IsSyncAccessible() { | 140 bool Profile::IsSyncAccessible() { |
| 142 browser_sync::SyncPrefs prefs(GetPrefs()); | 141 browser_sync::SyncPrefs prefs(GetPrefs()); |
| 143 return ProfileSyncService::IsSyncEnabled() && !prefs.IsManaged(); | 142 return ProfileSyncService::IsSyncEnabled() && !prefs.IsManaged(); |
| 144 } | 143 } |
| 145 | 144 |
| 146 void Profile::MaybeSendDestroyedNotification() { | 145 void Profile::MaybeSendDestroyedNotification() { |
| 147 if (!sent_destroyed_notification_) { | 146 if (!sent_destroyed_notification_) { |
| 148 sent_destroyed_notification_ = true; | 147 sent_destroyed_notification_ = true; |
| 149 content::NotificationService::current()->Notify( | 148 content::NotificationService::current()->Notify( |
| 150 chrome::NOTIFICATION_PROFILE_DESTROYED, | 149 chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 151 content::Source<Profile>(this), | 150 content::Source<Profile>(this), |
| 152 content::NotificationService::NoDetails()); | 151 content::NotificationService::NoDetails()); |
| 153 } | 152 } |
| 154 } | 153 } |
| OLD | NEW |