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

Side by Side Diff: chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc

Issue 834073002: ChromeOS: Implement periodic timezone refresh on geolocation data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/login/users/chrome_user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h" 29 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h"
30 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" 30 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h"
31 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" 31 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h"
32 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" 32 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
33 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" 33 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h"
34 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 34 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
35 #include "chrome/browser/chromeos/policy/device_local_account.h" 35 #include "chrome/browser/chromeos/policy/device_local_account.h"
36 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog. h" 36 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog. h"
37 #include "chrome/browser/chromeos/profiles/profile_helper.h" 37 #include "chrome/browser/chromeos/profiles/profile_helper.h"
38 #include "chrome/browser/chromeos/session_length_limiter.h" 38 #include "chrome/browser/chromeos/session_length_limiter.h"
39 #include "chrome/browser/chromeos/system/timezone_util.h"
39 #include "chrome/browser/profiles/profile.h" 40 #include "chrome/browser/profiles/profile.h"
40 #include "chrome/browser/signin/easy_unlock_service.h" 41 #include "chrome/browser/signin/easy_unlock_service.h"
41 #include "chrome/browser/supervised_user/chromeos/manager_password_service_facto ry.h" 42 #include "chrome/browser/supervised_user/chromeos/manager_password_service_facto ry.h"
42 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_servi ce_factory.h" 43 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_servi ce_factory.h"
43 #include "chrome/common/chrome_constants.h" 44 #include "chrome/common/chrome_constants.h"
44 #include "chrome/common/chrome_switches.h" 45 #include "chrome/common/chrome_switches.h"
45 #include "chrome/common/crash_keys.h" 46 #include "chrome/common/crash_keys.h"
46 #include "chrome/common/pref_names.h" 47 #include "chrome/common/pref_names.h"
47 #include "chrome/grit/theme_resources.h" 48 #include "chrome/grit/theme_resources.h"
48 #include "chromeos/chromeos_switches.h" 49 #include "chromeos/chromeos_switches.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 SupervisedUserPasswordServiceFactory::GetForProfile(profile); 372 SupervisedUserPasswordServiceFactory::GetForProfile(profile);
372 if (IsLoggedInAsUserWithGaiaAccount()) 373 if (IsLoggedInAsUserWithGaiaAccount())
373 ManagerPasswordServiceFactory::GetForProfile(profile); 374 ManagerPasswordServiceFactory::GetForProfile(profile);
374 375
375 if (!profile->IsOffTheRecord()) { 376 if (!profile->IsOffTheRecord()) {
376 AuthSyncObserver* sync_observer = 377 AuthSyncObserver* sync_observer =
377 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile); 378 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile);
378 sync_observer->StartObserving(); 379 sync_observer->StartObserving();
379 multi_profile_user_controller_->StartObserving(profile); 380 multi_profile_user_controller_->StartObserving(profile);
380 } 381 }
382 StartUserTimeZoneRefresh(profile);
Dmitry Polukhin 2015/01/20 15:32:28 I think in Guest mode we don't need to refresh tim
Alexander Alekseev 2015/01/22 18:55:22 Done.
381 } 383 }
382 break; 384 break;
383 } 385 }
384 case chrome::NOTIFICATION_PROFILE_CREATED: { 386 case chrome::NOTIFICATION_PROFILE_CREATED: {
385 Profile* profile = content::Source<Profile>(source).ptr(); 387 Profile* profile = content::Source<Profile>(source).ptr();
386 user_manager::User* user = 388 user_manager::User* user =
387 ProfileHelper::Get()->GetUserByProfile(profile); 389 ProfileHelper::Get()->GetUserByProfile(profile);
388 if (user != NULL) 390 if (user != NULL)
389 user->set_profile_is_created(); 391 user->set_profile_is_created();
390 392
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) 1072 if ((users + GetUsersAllowedForMultiProfile().size()) > 1)
1071 ash::MultiProfileUMA::RecordUserCount(users); 1073 ash::MultiProfileUMA::RecordUserCount(users);
1072 } 1074 }
1073 #endif 1075 #endif
1074 1076
1075 base::debug::SetCrashKeyValue( 1077 base::debug::SetCrashKeyValue(
1076 crash_keys::kNumberOfUsers, 1078 crash_keys::kNumberOfUsers,
1077 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); 1079 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size()));
1078 } 1080 }
1079 1081
1082 void ChromeUserManagerImpl::StartUserTimeZoneRefresh(Profile* profile) {
1083 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1084 chromeos::switches::kEnableTimeZoneTrackingOption)) {
1085 return;
1086 }
1087
1088 if (profile->GetPrefs()->GetBoolean(prefs::kResolveTimezoneByGeolocation) &&
1089 !system::HasSystemTimezonePolicy()) {
1090 g_browser_process->platform_part()->timezone_resolver()->Start();
1091 } else {
1092 g_browser_process->platform_part()->timezone_resolver()->Stop();
1093 }
1094 }
1095
1080 } // namespace chromeos 1096 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698