OLD | NEW |
---|---|
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/ui/startup/startup_browser_creator_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 : cur_dir_(cur_dir), | 322 : cur_dir_(cur_dir), |
323 command_line_(command_line), | 323 command_line_(command_line), |
324 profile_(NULL), | 324 profile_(NULL), |
325 browser_creator_(browser_creator), | 325 browser_creator_(browser_creator), |
326 is_first_run_(is_first_run == chrome::startup::IS_FIRST_RUN) { | 326 is_first_run_(is_first_run == chrome::startup::IS_FIRST_RUN) { |
327 } | 327 } |
328 | 328 |
329 StartupBrowserCreatorImpl::~StartupBrowserCreatorImpl() { | 329 StartupBrowserCreatorImpl::~StartupBrowserCreatorImpl() { |
330 } | 330 } |
331 | 331 |
332 | |
sky
2012/12/04 00:10:53
remove newline.
zel
2012/12/04 02:12:28
Done.
| |
332 bool StartupBrowserCreatorImpl::Launch(Profile* profile, | 333 bool StartupBrowserCreatorImpl::Launch(Profile* profile, |
333 const std::vector<GURL>& urls_to_open, | 334 const std::vector<GURL>& urls_to_open, |
334 bool process_startup) { | 335 bool process_startup) { |
335 DCHECK(profile); | 336 DCHECK(profile); |
336 profile_ = profile; | 337 profile_ = profile; |
337 | 338 |
338 if (command_line_.HasSwitch(switches::kDnsLogDetails)) | 339 if (command_line_.HasSwitch(switches::kDnsLogDetails)) |
339 chrome_browser_net::EnablePredictorDetailedLog(true); | 340 chrome_browser_net::EnablePredictorDetailedLog(true); |
340 if (command_line_.HasSwitch(switches::kDnsPrefetchDisable) && | 341 if (command_line_.HasSwitch(switches::kDnsPrefetchDisable) && |
341 profile->GetNetworkPredictor()) { | 342 profile->GetNetworkPredictor()) { |
342 profile->GetNetworkPredictor()->EnablePredictor(false); | 343 profile->GetNetworkPredictor()->EnablePredictor(false); |
343 } | 344 } |
344 | 345 |
345 if (command_line_.HasSwitch(switches::kDumpHistogramsOnExit)) | 346 if (command_line_.HasSwitch(switches::kDumpHistogramsOnExit)) |
346 base::StatisticsRecorder::set_dump_on_exit(true); | 347 base::StatisticsRecorder::set_dump_on_exit(true); |
347 | 348 |
348 if (command_line_.HasSwitch(switches::kRemoteDebuggingPort)) { | 349 #if !defined(OS_CHROMEOS) |
349 std::string port_str = | 350 LaunchDevToolsHandlerIfNeeded(profile, command_line_); |
350 command_line_.GetSwitchValueASCII(switches::kRemoteDebuggingPort); | 351 #endif |
351 int64 port; | |
352 if (base::StringToInt64(port_str, &port) && port > 0 && port < 65535) { | |
353 std::string frontend_str; | |
354 if (command_line_.HasSwitch(switches::kRemoteDebuggingFrontend)) { | |
355 frontend_str = command_line_.GetSwitchValueASCII( | |
356 switches::kRemoteDebuggingFrontend); | |
357 } | |
358 g_browser_process->CreateDevToolsHttpProtocolHandler( | |
359 profile, | |
360 "127.0.0.1", | |
361 static_cast<int>(port), | |
362 frontend_str); | |
363 } else { | |
364 DLOG(WARNING) << "Invalid http debugger port number " << port; | |
365 } | |
366 } | |
367 | 352 |
368 #if defined(ENABLE_APP_LIST) | 353 #if defined(ENABLE_APP_LIST) |
369 app_list_controller::CheckAppListTaskbarShortcut(); | 354 app_list_controller::CheckAppListTaskbarShortcut(); |
370 if (command_line_.HasSwitch(switches::kShowAppList)) { | 355 if (command_line_.HasSwitch(switches::kShowAppList)) { |
371 app_list_controller::ShowAppList(); | 356 app_list_controller::ShowAppList(); |
372 return true; | 357 return true; |
373 } | 358 } |
374 #endif | 359 #endif |
375 | 360 |
376 // Open the required browser windows and tabs. First, see if | 361 // Open the required browser windows and tabs. First, see if |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1046 prefs->GetString(prefs::kHomePage), | 1031 prefs->GetString(prefs::kHomePage), |
1047 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), | 1032 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), |
1048 prefs->GetBoolean(prefs::kShowHomeButton), | 1033 prefs->GetBoolean(prefs::kShowHomeButton), |
1049 // Backup: | 1034 // Backup: |
1050 backup_homepage, | 1035 backup_homepage, |
1051 backup_homepage_is_ntp, | 1036 backup_homepage_is_ntp, |
1052 backup_show_home_button)); | 1037 backup_show_home_button)); |
1053 } | 1038 } |
1054 } | 1039 } |
1055 | 1040 |
1041 void StartupBrowserCreatorImpl::LaunchDevToolsHandlerIfNeeded( | |
1042 Profile* profile, const CommandLine& command_line) { | |
sky
2012/12/04 00:10:53
wrap command_line to new line.
| |
1043 if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { | |
sky
2012/12/04 00:10:53
Refactor this so you don't duplicate it.
zel
2012/12/04 00:38:47
Yeah, that's what I wanted to ping you about - whe
sky
2012/12/04 01:22:45
If there is a directory for devtools stuff I would
zel
2012/12/04 02:12:28
Moved to chrome_browser_main.cc... invoked from Ch
| |
1044 std::string port_str = | |
1045 command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); | |
1046 int64 port; | |
1047 if (base::StringToInt64(port_str, &port) && port > 0 && port < 65535) { | |
1048 std::string frontend_str; | |
1049 if (command_line.HasSwitch(switches::kRemoteDebuggingFrontend)) { | |
1050 frontend_str = command_line.GetSwitchValueASCII( | |
1051 switches::kRemoteDebuggingFrontend); | |
1052 } | |
1053 g_browser_process->CreateDevToolsHttpProtocolHandler( | |
1054 profile, | |
1055 "127.0.0.1", | |
1056 static_cast<int>(port), | |
1057 frontend_str); | |
1058 } else { | |
1059 DLOG(WARNING) << "Invalid http debugger port number " << port; | |
1060 } | |
1061 } | |
1062 } | |
1063 | |
1056 #if !defined(OS_WIN) || defined(USE_AURA) | 1064 #if !defined(OS_WIN) || defined(USE_AURA) |
1057 // static | 1065 // static |
1058 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( | 1066 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( |
1059 Profile* profile, | 1067 Profile* profile, |
1060 const std::vector<GURL>& startup_urls) { | 1068 const std::vector<GURL>& startup_urls) { |
1061 return false; | 1069 return false; |
1062 } | 1070 } |
1063 #endif | 1071 #endif |
1064 | 1072 |
OLD | NEW |