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

Side by Side Diff: chromeos/login/login_state.cc

Issue 242983004: Disable some API calls in networkingPrivate for non-primary user (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adddress feedback Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/login/login_state.h ('k') | chromeos/login/login_state_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chromeos/login/login_state.h" 5 #include "chromeos/login/login_state.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "chromeos/chromeos_switches.h" 10 #include "chromeos/chromeos_switches.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 void LoginState::AddObserver(Observer* observer) { 52 void LoginState::AddObserver(Observer* observer) {
53 observer_list_.AddObserver(observer); 53 observer_list_.AddObserver(observer);
54 } 54 }
55 55
56 void LoginState::RemoveObserver(Observer* observer) { 56 void LoginState::RemoveObserver(Observer* observer) {
57 observer_list_.RemoveObserver(observer); 57 observer_list_.RemoveObserver(observer);
58 } 58 }
59 59
60 void LoginState::SetLoggedInStateAndPrimaryUser(
61 LoggedInState state,
62 LoggedInUserType type,
63 const std::string& primary_user_hash) {
64 DCHECK(type != LOGGED_IN_USER_NONE);
65 primary_user_hash_ = primary_user_hash;
66 VLOG(1) << "LoggedInStateUser: " << primary_user_hash;
67 SetLoggedInState(state, type);
68 }
69
60 void LoginState::SetLoggedInState(LoggedInState state, 70 void LoginState::SetLoggedInState(LoggedInState state,
61 LoggedInUserType type) { 71 LoggedInUserType type) {
62 if (state == logged_in_state_ && type == logged_in_user_type_) 72 if (state == logged_in_state_ && type == logged_in_user_type_)
63 return; 73 return;
64 VLOG(1) << "LoggedInState: " << state << " UserType: " << type; 74 VLOG(1) << "LoggedInState: " << state << " UserType: " << type;
65 logged_in_state_ = state; 75 logged_in_state_ = state;
66 logged_in_user_type_ = type; 76 logged_in_user_type_ = type;
77 if (type == LOGGED_IN_USER_NONE)
pneubeck (no reviews) 2014/06/13 08:51:12 The concept of logging out does not exist in Chrom
stevenjb 2014/06/13 16:53:24 I don't want to put a DCHECK in because I don't kn
78 primary_user_hash_.clear();
67 NotifyObservers(); 79 NotifyObservers();
68 } 80 }
69 81
70 LoginState::LoggedInUserType LoginState::GetLoggedInUserType() const { 82 LoginState::LoggedInUserType LoginState::GetLoggedInUserType() const {
71 return logged_in_user_type_; 83 return logged_in_user_type_;
72 } 84 }
73 85
74 bool LoginState::IsUserLoggedIn() const { 86 bool LoginState::IsUserLoggedIn() const {
75 if (always_logged_in_) 87 if (always_logged_in_)
76 return true; 88 return true;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 144
133 LoginState::~LoginState() { 145 LoginState::~LoginState() {
134 } 146 }
135 147
136 void LoginState::NotifyObservers() { 148 void LoginState::NotifyObservers() {
137 FOR_EACH_OBSERVER(LoginState::Observer, observer_list_, 149 FOR_EACH_OBSERVER(LoginState::Observer, observer_list_,
138 LoggedInStateChanged()); 150 LoggedInStateChanged());
139 } 151 }
140 152
141 } // namespace chromeos 153 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/login/login_state.h ('k') | chromeos/login/login_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698