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

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: rebase 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 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) {
170 LOG(ERROR) << "IsMounted call failed.";
171 return;
172 }
173 if (!is_mounted)
174 LOG(ERROR) << "Cryptohome is not mounted.";
175 }
176 #endif
177
166 } // namespace 178 } // namespace
167 179
168 #if defined(ENABLE_SESSION_SERVICE) 180 #if defined(ENABLE_SESSION_SERVICE)
169 // static 181 // static
170 void ProfileManager::ShutdownSessionServices() { 182 void ProfileManager::ShutdownSessionServices() {
171 ProfileManager* pm = g_browser_process->profile_manager(); 183 ProfileManager* pm = g_browser_process->profile_manager();
172 if (!pm) // Is NULL when running unit tests. 184 if (!pm) // Is NULL when running unit tests.
173 return; 185 return;
174 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); 186 std::vector<Profile*> profiles(pm->GetLoadedProfiles());
175 for (size_t i = 0; i < profiles.size(); ++i) 187 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) 531 #if defined(OS_CHROMEOS)
520 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { 532 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) {
521 logged_in_ = true; 533 logged_in_ = true;
522 534
523 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 535 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
524 if (!command_line.HasSwitch(switches::kTestType)) { 536 if (!command_line.HasSwitch(switches::kTestType)) {
525 // If we don't have a mounted profile directory we're in trouble. 537 // 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 538 // 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 539 // our profile directory is the one that's mounted, and that it's mounted
528 // as the current user. 540 // as the current user.
529 CHECK(chromeos::CrosLibrary::Get()->GetCryptohomeLibrary()->IsMounted()) 541 chromeos::DBusThreadManager::Get()->GetCryptohomeClient()->IsMounted(
530 << "The cryptohome was not mounted at login."; 542 base::Bind(&CheckCryptohomeIsMounted));
531 543
532 // Confirm that we hadn't loaded the new profile previously. 544 // Confirm that we hadn't loaded the new profile previously.
533 FilePath default_profile_dir = 545 FilePath default_profile_dir =
534 user_data_dir_.Append(GetInitialProfileDir()); 546 user_data_dir_.Append(GetInitialProfileDir());
535 CHECK(!GetProfileByPath(default_profile_dir)) 547 CHECK(!GetProfileByPath(default_profile_dir))
536 << "The default profile was loaded before we mounted the cryptohome."; 548 << "The default profile was loaded before we mounted the cryptohome.";
537 } 549 }
538 return; 550 return;
539 } 551 }
540 #endif 552 #endif
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, 1024 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks,
1013 Profile* profile, 1025 Profile* profile,
1014 Profile::CreateStatus status) { 1026 Profile::CreateStatus status) {
1015 for (size_t i = 0; i < callbacks.size(); ++i) 1027 for (size_t i = 0; i < callbacks.size(); ++i)
1016 callbacks[i].Run(profile, status); 1028 callbacks[i].Run(profile, status);
1017 } 1029 }
1018 1030
1019 ProfileManager::ProfileInfo::~ProfileInfo() { 1031 ProfileManager::ProfileInfo::~ProfileInfo() {
1020 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); 1032 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release());
1021 } 1033 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698