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

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 10817007: Remove chromeos::CryptohomeLibrary::IsMounted and convert (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 8 years, 5 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 <set> 5 #include <set>
6 6
7 #include "chrome/browser/profiles/profile_manager.h" 7 #include "chrome/browser/profiles/profile_manager.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "net/url_request/url_request_context_getter.h" 51 #include "net/url_request/url_request_context_getter.h"
52 #include "net/url_request/url_request_job.h" 52 #include "net/url_request/url_request_job.h"
53 #include "ui/base/l10n/l10n_util.h" 53 #include "ui/base/l10n/l10n_util.h"
54 54
55 #if defined(OS_WIN) 55 #if defined(OS_WIN)
56 #include "base/win/metro.h" 56 #include "base/win/metro.h"
57 #include "chrome/installer/util/browser_distribution.h" 57 #include "chrome/installer/util/browser_distribution.h"
58 #endif 58 #endif
59 59
60 #if defined(OS_CHROMEOS) 60 #if defined(OS_CHROMEOS)
61 #include "chrome/browser/chromeos/cros/cros_library.h" 61 #include "chromeos/dbus/cryptohome_client.h"
62 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 62 #include "chromeos/dbus/dbus_thread_manager.h"
63 #include "chrome/browser/chromeos/login/user_manager.h" 63 #include "chrome/browser/chromeos/login/user_manager.h"
64 #endif 64 #endif
65 65
66 using content::BrowserThread; 66 using content::BrowserThread;
67 using content::UserMetricsAction; 67 using content::UserMetricsAction;
68 68
69 namespace { 69 namespace {
70 70
71 // Profiles that should be deleted on shutdown. 71 // Profiles that should be deleted on shutdown.
72 std::vector<FilePath>& ProfilesToDelete() { 72 std::vector<FilePath>& ProfilesToDelete() {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 Profile::CreateStatus status) { 156 Profile::CreateStatus status) {
157 if (status == Profile::CREATE_STATUS_INITIALIZED) { 157 if (status == Profile::CREATE_STATUS_INITIALIZED) {
158 ProfileManager::FindOrCreateNewWindowForProfile( 158 ProfileManager::FindOrCreateNewWindowForProfile(
159 profile, 159 profile,
160 chrome::startup::IS_PROCESS_STARTUP, 160 chrome::startup::IS_PROCESS_STARTUP,
161 chrome::startup::IS_FIRST_RUN, 161 chrome::startup::IS_FIRST_RUN,
162 false); 162 false);
163 } 163 }
164 } 164 }
165 165
166 #if defined(OS_CHROMEOS)
167 void CheckCryptohomeIsMounted(chromeos::DBusMethodCallStatus call_status,
168 bool is_mounted) {
169 CHECK(call_status == chromeos::DBUS_METHOD_CALL_SUCCESS && is_mounted);
stevenjb 2012/07/23 17:42:50 This shouldn't be a CHECK - it *could* fail. We sh
hashimoto 2012/07/24 01:02:58 Done. "CHECK(!GetProfileByPath(default_profile_dir
stevenjb 2012/07/24 16:46:36 I don't think that getting the profile relies on e
170 }
171 #endif
172
166 } // namespace 173 } // namespace
167 174
168 #if defined(ENABLE_SESSION_SERVICE) 175 #if defined(ENABLE_SESSION_SERVICE)
169 // static 176 // static
170 void ProfileManager::ShutdownSessionServices() { 177 void ProfileManager::ShutdownSessionServices() {
171 ProfileManager* pm = g_browser_process->profile_manager(); 178 ProfileManager* pm = g_browser_process->profile_manager();
172 if (!pm) // Is NULL when running unit tests. 179 if (!pm) // Is NULL when running unit tests.
173 return; 180 return;
174 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); 181 std::vector<Profile*> profiles(pm->GetLoadedProfiles());
175 for (size_t i = 0; i < profiles.size(); ++i) 182 for (size_t i = 0; i < profiles.size(); ++i)
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 #if defined(OS_CHROMEOS) 526 #if defined(OS_CHROMEOS)
520 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { 527 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) {
521 logged_in_ = true; 528 logged_in_ = true;
522 529
523 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 530 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
524 if (!command_line.HasSwitch(switches::kTestType)) { 531 if (!command_line.HasSwitch(switches::kTestType)) {
525 // If we don't have a mounted profile directory we're in trouble. 532 // If we don't have a mounted profile directory we're in trouble.
526 // TODO(davemoore) Once we have better api this check should ensure that 533 // TODO(davemoore) Once we have better api this check should ensure that
527 // our profile directory is the one that's mounted, and that it's mounted 534 // our profile directory is the one that's mounted, and that it's mounted
528 // as the current user. 535 // as the current user.
529 CHECK(chromeos::CrosLibrary::Get()->GetCryptohomeLibrary()->IsMounted()) 536 chromeos::DBusThreadManager::Get()->GetCryptohomeClient()->IsMounted(
530 << "The cryptohome was not mounted at login."; 537 base::Bind(&CheckCryptohomeIsMounted));
531 538
532 // Confirm that we hadn't loaded the new profile previously. 539 // Confirm that we hadn't loaded the new profile previously.
533 FilePath default_profile_dir = 540 FilePath default_profile_dir =
534 user_data_dir_.Append(GetInitialProfileDir()); 541 user_data_dir_.Append(GetInitialProfileDir());
535 CHECK(!GetProfileByPath(default_profile_dir)) 542 CHECK(!GetProfileByPath(default_profile_dir))
536 << "The default profile was loaded before we mounted the cryptohome."; 543 << "The default profile was loaded before we mounted the cryptohome.";
537 } 544 }
538 return; 545 return;
539 } 546 }
540 #endif 547 #endif
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, 1019 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks,
1013 Profile* profile, 1020 Profile* profile,
1014 Profile::CreateStatus status) { 1021 Profile::CreateStatus status) {
1015 for (size_t i = 0; i < callbacks.size(); ++i) 1022 for (size_t i = 0; i < callbacks.size(); ++i)
1016 callbacks[i].Run(profile, status); 1023 callbacks[i].Run(profile, status);
1017 } 1024 }
1018 1025
1019 ProfileManager::ProfileInfo::~ProfileInfo() { 1026 ProfileManager::ProfileInfo::~ProfileInfo() {
1020 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); 1027 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release());
1021 } 1028 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698