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

Side by Side Diff: ash/shell/shell_main.cc

Issue 9166014: Allow a Views client to provide a default frameview for window widgets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/example_factory.h" 9 #include "ash/shell/example_factory.h"
10 #include "ash/shell/toplevel_window.h" 10 #include "ash/shell/toplevel_window.h"
11 #include "ash/wm/window_util.h" 11 #include "ash/wm/window_util.h"
12 #include "base/at_exit.h" 12 #include "base/at_exit.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/i18n/icu_util.h" 14 #include "base/i18n/icu_util.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/message_loop.h" 16 #include "base/message_loop.h"
17 #include "ui/aura/root_window.h" 17 #include "ui/aura/root_window.h"
18 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/base/ui_base_paths.h" 19 #include "ui/base/ui_base_paths.h"
20 #include "ui/gfx/canvas.h" 20 #include "ui/gfx/canvas.h"
21 #include "ui/gfx/compositor/test/compositor_test_support.h" 21 #include "ui/gfx/compositor/test/compositor_test_support.h"
22 #include "ui/views/test/test_views_delegate.h" 22 #include "ui/views/test/test_views_delegate.h"
23 #include "ui/views/widget/widget.h" 23 #include "ui/views/widget/widget.h"
24 #include "ui/views/widget/widget_delegate.h" 24 #include "ui/views/widget/widget_delegate.h"
25 25
26 namespace { 26 namespace {
27 27
28 class ShellViewsDelegate : public views::TestViewsDelegate {
29 public:
30 ShellViewsDelegate() {}
31 virtual ~ShellViewsDelegate() {}
32
33 // Overridden from views::TestViewsDelegate:
34 virtual views::NonClientFrameView* CreateDefaultNonClientFrameView(
35 views::Widget* widget) OVERRIDE {
36 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(widget);
37 }
38
39 private:
40 DISALLOW_COPY_AND_ASSIGN(ShellViewsDelegate);
41 };
42
28 class ShellDelegateImpl : public ash::ShellDelegate { 43 class ShellDelegateImpl : public ash::ShellDelegate {
29 public: 44 public:
30 ShellDelegateImpl() { 45 ShellDelegateImpl() {
31 } 46 }
32 47
33 virtual void CreateNewWindow() OVERRIDE { 48 virtual void CreateNewWindow() OVERRIDE {
34 ash::shell::ToplevelWindow::CreateParams create_params; 49 ash::shell::ToplevelWindow::CreateParams create_params;
35 create_params.can_resize = true; 50 create_params.can_resize = true;
36 create_params.can_maximize = true; 51 create_params.can_maximize = true;
37 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); 52 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 ui::RegisterPathProvider(); 114 ui::RegisterPathProvider();
100 icu_util::Initialize(); 115 icu_util::Initialize();
101 ResourceBundle::InitSharedInstance("en-US"); 116 ResourceBundle::InitSharedInstance("en-US");
102 117
103 // Create the message-loop here before creating the root window. 118 // Create the message-loop here before creating the root window.
104 MessageLoop message_loop(MessageLoop::TYPE_UI); 119 MessageLoop message_loop(MessageLoop::TYPE_UI);
105 ui::CompositorTestSupport::Initialize(); 120 ui::CompositorTestSupport::Initialize();
106 121
107 // A ViewsDelegate is required. 122 // A ViewsDelegate is required.
108 if (!views::ViewsDelegate::views_delegate) 123 if (!views::ViewsDelegate::views_delegate)
109 views::ViewsDelegate::views_delegate = new views::TestViewsDelegate; 124 views::ViewsDelegate::views_delegate = new ShellViewsDelegate;
110 125
111 ash::Shell::CreateInstance(new ShellDelegateImpl); 126 ash::Shell::CreateInstance(new ShellDelegateImpl);
112 127
113 ash::shell::InitWindowTypeLauncher(); 128 ash::shell::InitWindowTypeLauncher();
114 129
115 aura::RootWindow::GetInstance()->Run(); 130 aura::RootWindow::GetInstance()->Run();
116 131
117 ash::Shell::DeleteInstance(); 132 ash::Shell::DeleteInstance();
118 133
119 aura::RootWindow::DeleteInstance(); 134 aura::RootWindow::DeleteInstance();
120 135
121 ui::CompositorTestSupport::Terminate(); 136 ui::CompositorTestSupport::Terminate();
122 137
123 return 0; 138 return 0;
124 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698