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

Side by Side Diff: chrome/browser/chromeos/login/user_manager.cc

Issue 14306004: Put Kiosk App parameters into device settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make kiosk app ID a separate field in policy. Created 7 years, 8 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/chromeos/login/user_manager.h" 5 #include "chrome/browser/chromeos/login/user_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h"
bartfab (slow) 2013/04/25 11:17:28 Nit: Not used.
Mattias Nissler (ping if slow) 2013/04/26 09:10:05 Done.
8 #include "chrome/browser/chromeos/login/user_manager_impl.h" 9 #include "chrome/browser/chromeos/login/user_manager_impl.h"
10 #include "chrome/common/extensions/extension.h"
11 #include "google_apis/gaia/gaia_auth_util.h"
9 12
10 namespace chromeos { 13 namespace chromeos {
11 14
12 // static 15 // static
13 const char UserManager::kStubUser[] = "stub-user@example.com"; 16 const char UserManager::kStubUser[] = "stub-user@example.com";
14 17
15 // static 18 // static
16 const char UserManager::kLocallyManagedUserDomain[] = 19 const char UserManager::kLocallyManagedUserDomain[] =
17 "locally-managed.localhost"; 20 "locally-managed.localhost";
18 21
(...skipping 28 matching lines...) Expand all
47 UserManager::~UserManager() { 50 UserManager::~UserManager() {
48 } 51 }
49 52
50 // static 53 // static
51 UserManager* UserManager::SetForTesting(UserManager* user_manager) { 54 UserManager* UserManager::SetForTesting(UserManager* user_manager) {
52 UserManager* previous_user_manager = g_user_manager; 55 UserManager* previous_user_manager = g_user_manager;
53 g_user_manager = user_manager; 56 g_user_manager = user_manager;
54 return previous_user_manager; 57 return previous_user_manager;
55 } 58 }
56 59
60 // static
61 bool UserManager::ParseKioskAppUserId(const std::string& user_id,
62 std::string* app_id) {
63 if (gaia::ExtractDomainName(user_id) == kKioskAppUserDomain) {
64 const std::string candidate_app_id(
65 user_id.substr(0, user_id.size() - arraysize(kKioskAppUserDomain)));
bartfab (slow) 2013/04/25 11:17:28 Will that not leave a dangling "@" at the end of |
xiyuan 2013/04/25 17:26:32 I had the same question when looking at this. Then
Mattias Nissler (ping if slow) 2013/04/26 09:10:05 Obsolete
66 if (extensions::Extension::IdIsValid(candidate_app_id)) {
bartfab (slow) 2013/04/25 11:17:28 Since you are explicitly storing the app ID in a d
xiyuan 2013/04/25 17:26:32 I don't see the the benefit of using an opaque ide
Mattias Nissler (ping if slow) 2013/04/26 09:10:05 Obsolete
Mattias Nissler (ping if slow) 2013/04/26 09:10:05 Some background from an offline discussion I had w
67 *app_id = candidate_app_id;
68 return true;
69 }
70 }
71
72 return false;
73 }
74
75 // static
76 std::string UserManager::FormatKioskAppUserId(const std::string& app_id) {
77 DCHECK(extensions::Extension::IdIsValid(app_id));
bartfab (slow) 2013/04/25 11:17:28 Same as above: Why does the local part need to be
Mattias Nissler (ping if slow) 2013/04/26 09:10:05 Obsolete
78 return app_id + '@' + kKioskAppUserDomain;
79 }
80
57 ScopedUserManagerEnabler::ScopedUserManagerEnabler(UserManager* user_manager) 81 ScopedUserManagerEnabler::ScopedUserManagerEnabler(UserManager* user_manager)
58 : previous_user_manager_(UserManager::SetForTesting(user_manager)) { 82 : previous_user_manager_(UserManager::SetForTesting(user_manager)) {
59 } 83 }
60 84
61 ScopedUserManagerEnabler::~ScopedUserManagerEnabler() { 85 ScopedUserManagerEnabler::~ScopedUserManagerEnabler() {
62 UserManager::Get()->Shutdown(); 86 UserManager::Get()->Shutdown();
63 UserManager::Destroy(); 87 UserManager::Destroy();
64 UserManager::SetForTesting(previous_user_manager_); 88 UserManager::SetForTesting(previous_user_manager_);
65 } 89 }
66 90
67 ScopedTestUserManager::ScopedTestUserManager() 91 ScopedTestUserManager::ScopedTestUserManager()
68 : initialized_user_manager_(false) { 92 : initialized_user_manager_(false) {
69 if (!UserManager::IsInitialized()) { 93 if (!UserManager::IsInitialized()) {
70 UserManager::Initialize(); 94 UserManager::Initialize();
71 initialized_user_manager_ = true; 95 initialized_user_manager_ = true;
72 } 96 }
73 } 97 }
74 98
75 ScopedTestUserManager::~ScopedTestUserManager() { 99 ScopedTestUserManager::~ScopedTestUserManager() {
76 if (initialized_user_manager_) { 100 if (initialized_user_manager_) {
77 UserManager::Get()->Shutdown(); 101 UserManager::Get()->Shutdown();
78 UserManager::Destroy(); 102 UserManager::Destroy();
79 } 103 }
80 } 104 }
81 105
82 } // namespace chromeos 106 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698