| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 #if defined(ENABLE_EXTENSIONS) | 33 #if defined(ENABLE_EXTENSIONS) |
| 34 #include "extensions/browser/pref_names.h" | 34 #include "extensions/browser/pref_names.h" |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 Profile::Profile() | 37 Profile::Profile() |
| 38 : restored_last_session_(false), | 38 : restored_last_session_(false), |
| 39 sent_destroyed_notification_(false), | 39 sent_destroyed_notification_(false), |
| 40 accessibility_pause_level_(0), | 40 accessibility_pause_level_(0), |
| 41 is_guest_profile_(false) { | 41 is_guest_profile_(false), |
| 42 is_system_profile_(false) { |
| 42 } | 43 } |
| 43 | 44 |
| 44 Profile::~Profile() { | 45 Profile::~Profile() { |
| 45 } | 46 } |
| 46 | 47 |
| 47 // static | 48 // static |
| 48 Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) { | 49 Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) { |
| 49 // This is safe; this is the only implementation of the browser context. | 50 // This is safe; this is the only implementation of the browser context. |
| 50 return static_cast<Profile*>(browser_context); | 51 return static_cast<Profile*>(browser_context); |
| 51 } | 52 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 #if defined(OS_CHROMEOS) | 209 #if defined(OS_CHROMEOS) |
| 209 static bool is_guest_session = | 210 static bool is_guest_session = |
| 210 base::CommandLine::ForCurrentProcess()->HasSwitch( | 211 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 211 chromeos::switches::kGuestSession); | 212 chromeos::switches::kGuestSession); |
| 212 return is_guest_session; | 213 return is_guest_session; |
| 213 #else | 214 #else |
| 214 return is_guest_profile_; | 215 return is_guest_profile_; |
| 215 #endif | 216 #endif |
| 216 } | 217 } |
| 217 | 218 |
| 219 bool Profile::IsSystemProfile() const { |
| 220 return is_system_profile_; |
| 221 } |
| 222 |
| 218 bool Profile::IsNewProfile() { | 223 bool Profile::IsNewProfile() { |
| 219 // The profile has been shut down if the prefs were loaded from disk, unless | 224 // The profile has been shut down if the prefs were loaded from disk, unless |
| 220 // first-run autoimport wrote them and reloaded the pref service. | 225 // first-run autoimport wrote them and reloaded the pref service. |
| 221 // TODO(dconnelly): revisit this when crbug.com/22142 (unifying the profile | 226 // TODO(dconnelly): revisit this when crbug.com/22142 (unifying the profile |
| 222 // import code) is fixed. | 227 // import code) is fixed. |
| 223 return GetOriginalProfile()->GetPrefs()->GetInitializationStatus() == | 228 return GetOriginalProfile()->GetPrefs()->GetInitializationStatus() == |
| 224 PrefService::INITIALIZATION_STATUS_CREATED_NEW_PREF_STORE; | 229 PrefService::INITIALIZATION_STATUS_CREATED_NEW_PREF_STORE; |
| 225 } | 230 } |
| 226 | 231 |
| 227 bool Profile::IsSyncAccessible() { | 232 bool Profile::IsSyncAccessible() { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 251 if (a->IsSameProfile(b)) | 256 if (a->IsSameProfile(b)) |
| 252 return false; | 257 return false; |
| 253 return a->GetOriginalProfile() < b->GetOriginalProfile(); | 258 return a->GetOriginalProfile() < b->GetOriginalProfile(); |
| 254 } | 259 } |
| 255 | 260 |
| 256 double Profile::GetDefaultZoomLevelForProfile() { | 261 double Profile::GetDefaultZoomLevelForProfile() { |
| 257 return GetDefaultStoragePartition(this) | 262 return GetDefaultStoragePartition(this) |
| 258 ->GetHostZoomMap() | 263 ->GetHostZoomMap() |
| 259 ->GetDefaultZoomLevel(); | 264 ->GetDefaultZoomLevel(); |
| 260 } | 265 } |
| OLD | NEW |