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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 signin_metrics::SignoutDelete::IGNORE_METRIC); | 72 signin_metrics::SignoutDelete::IGNORE_METRIC); |
73 browser->CloseModalSigninWindow(); | 73 browser->CloseModalSigninWindow(); |
74 } | 74 } |
75 | 75 |
76 void SyncConfirmationHandler::SetUserImageURL(const std::string& picture_url) { | 76 void SyncConfirmationHandler::SetUserImageURL(const std::string& picture_url) { |
77 GURL url; | 77 GURL url; |
78 if (profiles::GetImageURLWithThumbnailSize(GURL(picture_url), | 78 if (profiles::GetImageURLWithThumbnailSize(GURL(picture_url), |
79 kProfileImageSize, | 79 kProfileImageSize, |
80 &url)) { | 80 &url)) { |
81 base::StringValue picture_url_value(url.spec()); | 81 base::StringValue picture_url_value(url.spec()); |
82 web_ui()->CallJavascriptFunction( | 82 web_ui()->CallJavascriptFunctionUnsafe("sync.confirmation.setUserImageURL", |
83 "sync.confirmation.setUserImageURL", picture_url_value); | 83 picture_url_value); |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 void SyncConfirmationHandler::OnAccountUpdated(const AccountInfo& info) { | 87 void SyncConfirmationHandler::OnAccountUpdated(const AccountInfo& info) { |
88 DCHECK(info.IsValid()); | 88 DCHECK(info.IsValid()); |
89 Profile* profile = Profile::FromWebUI(web_ui()); | 89 Profile* profile = Profile::FromWebUI(web_ui()); |
90 AccountTrackerServiceFactory::GetForProfile(profile)->RemoveObserver(this); | 90 AccountTrackerServiceFactory::GetForProfile(profile)->RemoveObserver(this); |
91 | 91 |
92 SetUserImageURL(info.picture_url); | 92 SetUserImageURL(info.picture_url); |
93 } | 93 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 DCHECK(success); | 131 DCHECK(success); |
132 | 132 |
133 browser->signin_view_controller()->SetModalSigninHeight( | 133 browser->signin_view_controller()->SetModalSigninHeight( |
134 static_cast<int>(height)); | 134 static_cast<int>(height)); |
135 | 135 |
136 // After the dialog is shown, some platforms might have an element focused. | 136 // After the dialog is shown, some platforms might have an element focused. |
137 // To be consistent, clear the focused element on all platforms. | 137 // To be consistent, clear the focused element on all platforms. |
138 // TODO(anthonyvd): Figure out why this is needed on Mac and not other | 138 // TODO(anthonyvd): Figure out why this is needed on Mac and not other |
139 // platforms and if there's a way to start unfocused while avoiding this | 139 // platforms and if there's a way to start unfocused while avoiding this |
140 // workaround. | 140 // workaround. |
141 web_ui()->CallJavascriptFunction("sync.confirmation.clearFocus"); | 141 web_ui()->CallJavascriptFunctionUnsafe("sync.confirmation.clearFocus"); |
142 } | 142 } |
OLD | NEW |