OLD | NEW |
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 "chrome/browser/profiles/profile_manager.h" | 5 #include "chrome/browser/profiles/profile_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "chrome/browser/profiles/profiles_state.h" | 47 #include "chrome/browser/profiles/profiles_state.h" |
48 #include "chrome/browser/signin/account_fetcher_service_factory.h" | 48 #include "chrome/browser/signin/account_fetcher_service_factory.h" |
49 #include "chrome/browser/signin/account_reconcilor_factory.h" | 49 #include "chrome/browser/signin/account_reconcilor_factory.h" |
50 #include "chrome/browser/signin/account_tracker_service_factory.h" | 50 #include "chrome/browser/signin/account_tracker_service_factory.h" |
51 #include "chrome/browser/signin/cross_device_promo.h" | 51 #include "chrome/browser/signin/cross_device_promo.h" |
52 #include "chrome/browser/signin/cross_device_promo_factory.h" | 52 #include "chrome/browser/signin/cross_device_promo_factory.h" |
53 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" | 53 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" |
54 #include "chrome/browser/signin/signin_manager_factory.h" | 54 #include "chrome/browser/signin/signin_manager_factory.h" |
55 #include "chrome/browser/sync/profile_sync_service_factory.h" | 55 #include "chrome/browser/sync/profile_sync_service_factory.h" |
56 #include "chrome/browser/ui/browser.h" | 56 #include "chrome/browser/ui/browser.h" |
57 #include "chrome/browser/ui/browser_iterator.h" | 57 #include "chrome/browser/ui/browser_list.h" |
58 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 58 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
59 #include "chrome/common/chrome_constants.h" | 59 #include "chrome/common/chrome_constants.h" |
60 #include "chrome/common/chrome_paths_internal.h" | 60 #include "chrome/common/chrome_paths_internal.h" |
61 #include "chrome/common/chrome_switches.h" | 61 #include "chrome/common/chrome_switches.h" |
62 #include "chrome/common/logging_chrome.h" | 62 #include "chrome/common/logging_chrome.h" |
63 #include "chrome/common/pref_names.h" | 63 #include "chrome/common/pref_names.h" |
64 #include "chrome/common/url_constants.h" | 64 #include "chrome/common/url_constants.h" |
65 #include "chrome/grit/generated_resources.h" | 65 #include "chrome/grit/generated_resources.h" |
66 #include "components/bookmarks/browser/bookmark_model.h" | 66 #include "components/bookmarks/browser/bookmark_model.h" |
67 #include "components/bookmarks/browser/startup_task_runner_service.h" | 67 #include "components/bookmarks/browser/startup_task_runner_service.h" |
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 } | 1478 } |
1479 | 1479 |
1480 void ProfileManager::BrowserListObserver::OnBrowserAdded( | 1480 void ProfileManager::BrowserListObserver::OnBrowserAdded( |
1481 Browser* browser) {} | 1481 Browser* browser) {} |
1482 | 1482 |
1483 void ProfileManager::BrowserListObserver::OnBrowserRemoved( | 1483 void ProfileManager::BrowserListObserver::OnBrowserRemoved( |
1484 Browser* browser) { | 1484 Browser* browser) { |
1485 Profile* profile = browser->profile(); | 1485 Profile* profile = browser->profile(); |
1486 Profile* original_profile = profile->GetOriginalProfile(); | 1486 Profile* original_profile = profile->GetOriginalProfile(); |
1487 // Do nothing if the closed window is not the last window of the same profile. | 1487 // Do nothing if the closed window is not the last window of the same profile. |
1488 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 1488 for (auto* browser : *BrowserList::GetInstance()) { |
1489 if (it->profile()->GetOriginalProfile() == original_profile) | 1489 if (browser->profile()->GetOriginalProfile() == original_profile) |
1490 return; | 1490 return; |
1491 } | 1491 } |
1492 | 1492 |
1493 base::FilePath path = profile->GetPath(); | 1493 base::FilePath path = profile->GetPath(); |
1494 if (IsProfileMarkedForDeletion(path)) { | 1494 if (IsProfileMarkedForDeletion(path)) { |
1495 // Do nothing if the profile is already being deleted. | 1495 // Do nothing if the profile is already being deleted. |
1496 } else if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles)) { | 1496 } else if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles)) { |
1497 // Delete if the profile is an ephemeral profile. | 1497 // Delete if the profile is an ephemeral profile. |
1498 g_browser_process->profile_manager()->ScheduleProfileForDeletion( | 1498 g_browser_process->profile_manager()->ScheduleProfileForDeletion( |
1499 path, ProfileManager::CreateCallback()); | 1499 path, ProfileManager::CreateCallback()); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 | 1548 |
1549 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); | 1549 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); |
1550 if (!original_callback.is_null()) | 1550 if (!original_callback.is_null()) |
1551 original_callback.Run(loaded_profile, status); | 1551 original_callback.Run(loaded_profile, status); |
1552 } | 1552 } |
1553 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 1553 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
1554 | 1554 |
1555 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1555 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1556 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1556 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1557 } | 1557 } |
OLD | NEW |