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 |
14 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | |
15 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" | 14 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
16 #include "chrome/browser/chromeos/base/file_flusher.h" | 15 #include "chrome/browser/chromeos/base/file_flusher.h" |
17 #include "chrome/browser/chromeos/login/helper.h" | 16 #include "chrome/browser/chromeos/login/helper.h" |
18 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" | 17 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" |
19 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 18 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
20 #include "chrome/browser/download/download_prefs.h" | 19 #include "chrome/browser/download/download_prefs.h" |
21 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
23 #include "chrome/browser/profiles/profiles_state.h" | 22 #include "chrome/browser/profiles/profiles_state.h" |
24 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
25 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
26 #include "chromeos/chromeos_constants.h" | 25 #include "chromeos/chromeos_constants.h" |
27 #include "chromeos/chromeos_switches.h" | 26 #include "chromeos/chromeos_switches.h" |
28 #include "components/guest_view/browser/guest_view_manager.h" | 27 #include "components/guest_view/browser/guest_view_manager.h" |
29 #include "components/signin/core/account_id/account_id.h" | 28 #include "components/signin/core/account_id/account_id.h" |
30 #include "components/user_manager/user.h" | 29 #include "components/user_manager/user.h" |
31 #include "components/user_manager/user_manager.h" | 30 #include "components/user_manager/user_manager.h" |
32 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
| 32 #include "content/public/browser/browsing_data_remover.h" |
33 #include "content/public/browser/storage_partition.h" | 33 #include "content/public/browser/storage_partition.h" |
34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
35 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 35 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
36 #include "extensions/common/constants.h" | 36 #include "extensions/common/constants.h" |
37 | 37 |
38 namespace chromeos { | 38 namespace chromeos { |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 // As defined in /chromeos/dbus/cryptohome_client.cc. | 42 // As defined in /chromeos/dbus/cryptohome_client.cc. |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 on_clear_profile_stage_finished_ = | 255 on_clear_profile_stage_finished_ = |
256 base::BarrierClosure(2, base::Bind(&ProfileHelper::OnSigninProfileCleared, | 256 base::BarrierClosure(2, base::Bind(&ProfileHelper::OnSigninProfileCleared, |
257 weak_factory_.GetWeakPtr())); | 257 weak_factory_.GetWeakPtr())); |
258 | 258 |
259 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 259 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
260 // Check if signin profile was loaded. | 260 // Check if signin profile was loaded. |
261 if (profile_manager->GetProfileByPath(GetSigninProfileDir())) { | 261 if (profile_manager->GetProfileByPath(GetSigninProfileDir())) { |
262 LOG_ASSERT(!browsing_data_remover_); | 262 LOG_ASSERT(!browsing_data_remover_); |
263 browsing_data_remover_ = | 263 browsing_data_remover_ = |
264 BrowsingDataRemoverFactory::GetForBrowserContext(GetSigninProfile()); | 264 content::BrowserContext::GetBrowsingDataRemover(GetSigninProfile()); |
265 browsing_data_remover_->AddObserver(this); | 265 browsing_data_remover_->AddObserver(this); |
266 browsing_data_remover_->RemoveAndReply( | 266 browsing_data_remover_->RemoveAndReply( |
267 base::Time(), base::Time::Max(), | 267 base::Time(), base::Time::Max(), |
268 ChromeBrowsingDataRemoverDelegate::DATA_TYPE_SITE_DATA, | 268 ChromeBrowsingDataRemoverDelegate::DATA_TYPE_SITE_DATA, |
269 ChromeBrowsingDataRemoverDelegate::ALL_ORIGIN_TYPES, this); | 269 ChromeBrowsingDataRemoverDelegate::ALL_ORIGIN_TYPES, this); |
270 } else { | 270 } else { |
271 on_clear_profile_stage_finished_.Run(); | 271 on_clear_profile_stage_finished_.Run(); |
272 } | 272 } |
273 | 273 |
274 if (content::StoragePartition* partition = login::GetSigninPartition()) { | 274 if (content::StoragePartition* partition = login::GetSigninPartition()) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 void ProfileHelper::OnSigninProfileCleared() { | 396 void ProfileHelper::OnSigninProfileCleared() { |
397 std::vector<base::Closure> callbacks; | 397 std::vector<base::Closure> callbacks; |
398 callbacks.swap(on_clear_callbacks_); | 398 callbacks.swap(on_clear_callbacks_); |
399 for (const base::Closure& callback : callbacks) { | 399 for (const base::Closure& callback : callbacks) { |
400 if (!callback.is_null()) | 400 if (!callback.is_null()) |
401 callback.Run(); | 401 callback.Run(); |
402 } | 402 } |
403 } | 403 } |
404 | 404 |
405 //////////////////////////////////////////////////////////////////////////////// | 405 //////////////////////////////////////////////////////////////////////////////// |
406 // ProfileHelper, BrowsingDataRemover::Observer implementation: | 406 // ProfileHelper, content::BrowsingDataRemover::Observer implementation: |
407 | 407 |
408 void ProfileHelper::OnBrowsingDataRemoverDone() { | 408 void ProfileHelper::OnBrowsingDataRemoverDone() { |
409 LOG_ASSERT(browsing_data_remover_); | 409 LOG_ASSERT(browsing_data_remover_); |
410 browsing_data_remover_->RemoveObserver(this); | 410 browsing_data_remover_->RemoveObserver(this); |
411 browsing_data_remover_ = nullptr; | 411 browsing_data_remover_ = nullptr; |
412 | 412 |
413 on_clear_profile_stage_finished_.Run(); | 413 on_clear_profile_stage_finished_.Run(); |
414 } | 414 } |
415 | 415 |
416 //////////////////////////////////////////////////////////////////////////////// | 416 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 DownloadPrefs::FromBrowserContext(profile)->DownloadPath()); | 493 DownloadPrefs::FromBrowserContext(profile)->DownloadPath()); |
494 // Let extension system handle extension files. | 494 // Let extension system handle extension files. |
495 excludes.push_back(base::FilePath(extensions::kInstallDirectoryName)); | 495 excludes.push_back(base::FilePath(extensions::kInstallDirectoryName)); |
496 // Do not flush Drive cache. | 496 // Do not flush Drive cache. |
497 excludes.push_back(base::FilePath(chromeos::kDriveCacheDirname)); | 497 excludes.push_back(base::FilePath(chromeos::kDriveCacheDirname)); |
498 | 498 |
499 profile_flusher_->RequestFlush(profile->GetPath(), excludes, base::Closure()); | 499 profile_flusher_->RequestFlush(profile->GetPath(), excludes, base::Closure()); |
500 } | 500 } |
501 | 501 |
502 } // namespace chromeos | 502 } // namespace chromeos |
OLD | NEW |