OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/launcher/launcher_types.h" | 5 #include "ash/launcher/launcher_types.h" |
6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
7 #include "ash/shell_delegate.h" | 7 #include "ash/shell_delegate.h" |
8 #include "ash/shell_factory.h" | 8 #include "ash/shell_factory.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/shell/example_factory.h" | 10 #include "ash/shell/example_factory.h" |
11 #include "ash/shell/toplevel_window.h" | 11 #include "ash/shell/toplevel_window.h" |
12 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
13 #include "base/at_exit.h" | 13 #include "base/at_exit.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/i18n/icu_util.h" | 15 #include "base/i18n/icu_util.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
18 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
20 #include "ui/base/ui_base_paths.h" | 20 #include "ui/base/ui_base_paths.h" |
21 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
22 #include "ui/gfx/compositor/test/compositor_test_support.h" | 22 #include "ui/gfx/compositor/test/compositor_test_support.h" |
23 #include "ui/views/test/test_views_delegate.h" | 23 #include "ui/views/test/test_views_delegate.h" |
24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
25 #include "ui/views/widget/widget_delegate.h" | 25 #include "ui/views/widget/widget_delegate.h" |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
| 29 class ShellViewsDelegate : public views::TestViewsDelegate { |
| 30 public: |
| 31 ShellViewsDelegate() {} |
| 32 virtual ~ShellViewsDelegate() {} |
| 33 |
| 34 // Overridden from views::TestViewsDelegate: |
| 35 virtual views::NonClientFrameView* CreateDefaultNonClientFrameView( |
| 36 views::Widget* widget) OVERRIDE { |
| 37 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(widget); |
| 38 } |
| 39 |
| 40 private: |
| 41 DISALLOW_COPY_AND_ASSIGN(ShellViewsDelegate); |
| 42 }; |
| 43 |
29 class ShellDelegateImpl : public ash::ShellDelegate { | 44 class ShellDelegateImpl : public ash::ShellDelegate { |
30 public: | 45 public: |
31 ShellDelegateImpl() { | 46 ShellDelegateImpl() { |
32 } | 47 } |
33 | 48 |
34 virtual void CreateNewWindow() OVERRIDE { | 49 virtual void CreateNewWindow() OVERRIDE { |
35 ash::shell::ToplevelWindow::CreateParams create_params; | 50 ash::shell::ToplevelWindow::CreateParams create_params; |
36 create_params.can_resize = true; | 51 create_params.can_resize = true; |
37 create_params.can_maximize = true; | 52 create_params.can_maximize = true; |
38 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); | 53 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 ui::RegisterPathProvider(); | 124 ui::RegisterPathProvider(); |
110 icu_util::Initialize(); | 125 icu_util::Initialize(); |
111 ResourceBundle::InitSharedInstance("en-US"); | 126 ResourceBundle::InitSharedInstance("en-US"); |
112 | 127 |
113 // Create the message-loop here before creating the root window. | 128 // Create the message-loop here before creating the root window. |
114 MessageLoop message_loop(MessageLoop::TYPE_UI); | 129 MessageLoop message_loop(MessageLoop::TYPE_UI); |
115 ui::CompositorTestSupport::Initialize(); | 130 ui::CompositorTestSupport::Initialize(); |
116 | 131 |
117 // A ViewsDelegate is required. | 132 // A ViewsDelegate is required. |
118 if (!views::ViewsDelegate::views_delegate) | 133 if (!views::ViewsDelegate::views_delegate) |
119 views::ViewsDelegate::views_delegate = new views::TestViewsDelegate; | 134 views::ViewsDelegate::views_delegate = new ShellViewsDelegate; |
120 | 135 |
121 ash::Shell::CreateInstance(new ShellDelegateImpl); | 136 ash::Shell::CreateInstance(new ShellDelegateImpl); |
122 | 137 |
123 ash::shell::InitWindowTypeLauncher(); | 138 ash::shell::InitWindowTypeLauncher(); |
124 | 139 |
125 aura::RootWindow::GetInstance()->Run(); | 140 aura::RootWindow::GetInstance()->Run(); |
126 | 141 |
127 ash::Shell::DeleteInstance(); | 142 ash::Shell::DeleteInstance(); |
128 | 143 |
129 aura::RootWindow::DeleteInstance(); | 144 aura::RootWindow::DeleteInstance(); |
130 | 145 |
131 ui::CompositorTestSupport::Terminate(); | 146 ui::CompositorTestSupport::Terminate(); |
132 | 147 |
133 return 0; | 148 return 0; |
134 } | 149 } |
OLD | NEW |