| 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 DCHECK(false); | 209 DCHECK(false); |
| 210 } | 210 } |
| 211 | 211 |
| 212 // This parameter causes a null pointer crash (crash reporter trigger). | 212 // This parameter causes a null pointer crash (crash reporter trigger). |
| 213 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { | 213 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { |
| 214 int* bad_pointer = NULL; | 214 int* bad_pointer = NULL; |
| 215 *bad_pointer = 0; | 215 *bad_pointer = 0; |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 219 void AddFirstRunNewTabs(StartupBrowserCreator* browser_creator, | 220 void AddFirstRunNewTabs(StartupBrowserCreator* browser_creator, |
| 220 const std::vector<GURL>& new_tabs) { | 221 const std::vector<GURL>& new_tabs) { |
| 221 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); | 222 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); |
| 222 it != new_tabs.end(); ++it) { | 223 it != new_tabs.end(); ++it) { |
| 223 if (it->is_valid()) | 224 if (it->is_valid()) |
| 224 browser_creator->AddFirstRunTab(*it); | 225 browser_creator->AddFirstRunTab(*it); |
| 225 } | 226 } |
| 226 } | 227 } |
| 228 #endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 227 | 229 |
| 228 // Returns the new local state object, guaranteed non-NULL. | 230 // Returns the new local state object, guaranteed non-NULL. |
| 229 // |local_state_task_runner| must be a shutdown-blocking task runner. | 231 // |local_state_task_runner| must be a shutdown-blocking task runner. |
| 230 PrefService* InitializeLocalState( | 232 PrefService* InitializeLocalState( |
| 231 base::SequencedTaskRunner* local_state_task_runner, | 233 base::SequencedTaskRunner* local_state_task_runner, |
| 232 const CommandLine& parsed_command_line) { | 234 const CommandLine& parsed_command_line) { |
| 233 TRACE_EVENT0("startup", "ChromeBrowserMainParts::InitializeLocalState") | 235 TRACE_EVENT0("startup", "ChromeBrowserMainParts::InitializeLocalState") |
| 234 base::FilePath local_state_path; | 236 base::FilePath local_state_path; |
| 235 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 237 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
| 236 bool local_state_file_exists = base::PathExists(local_state_path); | 238 bool local_state_file_exists = base::PathExists(local_state_path); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 return NULL; | 384 return NULL; |
| 383 } | 385 } |
| 384 | 386 |
| 385 #if defined(OS_MACOSX) | 387 #if defined(OS_MACOSX) |
| 386 OSStatus KeychainCallback(SecKeychainEvent keychain_event, | 388 OSStatus KeychainCallback(SecKeychainEvent keychain_event, |
| 387 SecKeychainCallbackInfo* info, void* context) { | 389 SecKeychainCallbackInfo* info, void* context) { |
| 388 return noErr; | 390 return noErr; |
| 389 } | 391 } |
| 390 #endif | 392 #endif |
| 391 | 393 |
| 394 #if !defined(OS_ANDROID) |
| 392 void RegisterComponentsForUpdate(const CommandLine& command_line) { | 395 void RegisterComponentsForUpdate(const CommandLine& command_line) { |
| 393 ComponentUpdateService* cus = g_browser_process->component_updater(); | 396 ComponentUpdateService* cus = g_browser_process->component_updater(); |
| 394 | 397 |
| 395 // Registration can be before or after cus->Start() so it is ok to post | 398 // Registration can be before or after cus->Start() so it is ok to post |
| 396 // a task to the UI thread to do registration once you done the necessary | 399 // a task to the UI thread to do registration once you done the necessary |
| 397 // file IO to know you existing component version. | 400 // file IO to know you existing component version. |
| 398 #if !defined(OS_CHROMEOS) | 401 #if !defined(OS_CHROMEOS) |
| 399 RegisterRecoveryComponent(cus, g_browser_process->local_state()); | 402 RegisterRecoveryComponent(cus, g_browser_process->local_state()); |
| 400 RegisterPepperFlashComponent(cus); | 403 RegisterPepperFlashComponent(cus); |
| 401 RegisterSwiftShaderComponent(cus); | 404 RegisterSwiftShaderComponent(cus); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 469 |
| 467 base::FilePath user_data_dir = | 470 base::FilePath user_data_dir = |
| 468 g_browser_process->profile_manager()->user_data_dir(); | 471 g_browser_process->profile_manager()->user_data_dir(); |
| 469 base::FilePath startup_profile_dir = | 472 base::FilePath startup_profile_dir = |
| 470 GetStartupProfilePath(user_data_dir, command_line); | 473 GetStartupProfilePath(user_data_dir, command_line); |
| 471 | 474 |
| 472 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( | 475 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( |
| 473 command_line, current_directory, startup_profile_dir); | 476 command_line, current_directory, startup_profile_dir); |
| 474 return true; | 477 return true; |
| 475 } | 478 } |
| 479 #endif // !defined(OS_ANDROID) |
| 476 | 480 |
| 477 void LaunchDevToolsHandlerIfNeeded(const CommandLine& command_line) { | 481 void LaunchDevToolsHandlerIfNeeded(const CommandLine& command_line) { |
| 478 if (command_line.HasSwitch(::switches::kRemoteDebuggingPort)) { | 482 if (command_line.HasSwitch(::switches::kRemoteDebuggingPort)) { |
| 479 std::string port_str = | 483 std::string port_str = |
| 480 command_line.GetSwitchValueASCII(::switches::kRemoteDebuggingPort); | 484 command_line.GetSwitchValueASCII(::switches::kRemoteDebuggingPort); |
| 481 int port; | 485 int port; |
| 482 if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) { | 486 if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) { |
| 483 std::string frontend_str; | 487 std::string frontend_str; |
| 484 if (command_line.HasSwitch(::switches::kRemoteDebuggingFrontend)) { | 488 if (command_line.HasSwitch(::switches::kRemoteDebuggingFrontend)) { |
| 485 frontend_str = command_line.GetSwitchValueASCII( | 489 frontend_str = command_line.GetSwitchValueASCII( |
| (...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 chromeos::CrosSettings::Shutdown(); | 1721 chromeos::CrosSettings::Shutdown(); |
| 1718 #endif | 1722 #endif |
| 1719 #endif | 1723 #endif |
| 1720 } | 1724 } |
| 1721 | 1725 |
| 1722 // Public members: | 1726 // Public members: |
| 1723 | 1727 |
| 1724 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1728 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1725 chrome_extra_parts_.push_back(parts); | 1729 chrome_extra_parts_.push_back(parts); |
| 1726 } | 1730 } |
| OLD | NEW |