Chromium Code Reviews| 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 "content/shell/shell_browser_main_parts.h" | 5 #include "content/shell/shell_browser_main_parts.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_number_conversions.h" | |
| 11 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| 12 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
| 13 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
| 14 #include "content/public/common/main_function_params.h" | 13 #include "content/public/common/main_function_params.h" |
| 15 #include "content/public/common/url_constants.h" | 14 #include "content/public/common/url_constants.h" |
| 16 #include "content/shell/shell.h" | 15 #include "content/shell/shell.h" |
| 17 #include "content/shell/shell_browser_context.h" | 16 #include "content/shell/shell_browser_context.h" |
| 18 #include "content/shell/shell_devtools_delegate.h" | 17 #include "content/shell/shell_devtools_delegate.h" |
| 19 #include "content/shell/shell_switches.h" | 18 #include "content/shell/shell_switches.h" |
| 20 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 | 74 |
| 76 void ShellBrowserMainParts::PreMainMessageLoopRun() { | 75 void ShellBrowserMainParts::PreMainMessageLoopRun() { |
| 77 browser_context_.reset(new ShellBrowserContext(false)); | 76 browser_context_.reset(new ShellBrowserContext(false)); |
| 78 off_the_record_browser_context_.reset(new ShellBrowserContext(true)); | 77 off_the_record_browser_context_.reset(new ShellBrowserContext(true)); |
| 79 | 78 |
| 80 Shell::PlatformInitialize(); | 79 Shell::PlatformInitialize(); |
| 81 net::NetModule::SetResourceProvider(Shell::PlatformResourceProvider); | 80 net::NetModule::SetResourceProvider(Shell::PlatformResourceProvider); |
| 82 | 81 |
| 83 #if defined(OS_ANDROID) | 82 #if defined(OS_ANDROID) |
| 84 devtools_delegate_ = new ShellDevToolsDelegate( | 83 devtools_delegate_ = new ShellDevToolsDelegate( |
| 85 0, // On android the port number isn't used. | |
| 86 browser_context_->GetRequestContext()); | 84 browser_context_->GetRequestContext()); |
| 87 #else | 85 #else |
| 88 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 86 devtools_delegate_ = new ShellDevToolsDelegate( |
| 89 if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { | 87 browser_context_->GetRequestContext()); |
| 90 std::string port_str = | |
| 91 command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); | |
| 92 int port; | |
| 93 if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) { | |
| 94 devtools_delegate_ = new ShellDevToolsDelegate( | |
| 95 port, | |
| 96 browser_context_->GetRequestContext()); | |
| 97 } else { | |
| 98 DLOG(WARNING) << "Invalid http debugger port number " << port; | |
| 99 } | |
| 100 } | |
| 101 #endif | 88 #endif |
|
Avi (use Gerrit)
2012/08/09 19:18:00
How are these if branches different? I'll fix with
jam
2012/08/10 16:49:56
I missed that :)
| |
| 102 | 89 |
| 103 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 90 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
| 104 Shell::CreateNewWindow(browser_context_.get(), | 91 Shell::CreateNewWindow(browser_context_.get(), |
| 105 GetStartupURL(), | 92 GetStartupURL(), |
| 106 NULL, | 93 NULL, |
| 107 MSG_ROUTING_NONE, | 94 MSG_ROUTING_NONE, |
| 108 NULL); | 95 NULL); |
| 109 } | 96 } |
| 110 | 97 |
| 111 if (parameters_.ui_task) { | 98 if (parameters_.ui_task) { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 123 #if defined(USE_AURA) | 110 #if defined(USE_AURA) |
| 124 Shell::PlatformExit(); | 111 Shell::PlatformExit(); |
| 125 #endif | 112 #endif |
| 126 if (devtools_delegate_) | 113 if (devtools_delegate_) |
| 127 devtools_delegate_->Stop(); | 114 devtools_delegate_->Stop(); |
| 128 browser_context_.reset(); | 115 browser_context_.reset(); |
| 129 off_the_record_browser_context_.reset(); | 116 off_the_record_browser_context_.reset(); |
| 130 } | 117 } |
| 131 | 118 |
| 132 } // namespace | 119 } // namespace |
| OLD | NEW |