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

Unified Diff: chrome/browser/ui/webui/options/managed_user_import_handler.cc

Issue 147083016: Add avatar syncing for supervised users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/options/managed_user_import.js ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/managed_user_import_handler.cc
diff --git a/chrome/browser/ui/webui/options/managed_user_import_handler.cc b/chrome/browser/ui/webui/options/managed_user_import_handler.cc
index f86f6b9b76e4487c38bccf15df53d8ab36b5d291..3eb53994cfaeaebca5728d641e07efc9806f25f3 100644
--- a/chrome/browser/ui/webui/options/managed_user_import_handler.cc
+++ b/chrome/browser/ui/webui/options/managed_user_import_handler.cc
@@ -11,6 +11,9 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/managed_mode/managed_user_constants.h"
+#include "chrome/browser/managed_mode/managed_user_shared_settings_service.h"
+#include "chrome/browser/managed_mode/managed_user_shared_settings_service_factory.h"
#include "chrome/browser/managed_mode/managed_user_sync_service.h"
#include "chrome/browser/managed_mode/managed_user_sync_service_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -131,21 +134,32 @@ void ManagedUserImportHandler::SendExistingManagedUsers(
}
base::ListValue managed_users;
+ Profile* profile = Profile::FromWebUI(web_ui());
+ ManagedUserSharedSettingsService* service =
+ ManagedUserSharedSettingsServiceFactory::GetForBrowserContext(profile);
for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
const base::DictionaryValue* value = NULL;
bool success = it.value().GetAsDictionary(&value);
DCHECK(success);
std::string name;
value->GetString(ManagedUserSyncService::kName, &name);
- std::string avatar_str;
- value->GetString(ManagedUserSyncService::kChromeAvatar, &avatar_str);
base::DictionaryValue* managed_user = new base::DictionaryValue;
managed_user->SetString("id", it.key());
managed_user->SetString("name", name);
int avatar_index = ManagedUserSyncService::kNoAvatar;
- success = ManagedUserSyncService::GetAvatarIndex(avatar_str, &avatar_index);
+ const base::Value* avatar_index_value =
+ service->GetValue(it.key(), managed_users::kChromeAvatarIndex);
+ if (avatar_index_value) {
+ success = avatar_index_value->GetAsInteger(&avatar_index);
+ } else {
+ // Check if there is a legacy avatar index stored.
+ std::string avatar_str;
+ value->GetString(ManagedUserSyncService::kChromeAvatar, &avatar_str);
+ success =
+ ManagedUserSyncService::GetAvatarIndex(avatar_str, &avatar_index);
+ }
DCHECK(success);
managed_user->SetBoolean("needAvatar",
avatar_index == ManagedUserSyncService::kNoAvatar);
« no previous file with comments | « chrome/browser/resources/options/managed_user_import.js ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698