OLD | NEW |
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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 if (it != user_list_for_testing_.end()) | 468 if (it != user_list_for_testing_.end()) |
469 user_list_for_testing_.erase(it); | 469 user_list_for_testing_.erase(it); |
470 } | 470 } |
471 | 471 |
472 // static | 472 // static |
473 std::string ProfileHelper::GetUserIdHashByUserIdForTesting( | 473 std::string ProfileHelper::GetUserIdHashByUserIdForTesting( |
474 const std::string& user_id) { | 474 const std::string& user_id) { |
475 return user_id + kUserIdHashSuffix; | 475 return user_id + kUserIdHashSuffix; |
476 } | 476 } |
477 | 477 |
| 478 void ProfileHelper::SetActiveUserIdForTesting(const std::string& user_id) { |
| 479 active_user_id_hash_ = GetUserIdHashByUserIdForTesting(user_id); |
| 480 } |
| 481 |
478 void ProfileHelper::FlushProfile(Profile* profile) { | 482 void ProfileHelper::FlushProfile(Profile* profile) { |
479 if (!profile_flusher_) | 483 if (!profile_flusher_) |
480 profile_flusher_.reset(new FileFlusher); | 484 profile_flusher_.reset(new FileFlusher); |
481 | 485 |
482 // Files/directories that do not need to be flushed. | 486 // Files/directories that do not need to be flushed. |
483 std::vector<base::FilePath> excludes; | 487 std::vector<base::FilePath> excludes; |
484 | 488 |
485 // Preferences file is handled by ImportantFileWriter. | 489 // Preferences file is handled by ImportantFileWriter. |
486 excludes.push_back(base::FilePath(chrome::kPreferencesFilename)); | 490 excludes.push_back(base::FilePath(chrome::kPreferencesFilename)); |
487 // Do not flush cache files. | 491 // Do not flush cache files. |
488 excludes.push_back(base::FilePath(chrome::kCacheDirname)); | 492 excludes.push_back(base::FilePath(chrome::kCacheDirname)); |
489 excludes.push_back(base::FilePath(chrome::kMediaCacheDirname)); | 493 excludes.push_back(base::FilePath(chrome::kMediaCacheDirname)); |
490 excludes.push_back(base::FilePath(FILE_PATH_LITERAL("GPUCache"))); | 494 excludes.push_back(base::FilePath(FILE_PATH_LITERAL("GPUCache"))); |
491 // Do not flush user Downloads. | 495 // Do not flush user Downloads. |
492 excludes.push_back( | 496 excludes.push_back( |
493 DownloadPrefs::FromBrowserContext(profile)->DownloadPath()); | 497 DownloadPrefs::FromBrowserContext(profile)->DownloadPath()); |
494 // Let extension system handle extension files. | 498 // Let extension system handle extension files. |
495 excludes.push_back(base::FilePath(extensions::kInstallDirectoryName)); | 499 excludes.push_back(base::FilePath(extensions::kInstallDirectoryName)); |
496 // Do not flush Drive cache. | 500 // Do not flush Drive cache. |
497 excludes.push_back(base::FilePath(chromeos::kDriveCacheDirname)); | 501 excludes.push_back(base::FilePath(chromeos::kDriveCacheDirname)); |
498 | 502 |
499 profile_flusher_->RequestFlush(profile->GetPath(), excludes, base::Closure()); | 503 profile_flusher_->RequestFlush(profile->GetPath(), excludes, base::Closure()); |
500 } | 504 } |
501 | 505 |
502 } // namespace chromeos | 506 } // namespace chromeos |
OLD | NEW |