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

Side by Side Diff: ui/aura_shell/examples/aura_shell_main.cc

Issue 8558031: [Aura] Refactor and update app list window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync, change initial size close to final size to avoid CardSlider resize animation Created 9 years, 1 month 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
« no previous file with comments | « ui/aura_shell/aura_shell.gyp ('k') | ui/aura_shell/launcher/launcher_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/i18n/icu_util.h" 7 #include "base/i18n/icu_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "ui/aura/desktop.h" 10 #include "ui/aura/desktop.h"
11 #include "ui/aura_shell/examples/toplevel_window.h" 11 #include "ui/aura_shell/examples/toplevel_window.h"
12 #include "ui/aura_shell/launcher/launcher_types.h" 12 #include "ui/aura_shell/launcher/launcher_types.h"
13 #include "ui/aura_shell/shell.h" 13 #include "ui/aura_shell/shell.h"
14 #include "ui/aura_shell/shell_delegate.h" 14 #include "ui/aura_shell/shell_delegate.h"
15 #include "ui/aura_shell/shell_factory.h" 15 #include "ui/aura_shell/shell_factory.h"
16 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/base/ui_base_paths.h" 17 #include "ui/base/ui_base_paths.h"
18 #include "ui/gfx/canvas.h"
18 #include "ui/gfx/compositor/test/compositor_test_support.h" 19 #include "ui/gfx/compositor/test/compositor_test_support.h"
20 #include "views/widget/widget_delegate.h"
21 #include "views/widget/widget.h"
19 22
20 namespace { 23 namespace {
21 24
25 class AppListWindow : public views::WidgetDelegateView {
26 public:
27 AppListWindow() {
28 }
29
30 // static
31 static views::Widget* Create() {
32 AppListWindow* app_list = new AppListWindow;
33
34 views::Widget::InitParams widget_params(
35 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
36 widget_params.delegate = app_list;
37 widget_params.keep_on_top = true;
38 widget_params.transparent = true;
39
40 views::Widget* widget = new views::Widget;
41 widget->Init(widget_params);
42 widget->SetContentsView(app_list);
43 return widget;
44 }
45
46 // Overridden from views::View:
47 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
48 canvas->FillRect(SkColorSetARGB(0x4F, 0xFF, 0, 0), bounds());
49 }
50 };
51
22 class ShellDelegateImpl : public aura_shell::ShellDelegate { 52 class ShellDelegateImpl : public aura_shell::ShellDelegate {
23 public: 53 public:
24 ShellDelegateImpl() { 54 ShellDelegateImpl() {
25 } 55 }
26 56
27 virtual void CreateNewWindow() OVERRIDE { 57 virtual void CreateNewWindow() OVERRIDE {
28 aura_shell::examples::ToplevelWindow::CreateParams create_params; 58 aura_shell::examples::ToplevelWindow::CreateParams create_params;
29 create_params.can_resize = true; 59 create_params.can_resize = true;
30 create_params.can_maximize = true; 60 create_params.can_maximize = true;
31 aura_shell::examples::ToplevelWindow::CreateToplevelWindow(create_params); 61 aura_shell::examples::ToplevelWindow::CreateToplevelWindow(create_params);
32 } 62 }
33 63
34 virtual views::Widget* CreateStatusArea() OVERRIDE { 64 virtual views::Widget* CreateStatusArea() OVERRIDE {
35 return aura_shell::internal::CreateStatusArea(); 65 return aura_shell::internal::CreateStatusArea();
36 } 66 }
37 67
38 virtual void ShowApps() OVERRIDE { 68 virtual void RequestAppListWidget(
39 NOTIMPLEMENTED(); 69 const SetWidgetCallback& callback) OVERRIDE {
70 callback.Run(AppListWindow::Create());
40 } 71 }
41 72
42 virtual void LauncherItemClicked( 73 virtual void LauncherItemClicked(
43 const aura_shell::LauncherItem& item) OVERRIDE { 74 const aura_shell::LauncherItem& item) OVERRIDE {
44 item.window->Activate(); 75 item.window->Activate();
45 } 76 }
46 77
47 virtual bool ConfigureLauncherItem(aura_shell::LauncherItem* item) OVERRIDE { 78 virtual bool ConfigureLauncherItem(aura_shell::LauncherItem* item) OVERRIDE {
48 static int image_count = 0; 79 static int image_count = 0;
49 item->tab_images.resize(image_count + 1); 80 item->tab_images.resize(image_count + 1);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 aura_shell::examples::InitWindowTypeLauncher(); 120 aura_shell::examples::InitWindowTypeLauncher();
90 121
91 aura::Desktop::GetInstance()->Run(); 122 aura::Desktop::GetInstance()->Run();
92 123
93 delete aura::Desktop::GetInstance(); 124 delete aura::Desktop::GetInstance();
94 125
95 ui::CompositorTestSupport::Terminate(); 126 ui::CompositorTestSupport::Terminate();
96 127
97 return 0; 128 return 0;
98 } 129 }
OLDNEW
« no previous file with comments | « ui/aura_shell/aura_shell.gyp ('k') | ui/aura_shell/launcher/launcher_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698