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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/existing_user_controller_browsertest.cc » ('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/chromeos/chrome_browser_main_chromeos.h" 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "chrome/common/pref_names.h" 72 #include "chrome/common/pref_names.h"
73 #include "chromeos/dbus/dbus_thread_manager.h" 73 #include "chromeos/dbus/dbus_thread_manager.h"
74 #include "chromeos/dbus/power_manager_client.h" 74 #include "chromeos/dbus/power_manager_client.h"
75 #include "chromeos/dbus/session_manager_client.h" 75 #include "chromeos/dbus/session_manager_client.h"
76 #include "content/public/browser/notification_service.h" 76 #include "content/public/browser/notification_service.h"
77 #include "content/public/common/main_function_params.h" 77 #include "content/public/common/main_function_params.h"
78 #include "grit/platform_locale_settings.h" 78 #include "grit/platform_locale_settings.h"
79 #include "net/base/network_change_notifier.h" 79 #include "net/base/network_change_notifier.h"
80 #include "net/url_request/url_request.h" 80 #include "net/url_request/url_request.h"
81 81
82 namespace {
83
84 // Username for stub login when not running on ChromeOS.
85 const char kStubUsername[] = "stub-user@example.com";
86
87 }
88
82 class MessageLoopObserver : public MessageLoopForUI::Observer { 89 class MessageLoopObserver : public MessageLoopForUI::Observer {
83 virtual base::EventStatus WillProcessEvent( 90 virtual base::EventStatus WillProcessEvent(
84 const base::NativeEvent& event) OVERRIDE { 91 const base::NativeEvent& event) OVERRIDE {
85 return base::EVENT_CONTINUE; 92 return base::EVENT_CONTINUE;
86 } 93 }
87 94
88 virtual void DidProcessEvent( 95 virtual void DidProcessEvent(
89 const base::NativeEvent& event) OVERRIDE { 96 const base::NativeEvent& event) OVERRIDE {
90 } 97 }
91 }; 98 };
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // To be precise, logout (browser shutdown) is not yet done, but the 230 // To be precise, logout (browser shutdown) is not yet done, but the
224 // remaining work is negligible, hence we say LogoutDone here. 231 // remaining work is negligible, hence we say LogoutDone here.
225 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 232 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
226 false); 233 false);
227 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 234 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
228 } 235 }
229 236
230 // content::BrowserMainParts and ChromeBrowserMainExtraParts overrides --------- 237 // content::BrowserMainParts and ChromeBrowserMainExtraParts overrides ---------
231 238
232 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { 239 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() {
240 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess();
241
233 if (parsed_command_line().HasSwitch(switches::kGuestSession)) { 242 if (parsed_command_line().HasSwitch(switches::kGuestSession)) {
234 // Disable sync and extensions if we're in "browse without sign-in" mode. 243 // Disable sync and extensions if we're in "browse without sign-in" mode.
235 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess();
236 singleton_command_line->AppendSwitch(switches::kDisableSync); 244 singleton_command_line->AppendSwitch(switches::kDisableSync);
237 singleton_command_line->AppendSwitch(switches::kDisableExtensions); 245 singleton_command_line->AppendSwitch(switches::kDisableExtensions);
238 browser_defaults::bookmarks_enabled = false; 246 browser_defaults::bookmarks_enabled = false;
239 } 247 }
240 248
249 // If we're not running on real ChromeOS hardware (or under VM), and are not
250 // showing the login manager or attempting a command line login, login with a
251 // stub user.
252 if (!base::chromeos::IsRunningOnChromeOS() &&
253 !parsed_command_line().HasSwitch(switches::kLoginManager) &&
254 !parsed_command_line().HasSwitch(switches::kLoginUser) &&
255 !parsed_command_line().HasSwitch(switches::kGuestSession)) {
256 singleton_command_line->AppendSwitchASCII(switches::kLoginUser,
257 kStubUsername);
258 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) {
259 // This must be kept in sync with TestingProfile::kTestUserProfileDir.
260 singleton_command_line->AppendSwitchASCII(
261 switches::kLoginProfile, "test-user");
262 }
263 LOG(INFO) << "Running as stub user with profile dir: "
264 << singleton_command_line->GetSwitchValuePath(
265 switches::kLoginProfile).value();
266 }
267
241 ChromeBrowserMainPartsLinux::PreEarlyInitialization(); 268 ChromeBrowserMainPartsLinux::PreEarlyInitialization();
242 } 269 }
243 270
244 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { 271 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() {
245 // Initialize CrosLibrary only for the browser, unless running tests 272 // Initialize CrosLibrary only for the browser, unless running tests
246 // (which do their own CrosLibrary setup). 273 // (which do their own CrosLibrary setup).
247 if (!parameters().ui_task) { 274 if (!parameters().ui_task) {
248 const bool use_stub = !base::chromeos::IsRunningOnChromeOS(); 275 const bool use_stub = !base::chromeos::IsRunningOnChromeOS();
249 chromeos::CrosLibrary::Initialize(use_stub); 276 chromeos::CrosLibrary::Initialize(use_stub);
250 } 277 }
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 LOG(WARNING) << "low_mem: Part of '100MB' experiment"; 585 LOG(WARNING) << "low_mem: Part of '100MB' experiment";
559 chromeos::LowMemoryObserver::SetLowMemoryMargin(100); 586 chromeos::LowMemoryObserver::SetLowMemoryMargin(100);
560 } else if (trial->group() == margin_200mb) { 587 } else if (trial->group() == margin_200mb) {
561 LOG(WARNING) << "low_mem: Part of '200MB' experiment"; 588 LOG(WARNING) << "low_mem: Part of '200MB' experiment";
562 chromeos::LowMemoryObserver::SetLowMemoryMargin(200); 589 chromeos::LowMemoryObserver::SetLowMemoryMargin(200);
563 } else { 590 } else {
564 LOG(WARNING) << "low_mem: Part of 'default' experiment"; 591 LOG(WARNING) << "low_mem: Part of 'default' experiment";
565 } 592 }
566 } 593 }
567 } 594 }
OLDNEW
« 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