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 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" | 28 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" |
29 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
_factory.h" | 29 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
_factory.h" |
30 #include "chrome/browser/supervised_user/supervised_user_site_list.h" | 30 #include "chrome/browser/supervised_user/supervised_user_site_list.h" |
31 #include "chrome/browser/supervised_user/supervised_user_sync_service.h" | 31 #include "chrome/browser/supervised_user/supervised_user_sync_service.h" |
32 #include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" | 32 #include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" |
33 #include "chrome/browser/sync/profile_sync_service.h" | 33 #include "chrome/browser/sync/profile_sync_service.h" |
34 #include "chrome/browser/sync/profile_sync_service_factory.h" | 34 #include "chrome/browser/sync/profile_sync_service_factory.h" |
35 #include "chrome/browser/ui/browser.h" | 35 #include "chrome/browser/ui/browser.h" |
36 #include "chrome/browser/ui/browser_list.h" | 36 #include "chrome/browser/ui/browser_list.h" |
37 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
38 #include "chrome/common/extensions/api/managed_mode_private/managed_mode_handler
.h" | 38 #include "chrome/common/extensions/api/supervised_user_private/supervised_user_h
andler.h" |
39 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
40 #include "components/pref_registry/pref_registry_syncable.h" | 40 #include "components/pref_registry/pref_registry_syncable.h" |
41 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 41 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
42 #include "components/signin/core/browser/signin_manager.h" | 42 #include "components/signin/core/browser/signin_manager.h" |
43 #include "components/signin/core/browser/signin_manager_base.h" | 43 #include "components/signin/core/browser/signin_manager_base.h" |
44 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
45 #include "content/public/browser/user_metrics.h" | 45 #include "content/public/browser/user_metrics.h" |
46 #include "extensions/browser/extension_registry.h" | 46 #include "extensions/browser/extension_registry.h" |
47 #include "extensions/browser/extension_system.h" | 47 #include "extensions/browser/extension_system.h" |
48 #include "extensions/common/extension_set.h" | 48 #include "extensions/common/extension_set.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 } | 335 } |
336 | 336 |
337 DLOG_IF(ERROR, service->GetAuthError().state() == | 337 DLOG_IF(ERROR, service->GetAuthError().state() == |
338 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS) | 338 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS) |
339 << "Credentials rejected"; | 339 << "Credentials rejected"; |
340 } | 340 } |
341 | 341 |
342 void SupervisedUserService::OnExtensionLoaded( | 342 void SupervisedUserService::OnExtensionLoaded( |
343 content::BrowserContext* browser_context, | 343 content::BrowserContext* browser_context, |
344 const extensions::Extension* extension) { | 344 const extensions::Extension* extension) { |
345 if (!extensions::ManagedModeInfo::GetContentPackSiteList(extension).empty()) { | 345 if (!extensions::SupervisedUserInfo::GetContentPackSiteList(extension) |
| 346 .empty()) { |
346 UpdateSiteLists(); | 347 UpdateSiteLists(); |
347 } | 348 } |
348 } | 349 } |
349 void SupervisedUserService::OnExtensionUnloaded( | 350 void SupervisedUserService::OnExtensionUnloaded( |
350 content::BrowserContext* browser_context, | 351 content::BrowserContext* browser_context, |
351 const extensions::Extension* extension, | 352 const extensions::Extension* extension, |
352 extensions::UnloadedExtensionInfo::Reason reason) { | 353 extensions::UnloadedExtensionInfo::Reason reason) { |
353 if (!extensions::ManagedModeInfo::GetContentPackSiteList(extension).empty()) { | 354 if (!extensions::SupervisedUserInfo::GetContentPackSiteList(extension) |
| 355 .empty()) { |
354 UpdateSiteLists(); | 356 UpdateSiteLists(); |
355 } | 357 } |
356 } | 358 } |
357 | 359 |
358 void SupervisedUserService::SetupSync() { | 360 void SupervisedUserService::SetupSync() { |
359 ProfileSyncService* service = | 361 ProfileSyncService* service = |
360 ProfileSyncServiceFactory::GetForProfile(profile_); | 362 ProfileSyncServiceFactory::GetForProfile(profile_); |
361 DCHECK(service->sync_initialized()); | 363 DCHECK(service->sync_initialized()); |
362 | 364 |
363 bool sync_everything = false; | 365 bool sync_everything = false; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 return site_lists.Pass(); | 397 return site_lists.Pass(); |
396 | 398 |
397 const extensions::ExtensionSet* extensions = extension_service->extensions(); | 399 const extensions::ExtensionSet* extensions = extension_service->extensions(); |
398 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); | 400 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
399 it != extensions->end(); ++it) { | 401 it != extensions->end(); ++it) { |
400 const extensions::Extension* extension = it->get(); | 402 const extensions::Extension* extension = it->get(); |
401 if (!extension_service->IsExtensionEnabled(extension->id())) | 403 if (!extension_service->IsExtensionEnabled(extension->id())) |
402 continue; | 404 continue; |
403 | 405 |
404 extensions::ExtensionResource site_list = | 406 extensions::ExtensionResource site_list = |
405 extensions::ManagedModeInfo::GetContentPackSiteList(extension); | 407 extensions::SupervisedUserInfo::GetContentPackSiteList(extension); |
406 if (!site_list.empty()) { | 408 if (!site_list.empty()) { |
407 site_lists.push_back(new SupervisedUserSiteList(extension->id(), | 409 site_lists.push_back(new SupervisedUserSiteList(extension->id(), |
408 site_list.GetFilePath())); | 410 site_list.GetFilePath())); |
409 } | 411 } |
410 } | 412 } |
411 | 413 |
412 return site_lists.Pass(); | 414 return site_lists.Pass(); |
413 } | 415 } |
414 | 416 |
415 SupervisedUserSettingsService* SupervisedUserService::GetSettingsService() { | 417 SupervisedUserSettingsService* SupervisedUserService::GetSettingsService() { |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 743 |
742 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { | 744 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { |
743 bool profile_became_active = profile_->IsSameProfile(browser->profile()); | 745 bool profile_became_active = profile_->IsSameProfile(browser->profile()); |
744 if (!is_profile_active_ && profile_became_active) | 746 if (!is_profile_active_ && profile_became_active) |
745 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); | 747 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); |
746 else if (is_profile_active_ && !profile_became_active) | 748 else if (is_profile_active_ && !profile_became_active) |
747 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); | 749 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); |
748 | 750 |
749 is_profile_active_ = profile_became_active; | 751 is_profile_active_ = profile_became_active; |
750 } | 752 } |
OLD | NEW |