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

Side by Side Diff: chrome/browser/chromeos/login/session/user_session_manager.h

Issue 1129293004: Move token handle obtaining to UserSessionManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "chrome/browser/chromeos/base/locale_util.h" 16 #include "chrome/browser/chromeos/base/locale_util.h"
17 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" 17 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
18 #include "chrome/browser/chromeos/login/signin/token_handle_util.h"
18 #include "chromeos/dbus/session_manager_client.h" 19 #include "chromeos/dbus/session_manager_client.h"
19 #include "chromeos/login/auth/authenticator.h" 20 #include "chromeos/login/auth/authenticator.h"
20 #include "chromeos/login/auth/user_context.h" 21 #include "chromeos/login/auth/user_context.h"
21 #include "components/user_manager/user.h" 22 #include "components/user_manager/user.h"
22 #include "components/user_manager/user_manager.h" 23 #include "components/user_manager/user_manager.h"
23 #include "net/base/network_change_notifier.h" 24 #include "net/base/network_change_notifier.h"
24 #include "ui/base/ime/chromeos/input_method_manager.h" 25 #include "ui/base/ime/chromeos/input_method_manager.h"
25 26
26 class GURL; 27 class GURL;
27 class PrefRegistrySimple; 28 class PrefRegistrySimple;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 212
212 // Returns true if there are pending Easy unlock key operations and 213 // Returns true if there are pending Easy unlock key operations and
213 // |callback| will be invoked when it is done. 214 // |callback| will be invoked when it is done.
214 bool CheckEasyUnlockKeyOps(const base::Closure& callback); 215 bool CheckEasyUnlockKeyOps(const base::Closure& callback);
215 216
216 void AddSessionStateObserver(chromeos::UserSessionStateObserver* observer); 217 void AddSessionStateObserver(chromeos::UserSessionStateObserver* observer);
217 void RemoveSessionStateObserver(chromeos::UserSessionStateObserver* observer); 218 void RemoveSessionStateObserver(chromeos::UserSessionStateObserver* observer);
218 219
219 void ActiveUserChanged(const user_manager::User* active_user) override; 220 void ActiveUserChanged(const user_manager::User* active_user) override;
220 221
222 // This method will be called when user have obtained oauth2 tokens.
223 void OnOAuth2TokensFetched(UserContext context);
224
221 // Returns default IME state for user session. 225 // Returns default IME state for user session.
222 scoped_refptr<input_method::InputMethodManager::State> GetDefaultIMEState( 226 scoped_refptr<input_method::InputMethodManager::State> GetDefaultIMEState(
223 Profile* profile); 227 Profile* profile);
224 228
225 // Note this could return NULL if not enabled. 229 // Note this could return NULL if not enabled.
226 EasyUnlockKeyManager* GetEasyUnlockKeyManager(); 230 EasyUnlockKeyManager* GetEasyUnlockKeyManager();
227 231
228 // Update Easy unlock cryptohome keys for given user context. 232 // Update Easy unlock cryptohome keys for given user context.
229 void UpdateEasyUnlockKeys(const UserContext& user_context); 233 void UpdateEasyUnlockKeys(const UserContext& user_context);
230 234
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // completed this method is called with |locale_pref_checked| set to true. 357 // completed this method is called with |locale_pref_checked| set to true.
354 void DoBrowserLaunchInternal(Profile* profile, 358 void DoBrowserLaunchInternal(Profile* profile,
355 LoginDisplayHost* login_host, 359 LoginDisplayHost* login_host,
356 bool locale_pref_checked); 360 bool locale_pref_checked);
357 361
358 static void RunCallbackOnLocaleLoaded( 362 static void RunCallbackOnLocaleLoaded(
359 const base::Closure& callback, 363 const base::Closure& callback,
360 InputEventsBlocker* input_events_blocker, 364 InputEventsBlocker* input_events_blocker,
361 const locale_util::LanguageSwitchResult& result); 365 const locale_util::LanguageSwitchResult& result);
362 366
367 // Callback invoked when |token_handle_util_| has finished.
368 void OnTokenHandleObtained(const user_manager::UserID& id,
369 TokenHandleUtil::TokenHandleStatus status);
370
371 // Returns |true| if token handles should be used on this device.
372 bool TokenHandlesEnabled();
373
363 // Test API methods. 374 // Test API methods.
364 375
365 // Injects |user_context| that will be used to create StubAuthenticator 376 // Injects |user_context| that will be used to create StubAuthenticator
366 // instance when CreateAuthenticator() is called. 377 // instance when CreateAuthenticator() is called.
367 void InjectStubUserContext(const UserContext& user_context); 378 void InjectStubUserContext(const UserContext& user_context);
368 379
369 // Controls whether browser instance should be launched after sign in 380 // Controls whether browser instance should be launched after sign in
370 // (used in tests). 381 // (used in tests).
371 void set_should_launch_browser_in_tests(bool should_launch_browser) { 382 void set_should_launch_browser_in_tests(bool should_launch_browser) {
372 should_launch_browser_ = should_launch_browser; 383 should_launch_browser_ = should_launch_browser;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 448
438 // Per-user-session Input Methods states. 449 // Per-user-session Input Methods states.
439 std::map<Profile*, scoped_refptr<input_method::InputMethodManager::State>, 450 std::map<Profile*, scoped_refptr<input_method::InputMethodManager::State>,
440 ProfileCompare> default_ime_states_; 451 ProfileCompare> default_ime_states_;
441 452
442 // Manages Easy unlock cryptohome keys. 453 // Manages Easy unlock cryptohome keys.
443 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; 454 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_;
444 bool running_easy_unlock_key_ops_; 455 bool running_easy_unlock_key_ops_;
445 base::Closure easy_unlock_key_ops_finished_callback_; 456 base::Closure easy_unlock_key_ops_finished_callback_;
446 457
458 scoped_ptr<TokenHandleUtil> token_handle_util_;
459
447 // Whether should launch browser, tests may override this value. 460 // Whether should launch browser, tests may override this value.
448 bool should_launch_browser_; 461 bool should_launch_browser_;
449 462
450 // Child account status is necessary for InitializeStartUrls call. 463 // Child account status is necessary for InitializeStartUrls call.
451 bool waiting_for_child_account_status_; 464 bool waiting_for_child_account_status_;
452 465
453 base::WeakPtrFactory<UserSessionManager> weak_factory_; 466 base::WeakPtrFactory<UserSessionManager> weak_factory_;
454 467
455 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); 468 DISALLOW_COPY_AND_ASSIGN(UserSessionManager);
456 }; 469 };
457 470
458 } // namespace chromeos 471 } // namespace chromeos
459 472
460 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ 473 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698