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

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

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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>
8
7 #include "base/command_line.h" 9 #include "base/command_line.h"
8 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
10 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
11 #include "base/path_service.h" 13 #include "base/path_service.h"
12 #include "base/prefs/pref_service.h" 14 #include "base/prefs/pref_service.h"
13 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
14 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
15 #include "base/task_runner_util.h" 17 #include "base/task_runner_util.h"
16 #include "base/version.h" 18 #include "base/version.h"
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 const base::DictionaryValue* dict = 824 const base::DictionaryValue* dict =
823 profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUserManualHosts); 825 profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUserManualHosts);
824 scoped_ptr<std::map<std::string, bool> > host_map( 826 scoped_ptr<std::map<std::string, bool> > host_map(
825 new std::map<std::string, bool>()); 827 new std::map<std::string, bool>());
826 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { 828 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
827 bool allow = false; 829 bool allow = false;
828 bool result = it.value().GetAsBoolean(&allow); 830 bool result = it.value().GetAsBoolean(&allow);
829 DCHECK(result); 831 DCHECK(result);
830 (*host_map)[it.key()] = allow; 832 (*host_map)[it.key()] = allow;
831 } 833 }
832 url_filter_context_.SetManualHosts(host_map.Pass()); 834 url_filter_context_.SetManualHosts(std::move(host_map));
833 835
834 FOR_EACH_OBSERVER( 836 FOR_EACH_OBSERVER(
835 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged()); 837 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged());
836 } 838 }
837 839
838 void SupervisedUserService::UpdateManualURLs() { 840 void SupervisedUserService::UpdateManualURLs() {
839 const base::DictionaryValue* dict = 841 const base::DictionaryValue* dict =
840 profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUserManualURLs); 842 profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUserManualURLs);
841 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); 843 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>());
842 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { 844 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
843 bool allow = false; 845 bool allow = false;
844 bool result = it.value().GetAsBoolean(&allow); 846 bool result = it.value().GetAsBoolean(&allow);
845 DCHECK(result); 847 DCHECK(result);
846 (*url_map)[GURL(it.key())] = allow; 848 (*url_map)[GURL(it.key())] = allow;
847 } 849 }
848 url_filter_context_.SetManualURLs(url_map.Pass()); 850 url_filter_context_.SetManualURLs(std::move(url_map));
849 851
850 FOR_EACH_OBSERVER( 852 FOR_EACH_OBSERVER(
851 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged()); 853 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged());
852 } 854 }
853 855
854 std::string SupervisedUserService::GetSupervisedUserName() const { 856 std::string SupervisedUserService::GetSupervisedUserName() const {
855 #if defined(OS_CHROMEOS) 857 #if defined(OS_CHROMEOS)
856 // The active user can be NULL in unit tests. 858 // The active user can be NULL in unit tests.
857 if (user_manager::UserManager::Get()->GetActiveUser()) { 859 if (user_manager::UserManager::Get()->GetActiveUser()) {
858 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( 860 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName(
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 1002
1001 is_profile_active_ = profile_became_active; 1003 is_profile_active_ = profile_became_active;
1002 } 1004 }
1003 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 1005 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
1004 1006
1005 void SupervisedUserService::OnSiteListUpdated() { 1007 void SupervisedUserService::OnSiteListUpdated() {
1006 FOR_EACH_OBSERVER( 1008 FOR_EACH_OBSERVER(
1007 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged()); 1009 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged());
1008 } 1010 }
1009 1011
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698