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

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: Further test fixes. Created 8 years, 6 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
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 c319ebc90010ebda849abc6144ac097b06c06e97..b877e683b08a4dda774211488ba6d1fe7889cbfb 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -78,6 +78,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 {
@@ -229,14 +236,32 @@ 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 ChromeOS, and are not showing the login manager
Nikita (slow) 2012/06/20 13:28:32 nit: Should be "If we're not running on real Chrom
Ivan Korotkov 2012/06/21 12:25:12 Done.
+ // 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)) {
+ singleton_command_line->AppendSwitchASCII(
+ switches::kLoginProfile, ProfileManager::kTestUserProfile);
+ }
+ LOG(INFO) << "Running as stub user with profile dir: "
+ << singleton_command_line->GetSwitchValuePath(
+ switches::kLoginProfile).value();
+ }
+
ChromeBrowserMainPartsLinux::PreEarlyInitialization();
}

Powered by Google App Engine
This is Rietveld 408576698