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" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 12 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
13 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 13 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
14 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 14 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 15 #include "chrome/browser/browsing_data/chrome_browsing_data_types.h" |
15 #include "chrome/browser/chromeos/base/file_flusher.h" | 16 #include "chrome/browser/chromeos/base/file_flusher.h" |
16 #include "chrome/browser/chromeos/login/helper.h" | 17 #include "chrome/browser/chromeos/login/helper.h" |
17 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" | 18 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" |
18 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 19 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
19 #include "chrome/browser/download/download_prefs.h" | 20 #include "chrome/browser/download/download_prefs.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
22 #include "chrome/browser/profiles/profiles_state.h" | 23 #include "chrome/browser/profiles/profiles_state.h" |
23 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 base::BarrierClosure(2, base::Bind(&ProfileHelper::OnSigninProfileCleared, | 256 base::BarrierClosure(2, base::Bind(&ProfileHelper::OnSigninProfileCleared, |
256 weak_factory_.GetWeakPtr())); | 257 weak_factory_.GetWeakPtr())); |
257 | 258 |
258 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 259 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
259 // Check if signin profile was loaded. | 260 // Check if signin profile was loaded. |
260 if (profile_manager->GetProfileByPath(GetSigninProfileDir())) { | 261 if (profile_manager->GetProfileByPath(GetSigninProfileDir())) { |
261 LOG_ASSERT(!browsing_data_remover_); | 262 LOG_ASSERT(!browsing_data_remover_); |
262 browsing_data_remover_ = | 263 browsing_data_remover_ = |
263 BrowsingDataRemoverFactory::GetForBrowserContext(GetSigninProfile()); | 264 BrowsingDataRemoverFactory::GetForBrowserContext(GetSigninProfile()); |
264 browsing_data_remover_->AddObserver(this); | 265 browsing_data_remover_->AddObserver(this); |
265 browsing_data_remover_->RemoveAndReply( | 266 browsing_data_remover_->RemoveAndReply(base::Time(), base::Time::Max(), |
266 base::Time(), base::Time::Max(), BrowsingDataRemover::REMOVE_SITE_DATA, | 267 BrowsingDataTypeSetSiteData(), |
267 BrowsingDataHelper::ALL, this); | 268 BrowsingDataHelper::ALL, this); |
268 } else { | 269 } else { |
269 on_clear_profile_stage_finished_.Run(); | 270 on_clear_profile_stage_finished_.Run(); |
270 } | 271 } |
271 | 272 |
272 if (content::StoragePartition* partition = login::GetSigninPartition()) { | 273 if (content::StoragePartition* partition = login::GetSigninPartition()) { |
273 partition->ClearData( | 274 partition->ClearData( |
274 content::StoragePartition::REMOVE_DATA_MASK_ALL, | 275 content::StoragePartition::REMOVE_DATA_MASK_ALL, |
275 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, GURL(), | 276 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, GURL(), |
276 content::StoragePartition::OriginMatcherFunction(), base::Time(), | 277 content::StoragePartition::OriginMatcherFunction(), base::Time(), |
277 base::Time::Now(), on_clear_profile_stage_finished_); | 278 base::Time::Now(), on_clear_profile_stage_finished_); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 DownloadPrefs::FromBrowserContext(profile)->DownloadPath()); | 492 DownloadPrefs::FromBrowserContext(profile)->DownloadPath()); |
492 // Let extension system handle extension files. | 493 // Let extension system handle extension files. |
493 excludes.push_back(base::FilePath(extensions::kInstallDirectoryName)); | 494 excludes.push_back(base::FilePath(extensions::kInstallDirectoryName)); |
494 // Do not flush Drive cache. | 495 // Do not flush Drive cache. |
495 excludes.push_back(base::FilePath(chromeos::kDriveCacheDirname)); | 496 excludes.push_back(base::FilePath(chromeos::kDriveCacheDirname)); |
496 | 497 |
497 profile_flusher_->RequestFlush(profile->GetPath(), excludes, base::Closure()); | 498 profile_flusher_->RequestFlush(profile->GetPath(), excludes, base::Closure()); |
498 } | 499 } |
499 | 500 |
500 } // namespace chromeos | 501 } // namespace chromeos |
OLD | NEW |