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 "apps/shell/app/shell_main_delegate.h" | 5 #include "apps/shell/app/shell_main_delegate.h" |
6 #include "apps/shell/browser/shell_browser_main_delegate.h" | 6 #include "apps/shell/browser/shell_browser_main_delegate.h" |
7 #include "apps/shell/browser/shell_desktop_controller.h" | 7 #include "apps/shell/browser/shell_desktop_controller.h" |
8 #include "apps/shell/browser/shell_extension_system.h" | 8 #include "apps/shell/browser/shell_extension_system.h" |
9 #include "athena/content/public/content_activity_factory.h" | 9 #include "athena/content/public/content_activity_factory.h" |
10 #include "athena/content/public/content_app_model_builder.h" | 10 #include "athena/content/public/content_app_model_builder.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 const std::string kAppSwitch = "app"; | 22 const std::string kAppSwitch = "app"; |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 class AthenaBrowserMainDelegate : public apps::ShellBrowserMainDelegate { | 25 class AthenaBrowserMainDelegate : public apps::ShellBrowserMainDelegate { |
26 public: | 26 public: |
27 AthenaBrowserMainDelegate() {} | 27 AthenaBrowserMainDelegate() {} |
28 virtual ~AthenaBrowserMainDelegate() {} | 28 virtual ~AthenaBrowserMainDelegate() {} |
29 | 29 |
30 // apps::ShellBrowserMainDelegate: | 30 // apps::ShellBrowserMainDelegate: |
31 virtual void Start(content::BrowserContext* context) OVERRIDE { | 31 virtual void Start(content::BrowserContext* context) OVERRIDE { |
32 athena::StartAthena( | |
33 apps::ShellDesktopController::instance()->host()->window(), | |
34 new athena::ContentActivityFactory(), | |
35 new athena::ContentAppModelBuilder(context)); | |
36 athena::HomeCard::Get()->RegisterSearchProvider( | |
37 new athena::UrlSearchProvider(context)); | |
38 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 32 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
39 if (command_line->HasSwitch(kAppSwitch)) { | 33 if (command_line->HasSwitch(kAppSwitch)) { |
40 base::FilePath app_dir(command_line->GetSwitchValueNative(kAppSwitch)); | 34 base::FilePath app_dir(command_line->GetSwitchValueNative(kAppSwitch)); |
41 base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir); | 35 base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir); |
42 extensions::ShellExtensionSystem* extension_system = | 36 extensions::ShellExtensionSystem* extension_system = |
43 static_cast<extensions::ShellExtensionSystem*>( | 37 static_cast<extensions::ShellExtensionSystem*>( |
44 extensions::ExtensionSystem::Get(context)); | 38 extensions::ExtensionSystem::Get(context)); |
45 extension_system->LoadApp(app_absolute_dir); | 39 extension_system->LoadApp(app_absolute_dir); |
46 } | 40 } |
| 41 |
| 42 athena::StartAthena( |
| 43 apps::ShellDesktopController::instance()->host()->window(), |
| 44 new athena::ContentActivityFactory(), |
| 45 new athena::ContentAppModelBuilder(context)); |
| 46 athena::HomeCard::Get()->RegisterSearchProvider( |
| 47 new athena::UrlSearchProvider(context)); |
47 CreateTestPages(context); | 48 CreateTestPages(context); |
48 } | 49 } |
49 | 50 |
50 virtual void Shutdown() OVERRIDE { athena::ShutdownAthena(); } | 51 virtual void Shutdown() OVERRIDE { athena::ShutdownAthena(); } |
51 | 52 |
52 virtual apps::ShellDesktopController* CreateDesktopController() OVERRIDE { | 53 virtual apps::ShellDesktopController* CreateDesktopController() OVERRIDE { |
53 // TODO(mukai): create Athena's own ShellDesktopController subclass so that | 54 // TODO(mukai): create Athena's own ShellDesktopController subclass so that |
54 // it can initialize its own window manager logic. | 55 // it can initialize its own window manager logic. |
55 return new apps::ShellDesktopController(); | 56 return new apps::ShellDesktopController(); |
56 } | 57 } |
(...skipping 19 matching lines...) Expand all Loading... |
76 | 77 |
77 int main(int argc, const char** argv) { | 78 int main(int argc, const char** argv) { |
78 AthenaMainDelegate delegate; | 79 AthenaMainDelegate delegate; |
79 content::ContentMainParams params(&delegate); | 80 content::ContentMainParams params(&delegate); |
80 | 81 |
81 params.argc = argc; | 82 params.argc = argc; |
82 params.argv = argv; | 83 params.argv = argv; |
83 | 84 |
84 return content::ContentMain(params); | 85 return content::ContentMain(params); |
85 } | 86 } |
OLD | NEW |