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

Side by Side Diff: chrome/browser/ui/webui/options/managed_user_import_handler.cc

Issue 23691045: Update managed user registration to allow updating the avatar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bauerb@+ Created 7 years, 3 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
« no previous file with comments | « chrome/browser/managed_mode/managed_user_sync_service_unittest.cc ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/options/managed_user_import_handler.h" 5 #include "chrome/browser/ui/webui/options/managed_user_import_handler.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 DCHECK(success); 70 DCHECK(success);
71 std::string name; 71 std::string name;
72 value->GetString(ManagedUserSyncService::kName, &name); 72 value->GetString(ManagedUserSyncService::kName, &name);
73 std::string avatar_str; 73 std::string avatar_str;
74 value->GetString(ManagedUserSyncService::kChromeAvatar, &avatar_str); 74 value->GetString(ManagedUserSyncService::kChromeAvatar, &avatar_str);
75 75
76 DictionaryValue* managed_user = new DictionaryValue; 76 DictionaryValue* managed_user = new DictionaryValue;
77 managed_user->SetString("id", it.key()); 77 managed_user->SetString("id", it.key());
78 managed_user->SetString("name", name); 78 managed_user->SetString("name", name);
79 79
80 int avatar_index = -1; 80 int avatar_index = ManagedUserSyncService::kNoAvatar;
81 success = ManagedUserSyncService::GetAvatarIndex(avatar_str, &avatar_index); 81 success = ManagedUserSyncService::GetAvatarIndex(avatar_str, &avatar_index);
82 DCHECK(success); 82 DCHECK(success);
83 83
84 // TODO(ibraaaa): When we have an image indicating that this user 84 // TODO(ibraaaa): When we have an image indicating that this user
85 // has no synced avatar then change this to use it. 85 // has no synced avatar then change this to use it.
86 avatar_index = avatar_index < 0 ? 0 : avatar_index; 86 avatar_index =
87 avatar_index == ManagedUserSyncService::kNoAvatar ? 0 : avatar_index;
87 std::string avatar_url = 88 std::string avatar_url =
88 ProfileInfoCache::GetDefaultAvatarIconUrl(avatar_index); 89 ProfileInfoCache::GetDefaultAvatarIconUrl(avatar_index);
89 managed_user->SetString("iconURL", avatar_url); 90 managed_user->SetString("iconURL", avatar_url);
90 bool on_current_device = 91 bool on_current_device =
91 managed_user_ids.find(it.key()) != managed_user_ids.end(); 92 managed_user_ids.find(it.key()) != managed_user_ids.end();
92 managed_user->SetBoolean("onCurrentDevice", on_current_device); 93 managed_user->SetBoolean("onCurrentDevice", on_current_device);
93 94
94 managed_users.Append(managed_user); 95 managed_users.Append(managed_user);
95 } 96 }
96 97
97 web_ui()->CallJavascriptFunction( 98 web_ui()->CallJavascriptFunction(
98 "ManagedUserImportOverlay.receiveExistingManagedUsers", 99 "ManagedUserImportOverlay.receiveExistingManagedUsers",
99 managed_users); 100 managed_users);
100 } 101 }
101 102
102 } // namespace options 103 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/managed_mode/managed_user_sync_service_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698