summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 16:17:24 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 16:17:24 +0000
commit595b52a3cb8b04192f47ac0039ac0a816b034b40 (patch)
tree2be11a33f7da12c9de6201a6bded1b073df28d58
parent80e776ae1d59c54371ae86623bea63fed23663f2 (diff)
downloadchromium_src-595b52a3cb8b04192f47ac0039ac0a816b034b40.zip
chromium_src-595b52a3cb8b04192f47ac0039ac0a816b034b40.tar.gz
chromium_src-595b52a3cb8b04192f47ac0039ac0a816b034b40.tar.bz2
Makes the launcher use a layer with a solid color, which is cheaper
than a textured layer. BUG=119581 TEST=none R=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/9835028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128500 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/accelerators/accelerator_controller.cc1
-rw-r--r--ash/app_list/app_list.cc1
-rw-r--r--ash/desktop_background/desktop_background_controller.cc2
-rw-r--r--ash/drag_drop/drag_drop_controller.cc1
-rw-r--r--ash/launcher/launcher.cc13
-rw-r--r--ash/monitor/monitor_controller.cc2
-rw-r--r--ash/shell.cc2
-rw-r--r--ash/wm/default_window_resizer.cc1
-rw-r--r--ash/wm/image_grid.cc4
-rw-r--r--ash/wm/power_button_controller.cc2
-rw-r--r--ash/wm/root_window_layout_manager.cc1
-rw-r--r--ash/wm/shadow_controller.cc1
-rw-r--r--ash/wm/shadow_controller_unittest.cc12
-rw-r--r--ash/wm/toplevel_window_event_filter_unittest.cc4
-rw-r--r--ash/wm/visibility_controller.cc1
-rw-r--r--ash/wm/visibility_controller_unittest.cc1
-rw-r--r--ash/wm/window_animations.cc1
-rw-r--r--ash/wm/workspace/multi_window_resize_controller_unittest.cc2
-rw-r--r--ash/wm/workspace/workspace_event_filter_unittest.cc2
-rw-r--r--ash/wm/workspace/workspace_layout_manager.cc1
-rw-r--r--ash/wm/workspace/workspace_manager_unittest.cc5
-rw-r--r--ash/wm/workspace/workspace_window_resizer_unittest.cc6
-rw-r--r--chrome/browser/ui/tabs/dock_info_aura.cc2
-rw-r--r--chrome/browser/ui/views/ash/launcher/launcher_updater_unittest.cc6
-rw-r--r--chrome/browser/ui/views/ash/screenshot_taker.cc2
-rw-r--r--chrome/browser/ui/views/ash/window_positioner.cc1
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc2
-rw-r--r--chrome/browser/ui/window_snapshot/window_snapshot_aura.cc1
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc6
-rw-r--r--ui/aura/demo/demo_main.cc6
-rw-r--r--ui/aura/event_filter_unittest.cc2
-rw-r--r--ui/aura/root_window.cc2
-rw-r--r--ui/aura/test/test_windows.cc4
-rw-r--r--ui/aura/window.cc3
-rw-r--r--ui/aura/window.h4
-rw-r--r--ui/aura/window_unittest.cc42
-rw-r--r--ui/gfx/compositor/compositor.gyp1
-rw-r--r--ui/gfx/compositor/debug_utils.cc6
-rw-r--r--ui/gfx/compositor/layer.h13
-rw-r--r--ui/gfx/compositor/layer_type.h25
-rw-r--r--ui/gfx/compositor/layer_unittest.cc36
-rw-r--r--ui/views/widget/native_widget_aura.cc4
-rw-r--r--ui/views/widget/native_widget_aura_unittest.cc4
-rw-r--r--ui/views/widget/widget.cc4
-rw-r--r--ui/views/widget/widget.h8
45 files changed, 137 insertions, 113 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index bbdb5c1..5af7a3c 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -27,6 +27,7 @@
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/accelerators/accelerator_manager.h"
#include "ui/gfx/compositor/debug_utils.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/layer_animation_sequence.h"
#include "ui/gfx/compositor/layer_animator.h"
#include "ui/gfx/compositor/screen_rotation.h"
diff --git a/ash/app_list/app_list.cc b/ash/app_list/app_list.cc
index e9b420f..c4771b6f 100644
--- a/ash/app_list/app_list.cc
+++ b/ash/app_list/app_list.cc
@@ -11,6 +11,7 @@
#include "ui/aura/event.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/transform_util.h"
diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc
index ccf22f4..c6698cc 100644
--- a/ash/desktop_background/desktop_background_controller.cc
+++ b/ash/desktop_background/desktop_background_controller.cc
@@ -56,7 +56,7 @@ void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode() {
// viewport when there are regions not covered by a layer:
// http://crbug.com/113445
Shell* shell = Shell::GetInstance();
- ui::Layer* background_layer = new ui::Layer(ui::Layer::LAYER_SOLID_COLOR);
+ ui::Layer* background_layer = new ui::Layer(ui::LAYER_SOLID_COLOR);
background_layer->SetColor(SK_ColorBLACK);
shell->GetContainer(internal::kShellWindowId_DesktopBackgroundContainer)->
layer()->Add(background_layer);
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index 052cb8d..5510081 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -13,6 +13,7 @@
#include "ui/aura/window.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/os_exchange_data_provider_aura.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/layer_animator.h"
#include "ui/gfx/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/point.h"
diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc
index a38b536..51b2c58 100644
--- a/ash/launcher/launcher.cc
+++ b/ash/launcher/launcher.cc
@@ -17,7 +17,6 @@
#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/image/image.h"
#include "ui/views/accessible_pane_view.h"
-#include "ui/views/background.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
@@ -118,7 +117,8 @@ Launcher::Launcher(aura::Window* window_container)
widget_.reset(new views::Widget);
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
- params.create_texture_for_layer = true;
+ // The launcher only ever draws a solid color.
+ params.layer_type = ui::LAYER_SOLID_COLOR;
params.transparent = true;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.parent = Shell::GetInstance()->GetContainer(
@@ -185,13 +185,8 @@ internal::LauncherView* Launcher::GetLauncherViewForTest() {
}
void Launcher::UpdateBackground(int alpha) {
- if (alpha == 0) {
- delegate_view_->set_background(NULL);
- } else {
- delegate_view_->set_background(
- views::Background::CreateSolidBackground(0, 0, 0, alpha));
- }
- delegate_view_->SchedulePaint();
+ ui::Layer* layer = widget_->GetNativeView()->layer();
+ layer->SetColor(SkColorSetARGB(alpha, 0, 0, 0));
}
} // namespace ash
diff --git a/ash/monitor/monitor_controller.cc b/ash/monitor/monitor_controller.cc
index c09d9db..397e5ab 100644
--- a/ash/monitor/monitor_controller.cc
+++ b/ash/monitor/monitor_controller.cc
@@ -27,7 +27,7 @@ void SetupAsSecondaryMonitor(aura::RootWindow* root) {
root->SetLayoutManager(new internal::RootWindowLayoutManager(root));
aura::Window* container = new aura::Window(NULL);
container->SetName("SecondaryMonitorContainer");
- container->Init(ui::Layer::LAYER_NOT_DRAWN);
+ container->Init(ui::LAYER_NOT_DRAWN);
root->AddChild(container);
container->SetLayoutManager(new internal::BaseLayoutManager(root));
CreateSecondaryMonitorWidget(container);
diff --git a/ash/shell.cc b/ash/shell.cc
index e2665e5..dcdf714 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -108,7 +108,7 @@ aura::Window* CreateContainer(int window_id,
aura::Window* container = new aura::Window(NULL);
container->set_id(window_id);
container->SetName(name);
- container->Init(ui::Layer::LAYER_NOT_DRAWN);
+ container->Init(ui::LAYER_NOT_DRAWN);
parent->AddChild(container);
if (window_id != internal::kShellWindowId_UnparentedControlContainer)
container->Show();
diff --git a/ash/wm/default_window_resizer.cc b/ash/wm/default_window_resizer.cc
index 130a850..71cbf9e 100644
--- a/ash/wm/default_window_resizer.cc
+++ b/ash/wm/default_window_resizer.cc
@@ -12,6 +12,7 @@
#include "ui/aura/window_delegate.h"
#include "ui/base/hit_test.h"
#include "ui/base/ui_base_types.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/screen.h"
diff --git a/ash/wm/image_grid.cc b/ash/wm/image_grid.cc
index c9c341f..99fb8ff 100644
--- a/ash/wm/image_grid.cc
+++ b/ash/wm/image_grid.cc
@@ -26,7 +26,7 @@ gfx::Rect ImageGrid::TestAPI::GetTransformedLayerBounds(
}
ImageGrid::ImageGrid()
- : layer_(new ui::Layer(ui::Layer::LAYER_NOT_DRAWN)),
+ : layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)),
top_image_height_(0),
bottom_image_height_(0),
left_image_width_(0),
@@ -257,7 +257,7 @@ void ImageGrid::SetImage(const gfx::Image* image,
return;
// Set up the new layer and painter.
- layer_ptr->reset(new ui::Layer(ui::Layer::LAYER_TEXTURED));
+ layer_ptr->reset(new ui::Layer(ui::LAYER_TEXTURED));
const gfx::Size size = GetImageSize(image);
layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height()));
diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc
index bf70750..aadedaa 100644
--- a/ash/wm/power_button_controller.cc
+++ b/ash/wm/power_button_controller.cc
@@ -525,7 +525,7 @@ void PowerButtonController::ShowBackgroundLayer() {
hide_background_layer_timer_.Stop();
if (!background_layer_.get()) {
- background_layer_.reset(new ui::Layer(ui::Layer::LAYER_SOLID_COLOR));
+ background_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
background_layer_->SetColor(SK_ColorBLACK);
ui::Layer* root_layer = Shell::GetRootWindow()->layer();
diff --git a/ash/wm/root_window_layout_manager.cc b/ash/wm/root_window_layout_manager.cc
index 409247c..7514d9a 100644
--- a/ash/wm/root_window_layout_manager.cc
+++ b/ash/wm/root_window_layout_manager.cc
@@ -5,6 +5,7 @@
#include "ash/wm/root_window_layout_manager.h"
#include "ui/aura/window.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/views/widget/widget.h"
namespace ash {
diff --git a/ash/wm/shadow_controller.cc b/ash/wm/shadow_controller.cc
index e467f2c..5b0a58b 100644
--- a/ash/wm/shadow_controller.cc
+++ b/ash/wm/shadow_controller.cc
@@ -16,6 +16,7 @@
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
+#include "ui/gfx/compositor/layer.h"
using std::make_pair;
diff --git a/ash/wm/shadow_controller_unittest.cc b/ash/wm/shadow_controller_unittest.cc
index eb6f9af..8503168 100644
--- a/ash/wm/shadow_controller_unittest.cc
+++ b/ash/wm/shadow_controller_unittest.cc
@@ -27,7 +27,7 @@ typedef ash::test::AshTestBase ShadowControllerTest;
TEST_F(ShadowControllerTest, Shadow) {
scoped_ptr<aura::Window> window(new aura::Window(NULL));
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
- window->Init(ui::Layer::LAYER_TEXTURED);
+ window->Init(ui::LAYER_TEXTURED);
window->SetParent(NULL);
// We should create the shadow before the window is visible (the shadow's
@@ -64,7 +64,7 @@ TEST_F(ShadowControllerTest, Shadow) {
TEST_F(ShadowControllerTest, ShadowBounds) {
scoped_ptr<aura::Window> window(new aura::Window(NULL));
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
- window->Init(ui::Layer::LAYER_TEXTURED);
+ window->Init(ui::LAYER_TEXTURED);
window->SetParent(NULL);
window->Show();
@@ -95,7 +95,7 @@ TEST_F(ShadowControllerTest, ShadowStyle) {
scoped_ptr<aura::Window> window1(new aura::Window(NULL));
window1->SetType(aura::client::WINDOW_TYPE_NORMAL);
- window1->Init(ui::Layer::LAYER_TEXTURED);
+ window1->Init(ui::LAYER_TEXTURED);
window1->SetParent(NULL);
window1->SetBounds(gfx::Rect(10, 20, 300, 400));
window1->Show();
@@ -109,7 +109,7 @@ TEST_F(ShadowControllerTest, ShadowStyle) {
// Create another window and activate it.
scoped_ptr<aura::Window> window2(new aura::Window(NULL));
window2->SetType(aura::client::WINDOW_TYPE_NORMAL);
- window2->Init(ui::Layer::LAYER_TEXTURED);
+ window2->Init(ui::LAYER_TEXTURED);
window2->SetParent(NULL);
window2->SetBounds(gfx::Rect(11, 21, 301, 401));
window2->Show();
@@ -129,7 +129,7 @@ TEST_F(ShadowControllerTest, SmallShadowsForTooltipsAndMenus) {
scoped_ptr<aura::Window> tooltip_window(new aura::Window(NULL));
tooltip_window->SetType(aura::client::WINDOW_TYPE_TOOLTIP);
- tooltip_window->Init(ui::Layer::LAYER_TEXTURED);
+ tooltip_window->Init(ui::LAYER_TEXTURED);
tooltip_window->SetParent(NULL);
tooltip_window->SetBounds(gfx::Rect(10, 20, 300, 400));
tooltip_window->Show();
@@ -140,7 +140,7 @@ TEST_F(ShadowControllerTest, SmallShadowsForTooltipsAndMenus) {
scoped_ptr<aura::Window> menu_window(new aura::Window(NULL));
menu_window->SetType(aura::client::WINDOW_TYPE_MENU);
- menu_window->Init(ui::Layer::LAYER_TEXTURED);
+ menu_window->Init(ui::LAYER_TEXTURED);
menu_window->SetParent(NULL);
menu_window->SetBounds(gfx::Rect(10, 20, 300, 400));
menu_window->Show();
diff --git a/ash/wm/toplevel_window_event_filter_unittest.cc b/ash/wm/toplevel_window_event_filter_unittest.cc
index 6e4a093..caa8a7c 100644
--- a/ash/wm/toplevel_window_event_filter_unittest.cc
+++ b/ash/wm/toplevel_window_event_filter_unittest.cc
@@ -70,7 +70,7 @@ class ToplevelWindowEventFilterTest : public AshTestBase {
virtual void SetUp() OVERRIDE {
AshTestBase::SetUp();
parent_ = new aura::Window(NULL);
- parent_->Init(ui::Layer::LAYER_NOT_DRAWN);
+ parent_->Init(ui::LAYER_NOT_DRAWN);
parent_->Show();
Shell::GetRootWindow()->AddChild(parent_);
parent_->SetBounds(Shell::GetRootWindow()->bounds());
@@ -89,7 +89,7 @@ class ToplevelWindowEventFilterTest : public AshTestBase {
TestWindowDelegate* d1 = new TestWindowDelegate(hittest_code);
aura::Window* w1 = new aura::Window(d1);
w1->set_id(1);
- w1->Init(ui::Layer::LAYER_TEXTURED);
+ w1->Init(ui::LAYER_TEXTURED);
w1->SetParent(parent_);
w1->SetBounds(gfx::Rect(0, 0, 100, 100));
w1->Show();
diff --git a/ash/wm/visibility_controller.cc b/ash/wm/visibility_controller.cc
index 0a6e61d..839cce3 100644
--- a/ash/wm/visibility_controller.cc
+++ b/ash/wm/visibility_controller.cc
@@ -8,6 +8,7 @@
#include "ash/wm/window_animations.h"
#include "ui/aura/window.h"
#include "ui/aura/window_property.h"
+#include "ui/gfx/compositor/layer.h"
DECLARE_WINDOW_PROPERTY_TYPE(bool)
diff --git a/ash/wm/visibility_controller_unittest.cc b/ash/wm/visibility_controller_unittest.cc
index 8021d30..a69c97a 100644
--- a/ash/wm/visibility_controller_unittest.cc
+++ b/ash/wm/visibility_controller_unittest.cc
@@ -8,6 +8,7 @@
#include "ui/aura/test/test_windows.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/layer_animator.h"
namespace ash {
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index dd23ec5..d423c0b 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -17,6 +17,7 @@
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#include "ui/aura/window_property.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/layer_animation_observer.h"
#include "ui/gfx/compositor/layer_animation_sequence.h"
#include "ui/gfx/compositor/layer_animator.h"
diff --git a/ash/wm/workspace/multi_window_resize_controller_unittest.cc b/ash/wm/workspace/multi_window_resize_controller_unittest.cc
index 7794470..4dbf4f2 100644
--- a/ash/wm/workspace/multi_window_resize_controller_unittest.cc
+++ b/ash/wm/workspace/multi_window_resize_controller_unittest.cc
@@ -42,7 +42,7 @@ class MultiWindowResizeControllerTest : public test::AshTestBase {
const gfx::Rect& bounds) {
aura::Window* window = new aura::Window(delegate);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
- window->Init(ui::Layer::LAYER_TEXTURED);
+ window->Init(ui::LAYER_TEXTURED);
window->SetParent(NULL);
window->SetBounds(bounds);
window->Show();
diff --git a/ash/wm/workspace/workspace_event_filter_unittest.cc b/ash/wm/workspace/workspace_event_filter_unittest.cc
index 06e5762..a02984c 100644
--- a/ash/wm/workspace/workspace_event_filter_unittest.cc
+++ b/ash/wm/workspace/workspace_event_filter_unittest.cc
@@ -28,7 +28,7 @@ class WorkspaceEventFilterTest : public test::AshTestBase {
const gfx::Rect& bounds) {
aura::Window* window = new aura::Window(delegate);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
- window->Init(ui::Layer::LAYER_TEXTURED);
+ window->Init(ui::LAYER_TEXTURED);
window->SetParent(NULL);
window->SetBounds(bounds);
window->Show();
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index 455facc..9e31183 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -18,6 +18,7 @@
#include "ui/aura/window_observer.h"
#include "ui/aura/window_property.h"
#include "ui/base/ui_base_types.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/rect.h"
#include "ui/views/widget/native_widget_aura.h"
diff --git a/ash/wm/workspace/workspace_manager_unittest.cc b/ash/wm/workspace/workspace_manager_unittest.cc
index 90bb287..f15dbfc 100644
--- a/ash/wm/workspace/workspace_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_manager_unittest.cc
@@ -19,6 +19,7 @@
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/base/ui_base_types.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/screen.h"
using aura::Window;
@@ -35,7 +36,7 @@ class WorkspaceManagerTest : public test::AshTestBase {
aura::Window* window = new aura::Window(NULL);
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
- window->Init(ui::Layer::LAYER_TEXTURED);
+ window->Init(ui::LAYER_TEXTURED);
return window;
}
@@ -43,7 +44,7 @@ class WorkspaceManagerTest : public test::AshTestBase {
aura::Window* window = new aura::Window(NULL);
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
- window->Init(ui::Layer::LAYER_TEXTURED);
+ window->Init(ui::LAYER_TEXTURED);
window->SetParent(GetViewport());
return window;
}
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc
index e7c65fb..72fea98 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -56,17 +56,17 @@ class WorkspaceWindowResizerTest : public test::AshTestBase {
EXPECT_EQ(kRootHeight, root_bounds.height());
Shell::GetInstance()->SetMonitorWorkAreaInsets(root, gfx::Insets());
window_.reset(new aura::Window(&delegate_));
- window_->Init(ui::Layer::LAYER_NOT_DRAWN);
+ window_->Init(ui::LAYER_NOT_DRAWN);
window_->SetParent(root);
window_->set_id(1);
window2_.reset(new aura::Window(&delegate2_));
- window2_->Init(ui::Layer::LAYER_NOT_DRAWN);
+ window2_->Init(ui::LAYER_NOT_DRAWN);
window2_->SetParent(root);
window2_->set_id(2);
window3_.reset(new aura::Window(&delegate3_));
- window3_->Init(ui::Layer::LAYER_NOT_DRAWN);
+ window3_->Init(ui::LAYER_NOT_DRAWN);
window3_->SetParent(root);
window3_->set_id(3);
}
diff --git a/chrome/browser/ui/tabs/dock_info_aura.cc b/chrome/browser/ui/tabs/dock_info_aura.cc
index 711ed37..f058680 100644
--- a/chrome/browser/ui/tabs/dock_info_aura.cc
+++ b/chrome/browser/ui/tabs/dock_info_aura.cc
@@ -23,7 +23,7 @@ aura::Window* GetLocalProcessWindowAtPointImpl(
if (!window->IsVisible())
return NULL;
- if (window->layer()->type() == ui::Layer::LAYER_TEXTURED) {
+ if (window->layer()->type() == ui::LAYER_TEXTURED) {
gfx::Point window_point(screen_point);
aura::Window::ConvertPointToWindow(ash::Shell::GetRootWindow(), window,
&window_point);
diff --git a/chrome/browser/ui/views/ash/launcher/launcher_updater_unittest.cc b/chrome/browser/ui/views/ash/launcher/launcher_updater_unittest.cc
index 1e50fd98..1fcf4af 100644
--- a/chrome/browser/ui/views/ash/launcher/launcher_updater_unittest.cc
+++ b/chrome/browser/ui/views/ash/launcher/launcher_updater_unittest.cc
@@ -117,7 +117,7 @@ class LauncherUpdaterTest : public ChromeRenderViewHostTestHarness {
test->launcher_delegate_.get(),
launcher_type,
app_id) {
- window.Init(ui::Layer::LAYER_NOT_DRAWN);
+ window.Init(ui::LAYER_NOT_DRAWN);
launcher_test->root_window()->AddChild(&window);
launcher_test->activation_client_->ActivateWindow(&window);
updater.Init();
@@ -221,7 +221,7 @@ TEST_F(LauncherUpdaterTest, TabbedSetup) {
TabStripModel tab_strip(&tab_strip_delegate, profile());
tab_strip.InsertTabContentsAt(0, &wrapper, TabStripModel::ADD_ACTIVE);
aura::Window window(NULL);
- window.Init(ui::Layer::LAYER_NOT_DRAWN);
+ window.Init(ui::LAYER_NOT_DRAWN);
root_window()->AddChild(&window);
LauncherUpdater updater(&window, &tab_strip, launcher_delegate_.get(),
LauncherUpdater::TYPE_TABBED, std::string());
@@ -296,7 +296,7 @@ TEST_F(LauncherUpdaterTest, TabbedWithApp) {
TEST_F(LauncherUpdaterTest, TabbedWithAppOnCreate) {
size_t initial_size = launcher_model_->items().size();
aura::Window window(NULL);
- window.Init(ui::Layer::LAYER_NOT_DRAWN);
+ window.Init(ui::LAYER_NOT_DRAWN);
root_window()->AddChild(&window);
TestTabStripModelDelegate tab_strip_delegate;
TabStripModel tab_strip(&tab_strip_delegate, profile());
diff --git a/chrome/browser/ui/views/ash/screenshot_taker.cc b/chrome/browser/ui/views/ash/screenshot_taker.cc
index 1657409..1f874f1 100644
--- a/chrome/browser/ui/views/ash/screenshot_taker.cc
+++ b/chrome/browser/ui/views/ash/screenshot_taker.cc
@@ -122,7 +122,7 @@ void ScreenshotTaker::CloseVisualFeedbackLayer(const base::Closure& task) {
void ScreenshotTaker::DisplayVisualFeedback(const gfx::Rect& rect,
const base::Closure& task) {
- visual_feedback_layer_.reset(new ui::Layer(ui::Layer::LAYER_SOLID_COLOR));
+ visual_feedback_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
visual_feedback_layer_->SetColor(SK_ColorWHITE);
visual_feedback_layer_->SetOpacity(kVisualFeedbackLayerOpacity);
visual_feedback_layer_->SetBounds(rect);
diff --git a/chrome/browser/ui/views/ash/window_positioner.cc b/chrome/browser/ui/views/ash/window_positioner.cc
index 0aa27d5..22f9197 100644
--- a/chrome/browser/ui/views/ash/window_positioner.cc
+++ b/chrome/browser/ui/views/ash/window_positioner.cc
@@ -9,6 +9,7 @@
#include "ash/wm/window_util.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/screen.h"
WindowPositioner::WindowPositioner()
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
index 53ef9d0..01e62ab 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
@@ -182,7 +182,7 @@ void NativeTabContentsViewAura::InitNativeTabContentsView() {
views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
params.native_widget = this;
// We don't draw anything so we don't need a texture.
- params.create_texture_for_layer = false;
+ params.layer_type = ui::LAYER_NOT_DRAWN;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.parent = NULL;
params.can_activate = true;
diff --git a/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc b/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc
index 9e74a22..d17cb60 100644
--- a/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc
+++ b/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc
@@ -9,6 +9,7 @@
#include "ui/aura/window.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/compositor/compositor.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/rect.h"
namespace browser {
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 320fe53..3bb4d4d 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -202,7 +202,7 @@ RenderWidgetHostViewAura::~RenderWidgetHostViewAura() {
void RenderWidgetHostViewAura::InitAsChild(
gfx::NativeView parent_view) {
- window_->Init(ui::Layer::LAYER_TEXTURED);
+ window_->Init(ui::LAYER_TEXTURED);
window_->SetName("RenderWidgetHostViewAura");
}
@@ -213,7 +213,7 @@ void RenderWidgetHostViewAura::InitAsPopup(
static_cast<RenderWidgetHostViewAura*>(parent_host_view);
popup_parent_host_view_->popup_child_host_view_ = this;
window_->SetType(aura::client::WINDOW_TYPE_MENU);
- window_->Init(ui::Layer::LAYER_TEXTURED);
+ window_->Init(ui::LAYER_TEXTURED);
window_->SetName("RenderWidgetHostViewAura");
window_->SetParent(NULL);
@@ -225,7 +225,7 @@ void RenderWidgetHostViewAura::InitAsFullscreen(
RenderWidgetHostView* reference_host_view) {
is_fullscreen_ = true;
window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
- window_->Init(ui::Layer::LAYER_TEXTURED);
+ window_->Init(ui::LAYER_TEXTURED);
window_->SetName("RenderWidgetHostViewAura");
window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
window_->SetParent(NULL);
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc
index 75c9d27..14ff3ac 100644
--- a/ui/aura/demo/demo_main.cc
+++ b/ui/aura/demo/demo_main.cc
@@ -121,7 +121,7 @@ int main(int argc, char** argv) {
DemoWindowDelegate window_delegate1(SK_ColorBLUE);
aura::Window window1(&window_delegate1);
window1.set_id(1);
- window1.Init(ui::Layer::LAYER_TEXTURED);
+ window1.Init(ui::LAYER_TEXTURED);
window1.SetBounds(gfx::Rect(100, 100, 400, 400));
window1.Show();
window1.SetParent(NULL);
@@ -129,7 +129,7 @@ int main(int argc, char** argv) {
DemoWindowDelegate window_delegate2(SK_ColorRED);
aura::Window window2(&window_delegate2);
window2.set_id(2);
- window2.Init(ui::Layer::LAYER_TEXTURED);
+ window2.Init(ui::LAYER_TEXTURED);
window2.SetBounds(gfx::Rect(200, 200, 350, 350));
window2.Show();
window2.SetParent(NULL);
@@ -137,7 +137,7 @@ int main(int argc, char** argv) {
DemoWindowDelegate window_delegate3(SK_ColorGREEN);
aura::Window window3(&window_delegate3);
window3.set_id(3);
- window3.Init(ui::Layer::LAYER_TEXTURED);
+ window3.Init(ui::LAYER_TEXTURED);
window3.SetBounds(gfx::Rect(10, 10, 50, 50));
window3.Show();
window3.SetParent(&window2);
diff --git a/ui/aura/event_filter_unittest.cc b/ui/aura/event_filter_unittest.cc
index f221724..196ca18 100644
--- a/ui/aura/event_filter_unittest.cc
+++ b/ui/aura/event_filter_unittest.cc
@@ -71,7 +71,7 @@ class TestEventFilterWindowDelegate : public TestWindowDelegate {
Window* CreateWindow(int id, Window* parent, WindowDelegate* delegate) {
Window* window = new Window(delegate ? delegate : new TestWindowDelegate);
window->set_id(id);
- window->Init(ui::Layer::LAYER_TEXTURED);
+ window->Init(ui::LAYER_TEXTURED);
window->SetParent(parent);
window->SetBounds(gfx::Rect(0, 0, 100, 100));
window->Show();
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 34e2a6e..23bc107 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -728,7 +728,7 @@ bool RootWindow::IsFocusedWindow(const Window* window) const {
}
void RootWindow::Init() {
- Window::Init(ui::Layer::LAYER_NOT_DRAWN);
+ Window::Init(ui::LAYER_NOT_DRAWN);
SetBounds(gfx::Rect(host_->GetBounds().size()));
Show();
compositor()->SetRootLayer(layer());
diff --git a/ui/aura/test/test_windows.cc b/ui/aura/test/test_windows.cc
index 3f2390b..682fd54 100644
--- a/ui/aura/test/test_windows.cc
+++ b/ui/aura/test/test_windows.cc
@@ -48,7 +48,7 @@ Window* CreateTestWindowWithDelegateAndType(WindowDelegate* delegate,
Window* window = new Window(delegate);
window->set_id(id);
window->SetType(type);
- window->Init(ui::Layer::LAYER_TEXTURED);
+ window->Init(ui::LAYER_TEXTURED);
window->SetBounds(bounds);
window->Show();
window->SetParent(parent);
@@ -59,7 +59,7 @@ Window* CreateTransientChild(int id, Window* parent) {
Window* window = new Window(NULL);
window->set_id(id);
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
- window->Init(ui::Layer::LAYER_TEXTURED);
+ window->Init(ui::LAYER_TEXTURED);
window->SetParent(NULL);
parent->AddTransientChild(window);
return window;
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 8f08a4b..4755f62 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -21,6 +21,7 @@
#include "ui/base/animation/multi_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/compositor/compositor.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/screen.h"
namespace aura {
@@ -127,7 +128,7 @@ Window::~Window() {
layer_ = NULL;
}
-void Window::Init(ui::Layer::LayerType layer_type) {
+void Window::Init(ui::LayerType layer_type) {
layer_ = new ui::Layer(layer_type);
layer_owner_.reset(layer_);
layer_->SetVisible(false);
diff --git a/ui/aura/window.h b/ui/aura/window.h
index 9c2703b..95c6c21 100644
--- a/ui/aura/window.h
+++ b/ui/aura/window.h
@@ -17,9 +17,9 @@
#include "ui/base/events.h"
#include "ui/aura/aura_export.h"
#include "ui/aura/client/window_types.h"
-#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/layer_animator.h"
#include "ui/gfx/compositor/layer_delegate.h"
+#include "ui/gfx/compositor/layer_type.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/rect.h"
@@ -71,7 +71,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
explicit Window(WindowDelegate* delegate);
virtual ~Window();
- void Init(ui::Layer::LayerType layer_type);
+ void Init(ui::LayerType layer_type);
// A type is used to identify a class of Windows and customize behavior such
// as event handling and parenting. This field should only be consumed by the
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index bac8e51..f1bed32 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -240,11 +240,11 @@ TEST_F(WindowTest, GetChildById) {
// and not containing NULL or parents.
TEST_F(WindowTest, Contains) {
Window parent(NULL);
- parent.Init(ui::Layer::LAYER_NOT_DRAWN);
+ parent.Init(ui::LAYER_NOT_DRAWN);
Window child1(NULL);
- child1.Init(ui::Layer::LAYER_NOT_DRAWN);
+ child1.Init(ui::LAYER_NOT_DRAWN);
Window child2(NULL);
- child2.Init(ui::Layer::LAYER_NOT_DRAWN);
+ child2.Init(ui::LAYER_NOT_DRAWN);
child1.SetParent(&parent);
child2.SetParent(&child1);
@@ -272,7 +272,7 @@ TEST_F(WindowTest, ConvertPointToWindow) {
TEST_F(WindowTest, HitTest) {
Window w1(new ColorTestWindowDelegate(SK_ColorWHITE));
w1.set_id(1);
- w1.Init(ui::Layer::LAYER_TEXTURED);
+ w1.Init(ui::LAYER_TEXTURED);
w1.SetBounds(gfx::Rect(10, 20, 50, 60));
w1.Show();
w1.SetParent(NULL);
@@ -421,11 +421,11 @@ TEST_F(WindowTest, OrphanedBeforeOnDestroyed) {
// Make sure StackChildAtTop moves both the window and layer to the front.
TEST_F(WindowTest, StackChildAtTop) {
Window parent(NULL);
- parent.Init(ui::Layer::LAYER_NOT_DRAWN);
+ parent.Init(ui::LAYER_NOT_DRAWN);
Window child1(NULL);
- child1.Init(ui::Layer::LAYER_NOT_DRAWN);
+ child1.Init(ui::LAYER_NOT_DRAWN);
Window child2(NULL);
- child2.Init(ui::Layer::LAYER_NOT_DRAWN);
+ child2.Init(ui::LAYER_NOT_DRAWN);
child1.SetParent(&parent);
child2.SetParent(&parent);
@@ -448,15 +448,15 @@ TEST_F(WindowTest, StackChildAtTop) {
// Make sure StackChildBelow works.
TEST_F(WindowTest, StackChildBelow) {
Window parent(NULL);
- parent.Init(ui::Layer::LAYER_NOT_DRAWN);
+ parent.Init(ui::LAYER_NOT_DRAWN);
Window child1(NULL);
- child1.Init(ui::Layer::LAYER_NOT_DRAWN);
+ child1.Init(ui::LAYER_NOT_DRAWN);
child1.set_id(1);
Window child2(NULL);
- child2.Init(ui::Layer::LAYER_NOT_DRAWN);
+ child2.Init(ui::LAYER_NOT_DRAWN);
child2.set_id(2);
Window child3(NULL);
- child3.Init(ui::Layer::LAYER_NOT_DRAWN);
+ child3.Init(ui::LAYER_NOT_DRAWN);
child3.set_id(3);
child1.SetParent(&parent);
@@ -480,13 +480,13 @@ TEST_F(WindowTest, StackChildBelow) {
// Various assertions for StackChildAbove.
TEST_F(WindowTest, StackChildAbove) {
Window parent(NULL);
- parent.Init(ui::Layer::LAYER_NOT_DRAWN);
+ parent.Init(ui::LAYER_NOT_DRAWN);
Window child1(NULL);
- child1.Init(ui::Layer::LAYER_NOT_DRAWN);
+ child1.Init(ui::LAYER_NOT_DRAWN);
Window child2(NULL);
- child2.Init(ui::Layer::LAYER_NOT_DRAWN);
+ child2.Init(ui::LAYER_NOT_DRAWN);
Window child3(NULL);
- child3.Init(ui::Layer::LAYER_NOT_DRAWN);
+ child3.Init(ui::LAYER_NOT_DRAWN);
child1.SetParent(&parent);
child2.SetParent(&parent);
@@ -1774,7 +1774,7 @@ TEST_F(WindowTest, RootWindowAttachment) {
// Test a direct add/remove from the RootWindow.
scoped_ptr<Window> w1(new Window(NULL));
- w1->Init(ui::Layer::LAYER_NOT_DRAWN);
+ w1->Init(ui::LAYER_NOT_DRAWN);
w1->AddObserver(&observer);
w1->SetParent(NULL);
@@ -1789,9 +1789,9 @@ TEST_F(WindowTest, RootWindowAttachment) {
// Test an indirect add/remove from the RootWindow.
w1.reset(new Window(NULL));
- w1->Init(ui::Layer::LAYER_NOT_DRAWN);
+ w1->Init(ui::LAYER_NOT_DRAWN);
Window* w11 = new Window(NULL);
- w11->Init(ui::Layer::LAYER_NOT_DRAWN);
+ w11->Init(ui::LAYER_NOT_DRAWN);
w11->AddObserver(&observer);
w11->SetParent(w1.get());
EXPECT_EQ(0, observer.added_count());
@@ -1810,13 +1810,13 @@ TEST_F(WindowTest, RootWindowAttachment) {
// Test an indirect add/remove with nested observers.
w1.reset(new Window(NULL));
- w1->Init(ui::Layer::LAYER_NOT_DRAWN);
+ w1->Init(ui::LAYER_NOT_DRAWN);
w11 = new Window(NULL);
- w11->Init(ui::Layer::LAYER_NOT_DRAWN);
+ w11->Init(ui::LAYER_NOT_DRAWN);
w11->AddObserver(&observer);
w11->SetParent(w1.get());
Window* w111 = new Window(NULL);
- w111->Init(ui::Layer::LAYER_NOT_DRAWN);
+ w111->Init(ui::LAYER_NOT_DRAWN);
w111->AddObserver(&observer);
w111->SetParent(w11);
diff --git a/ui/gfx/compositor/compositor.gyp b/ui/gfx/compositor/compositor.gyp
index 095d743..d53f1f2 100644
--- a/ui/gfx/compositor/compositor.gyp
+++ b/ui/gfx/compositor/compositor.gyp
@@ -45,6 +45,7 @@
'layer_animation_sequence.h',
'layer_animator.cc',
'layer_animator.h',
+ 'layer_type.h',
'scoped_layer_animation_settings.cc',
'scoped_layer_animation_settings.h',
'screen_rotation.cc',
diff --git a/ui/gfx/compositor/debug_utils.cc b/ui/gfx/compositor/debug_utils.cc
index 1f9be6f..55e659d 100644
--- a/ui/gfx/compositor/debug_utils.cc
+++ b/ui/gfx/compositor/debug_utils.cc
@@ -43,15 +43,15 @@ void PrintLayerHierarchyImp(const Layer* layer, int indent,
buf << UTF8ToWide(layer->name()) << L' ' << layer;
switch (layer->type()) {
- case Layer::LAYER_NOT_DRAWN:
+ case ui::LAYER_NOT_DRAWN:
buf << L" not_drawn";
break;
- case Layer::LAYER_TEXTURED:
+ case ui::LAYER_TEXTURED:
buf << L" textured";
if (layer->fills_bounds_opaquely())
buf << L" opaque";
break;
- case Layer::LAYER_SOLID_COLOR:
+ case ui::LAYER_SOLID_COLOR:
buf << L" solid";
break;
}
diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h
index c03b28b..a0dd84a 100644
--- a/ui/gfx/compositor/layer.h
+++ b/ui/gfx/compositor/layer.h
@@ -22,6 +22,7 @@
#include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/compositor/layer_animation_delegate.h"
#include "ui/gfx/compositor/layer_delegate.h"
+#include "ui/gfx/compositor/layer_type.h"
class SkCanvas;
@@ -43,18 +44,6 @@ class COMPOSITOR_EXPORT Layer :
public LayerAnimationDelegate,
NON_EXPORTED_BASE(public WebKit::WebContentLayerClient) {
public:
- enum LayerType {
- // A layer that has no onscreen representation (note that its children will
- // still be drawn, though).
- LAYER_NOT_DRAWN = 0,
-
- // A layer that has a texture.
- LAYER_TEXTURED = 1,
-
- // A layer that's drawn as a single color.
- LAYER_SOLID_COLOR = 2,
- };
-
Layer();
explicit Layer(LayerType type);
virtual ~Layer();
diff --git a/ui/gfx/compositor/layer_type.h b/ui/gfx/compositor/layer_type.h
new file mode 100644
index 0000000..94bb82d
--- /dev/null
+++ b/ui/gfx/compositor/layer_type.h
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GFX_COMPOSITOR_LAYER_TYPE_H_
+#define UI_GFX_COMPOSITOR_LAYER_TYPE_H_
+#pragma once
+
+namespace ui {
+
+enum LayerType {
+ // A layer that has no onscreen representation (note that its children will
+ // still be drawn, though).
+ LAYER_NOT_DRAWN = 0,
+
+ // A layer that has a texture.
+ LAYER_TEXTURED = 1,
+
+ // A layer that's drawn as a single color.
+ LAYER_SOLID_COLOR = 2,
+};
+
+} // namespace
+
+#endif // UI_GFX_COMPOSITOR_LAYER_TYPE_H_
diff --git a/ui/gfx/compositor/layer_unittest.cc b/ui/gfx/compositor/layer_unittest.cc
index fb4ebf9..9c360e9 100644
--- a/ui/gfx/compositor/layer_unittest.cc
+++ b/ui/gfx/compositor/layer_unittest.cc
@@ -118,7 +118,7 @@ std::string GetLayerChildrenNames(const Layer& layer) {
class ColoredLayer : public Layer, public LayerDelegate {
public:
explicit ColoredLayer(SkColor color)
- : Layer(Layer::LAYER_TEXTURED),
+ : Layer(LAYER_TEXTURED),
color_(color) {
set_delegate(this);
}
@@ -147,7 +147,7 @@ class LayerWithRealCompositorTest : public testing::Test {
// Overridden from testing::Test:
virtual void SetUp() OVERRIDE {
- ui::DisableTestCompositor();
+ DisableTestCompositor();
const gfx::Rect host_bounds(10, 10, 500, 500);
window_.reset(TestCompositorHost::Create(host_bounds));
window_->Show();
@@ -160,7 +160,7 @@ class LayerWithRealCompositorTest : public testing::Test {
return window_->GetCompositor();
}
- Layer* CreateLayer(Layer::LayerType type) {
+ Layer* CreateLayer(LayerType type) {
return new Layer(type);
}
@@ -171,7 +171,7 @@ class LayerWithRealCompositorTest : public testing::Test {
}
Layer* CreateNoTextureLayer(const gfx::Rect& bounds) {
- Layer* layer = CreateLayer(Layer::LAYER_NOT_DRAWN);
+ Layer* layer = CreateLayer(LAYER_NOT_DRAWN);
layer->SetBounds(bounds);
return layer;
}
@@ -365,7 +365,7 @@ class LayerWithDelegateTest : public testing::Test, public CompositorDelegate {
// Overridden from testing::Test:
virtual void SetUp() OVERRIDE {
ui::SetupTestCompositor();
- compositor_.reset(new ui::Compositor(this, NULL, gfx::Size(1000, 1000)));
+ compositor_.reset(new Compositor(this, NULL, gfx::Size(1000, 1000)));
}
virtual void TearDown() OVERRIDE {
@@ -373,7 +373,7 @@ class LayerWithDelegateTest : public testing::Test, public CompositorDelegate {
Compositor* compositor() { return compositor_.get(); }
- virtual Layer* CreateLayer(Layer::LayerType type) {
+ virtual Layer* CreateLayer(LayerType type) {
return new Layer(type);
}
@@ -384,7 +384,7 @@ class LayerWithDelegateTest : public testing::Test, public CompositorDelegate {
}
virtual Layer* CreateNoTextureLayer(const gfx::Rect& bounds) {
- Layer* layer = CreateLayer(Layer::LAYER_NOT_DRAWN);
+ Layer* layer = CreateLayer(LAYER_NOT_DRAWN);
layer->SetBounds(bounds);
return layer;
}
@@ -415,7 +415,7 @@ class LayerWithDelegateTest : public testing::Test, public CompositorDelegate {
bool schedule_draw_invoked_;
private:
- scoped_ptr<ui::Compositor> compositor_;
+ scoped_ptr<Compositor> compositor_;
DISALLOW_COPY_AND_ASSIGN(LayerWithDelegateTest);
};
@@ -573,7 +573,7 @@ class LayerWithNullDelegateTest : public LayerWithDelegateTest {
virtual void TearDown() OVERRIDE {
}
- Layer* CreateLayer(Layer::LayerType type) OVERRIDE {
+ Layer* CreateLayer(LayerType type) OVERRIDE {
Layer* layer = new Layer(type);
layer->set_delegate(default_layer_delegate_.get());
return layer;
@@ -586,13 +586,13 @@ class LayerWithNullDelegateTest : public LayerWithDelegateTest {
}
Layer* CreateTextureLayer(const gfx::Rect& bounds) {
- Layer* layer = CreateLayer(Layer::LAYER_TEXTURED);
+ Layer* layer = CreateLayer(LAYER_TEXTURED);
layer->SetBounds(bounds);
return layer;
}
Layer* CreateNoTextureLayer(const gfx::Rect& bounds) OVERRIDE {
- Layer* layer = CreateLayer(Layer::LAYER_NOT_DRAWN);
+ Layer* layer = CreateLayer(LAYER_NOT_DRAWN);
layer->SetBounds(bounds);
return layer;
}
@@ -609,9 +609,9 @@ class LayerWithNullDelegateTest : public LayerWithDelegateTest {
// Various visibile/drawn assertions.
TEST_F(LayerWithNullDelegateTest, Visibility) {
- scoped_ptr<Layer> l1(new Layer(Layer::LAYER_TEXTURED));
- scoped_ptr<Layer> l2(new Layer(Layer::LAYER_TEXTURED));
- scoped_ptr<Layer> l3(new Layer(Layer::LAYER_TEXTURED));
+ scoped_ptr<Layer> l1(new Layer(LAYER_TEXTURED));
+ scoped_ptr<Layer> l2(new Layer(LAYER_TEXTURED));
+ scoped_ptr<Layer> l3(new Layer(LAYER_TEXTURED));
l1->Add(l2.get());
l2->Add(l3.get());
@@ -653,10 +653,10 @@ TEST_F(LayerWithNullDelegateTest, Visibility) {
// Checks that stacking-related methods behave as advertised.
TEST_F(LayerWithNullDelegateTest, Stacking) {
- scoped_ptr<Layer> root(new Layer(Layer::LAYER_NOT_DRAWN));
- scoped_ptr<Layer> l1(new Layer(Layer::LAYER_TEXTURED));
- scoped_ptr<Layer> l2(new Layer(Layer::LAYER_TEXTURED));
- scoped_ptr<Layer> l3(new Layer(Layer::LAYER_TEXTURED));
+ scoped_ptr<Layer> root(new Layer(LAYER_NOT_DRAWN));
+ scoped_ptr<Layer> l1(new Layer(LAYER_TEXTURED));
+ scoped_ptr<Layer> l2(new Layer(LAYER_TEXTURED));
+ scoped_ptr<Layer> l3(new Layer(LAYER_TEXTURED));
l1->set_name("1");
l2->set_name("2");
l3->set_name("3");
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index f3073da..2f20c00 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -164,9 +164,7 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
window_->SetType(GetAuraWindowTypeForWidgetType(params.type));
window_->SetProperty(aura::client::kShowStateKey, params.show_state);
window_->SetTransparent(params.transparent);
- window_->Init(params.create_texture_for_layer ?
- ui::Layer::LAYER_TEXTURED :
- ui::Layer::LAYER_NOT_DRAWN);
+ window_->Init(params.layer_type);
if (params.type == Widget::InitParams::TYPE_CONTROL)
window_->Show();
diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc
index 59f87a7..cfe79f7 100644
--- a/ui/views/widget/native_widget_aura_unittest.cc
+++ b/ui/views/widget/native_widget_aura_unittest.cc
@@ -63,7 +63,7 @@ class NativeWidgetAuraTest : public testing::Test {
TEST_F(NativeWidgetAuraTest, CenterWindowLargeParent) {
// Make a parent window larger than the host represented by rootwindow.
scoped_ptr<aura::Window> parent(new aura::Window(NULL));
- parent->Init(ui::Layer::LAYER_NOT_DRAWN);
+ parent->Init(ui::LAYER_NOT_DRAWN);
parent->SetBounds(gfx::Rect(0, 0, 1024, 800));
scoped_ptr<Widget> widget(new Widget());
NativeWidgetAura* window = Init(parent.get(), widget.get());
@@ -79,7 +79,7 @@ TEST_F(NativeWidgetAuraTest, CenterWindowLargeParent) {
TEST_F(NativeWidgetAuraTest, CenterWindowSmallParent) {
// Make a parent window smaller than the host represented by rootwindow.
scoped_ptr<aura::Window> parent(new aura::Window(NULL));
- parent->Init(ui::Layer::LAYER_NOT_DRAWN);
+ parent->Init(ui::LAYER_NOT_DRAWN);
parent->SetBounds(gfx::Rect(0, 0, 480, 320));
scoped_ptr<Widget> widget(new Widget());
NativeWidgetAura* window = Init(parent.get(), widget.get());
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 72a207c..8c3799d 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -128,7 +128,7 @@ Widget::InitParams::InitParams()
parent_widget(NULL),
native_widget(NULL),
top_level(false),
- create_texture_for_layer(true) {
+ layer_type(ui::LAYER_TEXTURED) {
}
Widget::InitParams::InitParams(Type type)
@@ -153,7 +153,7 @@ Widget::InitParams::InitParams(Type type)
parent_widget(NULL),
native_widget(NULL),
top_level(false),
- create_texture_for_layer(true) {
+ layer_type(ui::LAYER_TEXTURED) {
}
gfx::NativeView Widget::InitParams::GetParent() const {
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h
index 968c038..174edf4 100644
--- a/ui/views/widget/widget.h
+++ b/ui/views/widget/widget.h
@@ -14,6 +14,7 @@
#include "base/observer_list.h"
#include "ui/base/accessibility/accessibility_types.h"
#include "ui/base/ui_base_types.h"
+#include "ui/gfx/compositor/layer_type.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/rect.h"
#include "ui/views/focus/focus_manager.h"
@@ -131,6 +132,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
TYPE_TOOLTIP,
TYPE_BUBBLE,
};
+
enum Ownership {
// Default. Creator is not responsible for managing the lifetime of the
// Widget, it is destroyed when the corresponding NativeWidget is
@@ -181,9 +183,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// The Widget will not construct a default one. Default is NULL.
NativeWidget* native_widget;
bool top_level;
- // Only used by NativeWidgetAura. Specifies whether the Layer created by
- // aura::Window has a texture. The default is true.
- bool create_texture_for_layer;
+ // Only used by NativeWidgetAura. Specifies the type of layer for the
+ // aura::Window. Default is LAYER_TEXTURED.
+ ui::LayerType layer_type;
};
Widget();