| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ui/webui/settings/profile_info_handler.h" | 5 #include "chrome/browser/ui/webui/settings/profile_info_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 const char ProfileInfoHandler::kProfileInfoChangedEventName[] = | 34 const char ProfileInfoHandler::kProfileInfoChangedEventName[] = |
| 35 "profile-info-changed"; | 35 "profile-info-changed"; |
| 36 const char | 36 const char |
| 37 ProfileInfoHandler::kProfileManagesSupervisedUsersChangedEventName[] = | 37 ProfileInfoHandler::kProfileManagesSupervisedUsersChangedEventName[] = |
| 38 "profile-manages-supervised-users-changed"; | 38 "profile-manages-supervised-users-changed"; |
| 39 const char ProfileInfoHandler::kProfileStatsCountReadyEventName[] = | 39 const char ProfileInfoHandler::kProfileStatsCountReadyEventName[] = |
| 40 "profile-stats-count-ready"; | 40 "profile-stats-count-ready"; |
| 41 | 41 |
| 42 ProfileInfoHandler::ProfileInfoHandler(Profile* profile) | 42 ProfileInfoHandler::ProfileInfoHandler(Profile* profile) |
| 43 : profile_(profile), | 43 : profile_(profile), |
| 44 profile_observer_(this) {} | 44 profile_observer_(this) { |
| 45 #if defined(OS_CHROMEOS) |
| 46 // Set up the chrome://userimage/ source. |
| 47 content::URLDataSource::Add(profile, |
| 48 new chromeos::options::UserImageSource()); |
| 49 #endif |
| 50 } |
| 45 | 51 |
| 46 ProfileInfoHandler::~ProfileInfoHandler() {} | 52 ProfileInfoHandler::~ProfileInfoHandler() {} |
| 47 | 53 |
| 48 void ProfileInfoHandler::RegisterMessages() { | 54 void ProfileInfoHandler::RegisterMessages() { |
| 49 web_ui()->RegisterMessageCallback( | 55 web_ui()->RegisterMessageCallback( |
| 50 "getProfileInfo", base::Bind(&ProfileInfoHandler::HandleGetProfileInfo, | 56 "getProfileInfo", base::Bind(&ProfileInfoHandler::HandleGetProfileInfo, |
| 51 base::Unretained(this))); | 57 base::Unretained(this))); |
| 52 #if !defined(OS_CHROMEOS) | 58 #if !defined(OS_CHROMEOS) |
| 53 web_ui()->RegisterMessageCallback( | 59 web_ui()->RegisterMessageCallback( |
| 54 "getProfileStatsCount", | 60 "getProfileStatsCount", |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 response->SetString("name", name); | 219 response->SetString("name", name); |
| 214 response->SetString("iconUrl", icon_url); | 220 response->SetString("iconUrl", icon_url); |
| 215 return base::WrapUnique(response); | 221 return base::WrapUnique(response); |
| 216 } | 222 } |
| 217 | 223 |
| 218 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const { | 224 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const { |
| 219 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); | 225 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); |
| 220 } | 226 } |
| 221 | 227 |
| 222 } // namespace settings | 228 } // namespace settings |
| OLD | NEW |