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

Side by Side Diff: chrome/browser/ui/webui/help/help_handler.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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/help/help_handler.h" 5 #include "chrome/browser/ui/webui/help/help_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // On a managed machine we delegate this setting to the users of the same 101 // On a managed machine we delegate this setting to the users of the same
102 // domain only if the policy value is "domain". 102 // domain only if the policy value is "domain".
103 if (IsEnterpriseManaged()) { 103 if (IsEnterpriseManaged()) {
104 if (!value) 104 if (!value)
105 return false; 105 return false;
106 // Get the currently logged in user and strip the domain part only. 106 // Get the currently logged in user and strip the domain part only.
107 std::string domain = ""; 107 std::string domain = "";
108 const user_manager::User* user = 108 const user_manager::User* user =
109 profile ? chromeos::ProfileHelper::Get()->GetUserByProfile(profile) 109 profile ? chromeos::ProfileHelper::Get()->GetUserByProfile(profile)
110 : nullptr; 110 : nullptr;
111 std::string email = user ? user->email() : std::string(); 111 std::string email = user ? user->GetUserID().GetUserEmail() : std::string();
112 size_t at_pos = email.find('@'); 112 size_t at_pos = email.find('@');
113 if (at_pos != std::string::npos && at_pos + 1 < email.length()) 113 if (at_pos != std::string::npos && at_pos + 1 < email.length())
114 domain = email.substr(email.find('@') + 1); 114 domain = email.substr(email.find('@') + 1);
115 policy::BrowserPolicyConnectorChromeOS* connector = 115 policy::BrowserPolicyConnectorChromeOS* connector =
116 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 116 g_browser_process->platform_part()->browser_policy_connector_chromeos();
117 return domain == connector->GetEnterpriseDomain(); 117 return domain == connector->GetEnterpriseDomain();
118 } else { 118 } else {
119 chromeos::OwnerSettingsServiceChromeOS* service = 119 chromeos::OwnerSettingsServiceChromeOS* service =
120 chromeos::OwnerSettingsServiceChromeOSFactory::GetInstance() 120 chromeos::OwnerSettingsServiceChromeOSFactory::GetInstance()
121 ->GetForBrowserContext(profile); 121 ->GetForBrowserContext(profile);
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 607 }
608 608
609 void HelpHandler::OnFCCLabelTextRead(const std::string& text) { 609 void HelpHandler::OnFCCLabelTextRead(const std::string& text) {
610 // Remove unnecessary whitespace. 610 // Remove unnecessary whitespace.
611 web_ui()->CallJavascriptFunction( 611 web_ui()->CallJavascriptFunction(
612 "help.HelpPage.setProductLabelText", 612 "help.HelpPage.setProductLabelText",
613 base::StringValue(base::CollapseWhitespaceASCII(text, true))); 613 base::StringValue(base::CollapseWhitespaceASCII(text, true)));
614 } 614 }
615 615
616 #endif // defined(OS_CHROMEOS) 616 #endif // defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698