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

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

Issue 375413002: Replace chromeos::UserManager::Get() with chromeos::GetUserManager(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 5 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 | Annotate | Revision Log
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kReleaseChannelDelegated, 112 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kReleaseChannelDelegated,
113 &value); 113 &value);
114 114
115 // On a managed machine we delegate this setting to the users of the same 115 // On a managed machine we delegate this setting to the users of the same
116 // domain only if the policy value is "domain". 116 // domain only if the policy value is "domain".
117 if (IsEnterpriseManaged()) { 117 if (IsEnterpriseManaged()) {
118 if (!value) 118 if (!value)
119 return false; 119 return false;
120 // Get the currently logged in user and strip the domain part only. 120 // Get the currently logged in user and strip the domain part only.
121 std::string domain = ""; 121 std::string domain = "";
122 std::string user = chromeos::UserManager::Get()->GetLoggedInUser()->email(); 122 std::string user = chromeos::GetUserManager()->GetLoggedInUser()->email();
123 size_t at_pos = user.find('@'); 123 size_t at_pos = user.find('@');
124 if (at_pos != std::string::npos && at_pos + 1 < user.length()) 124 if (at_pos != std::string::npos && at_pos + 1 < user.length())
125 domain = user.substr(user.find('@') + 1); 125 domain = user.substr(user.find('@') + 1);
126 policy::BrowserPolicyConnectorChromeOS* connector = 126 policy::BrowserPolicyConnectorChromeOS* connector =
127 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 127 g_browser_process->platform_part()->browser_policy_connector_chromeos();
128 return domain == connector->GetEnterpriseDomain(); 128 return domain == connector->GetEnterpriseDomain();
129 } else if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { 129 } else if (chromeos::GetUserManager()->IsCurrentUserOwner()) {
130 // On non managed machines we have local owner who is the only one to change 130 // On non managed machines we have local owner who is the only one to change
131 // anything. Ensure that ReleaseChannelDelegated is false. 131 // anything. Ensure that ReleaseChannelDelegated is false.
132 return !value; 132 return !value;
133 } 133 }
134 return false; 134 return false;
135 } 135 }
136 136
137 #endif // defined(OS_CHROMEOS) 137 #endif // defined(OS_CHROMEOS)
138 138
139 } // namespace 139 } // namespace
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 base::string16 channel; 424 base::string16 channel;
425 bool is_powerwash_allowed; 425 bool is_powerwash_allowed;
426 if (!args->GetString(0, &channel) || 426 if (!args->GetString(0, &channel) ||
427 !args->GetBoolean(1, &is_powerwash_allowed)) { 427 !args->GetBoolean(1, &is_powerwash_allowed)) {
428 LOG(ERROR) << "Can't parse SetChannel() args"; 428 LOG(ERROR) << "Can't parse SetChannel() args";
429 return; 429 return;
430 } 430 }
431 431
432 version_updater_->SetChannel(base::UTF16ToUTF8(channel), 432 version_updater_->SetChannel(base::UTF16ToUTF8(channel),
433 is_powerwash_allowed); 433 is_powerwash_allowed);
434 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { 434 if (chromeos::GetUserManager()->IsCurrentUserOwner()) {
435 // Check for update after switching release channel. 435 // Check for update after switching release channel.
436 version_updater_->CheckForUpdate(base::Bind(&HelpHandler::SetUpdateStatus, 436 version_updater_->CheckForUpdate(base::Bind(&HelpHandler::SetUpdateStatus,
437 base::Unretained(this))); 437 base::Unretained(this)));
438 } 438 }
439 } 439 }
440 440
441 void HelpHandler::RelaunchAndPowerwash(const base::ListValue* args) { 441 void HelpHandler::RelaunchAndPowerwash(const base::ListValue* args) {
442 DCHECK(args->empty()); 442 DCHECK(args->empty());
443 443
444 if (IsEnterpriseManaged()) 444 if (IsEnterpriseManaged())
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 web_ui()->CallJavascriptFunction( 549 web_ui()->CallJavascriptFunction(
550 "help.HelpPage.updateCurrentChannel", base::StringValue(channel)); 550 "help.HelpPage.updateCurrentChannel", base::StringValue(channel));
551 } 551 }
552 552
553 void HelpHandler::OnTargetChannel(const std::string& channel) { 553 void HelpHandler::OnTargetChannel(const std::string& channel) {
554 web_ui()->CallJavascriptFunction( 554 web_ui()->CallJavascriptFunction(
555 "help.HelpPage.updateTargetChannel", base::StringValue(channel)); 555 "help.HelpPage.updateTargetChannel", base::StringValue(channel));
556 } 556 }
557 557
558 #endif // defined(OS_CHROMEOS) 558 #endif // defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/flags_ui.cc ('k') | chrome/browser/ui/webui/help/version_updater_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698