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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 CHECK_EQ(1U, args->GetSize()); | 120 CHECK_EQ(1U, args->GetSize()); |
121 const base::Value* callback_id; | 121 const base::Value* callback_id; |
122 CHECK(args->Get(0, &callback_id)); | 122 CHECK(args->Get(0, &callback_id)); |
123 | 123 |
124 ResolveJavascriptCallback(*callback_id, *GetAccountNameAndIcon()); | 124 ResolveJavascriptCallback(*callback_id, *GetAccountNameAndIcon()); |
125 } | 125 } |
126 | 126 |
127 #if !defined(OS_CHROMEOS) | 127 #if !defined(OS_CHROMEOS) |
128 void ProfileInfoHandler::HandleGetProfileStats(const base::ListValue* args) { | 128 void ProfileInfoHandler::HandleGetProfileStats(const base::ListValue* args) { |
| 129 AllowJavascript(); |
| 130 |
129 // Because there is open browser window for the current profile, statistics | 131 // Because there is open browser window for the current profile, statistics |
130 // from the ProfileAttributesStorage may not be up-to-date or may be missing | 132 // from the ProfileAttributesStorage may not be up-to-date or may be missing |
131 // (e.g., |item.success| is false). Therefore, query the actual statistics. | 133 // (e.g., |item.success| is false). Therefore, query the actual statistics. |
132 ProfileStatisticsFactory::GetForProfile(profile_)->GatherStatistics( | 134 ProfileStatisticsFactory::GetForProfile(profile_)->GatherStatistics( |
133 base::Bind(&ProfileInfoHandler::PushProfileStatsCount, | 135 base::Bind(&ProfileInfoHandler::PushProfileStatsCount, |
134 base::Unretained(this))); | 136 base::Unretained(this))); |
135 } | 137 } |
136 | 138 |
137 void ProfileInfoHandler::PushProfileStatsCount( | 139 void ProfileInfoHandler::PushProfileStatsCount( |
138 profiles::ProfileCategoryStats stats) { | 140 profiles::ProfileCategoryStats stats) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 response->SetString("name", name); | 224 response->SetString("name", name); |
223 response->SetString("iconUrl", icon_url); | 225 response->SetString("iconUrl", icon_url); |
224 return base::WrapUnique(response); | 226 return base::WrapUnique(response); |
225 } | 227 } |
226 | 228 |
227 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const { | 229 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const { |
228 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); | 230 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); |
229 } | 231 } |
230 | 232 |
231 } // namespace settings | 233 } // namespace settings |
OLD | NEW |