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