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

Side by Side Diff: components/arc/net/arc_net_host_impl.cc

Issue 2756443003: arc: Update device owner check implementation (Closed)
Patch Set: Created 3 years, 9 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
« components/arc/net/DEPS ('K') | « components/arc/net/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/arc/net/arc_net_host_impl.h" 5 #include "components/arc/net/arc_net_host_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/posix/eintr_wrapper.h" 14 #include "base/posix/eintr_wrapper.h"
15 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
17 #include "chromeos/login/login_state.h" 18 #include "chromeos/login/login_state.h"
18 #include "chromeos/network/managed_network_configuration_handler.h" 19 #include "chromeos/network/managed_network_configuration_handler.h"
19 #include "chromeos/network/network_connection_handler.h" 20 #include "chromeos/network/network_connection_handler.h"
20 #include "chromeos/network/network_handler.h" 21 #include "chromeos/network/network_handler.h"
21 #include "chromeos/network/network_state.h" 22 #include "chromeos/network/network_state.h"
22 #include "chromeos/network/network_state_handler.h" 23 #include "chromeos/network/network_state_handler.h"
23 #include "chromeos/network/network_type_pattern.h" 24 #include "chromeos/network/network_type_pattern.h"
24 #include "chromeos/network/network_util.h" 25 #include "chromeos/network/network_util.h"
25 #include "chromeos/network/onc/onc_utils.h" 26 #include "chromeos/network/onc/onc_utils.h"
26 #include "components/arc/arc_bridge_service.h" 27 #include "components/arc/arc_bridge_service.h"
(...skipping 11 matching lines...) Expand all
38 ->managed_network_configuration_handler(); 39 ->managed_network_configuration_handler();
39 } 40 }
40 41
41 chromeos::NetworkConnectionHandler* GetNetworkConnectionHandler() { 42 chromeos::NetworkConnectionHandler* GetNetworkConnectionHandler() {
42 return chromeos::NetworkHandler::Get()->network_connection_handler(); 43 return chromeos::NetworkHandler::Get()->network_connection_handler();
43 } 44 }
44 45
45 bool IsDeviceOwner() { 46 bool IsDeviceOwner() {
46 // Check whether the logged-in Chrome OS user is allowed to add or 47 // Check whether the logged-in Chrome OS user is allowed to add or
47 // remove WiFi networks. 48 // remove WiFi networks.
48 return chromeos::LoginState::Get()->GetLoggedInUserType() == 49 return chromeos::ChromeUserManager::Get()->GetOwnerAccountId() ==
49 chromeos::LoginState::LOGGED_IN_USER_OWNER; 50 chromeos::ChromeUserManager::Get()->GetActiveUser()->GetAccountId();
xiyuan 2017/03/16 05:13:21 I don't think this helps. GetOwnerAccountId() also
xiyuan 2017/03/16 17:14:51 Per discussion with abhishekbh@, the LoginState co
50 } 51 }
51 52
52 std::string GetStringFromOncDictionary(const base::DictionaryValue* dict, 53 std::string GetStringFromOncDictionary(const base::DictionaryValue* dict,
53 const char* key, 54 const char* key,
54 bool required) { 55 bool required) {
55 std::string value; 56 std::string value;
56 dict->GetString(key, &value); 57 dict->GetString(key, &value);
57 if (required && value.empty()) 58 if (required && value.empty())
58 VLOG(1) << "Required parameter " << key << " was not found."; 59 VLOG(1) << "Required parameter " << key << " was not found.";
59 return value; 60 return value;
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 net_instance->WifiEnabledStateChanged(is_enabled); 655 net_instance->WifiEnabledStateChanged(is_enabled);
655 } 656 }
656 657
657 void ArcNetHostImpl::OnShuttingDown() { 658 void ArcNetHostImpl::OnShuttingDown() {
658 DCHECK(observing_network_state_); 659 DCHECK(observing_network_state_);
659 GetStateHandler()->RemoveObserver(this, FROM_HERE); 660 GetStateHandler()->RemoveObserver(this, FROM_HERE);
660 observing_network_state_ = false; 661 observing_network_state_ = false;
661 } 662 }
662 663
663 } // namespace arc 664 } // namespace arc
OLDNEW
« components/arc/net/DEPS ('K') | « components/arc/net/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698