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

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

Issue 675183002: SupervisedUserService: Expose second custodian's name/email (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 if (name.empty()) { 309 if (name.empty()) {
310 name = base::UTF16ToUTF8(chromeos::ChromeUserManager::Get() 310 name = base::UTF16ToUTF8(chromeos::ChromeUserManager::Get()
311 ->GetSupervisedUserManager() 311 ->GetSupervisedUserManager()
312 ->GetManagerDisplayName( 312 ->GetManagerDisplayName(
313 user_manager::UserManager::Get()->GetActiveUser()->email())); 313 user_manager::UserManager::Get()->GetActiveUser()->email()));
314 } 314 }
315 #endif 315 #endif
316 return name.empty() ? GetCustodianEmailAddress() : name; 316 return name.empty() ? GetCustodianEmailAddress() : name;
317 } 317 }
318 318
319 std::string SupervisedUserService::GetSecondCustodianEmailAddress() const {
320 return profile_->GetPrefs()->GetString(
321 prefs::kSupervisedUserSecondCustodianEmail);
322 }
323
324 std::string SupervisedUserService::GetSecondCustodianName() const {
325 std::string name = profile_->GetPrefs()->GetString(
326 prefs::kSupervisedUserSecondCustodianName);
327 return name.empty() ? GetSecondCustodianEmailAddress() : name;
328 }
329
319 void SupervisedUserService::AddNavigationBlockedCallback( 330 void SupervisedUserService::AddNavigationBlockedCallback(
320 const NavigationBlockedCallback& callback) { 331 const NavigationBlockedCallback& callback) {
321 navigation_blocked_callbacks_.push_back(callback); 332 navigation_blocked_callbacks_.push_back(callback);
322 } 333 }
323 334
324 void SupervisedUserService::DidBlockNavigation( 335 void SupervisedUserService::DidBlockNavigation(
325 content::WebContents* web_contents) { 336 content::WebContents* web_contents) {
326 for (const auto& callback : navigation_blocked_callbacks_) 337 for (const auto& callback : navigation_blocked_callbacks_)
327 callback.Run(web_contents); 338 callback.Run(web_contents);
328 } 339 }
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 // The active user can be NULL in unit tests. 962 // The active user can be NULL in unit tests.
952 if (user_manager::UserManager::Get()->GetActiveUser()) { 963 if (user_manager::UserManager::Get()->GetActiveUser()) {
953 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( 964 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName(
954 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); 965 user_manager::UserManager::Get()->GetActiveUser()->GetUserID()));
955 } 966 }
956 return std::string(); 967 return std::string();
957 #else 968 #else
958 return profile_->GetPrefs()->GetString(prefs::kProfileName); 969 return profile_->GetPrefs()->GetString(prefs::kProfileName);
959 #endif 970 #endif
960 } 971 }
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698