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

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

Issue 2767893002: Remove ScopedVector from chrome/browser/. (Closed)
Patch Set: Address comments from zea@ Created 3 years, 8 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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/path_service.h" 15 #include "base/path_service.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "base/task_runner_util.h" 18 #include "base/task_runner_util.h"
18 #include "base/threading/sequenced_worker_pool.h" 19 #include "base/threading/sequenced_worker_pool.h"
19 #include "base/version.h" 20 #include "base/version.h"
20 #include "build/build_config.h" 21 #include "build/build_config.h"
21 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h " 23 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h "
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 observer_list_.AddObserver(observer); 409 observer_list_.AddObserver(observer);
409 } 410 }
410 411
411 void SupervisedUserService::RemoveObserver( 412 void SupervisedUserService::RemoveObserver(
412 SupervisedUserServiceObserver* observer) { 413 SupervisedUserServiceObserver* observer) {
413 observer_list_.RemoveObserver(observer); 414 observer_list_.RemoveObserver(observer);
414 } 415 }
415 416
416 void SupervisedUserService::AddPermissionRequestCreator( 417 void SupervisedUserService::AddPermissionRequestCreator(
417 std::unique_ptr<PermissionRequestCreator> creator) { 418 std::unique_ptr<PermissionRequestCreator> creator) {
418 permissions_creators_.push_back(creator.release()); 419 permissions_creators_.push_back(std::move(creator));
419 } 420 }
420 421
421 void SupervisedUserService::SetSafeSearchURLReporter( 422 void SupervisedUserService::SetSafeSearchURLReporter(
422 std::unique_ptr<SafeSearchURLReporter> reporter) { 423 std::unique_ptr<SafeSearchURLReporter> reporter) {
423 url_reporter_ = std::move(reporter); 424 url_reporter_ = std::move(reporter);
424 } 425 }
425 426
426 bool SupervisedUserService::IncludesSyncSessionsType() const { 427 bool SupervisedUserService::IncludesSyncSessionsType() const {
427 return includes_sync_sessions_type_; 428 return includes_sync_sessions_type_;
428 } 429 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 InitSync( 563 InitSync(
563 command_line->GetSwitchValueASCII( 564 command_line->GetSwitchValueASCII(
564 switches::kSupervisedUserSyncToken)); 565 switches::kSupervisedUserSyncToken));
565 } 566 }
566 567
567 ProfileOAuth2TokenService* token_service = 568 ProfileOAuth2TokenService* token_service =
568 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); 569 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
569 token_service->LoadCredentials( 570 token_service->LoadCredentials(
570 supervised_users::kSupervisedUserPseudoEmail); 571 supervised_users::kSupervisedUserPseudoEmail);
571 572
572 permissions_creators_.push_back(new PermissionRequestCreatorSync( 573 permissions_creators_.push_back(
573 GetSettingsService(), 574 base::MakeUnique<PermissionRequestCreatorSync>(
574 SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext( 575 GetSettingsService(),
575 profile_), 576 SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext(
576 ProfileSyncServiceFactory::GetForProfile(profile_), 577 profile_),
577 GetSupervisedUserName(), 578 ProfileSyncServiceFactory::GetForProfile(profile_),
578 profile_->GetPrefs()->GetString(prefs::kSupervisedUserId))); 579 GetSupervisedUserName(),
580 profile_->GetPrefs()->GetString(prefs::kSupervisedUserId)));
579 581
580 SetupSync(); 582 SetupSync();
581 #else 583 #else
582 NOTREACHED(); 584 NOTREACHED();
583 #endif 585 #endif
584 } 586 }
585 } 587 }
586 588
587 // Now activate/deactivate anything not handled by the delegate yet. 589 // Now activate/deactivate anything not handled by the delegate yet.
588 590
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 const SuccessCallback& callback, 781 const SuccessCallback& callback,
780 size_t index) { 782 size_t index) {
781 // Find a permission request creator that is enabled. 783 // Find a permission request creator that is enabled.
782 size_t next_index = FindEnabledPermissionRequestCreator(index); 784 size_t next_index = FindEnabledPermissionRequestCreator(index);
783 if (next_index >= permissions_creators_.size()) { 785 if (next_index >= permissions_creators_.size()) {
784 callback.Run(false); 786 callback.Run(false);
785 return; 787 return;
786 } 788 }
787 789
788 create_request.Run( 790 create_request.Run(
789 permissions_creators_[next_index], 791 permissions_creators_[next_index].get(),
790 base::Bind(&SupervisedUserService::OnPermissionRequestIssued, 792 base::Bind(&SupervisedUserService::OnPermissionRequestIssued,
791 weak_ptr_factory_.GetWeakPtr(), create_request, 793 weak_ptr_factory_.GetWeakPtr(), create_request, callback,
792 callback, next_index)); 794 next_index));
793 } 795 }
794 796
795 void SupervisedUserService::OnPermissionRequestIssued( 797 void SupervisedUserService::OnPermissionRequestIssued(
796 const CreatePermissionRequestCallback& create_request, 798 const CreatePermissionRequestCallback& create_request,
797 const SuccessCallback& callback, 799 const SuccessCallback& callback,
798 size_t index, 800 size_t index,
799 bool success) { 801 bool success) {
800 if (success) { 802 if (success) {
801 callback.Run(true); 803 callback.Run(true);
802 return; 804 return;
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); 1312 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile"));
1311 1313
1312 is_profile_active_ = profile_became_active; 1314 is_profile_active_ = profile_became_active;
1313 } 1315 }
1314 #endif // !defined(OS_ANDROID) 1316 #endif // !defined(OS_ANDROID)
1315 1317
1316 void SupervisedUserService::OnSiteListUpdated() { 1318 void SupervisedUserService::OnSiteListUpdated() {
1317 for (SupervisedUserServiceObserver& observer : observer_list_) 1319 for (SupervisedUserServiceObserver& observer : observer_list_)
1318 observer.OnURLFilterChanged(); 1320 observer.OnURLFilterChanged();
1319 } 1321 }
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_service.h ('k') | chrome/browser/sync/test/integration/apps_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698