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

Side by Side Diff: chrome/browser/chromeos/profiles/profile_helper.cc

Issue 2587853003: cros: Fix CrashRestoreComplexTest failure (Closed)
Patch Set: add comment Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/profiles/profile_helper.h" 5 #include "chrome/browser/chromeos/profiles/profile_helper.h"
6 6
7 #include "base/barrier_closure.h" 7 #include "base/barrier_closure.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // and don't really care about mapping to the real user. 359 // and don't really care about mapping to the real user.
360 // Without multi-profiles on Chrome OS such tests always got active_user_. 360 // Without multi-profiles on Chrome OS such tests always got active_user_.
361 // Now these tests will specify special flag to continue working. 361 // Now these tests will specify special flag to continue working.
362 // In future those tests can get a proper CrOS configuration i.e. register 362 // In future those tests can get a proper CrOS configuration i.e. register
363 // and login several users if they want to work with an additional profile. 363 // and login several users if they want to work with an additional profile.
364 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 364 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
365 switches::kIgnoreUserProfileMappingForTests)) { 365 switches::kIgnoreUserProfileMappingForTests)) {
366 return user_manager->GetActiveUser(); 366 return user_manager->GetActiveUser();
367 } 367 }
368 368
369 // Finds the matching user in logged-in user list since only a logged-in
370 // user would have a profile.
369 const std::string username_hash = 371 const std::string username_hash =
370 ProfileHelper::GetUserIdHashFromProfile(profile); 372 ProfileHelper::GetUserIdHashFromProfile(profile);
371 const user_manager::UserList& users = user_manager->GetUsers(); 373 const user_manager::UserList& users = user_manager->GetLoggedInUsers();
372 const user_manager::UserList::const_iterator pos = std::find_if( 374 const user_manager::UserList::const_iterator pos = std::find_if(
373 users.begin(), users.end(), UsernameHashMatcher(username_hash)); 375 users.begin(), users.end(), UsernameHashMatcher(username_hash));
374 if (pos != users.end()) 376 if (pos != users.end())
375 return *pos; 377 return *pos;
376 378
377 // Many tests do not have their users registered with UserManager and 379 // Many tests do not have their users registered with UserManager and
378 // runs here. If |active_user_| matches |profile|, returns it. 380 // runs here. If |active_user_| matches |profile|, returns it.
379 const user_manager::User* active_user = user_manager->GetActiveUser(); 381 const user_manager::User* active_user = user_manager->GetActiveUser();
380 return active_user && 382 return active_user &&
381 ProfileHelper::GetProfilePathByUserIdHash( 383 ProfileHelper::GetProfilePathByUserIdHash(
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 DownloadPrefs::FromBrowserContext(profile)->DownloadPath()); 491 DownloadPrefs::FromBrowserContext(profile)->DownloadPath());
490 // Let extension system handle extension files. 492 // Let extension system handle extension files.
491 excludes.push_back(base::FilePath(extensions::kInstallDirectoryName)); 493 excludes.push_back(base::FilePath(extensions::kInstallDirectoryName));
492 // Do not flush Drive cache. 494 // Do not flush Drive cache.
493 excludes.push_back(base::FilePath(chromeos::kDriveCacheDirname)); 495 excludes.push_back(base::FilePath(chromeos::kDriveCacheDirname));
494 496
495 profile_flusher_->RequestFlush(profile->GetPath(), excludes, base::Closure()); 497 profile_flusher_->RequestFlush(profile->GetPath(), excludes, base::Closure());
496 } 498 }
497 499
498 } // namespace chromeos 500 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698