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

Unified Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 10590004: [cros] Fake a stub user login when no --login-manager and --login-user are given. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 5 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 | chrome/browser/chromeos/login/existing_user_controller_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/chrome_browser_main_chromeos.cc
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
index 280082a59af8cca2d8a46687e245be68ddb558fa..f84e8a4f447831481d9810c4d377d0cd61114ce9 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -79,6 +79,13 @@
#include "net/base/network_change_notifier.h"
#include "net/url_request/url_request.h"
+namespace {
+
+// Username for stub login when not running on ChromeOS.
+const char kStubUsername[] = "stub-user@example.com";
+
+}
+
class MessageLoopObserver : public MessageLoopForUI::Observer {
virtual base::EventStatus WillProcessEvent(
const base::NativeEvent& event) OVERRIDE {
@@ -230,14 +237,34 @@ ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() {
// content::BrowserMainParts and ChromeBrowserMainExtraParts overrides ---------
void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() {
+ CommandLine* singleton_command_line = CommandLine::ForCurrentProcess();
+
if (parsed_command_line().HasSwitch(switches::kGuestSession)) {
// Disable sync and extensions if we're in "browse without sign-in" mode.
- CommandLine* singleton_command_line = CommandLine::ForCurrentProcess();
singleton_command_line->AppendSwitch(switches::kDisableSync);
singleton_command_line->AppendSwitch(switches::kDisableExtensions);
browser_defaults::bookmarks_enabled = false;
}
+ // If we're not running on real ChromeOS hardware (or under VM), and are not
+ // showing the login manager or attempting a command line login, login with a
+ // stub user.
+ if (!base::chromeos::IsRunningOnChromeOS() &&
+ !parsed_command_line().HasSwitch(switches::kLoginManager) &&
+ !parsed_command_line().HasSwitch(switches::kLoginUser) &&
+ !parsed_command_line().HasSwitch(switches::kGuestSession)) {
+ singleton_command_line->AppendSwitchASCII(switches::kLoginUser,
+ kStubUsername);
+ if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) {
+ // This must be kept in sync with TestingProfile::kTestUserProfileDir.
+ singleton_command_line->AppendSwitchASCII(
+ switches::kLoginProfile, "test-user");
+ }
+ LOG(INFO) << "Running as stub user with profile dir: "
+ << singleton_command_line->GetSwitchValuePath(
+ switches::kLoginProfile).value();
+ }
+
ChromeBrowserMainPartsLinux::PreEarlyInitialization();
}
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/existing_user_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698