OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/signin/sync_confirmation_handler.h" | 5 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 std::string picture_url_to_load; | 79 std::string picture_url_to_load; |
80 GURL url; | 80 GURL url; |
81 if (picture_url != AccountTrackerService::kNoPictureURLFound && | 81 if (picture_url != AccountTrackerService::kNoPictureURLFound && |
82 profiles::GetImageURLWithThumbnailSize(GURL(picture_url), | 82 profiles::GetImageURLWithThumbnailSize(GURL(picture_url), |
83 kProfileImageSize, &url)) { | 83 kProfileImageSize, &url)) { |
84 picture_url_to_load = url.spec(); | 84 picture_url_to_load = url.spec(); |
85 } else { | 85 } else { |
86 // Use the placeholder avatar icon until the account picture URL is fetched. | 86 // Use the placeholder avatar icon until the account picture URL is fetched. |
87 picture_url_to_load = profiles::GetPlaceholderAvatarIconUrl(); | 87 picture_url_to_load = profiles::GetPlaceholderAvatarIconUrl(); |
88 } | 88 } |
89 base::StringValue picture_url_value(picture_url_to_load); | 89 base::Value picture_url_value(picture_url_to_load); |
90 web_ui()->CallJavascriptFunctionUnsafe("sync.confirmation.setUserImageURL", | 90 web_ui()->CallJavascriptFunctionUnsafe("sync.confirmation.setUserImageURL", |
91 picture_url_value); | 91 picture_url_value); |
92 } | 92 } |
93 | 93 |
94 void SyncConfirmationHandler::OnAccountUpdated(const AccountInfo& info) { | 94 void SyncConfirmationHandler::OnAccountUpdated(const AccountInfo& info) { |
95 if (!info.IsValid()) | 95 if (!info.IsValid()) |
96 return; | 96 return; |
97 | 97 |
98 Profile* profile = Profile::FromWebUI(web_ui()); | 98 Profile* profile = Profile::FromWebUI(web_ui()); |
99 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile); | 99 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 signin::SetInitializedModalHeight(web_ui(), args); | 142 signin::SetInitializedModalHeight(web_ui(), args); |
143 | 143 |
144 // After the dialog is shown, some platforms might have an element focused. | 144 // After the dialog is shown, some platforms might have an element focused. |
145 // To be consistent, clear the focused element on all platforms. | 145 // To be consistent, clear the focused element on all platforms. |
146 // TODO(anthonyvd): Figure out why this is needed on Mac and not other | 146 // TODO(anthonyvd): Figure out why this is needed on Mac and not other |
147 // platforms and if there's a way to start unfocused while avoiding this | 147 // platforms and if there's a way to start unfocused while avoiding this |
148 // workaround. | 148 // workaround. |
149 web_ui()->CallJavascriptFunctionUnsafe("sync.confirmation.clearFocus"); | 149 web_ui()->CallJavascriptFunctionUnsafe("sync.confirmation.clearFocus"); |
150 } | 150 } |
OLD | NEW |