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

Side by Side Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 2570573002: Convert RLZ to a buildflag header (Closed)
Patch Set: iOS Created 4 years 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/session/user_session_manager.h" 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 #include "components/user_manager/known_user.h" 107 #include "components/user_manager/known_user.h"
108 #include "components/user_manager/user.h" 108 #include "components/user_manager/user.h"
109 #include "components/user_manager/user_manager.h" 109 #include "components/user_manager/user_manager.h"
110 #include "components/user_manager/user_names.h" 110 #include "components/user_manager/user_names.h"
111 #include "components/user_manager/user_type.h" 111 #include "components/user_manager/user_type.h"
112 #include "content/public/browser/browser_thread.h" 112 #include "content/public/browser/browser_thread.h"
113 #include "content/public/browser/notification_service.h" 113 #include "content/public/browser/notification_service.h"
114 #include "content/public/browser/storage_partition.h" 114 #include "content/public/browser/storage_partition.h"
115 #include "content/public/common/content_switches.h" 115 #include "content/public/common/content_switches.h"
116 #include "net/cert/sth_distributor.h" 116 #include "net/cert/sth_distributor.h"
117 #include "rlz/features/features.h"
117 #include "ui/base/ime/chromeos/input_method_descriptor.h" 118 #include "ui/base/ime/chromeos/input_method_descriptor.h"
118 #include "ui/base/ime/chromeos/input_method_manager.h" 119 #include "ui/base/ime/chromeos/input_method_manager.h"
119 #include "url/gurl.h" 120 #include "url/gurl.h"
120 121
121 #if defined(ENABLE_RLZ) 122 #if BUILDFLAG(ENABLE_RLZ)
122 #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h" 123 #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h"
123 #include "components/rlz/rlz_tracker.h" 124 #include "components/rlz/rlz_tracker.h"
124 #endif 125 #endif
125 126
126 namespace chromeos { 127 namespace chromeos {
127 128
128 namespace { 129 namespace {
129 130
130 // Milliseconds until we timeout our attempt to fetch flags from the child 131 // Milliseconds until we timeout our attempt to fetch flags from the child
131 // account service. 132 // account service.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 236
236 // Save the preferred languages in the user's preferences. 237 // Save the preferred languages in the user's preferences.
237 prefs->SetString(prefs::kLanguagePreferredLanguages, 238 prefs->SetString(prefs::kLanguagePreferredLanguages,
238 base::JoinString(language_codes, ",")); 239 base::JoinString(language_codes, ","));
239 240
240 // Indicate that we need to merge the syncable input methods when we sync, 241 // Indicate that we need to merge the syncable input methods when we sync,
241 // since we have not applied the synced prefs before. 242 // since we have not applied the synced prefs before.
242 prefs->SetBoolean(prefs::kLanguageShouldMergeInputMethods, true); 243 prefs->SetBoolean(prefs::kLanguageShouldMergeInputMethods, true);
243 } 244 }
244 245
245 #if defined(ENABLE_RLZ) 246 #if BUILDFLAG(ENABLE_RLZ)
246 // Flag file that disables RLZ tracking, when present. 247 // Flag file that disables RLZ tracking, when present.
247 const base::FilePath::CharType kRLZDisabledFlagName[] = 248 const base::FilePath::CharType kRLZDisabledFlagName[] =
248 FILE_PATH_LITERAL(".rlz_disabled"); 249 FILE_PATH_LITERAL(".rlz_disabled");
249 250
250 base::FilePath GetRlzDisabledFlagPath() { 251 base::FilePath GetRlzDisabledFlagPath() {
251 base::FilePath homedir; 252 base::FilePath homedir;
252 PathService::Get(base::DIR_HOME, &homedir); 253 PathService::Get(base::DIR_HOME, &homedir);
253 return homedir.Append(kRLZDisabledFlagName); 254 return homedir.Append(kRLZDisabledFlagName);
254 } 255 }
255 #endif 256 #endif
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 549 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
549 return user_sessions_restored_; 550 return user_sessions_restored_;
550 } 551 }
551 552
552 bool UserSessionManager::UserSessionsRestoreInProgress() const { 553 bool UserSessionManager::UserSessionsRestoreInProgress() const {
553 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 554 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
554 return user_sessions_restore_in_progress_; 555 return user_sessions_restore_in_progress_;
555 } 556 }
556 557
557 void UserSessionManager::InitRlz(Profile* profile) { 558 void UserSessionManager::InitRlz(Profile* profile) {
558 #if defined(ENABLE_RLZ) 559 #if BUILDFLAG(ENABLE_RLZ)
559 if (!g_browser_process->local_state()->HasPrefPath(prefs::kRLZBrand)) { 560 if (!g_browser_process->local_state()->HasPrefPath(prefs::kRLZBrand)) {
560 // Read brand code asynchronously from an OEM data and repost ourselves. 561 // Read brand code asynchronously from an OEM data and repost ourselves.
561 google_brand::chromeos::InitBrand( 562 google_brand::chromeos::InitBrand(
562 base::Bind(&UserSessionManager::InitRlz, AsWeakPtr(), profile)); 563 base::Bind(&UserSessionManager::InitRlz, AsWeakPtr(), profile));
563 return; 564 return;
564 } 565 }
565 base::PostTaskWithTraitsAndReplyWithResult( 566 base::PostTaskWithTraitsAndReplyWithResult(
566 FROM_HERE, base::TaskTraits() 567 FROM_HERE, base::TaskTraits()
567 .WithShutdownBehavior( 568 .WithShutdownBehavior(
568 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) 569 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 auth_request_context = 1348 auth_request_context =
1348 content::BrowserContext::GetDefaultStoragePartition( 1349 content::BrowserContext::GetDefaultStoragePartition(
1349 authenticator_->authentication_context())->GetURLRequestContext(); 1350 authenticator_->authentication_context())->GetURLRequestContext();
1350 } 1351 }
1351 login_manager->RestoreSession(auth_request_context, session_restore_strategy_, 1352 login_manager->RestoreSession(auth_request_context, session_restore_strategy_,
1352 user_context_.GetRefreshToken(), 1353 user_context_.GetRefreshToken(),
1353 user_context_.GetAccessToken()); 1354 user_context_.GetAccessToken());
1354 } 1355 }
1355 1356
1356 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) { 1357 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) {
1357 #if defined(ENABLE_RLZ) 1358 #if BUILDFLAG(ENABLE_RLZ)
1358 PrefService* local_state = g_browser_process->local_state(); 1359 PrefService* local_state = g_browser_process->local_state();
1359 if (disabled) { 1360 if (disabled) {
1360 // Empty brand code means an organic install (no RLZ pings are sent). 1361 // Empty brand code means an organic install (no RLZ pings are sent).
1361 google_brand::chromeos::ClearBrandForCurrentSession(); 1362 google_brand::chromeos::ClearBrandForCurrentSession();
1362 } 1363 }
1363 if (disabled != local_state->GetBoolean(prefs::kRLZDisabled)) { 1364 if (disabled != local_state->GetBoolean(prefs::kRLZDisabled)) {
1364 // When switching to RLZ enabled/disabled state, clear all recorded events. 1365 // When switching to RLZ enabled/disabled state, clear all recorded events.
1365 rlz::RLZTracker::ClearRlzState(); 1366 rlz::RLZTracker::ClearRlzState();
1366 local_state->SetBoolean(prefs::kRLZDisabled, disabled); 1367 local_state->SetBoolean(prefs::kRLZDisabled, disabled);
1367 } 1368 }
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 ->browser_policy_connector_chromeos() 1839 ->browser_policy_connector_chromeos()
1839 ->IsEnterpriseManaged()) { 1840 ->IsEnterpriseManaged()) {
1840 return false; 1841 return false;
1841 } 1842 }
1842 1843
1843 // Do not show end of life notification if this is a guest session 1844 // Do not show end of life notification if this is a guest session
1844 return !profile->IsGuestSession(); 1845 return !profile->IsGuestSession();
1845 } 1846 }
1846 1847
1847 } // namespace chromeos 1848 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_utils_browsertest.cc ('k') | chrome/browser/extensions/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698