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

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

Issue 200473002: Move all callers of GetHomeDir() to PathService::Get(base::DIR_HOME). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 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 | Annotate | Revision Log
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 "chrome/browser/chromeos/login/user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/user_manager_impl.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 9
10 #include "ash/multi_profile_uma.h" 10 #include "ash/multi_profile_uma.h"
11 #include "base/base_paths.h"
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
13 #include "base/command_line.h" 14 #include "base/command_line.h"
14 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
15 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
16 #include "base/format_macros.h" 17 #include "base/format_macros.h"
17 #include "base/logging.h" 18 #include "base/logging.h"
18 #include "base/metrics/histogram.h" 19 #include "base/metrics/histogram.h"
20 #include "base/path_service.h"
19 #include "base/prefs/pref_registry_simple.h" 21 #include "base/prefs/pref_registry_simple.h"
20 #include "base/prefs/pref_service.h" 22 #include "base/prefs/pref_service.h"
21 #include "base/prefs/scoped_user_pref_update.h" 23 #include "base/prefs/scoped_user_pref_update.h"
22 #include "base/rand_util.h" 24 #include "base/rand_util.h"
23 #include "base/strings/string_util.h" 25 #include "base/strings/string_util.h"
24 #include "base/strings/stringprintf.h" 26 #include "base/strings/stringprintf.h"
25 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
26 #include "base/sys_info.h" 28 #include "base/sys_info.h"
27 #include "base/threading/worker_pool.h" 29 #include "base/threading/worker_pool.h"
28 #include "base/values.h" 30 #include "base/values.h"
(...skipping 18 matching lines...) Expand all
47 #include "chrome/browser/chromeos/profiles/profile_helper.h" 49 #include "chrome/browser/chromeos/profiles/profile_helper.h"
48 #include "chrome/browser/chromeos/session_length_limiter.h" 50 #include "chrome/browser/chromeos/session_length_limiter.h"
49 #include "chrome/browser/managed_mode/chromeos/managed_user_password_service_fac tory.h" 51 #include "chrome/browser/managed_mode/chromeos/managed_user_password_service_fac tory.h"
50 #include "chrome/browser/managed_mode/chromeos/manager_password_service_factory. h" 52 #include "chrome/browser/managed_mode/chromeos/manager_password_service_factory. h"
51 #include "chrome/browser/net/nss_context.h" 53 #include "chrome/browser/net/nss_context.h"
52 #include "chrome/browser/profiles/profile.h" 54 #include "chrome/browser/profiles/profile.h"
53 #include "chrome/browser/profiles/profile_manager.h" 55 #include "chrome/browser/profiles/profile_manager.h"
54 #include "chrome/browser/sync/profile_sync_service.h" 56 #include "chrome/browser/sync/profile_sync_service.h"
55 #include "chrome/browser/sync/profile_sync_service_factory.h" 57 #include "chrome/browser/sync/profile_sync_service_factory.h"
56 #include "chrome/common/chrome_constants.h" 58 #include "chrome/common/chrome_constants.h"
59 #include "chrome/common/chrome_paths.h"
57 #include "chrome/common/chrome_switches.h" 60 #include "chrome/common/chrome_switches.h"
58 #include "chrome/common/crash_keys.h" 61 #include "chrome/common/crash_keys.h"
59 #include "chrome/common/pref_names.h" 62 #include "chrome/common/pref_names.h"
60 #include "chromeos/cert_loader.h" 63 #include "chromeos/cert_loader.h"
61 #include "chromeos/chromeos_switches.h" 64 #include "chromeos/chromeos_switches.h"
62 #include "chromeos/cryptohome/async_method_caller.h" 65 #include "chromeos/cryptohome/async_method_caller.h"
63 #include "chromeos/dbus/dbus_thread_manager.h" 66 #include "chromeos/dbus/dbus_thread_manager.h"
64 #include "chromeos/login/login_state.h" 67 #include "chromeos/login/login_state.h"
65 #include "chromeos/settings/cros_settings_names.h" 68 #include "chromeos/settings/cros_settings_names.h"
66 #include "content/public/browser/browser_thread.h" 69 #include "content/public/browser/browser_thread.h"
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 is_current_user_new_ = true; 1500 is_current_user_new_ = true;
1498 active_user_ = User::CreateRetailModeUser(); 1501 active_user_ = User::CreateRetailModeUser();
1499 GetUserImageManager(UserManager::kRetailModeUserName)->UserLoggedIn( 1502 GetUserImageManager(UserManager::kRetailModeUserName)->UserLoggedIn(
1500 is_current_user_new_, 1503 is_current_user_new_,
1501 true); 1504 true);
1502 WallpaperManager::Get()->SetUserWallpaperNow( 1505 WallpaperManager::Get()->SetUserWallpaperNow(
1503 UserManager::kRetailModeUserName); 1506 UserManager::kRetailModeUserName);
1504 } 1507 }
1505 1508
1506 void UserManagerImpl::NotifyOnLogin() { 1509 void UserManagerImpl::NotifyOnLogin() {
1510 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1511
1512 // Override user homedir.
1513 if (GetLoggedInUsers().size() == 1) {
1514 base::FilePath homedir = ProfileHelper::GetProfilePathByUserIdHash(
1515 primary_user_->username_hash());
1516 PathService::Override(base::DIR_HOME, homedir);
Will Drewry 2014/04/08 15:55:04 Does this mean the home dir will always be the fir
Nikita (slow) 2014/04/08 16:40:08 Correct. This is the way how it works today and ha
1517 PathService::Override(chrome::DIR_USER_DATA, homedir);
1518 }
1519
1507 UpdateNumberOfUsers(); 1520 UpdateNumberOfUsers();
1508 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1509 NotifyActiveUserHashChanged(active_user_->username_hash()); 1521 NotifyActiveUserHashChanged(active_user_->username_hash());
1510 NotifyActiveUserChanged(active_user_); 1522 NotifyActiveUserChanged(active_user_);
1523 UpdateLoginState();
1511 1524
1512 UpdateLoginState();
1513 // TODO(nkostylev): Deprecate this notification in favor of 1525 // TODO(nkostylev): Deprecate this notification in favor of
1514 // ActiveUserChanged() observer call. 1526 // ActiveUserChanged() observer call.
1515 content::NotificationService::current()->Notify( 1527 content::NotificationService::current()->Notify(
1516 chrome::NOTIFICATION_LOGIN_USER_CHANGED, 1528 chrome::NOTIFICATION_LOGIN_USER_CHANGED,
1517 content::Source<UserManager>(this), 1529 content::Source<UserManager>(this),
1518 content::Details<const User>(active_user_)); 1530 content::Details<const User>(active_user_));
1519 1531
1520 // Owner must be first user in session. DeviceSettingsService can't deal with 1532 // Owner must be first user in session. DeviceSettingsService can't deal with
1521 // multiple user and will mix up ownership, crbug.com/230018. 1533 // multiple user and will mix up ownership, crbug.com/230018.
1522 if (GetLoggedInUsers().size() == 1) { 1534 if (GetLoggedInUsers().size() == 1) {
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 } 2061 }
2050 2062
2051 void UserManagerImpl::DeleteUser(User* user) { 2063 void UserManagerImpl::DeleteUser(User* user) {
2052 const bool is_active_user = (user == active_user_); 2064 const bool is_active_user = (user == active_user_);
2053 delete user; 2065 delete user;
2054 if (is_active_user) 2066 if (is_active_user)
2055 active_user_ = NULL; 2067 active_user_ = NULL;
2056 } 2068 }
2057 2069
2058 } // namespace chromeos 2070 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698