OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "chrome/browser/profile_manager.h" | 38 #include "chrome/browser/profile_manager.h" |
39 #include "chrome/browser/sync/profile_sync_service.h" | 39 #include "chrome/browser/sync/profile_sync_service.h" |
40 #include "chrome/browser/ui/browser_init.h" | 40 #include "chrome/browser/ui/browser_init.h" |
41 #include "chrome/common/chrome_paths.h" | 41 #include "chrome/common/chrome_paths.h" |
42 #include "chrome/common/chrome_switches.h" | 42 #include "chrome/common/chrome_switches.h" |
43 #include "chrome/common/logging_chrome.h" | 43 #include "chrome/common/logging_chrome.h" |
44 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" | 44 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" |
45 #include "chrome/common/net/gaia/gaia_constants.h" | 45 #include "chrome/common/net/gaia/gaia_constants.h" |
46 #include "chrome/common/net/url_request_context_getter.h" | 46 #include "chrome/common/net/url_request_context_getter.h" |
47 #include "chrome/common/pref_names.h" | 47 #include "chrome/common/pref_names.h" |
| 48 #include "chrome/common/url_constants.h" |
48 #include "googleurl/src/gurl.h" | 49 #include "googleurl/src/gurl.h" |
49 #include "net/base/cookie_store.h" | 50 #include "net/base/cookie_store.h" |
50 #include "net/url_request/url_request_context.h" | 51 #include "net/url_request/url_request_context.h" |
51 #include "views/widget/widget_gtk.h" | 52 #include "views/widget/widget_gtk.h" |
52 | 53 |
53 namespace chromeos { | 54 namespace chromeos { |
54 | 55 |
55 namespace { | 56 namespace { |
56 | 57 |
57 // Affixes for Auth token received from ClientLogin request. | 58 // Affixes for Auth token received from ClientLogin request. |
58 const char kAuthPrefix[] = "Auth="; | 59 const char kAuthPrefix[] = "Auth="; |
59 const char kAuthSuffix[] = "\n"; | 60 const char kAuthSuffix[] = "\n"; |
60 | 61 |
61 // Increase logging level for Guest mode to avoid LOG(INFO) messages in logs. | 62 // Increase logging level for Guest mode to avoid LOG(INFO) messages in logs. |
62 const char kGuestModeLoggingLevel[] = "1"; | 63 const char kGuestModeLoggingLevel[] = "1"; |
63 | 64 |
64 // Format of command line switch. | 65 // Format of command line switch. |
65 const char kSwitchFormatString[] = "--%s=\"%s\""; | 66 const char kSwitchFormatString[] = " --%s=\"%s\""; |
66 | 67 |
67 } // namespace | 68 } // namespace |
68 | 69 |
69 class LoginUtilsImpl : public LoginUtils { | 70 class LoginUtilsImpl : public LoginUtils { |
70 public: | 71 public: |
71 LoginUtilsImpl() | 72 LoginUtilsImpl() |
72 : browser_launch_enabled_(true) { | 73 : browser_launch_enabled_(true) { |
73 } | 74 } |
74 | 75 |
75 // Invoked after the user has successfully logged in. This launches a browser | 76 // Invoked after the user has successfully logged in. This launches a browser |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 command_line.AppendSwitch(switches::kIncognito); | 307 command_line.AppendSwitch(switches::kIncognito); |
307 command_line.AppendSwitchASCII(switches::kLoggingLevel, | 308 command_line.AppendSwitchASCII(switches::kLoggingLevel, |
308 kGuestModeLoggingLevel); | 309 kGuestModeLoggingLevel); |
309 command_line.AppendSwitchASCII( | 310 command_line.AppendSwitchASCII( |
310 switches::kLoginUser, | 311 switches::kLoginUser, |
311 UserManager::Get()->logged_in_user().email()); | 312 UserManager::Get()->logged_in_user().email()); |
312 | 313 |
313 if (start_url.is_valid()) | 314 if (start_url.is_valid()) |
314 command_line.AppendArg(start_url.spec()); | 315 command_line.AppendArg(start_url.spec()); |
315 | 316 |
| 317 // Override the value of the homepage that is set in first run mode. |
| 318 // TODO(altimofeev): extend action of the |kNoFirstRun| to cover this case. |
| 319 command_line.AppendSwitchASCII( |
| 320 switches::kHomePage, |
| 321 GURL(chrome::kChromeUINewTabURL).spec()); |
| 322 |
316 std::string cmd_line_str = command_line.command_line_string(); | 323 std::string cmd_line_str = command_line.command_line_string(); |
317 // Special workaround for the arguments that should be quoted. | 324 // Special workaround for the arguments that should be quoted. |
318 // Copying switches won't be needed when Guest mode won't need restart | 325 // Copying switches won't be needed when Guest mode won't need restart |
319 // http://crosbug.com/6924 | 326 // http://crosbug.com/6924 |
320 if (browser_command_line.HasSwitch(switches::kRegisterPepperPlugins)) { | 327 if (browser_command_line.HasSwitch(switches::kRegisterPepperPlugins)) { |
321 cmd_line_str += base::StringPrintf( | 328 cmd_line_str += base::StringPrintf( |
322 kSwitchFormatString, | 329 kSwitchFormatString, |
323 switches::kRegisterPepperPlugins, | 330 switches::kRegisterPepperPlugins, |
324 browser_command_line.GetSwitchValueNative( | 331 browser_command_line.GetSwitchValueNative( |
325 switches::kRegisterPepperPlugins).c_str()); | 332 switches::kRegisterPepperPlugins).c_str()); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 BrowserInit browser_init; | 409 BrowserInit browser_init; |
403 int return_code; | 410 int return_code; |
404 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), | 411 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), |
405 profile, | 412 profile, |
406 FilePath(), | 413 FilePath(), |
407 true, | 414 true, |
408 &return_code); | 415 &return_code); |
409 } | 416 } |
410 | 417 |
411 } // namespace chromeos | 418 } // namespace chromeos |
OLD | NEW |