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 "athena/home/public/home_card.h" | 8 #include "athena/main/athena_launcher.h" |
9 #include "athena/main/placeholder.h" | 9 #include "athena/main/placeholder.h" |
10 #include "athena/screen/public/screen_manager.h" | |
11 #include "athena/wm/public/window_manager.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "content/public/app/content_main.h" | 10 #include "content/public/app/content_main.h" |
14 #include "ui/aura/window_tree_host.h" | 11 #include "ui/aura/window_tree_host.h" |
15 #include "ui/wm/core/visibility_controller.h" | 12 #include "ui/wm/core/visibility_controller.h" |
16 | 13 |
17 class AthenaBrowserMainDelegate : public apps::ShellBrowserMainDelegate { | 14 class AthenaBrowserMainDelegate : public apps::ShellBrowserMainDelegate { |
18 public: | 15 public: |
19 AthenaBrowserMainDelegate() {} | 16 AthenaBrowserMainDelegate() {} |
20 virtual ~AthenaBrowserMainDelegate() {} | 17 virtual ~AthenaBrowserMainDelegate() {} |
21 | 18 |
22 // apps::ShellBrowserMainDelegate: | 19 // apps::ShellBrowserMainDelegate: |
23 virtual void Start(content::BrowserContext* context) OVERRIDE { | 20 virtual void Start(content::BrowserContext* context) OVERRIDE { |
24 aura::Window* root_window = | 21 athena::StartAthena(apps::ShellDesktopController::instance() |
25 apps::ShellDesktopController::instance()->GetWindowTreeHost()->window(); | 22 ->GetWindowTreeHost() |
26 visibility_controller_.reset(new ::wm::VisibilityController); | 23 ->window()); |
27 aura::client::SetVisibilityClient(root_window, | |
28 visibility_controller_.get()); | |
29 | |
30 athena::ScreenManager::Create(root_window); | |
31 athena::WindowManager::Create(); | |
32 athena::HomeCard::Create(); | |
33 | |
34 SetupBackgroundImage(); | |
35 CreateTestWindows(); | 24 CreateTestWindows(); |
36 } | 25 } |
37 | 26 |
38 virtual void Shutdown() OVERRIDE { | 27 virtual void Shutdown() OVERRIDE { athena::ShutdownAthena(); } |
39 athena::HomeCard::Shutdown(); | |
40 athena::WindowManager::Shutdown(); | |
41 athena::ScreenManager::Shutdown(); | |
42 visibility_controller_.reset(); | |
43 } | |
44 | |
45 scoped_ptr< ::wm::VisibilityController> visibility_controller_; | |
46 | 28 |
47 private: | 29 private: |
48 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); | 30 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); |
49 }; | 31 }; |
50 | 32 |
51 class AthenaMainDelegate : public apps::ShellMainDelegate { | 33 class AthenaMainDelegate : public apps::ShellMainDelegate { |
52 public: | 34 public: |
53 AthenaMainDelegate() {} | 35 AthenaMainDelegate() {} |
54 virtual ~AthenaMainDelegate() {} | 36 virtual ~AthenaMainDelegate() {} |
55 | 37 |
56 private: | 38 private: |
57 // apps::ShellMainDelegate: | 39 // apps::ShellMainDelegate: |
58 virtual apps::ShellBrowserMainDelegate* CreateShellBrowserMainDelegate() | 40 virtual apps::ShellBrowserMainDelegate* CreateShellBrowserMainDelegate() |
59 OVERRIDE { | 41 OVERRIDE { |
60 return new AthenaBrowserMainDelegate(); | 42 return new AthenaBrowserMainDelegate(); |
61 } | 43 } |
62 | 44 |
63 DISALLOW_COPY_AND_ASSIGN(AthenaMainDelegate); | 45 DISALLOW_COPY_AND_ASSIGN(AthenaMainDelegate); |
64 }; | 46 }; |
65 | 47 |
66 int main(int argc, const char** argv) { | 48 int main(int argc, const char** argv) { |
67 AthenaMainDelegate delegate; | 49 AthenaMainDelegate delegate; |
68 content::ContentMainParams params(&delegate); | 50 content::ContentMainParams params(&delegate); |
69 | 51 |
70 params.argc = argc; | 52 params.argc = argc; |
71 params.argv = argv; | 53 params.argv = argv; |
72 | 54 |
73 return content::ContentMain(params); | 55 return content::ContentMain(params); |
74 } | 56 } |
OLD | NEW |