summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/ash.gyp4
-rw-r--r--ash/root_window_controller.cc8
-rw-r--r--ash/root_window_controller.h4
-rw-r--r--ash/wm/workspace/colored_window_controller.cc (renamed from ash/wm/workspace/system_background_controller.cc)38
-rw-r--r--ash/wm/workspace/colored_window_controller.h53
-rw-r--r--ash/wm/workspace/system_background_controller.h44
6 files changed, 82 insertions, 69 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 25c5565..25c0124 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -373,6 +373,8 @@
'wm/workspace_controller.cc',
'wm/workspace_controller.h',
'wm/workspace/base_workspace_manager.h',
+ 'wm/workspace/colored_window_controller.cc',
+ 'wm/workspace/colored_window_controller.h',
'wm/workspace/frame_maximize_button.cc',
'wm/workspace/frame_maximize_button.h',
'wm/workspace/magnetism_matcher.cc',
@@ -389,8 +391,6 @@
'wm/workspace/snap_sizer.cc',
'wm/workspace/snap_sizer.h',
'wm/workspace/snap_types.h',
- 'wm/workspace/system_background_controller.cc',
- 'wm/workspace/system_background_controller.h',
'wm/workspace/workspace.cc',
'wm/workspace/workspace.h',
'wm/workspace/workspace2.cc',
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index b0a5b92bb..9ea9344 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -20,7 +20,7 @@
#include "ash/wm/toplevel_window_event_handler.h"
#include "ash/wm/visibility_controller.h"
#include "ash/wm/window_properties.h"
-#include "ash/wm/workspace/system_background_controller.h"
+#include "ash/wm/workspace/colored_window_controller.h"
#include "ash/wm/workspace_controller.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/aura_constants.h"
@@ -207,7 +207,11 @@ void RootWindowController::CreateSystemBackground(
if (is_first_run_after_boot)
color = kBootSystemBackgroundColor;
#endif
- background_.reset(new SystemBackgroundController(root_window_.get(), color));
+ background_.reset(new ColoredWindowController(
+ root_window_->GetChildById(kShellWindowId_SystemBackgroundContainer),
+ "SystemBackground"));
+ background_->SetColor(color);
+ background_->GetWidget()->Show();
}
void RootWindowController::HandleDesktopBackgroundVisible() {
diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h
index c88795d..f1a0926 100644
--- a/ash/root_window_controller.h
+++ b/ash/root_window_controller.h
@@ -25,9 +25,9 @@ namespace ash {
class ToplevelWindowEventHandler;
namespace internal {
+class ColoredWindowController;
class RootWindowLayoutManager;
class ScreenDimmer;
-class SystemBackgroundController;
class SystemModalContainerLayoutManager;
class WorkspaceController;
@@ -98,7 +98,7 @@ class ASH_EXPORT RootWindowController {
// this, portions of the root window that aren't covered by layers will be
// painted white; this can show up if e.g. it takes a long time to decode the
// desktop background image when displaying the login screen.
- scoped_ptr<SystemBackgroundController> background_;
+ scoped_ptr<ColoredWindowController> background_;
scoped_ptr<ScreenDimmer> screen_dimmer_;
scoped_ptr<WorkspaceController> workspace_controller_;
diff --git a/ash/wm/workspace/system_background_controller.cc b/ash/wm/workspace/colored_window_controller.cc
index 363a305..055c67f 100644
--- a/ash/wm/workspace/system_background_controller.cc
+++ b/ash/wm/workspace/colored_window_controller.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/wm/workspace/system_background_controller.h"
+#include "ash/wm/workspace/colored_window_controller.h"
#include "ash/shell_window_ids.h"
#include "ui/aura/client/aura_constants.h"
@@ -15,9 +15,9 @@ namespace ash {
namespace internal {
// View implementation responsible for rendering the background.
-class SystemBackgroundController::View : public views::WidgetDelegateView {
+class ColoredWindowController::View : public views::WidgetDelegateView {
public:
- explicit View(SystemBackgroundController* controller);
+ explicit View(ColoredWindowController* controller);
virtual ~View();
// Closes the hosting widget.
@@ -27,60 +27,60 @@ class SystemBackgroundController::View : public views::WidgetDelegateView {
virtual views::View* GetContentsView() OVERRIDE;
private:
- SystemBackgroundController* controller_;
+ ColoredWindowController* controller_;
DISALLOW_COPY_AND_ASSIGN(View);
};
-SystemBackgroundController::View::View(SystemBackgroundController* controller)
+ColoredWindowController::View::View(ColoredWindowController* controller)
: controller_(controller) {
}
-SystemBackgroundController::View::~View() {
+ColoredWindowController::View::~View() {
if (controller_)
controller_->view_ = NULL;
}
-void SystemBackgroundController::View::Close() {
+void ColoredWindowController::View::Close() {
controller_ = NULL;
GetWidget()->Close();
}
-views::View* SystemBackgroundController::View::GetContentsView() {
+views::View* ColoredWindowController::View::GetContentsView() {
return this;
}
-SystemBackgroundController::SystemBackgroundController(aura::RootWindow* root,
- SkColor color)
+ColoredWindowController::ColoredWindowController(aura::Window* parent,
+ const std::string& window_name)
: ALLOW_THIS_IN_INITIALIZER_LIST(view_(new View(this))) {
views::Widget* widget = new views::Widget;
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
params.delegate = view_;
- params.parent = root->GetChildById(kShellWindowId_SystemBackgroundContainer);
+ params.parent = parent;
params.can_activate = false;
params.accept_events = false;
- // WARNING: because of a bug using anything but a solid color here causes
- // flicker.
params.layer_type = ui::LAYER_SOLID_COLOR;
widget->Init(params);
widget->GetNativeView()->SetProperty(aura::client::kAnimationsDisabledKey,
true);
- widget->GetNativeView()->layer()->SetColor(color);
- widget->SetBounds(params.parent->bounds());
- widget->Show();
- widget->GetNativeView()->SetName("SystemBackground");
+ widget->GetNativeView()->SetName(window_name);
+ widget->SetBounds(parent->bounds());
}
-SystemBackgroundController::~SystemBackgroundController() {
+ColoredWindowController::~ColoredWindowController() {
if (view_)
view_->Close();
}
-void SystemBackgroundController::SetColor(SkColor color) {
+void ColoredWindowController::SetColor(SkColor color) {
if (view_)
view_->GetWidget()->GetNativeView()->layer()->SetColor(color);
}
+views::Widget* ColoredWindowController::GetWidget() {
+ return view_ ? view_->GetWidget() : NULL;
+}
+
} // namespace internal
} // namespace ash
diff --git a/ash/wm/workspace/colored_window_controller.h b/ash/wm/workspace/colored_window_controller.h
new file mode 100644
index 0000000..082b2c7
--- /dev/null
+++ b/ash/wm/workspace/colored_window_controller.h
@@ -0,0 +1,53 @@
+// 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 ASH_WM_WORKSPACE_COLORED_WINDOW_CONTROLLER_H_
+#define ASH_WM_WORKSPACE_COLORED_WINDOW_CONTROLLER_H_
+
+#include <string>
+
+#include "ash/ash_export.h"
+#include "base/basictypes.h"
+
+typedef unsigned int SkColor;
+
+namespace aura {
+class Window;
+}
+
+namespace views {
+class Widget;
+}
+
+namespace ash {
+namespace internal {
+
+// ColoredWindowController creates a Widget whose layer is LAYER_SOLID_COLOR.
+// The Widget is sized to the supplied Window and parented to the specified
+// Window. It is used for animations and the system level background. See
+// kShellWindowId_SystemBackgroundContainer for one use case.
+class ASH_EXPORT ColoredWindowController {
+ public:
+ ColoredWindowController(aura::Window* parent, const std::string& window_name);
+ ~ColoredWindowController();
+
+ // Changes the background color.
+ void SetColor(SkColor color);
+
+ views::Widget* GetWidget();
+
+ private:
+ class View;
+
+ // View responsible for rendering the background. This is non-NULL if the
+ // widget containing it is deleted. It is owned by the widget.
+ View* view_;
+
+ DISALLOW_COPY_AND_ASSIGN(ColoredWindowController);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_WM_WORKSPACE_COLORED_WINDOW_CONTROLLER_H_
diff --git a/ash/wm/workspace/system_background_controller.h b/ash/wm/workspace/system_background_controller.h
deleted file mode 100644
index 4b84fc0..0000000
--- a/ash/wm/workspace/system_background_controller.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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 ASH_WM_WORKSPACE_SYSTEM_BACKGROUND_CONTROLLER_H_
-#define ASH_WM_WORKSPACE_SYSTEM_BACKGROUND_CONTROLLER_H_
-
-#include "ash/ash_export.h"
-#include "base/basictypes.h"
-
-typedef unsigned int SkColor;
-
-namespace aura {
-class RootWindow;
-};
-
-namespace ash {
-namespace internal {
-
-// SystemBackgroundController shows the system level background. See
-// kShellWindowId_SystemBackgroundContainer for a description of the system
-// level background.
-class ASH_EXPORT SystemBackgroundController {
- public:
- SystemBackgroundController(aura::RootWindow* root, SkColor color);
- ~SystemBackgroundController();
-
- // Changes the background color.
- void SetColor(SkColor color);
-
- private:
- class View;
-
- // View responsible for rendering the background. This is non-NULL if the
- // widget containing it is deleted. It is owned by the widget.
- View* view_;
-
- DISALLOW_COPY_AND_ASSIGN(SystemBackgroundController);
-};
-
-} // namespace internal
-} // namespace ash
-
-#endif // ASH_WM_WORKSPACE_SYSTEM_BACKGROUND_CONTROLLER_H_