| OLD | NEW |
| 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 ShellDelegateImpl : public aura_shell::ShellDelegate { | 28 class ShellDelegateImpl : public ash::ShellDelegate { |
| 29 public: | 29 public: |
| 30 ShellDelegateImpl() { | 30 ShellDelegateImpl() { |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual void CreateNewWindow() OVERRIDE { | 33 virtual void CreateNewWindow() OVERRIDE { |
| 34 ash::shell::ToplevelWindow::CreateParams create_params; | 34 ash::shell::ToplevelWindow::CreateParams create_params; |
| 35 create_params.can_resize = true; | 35 create_params.can_resize = true; |
| 36 create_params.can_maximize = true; | 36 create_params.can_maximize = true; |
| 37 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); | 37 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual views::Widget* CreateStatusArea() OVERRIDE { | 40 virtual views::Widget* CreateStatusArea() OVERRIDE { |
| 41 return aura_shell::internal::CreateStatusArea(); | 41 return ash::internal::CreateStatusArea(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 virtual void RequestAppListWidget( | 44 virtual void RequestAppListWidget( |
| 45 const gfx::Rect& bounds, | 45 const gfx::Rect& bounds, |
| 46 const SetWidgetCallback& callback) OVERRIDE { | 46 const SetWidgetCallback& callback) OVERRIDE { |
| 47 // TODO(xiyuan): Clean this up. | 47 // TODO(xiyuan): Clean this up. |
| 48 // The code below here is because we don't want to use | 48 // The code below here is because we don't want to use |
| 49 // --aura-views-applist. This function is deprecated and all code | 49 // --aura-views-applist. This function is deprecated and all code |
| 50 // here will be removed when we clean it up. | 50 // here will be removed when we clean it up. |
| 51 ash::shell::CreateAppList(bounds, callback); | 51 ash::shell::CreateAppList(bounds, callback); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual void BuildAppListModel(aura_shell::AppListModel* model) { | 54 virtual void BuildAppListModel(ash::AppListModel* model) { |
| 55 ash::shell::BuildAppListModel(model); | 55 ash::shell::BuildAppListModel(model); |
| 56 } | 56 } |
| 57 | 57 |
| 58 virtual aura_shell::AppListViewDelegate* CreateAppListViewDelegate() { | 58 virtual ash::AppListViewDelegate* CreateAppListViewDelegate() { |
| 59 return ash::shell::CreateAppListViewDelegate(); | 59 return ash::shell::CreateAppListViewDelegate(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual void LauncherItemClicked( | 62 virtual void LauncherItemClicked( |
| 63 const aura_shell::LauncherItem& item) OVERRIDE { | 63 const ash::LauncherItem& item) OVERRIDE { |
| 64 aura_shell::ActivateWindow(item.window); | 64 ash::ActivateWindow(item.window); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual bool ConfigureLauncherItem(aura_shell::LauncherItem* item) OVERRIDE { | 67 virtual bool ConfigureLauncherItem(ash::LauncherItem* item) OVERRIDE { |
| 68 static int image_count = 0; | 68 static int image_count = 0; |
| 69 item->tab_images.resize(image_count + 1); | 69 item->tab_images.resize(image_count + 1); |
| 70 for (int i = 0; i < image_count + 1; ++i) { | 70 for (int i = 0; i < image_count + 1; ++i) { |
| 71 item->tab_images[i].image.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); | 71 item->tab_images[i].image.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); |
| 72 item->tab_images[i].image.allocPixels(); | 72 item->tab_images[i].image.allocPixels(); |
| 73 item->tab_images[i].image.eraseARGB(255, | 73 item->tab_images[i].image.eraseARGB(255, |
| 74 i == 0 ? 255 : 0, | 74 i == 0 ? 255 : 0, |
| 75 i == 1 ? 255 : 0, | 75 i == 1 ? 255 : 0, |
| 76 i == 2 ? 255 : 0); | 76 i == 2 ? 255 : 0); |
| 77 } | 77 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 101 ResourceBundle::InitSharedInstance("en-US"); | 101 ResourceBundle::InitSharedInstance("en-US"); |
| 102 | 102 |
| 103 // Create the message-loop here before creating the root window. | 103 // Create the message-loop here before creating the root window. |
| 104 MessageLoop message_loop(MessageLoop::TYPE_UI); | 104 MessageLoop message_loop(MessageLoop::TYPE_UI); |
| 105 ui::CompositorTestSupport::Initialize(); | 105 ui::CompositorTestSupport::Initialize(); |
| 106 | 106 |
| 107 // A ViewsDelegate is required. | 107 // A ViewsDelegate is required. |
| 108 if (!views::ViewsDelegate::views_delegate) | 108 if (!views::ViewsDelegate::views_delegate) |
| 109 views::ViewsDelegate::views_delegate = new views::TestViewsDelegate; | 109 views::ViewsDelegate::views_delegate = new views::TestViewsDelegate; |
| 110 | 110 |
| 111 aura_shell::Shell::CreateInstance(new ShellDelegateImpl); | 111 ash::Shell::CreateInstance(new ShellDelegateImpl); |
| 112 | 112 |
| 113 ash::shell::InitWindowTypeLauncher(); | 113 ash::shell::InitWindowTypeLauncher(); |
| 114 | 114 |
| 115 aura::RootWindow::GetInstance()->Run(); | 115 aura::RootWindow::GetInstance()->Run(); |
| 116 | 116 |
| 117 aura_shell::Shell::DeleteInstance(); | 117 ash::Shell::DeleteInstance(); |
| 118 | 118 |
| 119 aura::RootWindow::DeleteInstance(); | 119 aura::RootWindow::DeleteInstance(); |
| 120 | 120 |
| 121 ui::CompositorTestSupport::Terminate(); | 121 ui::CompositorTestSupport::Terminate(); |
| 122 | 122 |
| 123 return 0; | 123 return 0; |
| 124 } | 124 } |
| OLD | NEW |