| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_browser_main_parts.h" | 5 #include "extensions/shell/browser/shell_browser_main_parts.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 using base::CommandLine; | 67 using base::CommandLine; |
| 68 using content::BrowserContext; | 68 using content::BrowserContext; |
| 69 | 69 |
| 70 #if !defined(DISABLE_NACL) | 70 #if !defined(DISABLE_NACL) |
| 71 using content::BrowserThread; | 71 using content::BrowserThread; |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 namespace extensions { | 74 namespace extensions { |
| 75 | 75 |
| 76 namespace { | |
| 77 | |
| 78 void CrxInstallComplete(bool success) { | |
| 79 VLOG(1) << "CRX download complete. Success: " << success; | |
| 80 } | |
| 81 } | |
| 82 | |
| 83 ShellBrowserMainParts::ShellBrowserMainParts( | 76 ShellBrowserMainParts::ShellBrowserMainParts( |
| 84 const content::MainFunctionParams& parameters, | 77 const content::MainFunctionParams& parameters, |
| 85 ShellBrowserMainDelegate* browser_main_delegate) | 78 ShellBrowserMainDelegate* browser_main_delegate) |
| 86 : devtools_http_handler_(nullptr), | 79 : devtools_http_handler_(nullptr), |
| 87 extension_system_(nullptr), | 80 extension_system_(nullptr), |
| 88 parameters_(parameters), | 81 parameters_(parameters), |
| 89 run_message_loop_(true), | 82 run_message_loop_(true), |
| 90 browser_main_delegate_(browser_main_delegate) { | 83 browser_main_delegate_(browser_main_delegate) { |
| 91 } | 84 } |
| 92 | 85 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 nacl::NaClBrowser::SetDelegate( | 197 nacl::NaClBrowser::SetDelegate( |
| 205 new ShellNaClBrowserDelegate(browser_context_.get())); | 198 new ShellNaClBrowserDelegate(browser_context_.get())); |
| 206 // Track the task so it can be canceled if app_shell shuts down very quickly, | 199 // Track the task so it can be canceled if app_shell shuts down very quickly, |
| 207 // such as in browser tests. | 200 // such as in browser tests. |
| 208 task_tracker_.PostTask( | 201 task_tracker_.PostTask( |
| 209 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), | 202 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), |
| 210 FROM_HERE, | 203 FROM_HERE, |
| 211 base::Bind(nacl::NaClProcessHost::EarlyStartup)); | 204 base::Bind(nacl::NaClProcessHost::EarlyStartup)); |
| 212 #endif | 205 #endif |
| 213 | 206 |
| 214 // TODO(rockot): Remove this temporary hack test. | |
| 215 std::string install_crx_id = | |
| 216 cmd->GetSwitchValueASCII(switches::kAppShellInstallCrx); | |
| 217 if (install_crx_id.size() != 0) { | |
| 218 CHECK(install_crx_id.size() == 32) | |
| 219 << "Extension ID must be exactly 32 characters long."; | |
| 220 UpdateService* update_service = UpdateService::Get(browser_context_.get()); | |
| 221 update_service->DownloadAndInstall(install_crx_id, | |
| 222 base::Bind(CrxInstallComplete)); | |
| 223 } | |
| 224 | |
| 225 devtools_http_handler_.reset( | 207 devtools_http_handler_.reset( |
| 226 content::ShellDevToolsManagerDelegate::CreateHttpHandler( | 208 content::ShellDevToolsManagerDelegate::CreateHttpHandler( |
| 227 browser_context_.get())); | 209 browser_context_.get())); |
| 228 if (parameters_.ui_task) { | 210 if (parameters_.ui_task) { |
| 229 // For running browser tests. | 211 // For running browser tests. |
| 230 parameters_.ui_task->Run(); | 212 parameters_.ui_task->Run(); |
| 231 delete parameters_.ui_task; | 213 delete parameters_.ui_task; |
| 232 run_message_loop_ = false; | 214 run_message_loop_ = false; |
| 233 } else { | 215 } else { |
| 234 browser_main_delegate_->Start(browser_context_.get()); | 216 browser_main_delegate_->Start(browser_context_.get()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 281 } |
| 300 | 282 |
| 301 void ShellBrowserMainParts::CreateExtensionSystem() { | 283 void ShellBrowserMainParts::CreateExtensionSystem() { |
| 302 DCHECK(browser_context_); | 284 DCHECK(browser_context_); |
| 303 extension_system_ = static_cast<ShellExtensionSystem*>( | 285 extension_system_ = static_cast<ShellExtensionSystem*>( |
| 304 ExtensionSystem::Get(browser_context_.get())); | 286 ExtensionSystem::Get(browser_context_.get())); |
| 305 extension_system_->InitForRegularProfile(true); | 287 extension_system_->InitForRegularProfile(true); |
| 306 } | 288 } |
| 307 | 289 |
| 308 } // namespace extensions | 290 } // namespace extensions |
| OLD | NEW |