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

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 1087933002: Cross Device Promo - Main Eligibility Flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a flow for when the first listDevices request is scheduled in the future. Tests around the sche… Created 5 years, 7 months 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
OLDNEW
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 <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" 32 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h"
33 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 33 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
34 #include "chrome/browser/profiles/profile_destroyer.h" 34 #include "chrome/browser/profiles/profile_destroyer.h"
35 #include "chrome/browser/profiles/profile_info_cache.h" 35 #include "chrome/browser/profiles/profile_info_cache.h"
36 #include "chrome/browser/profiles/profile_metrics.h" 36 #include "chrome/browser/profiles/profile_metrics.h"
37 #include "chrome/browser/profiles/profiles_state.h" 37 #include "chrome/browser/profiles/profiles_state.h"
38 #include "chrome/browser/profiles/startup_task_runner_service.h" 38 #include "chrome/browser/profiles/startup_task_runner_service.h"
39 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" 39 #include "chrome/browser/profiles/startup_task_runner_service_factory.h"
40 #include "chrome/browser/signin/account_reconcilor_factory.h" 40 #include "chrome/browser/signin/account_reconcilor_factory.h"
41 #include "chrome/browser/signin/account_tracker_service_factory.h" 41 #include "chrome/browser/signin/account_tracker_service_factory.h"
42 #include "chrome/browser/signin/cross_device_promo.h"
43 #include "chrome/browser/signin/cross_device_promo_factory.h"
42 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" 44 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
43 #include "chrome/browser/signin/signin_manager_factory.h" 45 #include "chrome/browser/signin/signin_manager_factory.h"
44 #include "chrome/browser/sync/profile_sync_service.h" 46 #include "chrome/browser/sync/profile_sync_service.h"
45 #include "chrome/browser/sync/profile_sync_service_factory.h" 47 #include "chrome/browser/sync/profile_sync_service_factory.h"
46 #include "chrome/browser/ui/browser.h" 48 #include "chrome/browser/ui/browser.h"
47 #include "chrome/browser/ui/browser_iterator.h" 49 #include "chrome/browser/ui/browser_iterator.h"
48 #include "chrome/browser/ui/sync/sync_promo_ui.h" 50 #include "chrome/browser/ui/sync/sync_promo_ui.h"
49 #include "chrome/common/chrome_constants.h" 51 #include "chrome/common/chrome_constants.h"
50 #include "chrome/common/chrome_paths_internal.h" 52 #include "chrome/common/chrome_paths_internal.h"
51 #include "chrome/common/chrome_switches.h" 53 #include "chrome/common/chrome_switches.h"
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 profile, ServiceAccessType::EXPLICIT_ACCESS).get(); 1215 profile, ServiceAccessType::EXPLICIT_ACCESS).get();
1214 if (password_store.get()) { 1216 if (password_store.get()) {
1215 password_store->RemoveLoginsCreatedBetween(base::Time(), 1217 password_store->RemoveLoginsCreatedBetween(base::Time(),
1216 base::Time::Max()); 1218 base::Time::Max());
1217 } 1219 }
1218 1220
1219 // The Profile Data doesn't get wiped until Chrome closes. Since we promised 1221 // The Profile Data doesn't get wiped until Chrome closes. Since we promised
1220 // that the user's data would be removed, do so immediately. 1222 // that the user's data would be removed, do so immediately.
1221 profiles::RemoveBrowsingDataForProfile(profile_dir); 1223 profiles::RemoveBrowsingDataForProfile(profile_dir);
1222 } else { 1224 } else {
1225 // It is safe to delete a not yet loaded Profile from disk.
1223 BrowserThread::PostTask( 1226 BrowserThread::PostTask(
1224 BrowserThread::FILE, FROM_HERE, 1227 BrowserThread::FILE, FROM_HERE,
1225 base::Bind(&NukeProfileFromDisk, profile_dir)); 1228 base::Bind(&NukeProfileFromDisk, profile_dir));
1226 } 1229 }
1227 1230
1228 // Queue even a profile that was Nuked so it will be MarkedForDeletion and so 1231 // Queue even a profile that was nuked so it will be MarkedForDeletion and so
1229 // CreateProfileAsync can't create it. 1232 // CreateProfileAsync can't create it.
1230 QueueProfileDirectoryForDeletion(profile_dir); 1233 QueueProfileDirectoryForDeletion(profile_dir);
1231 cache.DeleteProfileFromCache(profile_dir); 1234 cache.DeleteProfileFromCache(profile_dir);
1232 ProfileMetrics::UpdateReportedProfilesStatistics(this); 1235 ProfileMetrics::UpdateReportedProfilesStatistics(this);
1233 } 1236 }
1234 1237
1235 ProfileManager::ProfileInfo* ProfileManager::RegisterProfile( 1238 ProfileManager::ProfileInfo* ProfileManager::RegisterProfile(
1236 Profile* profile, 1239 Profile* profile,
1237 bool created) { 1240 bool created) {
1238 TRACE_EVENT0("browser", "ProfileManager::RegisterProfile"); 1241 TRACE_EVENT0("browser", "ProfileManager::RegisterProfile");
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 // Only keep track of profiles that we are managing; tests may create others. 1340 // Only keep track of profiles that we are managing; tests may create others.
1338 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end()) { 1341 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end()) {
1339 std::string profile_path_base = 1342 std::string profile_path_base =
1340 last_active->GetPath().BaseName().MaybeAsASCII(); 1343 last_active->GetPath().BaseName().MaybeAsASCII();
1341 if (profile_path_base != local_state->GetString(prefs::kProfileLastUsed)) 1344 if (profile_path_base != local_state->GetString(prefs::kProfileLastUsed))
1342 local_state->SetString(prefs::kProfileLastUsed, profile_path_base); 1345 local_state->SetString(prefs::kProfileLastUsed, profile_path_base);
1343 1346
1344 ProfileInfoCache& cache = GetProfileInfoCache(); 1347 ProfileInfoCache& cache = GetProfileInfoCache();
1345 size_t profile_index = 1348 size_t profile_index =
1346 cache.GetIndexOfProfileWithPath(last_active->GetPath()); 1349 cache.GetIndexOfProfileWithPath(last_active->GetPath());
1347 if (profile_index != std::string::npos) 1350 if (profile_index != std::string::npos) {
1351 CrossDevicePromoFactory::GetForProfile(last_active)->UpdateLastActiveTime(
1352 cache.GetProfileActiveTimeAtIndex(profile_index));
1348 cache.SetProfileActiveTimeAtIndex(profile_index); 1353 cache.SetProfileActiveTimeAtIndex(profile_index);
1354 }
1349 } 1355 }
1350 } 1356 }
1351 1357
1352 ProfileManager::BrowserListObserver::BrowserListObserver( 1358 ProfileManager::BrowserListObserver::BrowserListObserver(
1353 ProfileManager* manager) 1359 ProfileManager* manager)
1354 : profile_manager_(manager) { 1360 : profile_manager_(manager) {
1355 BrowserList::AddObserver(this); 1361 BrowserList::AddObserver(this);
1356 } 1362 }
1357 1363
1358 ProfileManager::BrowserListObserver::~BrowserListObserver() { 1364 ProfileManager::BrowserListObserver::~BrowserListObserver() {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 } 1429 }
1424 1430
1425 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1431 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1426 if (!original_callback.is_null()) 1432 if (!original_callback.is_null())
1427 original_callback.Run(loaded_profile, status); 1433 original_callback.Run(loaded_profile, status);
1428 } 1434 }
1429 1435
1430 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1436 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1431 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1437 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1432 } 1438 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698