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

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

Issue 2471993002: Remove calls to User::email() from chrome/browser/ui/webui/* (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser_options_handler.h" 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 IDS_PROFILES_LEGACY_SUPERVISED_USER_DASHBOARD_TIP, 593 IDS_PROFILES_LEGACY_SUPERVISED_USER_DASHBOARD_TIP,
594 supervised_user_dashboard)); 594 supervised_user_dashboard));
595 595
596 #if defined(OS_CHROMEOS) 596 #if defined(OS_CHROMEOS)
597 Profile* profile = Profile::FromWebUI(web_ui()); 597 Profile* profile = Profile::FromWebUI(web_ui());
598 std::string username = profile->GetProfileUserName(); 598 std::string username = profile->GetProfileUserName();
599 if (username.empty()) { 599 if (username.empty()) {
600 const user_manager::User* user = 600 const user_manager::User* user =
601 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); 601 chromeos::ProfileHelper::Get()->GetUserByProfile(profile);
602 if (user && (user->GetType() != user_manager::USER_TYPE_GUEST)) 602 if (user && (user->GetType() != user_manager::USER_TYPE_GUEST))
603 username = user->email(); 603 username = user->GetAccountId().GetUserEmail();
604 } 604 }
605 if (!username.empty()) 605 if (!username.empty())
606 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username)); 606 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username));
607 607
608 values->SetString("username", username); 608 values->SetString("username", username);
609 #endif 609 #endif
610 // Pass along sync status early so it will be available during page init. 610 // Pass along sync status early so it will be available during page init.
611 values->Set("syncData", GetSyncStateDictionary().release()); 611 values->Set("syncData", GetSyncStateDictionary().release());
612 612
613 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); 613 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL);
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 1456 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
1457 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) { 1457 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) {
1458 content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); 1458 content::RecordAction(UserMetricsAction("Options_GtkThemeSet"));
1459 Profile* profile = Profile::FromWebUI(web_ui()); 1459 Profile* profile = Profile::FromWebUI(web_ui());
1460 ThemeServiceFactory::GetForProfile(profile)->UseSystemTheme(); 1460 ThemeServiceFactory::GetForProfile(profile)->UseSystemTheme();
1461 } 1461 }
1462 #endif 1462 #endif
1463 1463
1464 #if defined(OS_CHROMEOS) 1464 #if defined(OS_CHROMEOS)
1465 void BrowserOptionsHandler::UpdateAccountPicture() { 1465 void BrowserOptionsHandler::UpdateAccountPicture() {
1466 std::string email = 1466 std::string email = user_manager::UserManager::Get()
1467 user_manager::UserManager::Get()->GetLoggedInUser()->email(); 1467 ->GetLoggedInUser()
1468 ->GetAccountId()
1469 .GetUserEmail();
1468 if (!email.empty()) { 1470 if (!email.empty()) {
1469 web_ui()->CallJavascriptFunctionUnsafe( 1471 web_ui()->CallJavascriptFunctionUnsafe(
1470 "BrowserOptions.updateAccountPicture"); 1472 "BrowserOptions.updateAccountPicture");
1471 base::StringValue email_value(email); 1473 base::StringValue email_value(email);
1472 web_ui()->CallJavascriptFunctionUnsafe( 1474 web_ui()->CallJavascriptFunctionUnsafe(
1473 "BrowserOptions.updateAccountPicture", email_value); 1475 "BrowserOptions.updateAccountPicture", email_value);
1474 web_ui()->CallJavascriptFunctionUnsafe( 1476 web_ui()->CallJavascriptFunctionUnsafe(
1475 "AccountsOptions.getInstance().updateAccountPicture", email_value); 1477 "AccountsOptions.getInstance().updateAccountPicture", email_value);
1476 } 1478 }
1477 } 1479 }
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2231 2233
2232 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2234 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2233 #if defined(OS_CHROMEOS) 2235 #if defined(OS_CHROMEOS)
2234 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2236 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2235 #else 2237 #else
2236 return true; 2238 return true;
2237 #endif 2239 #endif
2238 } 2240 }
2239 2241
2240 } // namespace options 2242 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698