Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service.cc

Issue 614053002: Supervised Users: Add tests for PermissionRequestCreatorApiary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 757
758 GetSettingsService()->SetActive(active_); 758 GetSettingsService()->SetActive(active_);
759 759
760 #if defined(ENABLE_EXTENSIONS) 760 #if defined(ENABLE_EXTENSIONS)
761 SetExtensionsActive(); 761 SetExtensionsActive();
762 #endif 762 #endif
763 763
764 if (active_) { 764 if (active_) {
765 if (CommandLine::ForCurrentProcess()->HasSwitch( 765 if (CommandLine::ForCurrentProcess()->HasSwitch(
766 switches::kPermissionRequestApiUrl)) { 766 switches::kPermissionRequestApiUrl)) {
767 scoped_ptr<PermissionRequestCreator> creator = 767 GURL url(CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
768 PermissionRequestCreatorApiary::CreateWithProfile( 768 switches::kPermissionRequestApiUrl));
769 profile_, 769 if (url.is_valid()) {
770 GURL(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 770 scoped_ptr<PermissionRequestCreator> creator =
771 switches::kPermissionRequestApiUrl))); 771 PermissionRequestCreatorApiary::CreateWithProfile(profile_, url);
772 permissions_creators_.push_back(creator.release()); 772 permissions_creators_.push_back(creator.release());
773 } else {
774 LOG(WARNING) << "Got invalid URL for "
775 << switches::kPermissionRequestApiUrl;
776 }
773 } else { 777 } else {
774 permissions_creators_.push_back(new PermissionRequestCreatorSync( 778 permissions_creators_.push_back(new PermissionRequestCreatorSync(
775 GetSettingsService(), 779 GetSettingsService(),
776 SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext( 780 SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext(
777 profile_), 781 profile_),
778 ProfileSyncServiceFactory::GetForProfile(profile_), 782 ProfileSyncServiceFactory::GetForProfile(profile_),
779 GetSupervisedUserName(), 783 GetSupervisedUserName(),
780 profile_->GetPrefs()->GetString(prefs::kSupervisedUserId))); 784 profile_->GetPrefs()->GetString(prefs::kSupervisedUserId)));
781 } 785 }
782 786
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 // The active user can be NULL in unit tests. 966 // The active user can be NULL in unit tests.
963 if (user_manager::UserManager::Get()->GetActiveUser()) { 967 if (user_manager::UserManager::Get()->GetActiveUser()) {
964 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( 968 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName(
965 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); 969 user_manager::UserManager::Get()->GetActiveUser()->GetUserID()));
966 } 970 }
967 return std::string(); 971 return std::string();
968 #else 972 #else
969 return profile_->GetPrefs()->GetString(prefs::kProfileName); 973 return profile_->GetPrefs()->GetString(prefs::kProfileName);
970 #endif 974 #endif
971 } 975 }
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/permission_request_creator_apiary_unittest.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698