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

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

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 26 matching lines...) Expand all
37 37
38 #if defined(OS_MACOSX) 38 #if defined(OS_MACOSX)
39 #include "chrome/browser/mac/obsolete_system.h" 39 #include "chrome/browser/mac/obsolete_system.h"
40 #endif 40 #endif
41 41
42 #if defined(OS_CHROMEOS) 42 #if defined(OS_CHROMEOS)
43 #include "base/files/file_util_proxy.h" 43 #include "base/files/file_util_proxy.h"
44 #include "base/i18n/time_formatting.h" 44 #include "base/i18n/time_formatting.h"
45 #include "base/prefs/pref_service.h" 45 #include "base/prefs/pref_service.h"
46 #include "base/sys_info.h" 46 #include "base/sys_info.h"
47 #include "chrome/browser/chromeos/login/users/user_manager.h"
48 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 47 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
49 #include "chrome/browser/chromeos/settings/cros_settings.h" 48 #include "chrome/browser/chromeos/settings/cros_settings.h"
50 #include "chrome/browser/profiles/profile.h" 49 #include "chrome/browser/profiles/profile.h"
51 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h" 50 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h"
52 #include "chromeos/chromeos_switches.h" 51 #include "chromeos/chromeos_switches.h"
53 #include "chromeos/dbus/dbus_thread_manager.h" 52 #include "chromeos/dbus/dbus_thread_manager.h"
54 #include "chromeos/dbus/power_manager_client.h" 53 #include "chromeos/dbus/power_manager_client.h"
54 #include "components/user_manager/user_manager.h"
55 #endif 55 #endif
56 56
57 using base::ListValue; 57 using base::ListValue;
58 using content::BrowserThread; 58 using content::BrowserThread;
59 59
60 namespace { 60 namespace {
61 61
62 #if defined(OS_CHROMEOS) 62 #if defined(OS_CHROMEOS)
63 63
64 // Returns message that informs user that for update it's better to 64 // Returns message that informs user that for update it's better to
(...skipping 20 matching lines...) Expand all
85 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kReleaseChannelDelegated, 85 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kReleaseChannelDelegated,
86 &value); 86 &value);
87 87
88 // On a managed machine we delegate this setting to the users of the same 88 // On a managed machine we delegate this setting to the users of the same
89 // domain only if the policy value is "domain". 89 // domain only if the policy value is "domain".
90 if (IsEnterpriseManaged()) { 90 if (IsEnterpriseManaged()) {
91 if (!value) 91 if (!value)
92 return false; 92 return false;
93 // Get the currently logged in user and strip the domain part only. 93 // Get the currently logged in user and strip the domain part only.
94 std::string domain = ""; 94 std::string domain = "";
95 std::string user = chromeos::UserManager::Get()->GetLoggedInUser()->email(); 95 std::string user =
96 user_manager::UserManager::Get()->GetLoggedInUser()->email();
96 size_t at_pos = user.find('@'); 97 size_t at_pos = user.find('@');
97 if (at_pos != std::string::npos && at_pos + 1 < user.length()) 98 if (at_pos != std::string::npos && at_pos + 1 < user.length())
98 domain = user.substr(user.find('@') + 1); 99 domain = user.substr(user.find('@') + 1);
99 policy::BrowserPolicyConnectorChromeOS* connector = 100 policy::BrowserPolicyConnectorChromeOS* connector =
100 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 101 g_browser_process->platform_part()->browser_policy_connector_chromeos();
101 return domain == connector->GetEnterpriseDomain(); 102 return domain == connector->GetEnterpriseDomain();
102 } else if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { 103 } else if (user_manager::UserManager::Get()->IsCurrentUserOwner()) {
103 // On non managed machines we have local owner who is the only one to change 104 // On non managed machines we have local owner who is the only one to change
104 // anything. Ensure that ReleaseChannelDelegated is false. 105 // anything. Ensure that ReleaseChannelDelegated is false.
105 return !value; 106 return !value;
106 } 107 }
107 return false; 108 return false;
108 } 109 }
109 110
110 #endif // defined(OS_CHROMEOS) 111 #endif // defined(OS_CHROMEOS)
111 112
112 } // namespace 113 } // namespace
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 base::string16 channel; 424 base::string16 channel;
424 bool is_powerwash_allowed; 425 bool is_powerwash_allowed;
425 if (!args->GetString(0, &channel) || 426 if (!args->GetString(0, &channel) ||
426 !args->GetBoolean(1, &is_powerwash_allowed)) { 427 !args->GetBoolean(1, &is_powerwash_allowed)) {
427 LOG(ERROR) << "Can't parse SetChannel() args"; 428 LOG(ERROR) << "Can't parse SetChannel() args";
428 return; 429 return;
429 } 430 }
430 431
431 version_updater_->SetChannel(base::UTF16ToUTF8(channel), 432 version_updater_->SetChannel(base::UTF16ToUTF8(channel),
432 is_powerwash_allowed); 433 is_powerwash_allowed);
433 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { 434 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) {
434 // Check for update after switching release channel. 435 // Check for update after switching release channel.
435 version_updater_->CheckForUpdate(base::Bind(&HelpHandler::SetUpdateStatus, 436 version_updater_->CheckForUpdate(base::Bind(&HelpHandler::SetUpdateStatus,
436 base::Unretained(this))); 437 base::Unretained(this)));
437 } 438 }
438 } 439 }
439 440
440 void HelpHandler::RelaunchAndPowerwash(const base::ListValue* args) { 441 void HelpHandler::RelaunchAndPowerwash(const base::ListValue* args) {
441 DCHECK(args->empty()); 442 DCHECK(args->empty());
442 443
443 if (IsEnterpriseManaged()) 444 if (IsEnterpriseManaged())
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 web_ui()->CallJavascriptFunction( 549 web_ui()->CallJavascriptFunction(
549 "help.HelpPage.updateCurrentChannel", base::StringValue(channel)); 550 "help.HelpPage.updateCurrentChannel", base::StringValue(channel));
550 } 551 }
551 552
552 void HelpHandler::OnTargetChannel(const std::string& channel) { 553 void HelpHandler::OnTargetChannel(const std::string& channel) {
553 web_ui()->CallJavascriptFunction( 554 web_ui()->CallJavascriptFunction(
554 "help.HelpPage.updateTargetChannel", base::StringValue(channel)); 555 "help.HelpPage.updateTargetChannel", base::StringValue(channel));
555 } 556 }
556 557
557 #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