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

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

Issue 270763002: Minimal athena shell main (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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_desktop_controller.h" 8 #include "apps/shell/browser/shell_desktop_controller.h"
9 #include "apps/shell/browser/shell_extension_system.h" 9 #include "apps/shell/browser/shell_extension_system.h"
10 #include "apps/shell/browser/shell_extension_system_factory.h" 10 #include "apps/shell/browser/shell_extension_system_factory.h"
11 #include "apps/shell/browser/shell_extensions_browser_client.h" 11 #include "apps/shell/browser/shell_extensions_browser_client.h"
12 #include "apps/shell/common/shell_extensions_client.h" 12 #include "apps/shell/common/shell_extensions_client.h"
13 #include "base/command_line.h"
14 #include "base/file_util.h"
15 #include "base/files/file_path.h"
16 #include "base/run_loop.h" 13 #include "base/run_loop.h"
17 #include "components/keyed_service/content/browser_context_dependency_manager.h" 14 #include "components/keyed_service/content/browser_context_dependency_manager.h"
18 #include "content/public/common/result_codes.h" 15 #include "content/public/common/result_codes.h"
19 #include "content/shell/browser/shell_devtools_delegate.h" 16 #include "content/shell/browser/shell_devtools_delegate.h"
20 #include "content/shell/browser/shell_net_log.h" 17 #include "content/shell/browser/shell_net_log.h"
21 #include "extensions/browser/browser_context_keyed_service_factories.h" 18 #include "extensions/browser/browser_context_keyed_service_factories.h"
22 #include "extensions/browser/extension_system.h" 19 #include "extensions/browser/extension_system.h"
23 #include "ui/aura/window_tree_host.h" 20 #include "ui/aura/window_tree_host.h"
24 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
25 22
(...skipping 14 matching lines...) Expand all
40 void EnsureBrowserContextKeyedServiceFactoriesBuilt() { 37 void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
41 extensions::EnsureBrowserContextKeyedServiceFactoriesBuilt(); 38 extensions::EnsureBrowserContextKeyedServiceFactoriesBuilt();
42 extensions::ShellExtensionSystemFactory::GetInstance(); 39 extensions::ShellExtensionSystemFactory::GetInstance();
43 } 40 }
44 41
45 } // namespace 42 } // namespace
46 43
47 namespace apps { 44 namespace apps {
48 45
49 ShellBrowserMainParts::ShellBrowserMainParts( 46 ShellBrowserMainParts::ShellBrowserMainParts(
50 const content::MainFunctionParams& parameters) 47 const content::MainFunctionParams& parameters,
48 StartCallback* start_callback)
51 : extension_system_(NULL), 49 : extension_system_(NULL),
52 parameters_(parameters), 50 parameters_(parameters),
53 run_message_loop_(true) {} 51 run_message_loop_(true),
52 start_callback_(start_callback) {
53 }
54 54
55 ShellBrowserMainParts::~ShellBrowserMainParts() { 55 ShellBrowserMainParts::~ShellBrowserMainParts() {
56 } 56 }
57 57
58 void ShellBrowserMainParts::PreMainMessageLoopStart() { 58 void ShellBrowserMainParts::PreMainMessageLoopStart() {
59 // TODO(jamescook): Initialize touch here? 59 // TODO(jamescook): Initialize touch here?
60 } 60 }
61 61
62 void ShellBrowserMainParts::PostMainMessageLoopStart() { 62 void ShellBrowserMainParts::PostMainMessageLoopStart() {
63 #if defined(OS_CHROMEOS) 63 #if defined(OS_CHROMEOS)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // KeyedServices depend on it. 98 // KeyedServices depend on it.
99 // TODO(yoz): Move this after EnsureBrowserContextKeyedServiceFactoriesBuilt. 99 // TODO(yoz): Move this after EnsureBrowserContextKeyedServiceFactoriesBuilt.
100 CreateExtensionSystem(); 100 CreateExtensionSystem();
101 101
102 ::EnsureBrowserContextKeyedServiceFactoriesBuilt(); 102 ::EnsureBrowserContextKeyedServiceFactoriesBuilt();
103 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( 103 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices(
104 browser_context_.get()); 104 browser_context_.get());
105 105
106 devtools_delegate_.reset( 106 devtools_delegate_.reset(
107 new content::ShellDevToolsDelegate(browser_context_.get())); 107 new content::ShellDevToolsDelegate(browser_context_.get()));
108 108 if (parameters_.ui_task) {
109 const std::string kAppSwitch = "app";
110 CommandLine* command_line = CommandLine::ForCurrentProcess();
111 if (command_line->HasSwitch(kAppSwitch)) {
112 base::FilePath app_dir(command_line->GetSwitchValueNative(kAppSwitch));
113 base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir);
114 extension_system_->LoadAndLaunchApp(app_absolute_dir);
115 } else if (parameters_.ui_task) {
116 // For running browser tests. 109 // For running browser tests.
117 parameters_.ui_task->Run(); 110 parameters_.ui_task->Run();
118 delete parameters_.ui_task; 111 delete parameters_.ui_task;
119 run_message_loop_ = false; 112 run_message_loop_ = false;
120 } else { 113 } else {
121 LOG(ERROR) << "--" << kAppSwitch << " unset; boredom is in your future"; 114 start_callback_->Run(browser_context_.get());
122 } 115 }
123 } 116 }
124 117
125 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { 118 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) {
126 if (!run_message_loop_) 119 if (!run_message_loop_)
127 return true; 120 return true;
128 // TODO(yoz): just return false here? 121 // TODO(yoz): just return false here?
129 base::RunLoop run_loop; 122 base::RunLoop run_loop;
130 run_loop.Run(); 123 run_loop.Run();
131 *result_code = content::RESULT_CODE_NORMAL_EXIT; 124 *result_code = content::RESULT_CODE_NORMAL_EXIT;
(...skipping 27 matching lines...) Expand all
159 } 152 }
160 153
161 void ShellBrowserMainParts::CreateExtensionSystem() { 154 void ShellBrowserMainParts::CreateExtensionSystem() {
162 DCHECK(browser_context_); 155 DCHECK(browser_context_);
163 extension_system_ = static_cast<ShellExtensionSystem*>( 156 extension_system_ = static_cast<ShellExtensionSystem*>(
164 ExtensionSystem::Get(browser_context_.get())); 157 ExtensionSystem::Get(browser_context_.get()));
165 extension_system_->InitForRegularProfile(true); 158 extension_system_->InitForRegularProfile(true);
166 } 159 }
167 160
168 } // namespace apps 161 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698