| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/supervised_user_service.h" | 5 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // Save the string space in official builds. | 263 // Save the string space in official builds. |
| 264 #ifdef NDEBUG | 264 #ifdef NDEBUG |
| 265 NOTREACHED(); | 265 NOTREACHED(); |
| 266 return std::string(); | 266 return std::string(); |
| 267 #else | 267 #else |
| 268 return "Supervised User Service"; | 268 return "Supervised User Service"; |
| 269 #endif | 269 #endif |
| 270 } | 270 } |
| 271 | 271 |
| 272 bool SupervisedUserService::UserMayLoad(const extensions::Extension* extension, | 272 bool SupervisedUserService::UserMayLoad(const extensions::Extension* extension, |
| 273 int install_flags, |
| 273 base::string16* error) const { | 274 base::string16* error) const { |
| 274 base::string16 tmp_error; | 275 base::string16 tmp_error; |
| 275 if (ExtensionManagementPolicyImpl(extension, &tmp_error)) | 276 if (ExtensionManagementPolicyImpl(extension, &tmp_error)) |
| 276 return true; | 277 return true; |
| 277 | 278 |
| 278 // If the extension is already loaded, we allow it, otherwise we'd unload | 279 // If the extension is already loaded, we allow it, otherwise we'd unload |
| 279 // all existing extensions. | 280 // all existing extensions. |
| 280 ExtensionService* extension_service = | 281 ExtensionService* extension_service = |
| 281 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 282 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 282 | 283 |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 | 764 |
| 764 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { | 765 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { |
| 765 bool profile_became_active = profile_->IsSameProfile(browser->profile()); | 766 bool profile_became_active = profile_->IsSameProfile(browser->profile()); |
| 766 if (!is_profile_active_ && profile_became_active) | 767 if (!is_profile_active_ && profile_became_active) |
| 767 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); | 768 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); |
| 768 else if (is_profile_active_ && !profile_became_active) | 769 else if (is_profile_active_ && !profile_became_active) |
| 769 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); | 770 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); |
| 770 | 771 |
| 771 is_profile_active_ = profile_became_active; | 772 is_profile_active_ = profile_became_active; |
| 772 } | 773 } |
| OLD | NEW |