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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/session_manager/core/session_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 0e6340d54882e17307f2bf2a0251ccfcbf8fdbcb..b1cc6465bfe5cc3c23b506085005977c79ab7e20 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -17,6 +17,7 @@
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
+#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_macros.h"
@@ -128,9 +129,14 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/locale_change_guard.h"
+#include "chrome/browser/chromeos/login/session/user_session_manager.h"
+#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
+#include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h"
#include "chrome/browser/chromeos/preferences.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/settings/device_settings_service.h"
+#include "components/session_manager/core/session_manager.h"
+#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
#endif
@@ -138,11 +144,7 @@
#include "chrome/browser/background/background_mode_manager.h"
#endif
-#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/login/session/user_session_manager.h"
-#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
-#include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h"
-#else
+#if !defined(OS_CHROMEOS)
#include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#endif
@@ -424,6 +426,21 @@ ProfileImpl::ProfileImpl(
DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
"profile files to the root directory!";
+#if defined(OS_CHROMEOS)
+ if (!chromeos::ProfileHelper::IsSigninProfile(this)) {
+ const user_manager::User* user =
+ chromeos::ProfileHelper::Get()->GetUserByProfile(this);
+ // A |User| instance should always exist for a profile which is not the
+ // initial or the sign-in profile.
+ CHECK(user);
+ LOG_IF(FATAL,
+ !session_manager::SessionManager::Get()->HasSessionForAccountId(
+ user->GetAccountId()))
+ << "Attempting to construct the profile before starting the user "
+ "session";
+ }
+#endif
+
#if BUILDFLAG(ENABLE_SESSION_SERVICE)
create_session_service_timer_.Start(FROM_HERE,
TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this,
« 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