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

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

Issue 2878233003: Add CHECK on session start for profile construction (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | components/session_manager/core/session_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/environment.h" 17 #include "base/environment.h"
18 #include "base/files/file_path.h" 18 #include "base/files/file_path.h"
19 #include "base/files/file_util.h" 19 #include "base/files/file_util.h"
20 #include "base/logging.h"
20 #include "base/memory/ptr_util.h" 21 #include "base/memory/ptr_util.h"
21 #include "base/memory/weak_ptr.h" 22 #include "base/memory/weak_ptr.h"
22 #include "base/metrics/histogram_macros.h" 23 #include "base/metrics/histogram_macros.h"
23 #include "base/path_service.h" 24 #include "base/path_service.h"
24 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
25 #include "base/strings/string_util.h" 26 #include "base/strings/string_util.h"
26 #include "base/strings/stringprintf.h" 27 #include "base/strings/stringprintf.h"
27 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
28 #include "base/synchronization/waitable_event.h" 29 #include "base/synchronization/waitable_event.h"
29 #include "base/threading/sequenced_worker_pool.h" 30 #include "base/threading/sequenced_worker_pool.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 #include "services/identity/identity_service.h" 122 #include "services/identity/identity_service.h"
122 #include "services/identity/public/interfaces/constants.mojom.h" 123 #include "services/identity/public/interfaces/constants.mojom.h"
123 #include "services/preferences/public/cpp/pref_service_main.h" 124 #include "services/preferences/public/cpp/pref_service_main.h"
124 #include "services/preferences/public/interfaces/preferences.mojom.h" 125 #include "services/preferences/public/interfaces/preferences.mojom.h"
125 #include "services/preferences/public/interfaces/tracked_preference_validation_d elegate.mojom.h" 126 #include "services/preferences/public/interfaces/tracked_preference_validation_d elegate.mojom.h"
126 #include "services/service_manager/public/cpp/service.h" 127 #include "services/service_manager/public/cpp/service.h"
127 #include "ui/base/l10n/l10n_util.h" 128 #include "ui/base/l10n/l10n_util.h"
128 129
129 #if defined(OS_CHROMEOS) 130 #if defined(OS_CHROMEOS)
130 #include "chrome/browser/chromeos/locale_change_guard.h" 131 #include "chrome/browser/chromeos/locale_change_guard.h"
132 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
133 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
134 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h"
131 #include "chrome/browser/chromeos/preferences.h" 135 #include "chrome/browser/chromeos/preferences.h"
132 #include "chrome/browser/chromeos/profiles/profile_helper.h" 136 #include "chrome/browser/chromeos/profiles/profile_helper.h"
133 #include "chrome/browser/chromeos/settings/device_settings_service.h" 137 #include "chrome/browser/chromeos/settings/device_settings_service.h"
138 #include "components/session_manager/core/session_manager.h"
139 #include "components/user_manager/user.h"
134 #include "components/user_manager/user_manager.h" 140 #include "components/user_manager/user_manager.h"
135 #endif 141 #endif
136 142
137 #if BUILDFLAG(ENABLE_BACKGROUND) 143 #if BUILDFLAG(ENABLE_BACKGROUND)
138 #include "chrome/browser/background/background_mode_manager.h" 144 #include "chrome/browser/background/background_mode_manager.h"
139 #endif 145 #endif
140 146
141 #if defined(OS_CHROMEOS) 147 #if !defined(OS_CHROMEOS)
142 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
143 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
144 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h"
145 #else
146 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" 148 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
147 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" 149 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
148 #endif 150 #endif
149 151
150 #if BUILDFLAG(ENABLE_EXTENSIONS) 152 #if BUILDFLAG(ENABLE_EXTENSIONS)
151 #include "chrome/browser/extensions/extension_service.h" 153 #include "chrome/browser/extensions/extension_service.h"
152 #include "chrome/browser/extensions/extension_special_storage_policy.h" 154 #include "chrome/browser/extensions/extension_special_storage_policy.h"
153 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 155 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
154 #include "components/guest_view/browser/guest_view_manager.h" 156 #include "components/guest_view/browser/guest_view_manager.h"
155 #include "extensions/browser/extension_pref_store.h" 157 #include "extensions/browser/extension_pref_store.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 pref_registry_(new user_prefs::PrefRegistrySyncable), 419 pref_registry_(new user_prefs::PrefRegistrySyncable),
418 io_data_(this), 420 io_data_(this),
419 last_session_exit_type_(EXIT_NORMAL), 421 last_session_exit_type_(EXIT_NORMAL),
420 start_time_(Time::Now()), 422 start_time_(Time::Now()),
421 delegate_(delegate), 423 delegate_(delegate),
422 predictor_(NULL) { 424 predictor_(NULL) {
423 TRACE_EVENT0("browser,startup", "ProfileImpl::ctor") 425 TRACE_EVENT0("browser,startup", "ProfileImpl::ctor")
424 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << 426 DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
425 "profile files to the root directory!"; 427 "profile files to the root directory!";
426 428
429 #if defined(OS_CHROMEOS)
430 if (!chromeos::ProfileHelper::IsSigninProfile(this)) {
431 const user_manager::User* user =
432 chromeos::ProfileHelper::Get()->GetUserByProfile(this);
433 // A |User| instance should always exist for a profile which is not the
434 // initial or the sign-in profile.
435 CHECK(user);
436 LOG_IF(FATAL,
437 !session_manager::SessionManager::Get()->HasSessionForAccountId(
438 user->GetAccountId()))
439 << "Attempting to construct the profile before starting the user "
440 "session";
441 }
442 #endif
443
427 #if BUILDFLAG(ENABLE_SESSION_SERVICE) 444 #if BUILDFLAG(ENABLE_SESSION_SERVICE)
428 create_session_service_timer_.Start(FROM_HERE, 445 create_session_service_timer_.Start(FROM_HERE,
429 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, 446 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this,
430 &ProfileImpl::EnsureSessionServiceCreated); 447 &ProfileImpl::EnsureSessionServiceCreated);
431 #endif 448 #endif
432 449
433 set_is_guest_profile(path == ProfileManager::GetGuestProfilePath()); 450 set_is_guest_profile(path == ProfileManager::GetGuestProfilePath());
434 set_is_system_profile(path == ProfileManager::GetSystemProfilePath()); 451 set_is_system_profile(path == ProfileManager::GetSystemProfilePath());
435 452
436 // If profile_manager is not present, it means we are in a unittest. 453 // If profile_manager is not present, it means we are in a unittest.
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); 1367 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>();
1351 1368
1352 return service->CreateMonitor( 1369 return service->CreateMonitor(
1353 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); 1370 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
1354 } 1371 }
1355 1372
1356 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() { 1373 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() {
1357 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this); 1374 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this);
1358 return base::MakeUnique<identity::IdentityService>(signin_manager); 1375 return base::MakeUnique<identity::IdentityService>(signin_manager);
1359 } 1376 }
OLDNEW
« no previous file with comments | « no previous file | components/session_manager/core/session_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698