Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: apps/shell/browser/shell_browser_main_parts.cc

Issue 147993009: [App Shell] Add dev tools for debugging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/shell/browser/shell_browser_main_parts.h" 5 #include "apps/shell/browser/shell_browser_main_parts.h"
6 6
7 #include "apps/shell/browser/shell_browser_context.h" 7 #include "apps/shell/browser/shell_browser_context.h"
8 #include "apps/shell/browser/shell_extension_system.h" 8 #include "apps/shell/browser/shell_extension_system.h"
9 #include "apps/shell/browser/shell_extensions_browser_client.h" 9 #include "apps/shell/browser/shell_extensions_browser_client.h"
10 #include "apps/shell/browser/web_view_window.h" 10 #include "apps/shell/browser/web_view_window.h"
11 #include "apps/shell/common/shell_extensions_client.h" 11 #include "apps/shell/common/shell_extensions_client.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 16 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
17 #include "content/public/common/result_codes.h" 17 #include "content/public/common/result_codes.h"
18 #include "content/shell/browser/shell_devtools_delegate.h"
18 #include "extensions/browser/extension_system.h" 19 #include "extensions/browser/extension_system.h"
19 #include "extensions/browser/renderer_startup_helper.h" 20 #include "extensions/browser/renderer_startup_helper.h"
20 #include "ui/aura/env.h" 21 #include "ui/aura/env.h"
21 #include "ui/aura/root_window.h" 22 #include "ui/aura/root_window.h"
22 #include "ui/aura/test/test_screen.h" 23 #include "ui/aura/test/test_screen.h"
23 #include "ui/base/ime/input_method_initializer.h" 24 #include "ui/base/ime/input_method_initializer.h"
24 #include "ui/base/resource/resource_bundle.h" 25 #include "ui/base/resource/resource_bundle.h"
25 #include "ui/gfx/screen.h" 26 #include "ui/gfx/screen.h"
26 #include "ui/views/test/test_views_delegate.h" 27 #include "ui/views/test/test_views_delegate.h"
27 #include "ui/views/views_delegate.h" 28 #include "ui/views/views_delegate.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); 107 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
107 108
108 // Create our custom ExtensionSystem first because other 109 // Create our custom ExtensionSystem first because other
109 // BrowserContextKeyedServices depend on it. 110 // BrowserContextKeyedServices depend on it.
110 CreateExtensionSystem(); 111 CreateExtensionSystem();
111 112
112 EnsureBrowserContextKeyedServiceFactoriesBuilt(); 113 EnsureBrowserContextKeyedServiceFactoriesBuilt();
113 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( 114 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices(
114 browser_context_.get()); 115 browser_context_.get());
115 116
117 devtools_delegate_.reset(
118 new content::ShellDevToolsDelegate(browser_context_.get()));
119
116 CreateRootWindow(); 120 CreateRootWindow();
117 CreateViewsDelegate(); 121 CreateViewsDelegate();
118 122
119 const std::string kAppSwitch = "app"; 123 const std::string kAppSwitch = "app";
120 CommandLine* command_line = CommandLine::ForCurrentProcess(); 124 CommandLine* command_line = CommandLine::ForCurrentProcess();
121 if (command_line->HasSwitch(kAppSwitch)) { 125 if (command_line->HasSwitch(kAppSwitch)) {
122 base::FilePath app_dir(command_line->GetSwitchValueNative(kAppSwitch)); 126 base::FilePath app_dir(command_line->GetSwitchValueNative(kAppSwitch));
123 base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir); 127 base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir);
124 extension_system_->LoadAndLaunchApp(app_absolute_dir); 128 extension_system_->LoadAndLaunchApp(app_absolute_dir);
125 } else { 129 } else {
126 // TODO(jamescook): For demo purposes create a window with a WebView just 130 // TODO(jamescook): For demo purposes create a window with a WebView just
127 // to ensure that the content module is properly initialized. 131 // to ensure that the content module is properly initialized.
128 ShowWebViewWindow(browser_context_.get(), 132 ShowWebViewWindow(browser_context_.get(),
129 wm_test_helper_->root_window()->window()); 133 wm_test_helper_->root_window()->window());
130 } 134 }
131 } 135 }
132 136
133 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { 137 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) {
134 base::RunLoop run_loop; 138 base::RunLoop run_loop;
135 run_loop.Run(); 139 run_loop.Run();
136 *result_code = content::RESULT_CODE_NORMAL_EXIT; 140 *result_code = content::RESULT_CODE_NORMAL_EXIT;
137 return true; 141 return true;
138 } 142 }
139 143
140 void ShellBrowserMainParts::PostMainMessageLoopRun() { 144 void ShellBrowserMainParts::PostMainMessageLoopRun() {
145 if (devtools_delegate_)
James Cook 2014/02/10 20:31:23 Why do you need the if()? It looks like it should
Haojian Wu 2014/02/11 03:24:36 Yes, in this code logic, it's always valid (it get
James Cook 2014/02/11 17:11:16 I wouldn't do the if() because it confuses the rea
146 devtools_delegate_->Stop();
141 DestroyViewsDelegate(); 147 DestroyViewsDelegate();
142 DestroyRootWindow(); 148 DestroyRootWindow();
143 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( 149 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
144 browser_context_.get()); 150 browser_context_.get());
145 extension_system_ = NULL; 151 extension_system_ = NULL;
146 extensions::ExtensionsBrowserClient::Set(NULL); 152 extensions::ExtensionsBrowserClient::Set(NULL);
147 extensions_browser_client_.reset(); 153 extensions_browser_client_.reset();
148 browser_context_.reset(); 154 browser_context_.reset();
149 aura::Env::DeleteInstance(); 155 aura::Env::DeleteInstance();
150 } 156 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 194 }
189 195
190 void ShellBrowserMainParts::CreateExtensionSystem() { 196 void ShellBrowserMainParts::CreateExtensionSystem() {
191 DCHECK(browser_context_); 197 DCHECK(browser_context_);
192 extension_system_ = static_cast<ShellExtensionSystem*>( 198 extension_system_ = static_cast<ShellExtensionSystem*>(
193 ExtensionSystem::Get(browser_context_.get())); 199 ExtensionSystem::Get(browser_context_.get()));
194 extension_system_->InitForRegularProfile(true); 200 extension_system_->InitForRegularProfile(true);
195 } 201 }
196 202
197 } // namespace apps 203 } // namespace apps
OLDNEW
« apps/shell/app/shell_main_delegate.cc ('K') | « apps/shell/browser/shell_browser_main_parts.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698