summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-07 00:02:59 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-07 00:02:59 +0000
commit99f07e02767cdb5318a82c97c7974f0e8591c020 (patch)
treeb05202037f40de0cc455033dfe57c80f786ee65d /ui
parent56d7ad42237c35d2b7653c7cad89e9ca6ea75d68 (diff)
downloadchromium_src-99f07e02767cdb5318a82c97c7974f0e8591c020.zip
chromium_src-99f07e02767cdb5318a82c97c7974f0e8591c020.tar.gz
chromium_src-99f07e02767cdb5318a82c97c7974f0e8591c020.tar.bz2
Rename Desktop->RootWindow.
BUG=none TEST=compiles TBR=sky Review URL: http://codereview.chromium.org/8771015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113303 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/aura.gyp14
-rw-r--r--ui/aura/client/aura_constants.cc4
-rw-r--r--ui/aura/client/aura_constants.h10
-rw-r--r--ui/aura/demo/demo_main.cc8
-rw-r--r--ui/aura/event_filter.cc2
-rw-r--r--ui/aura/event_filter_unittest.cc29
-rw-r--r--ui/aura/root_window.cc (renamed from ui/aura/desktop.cc)151
-rw-r--r--ui/aura/root_window.h (renamed from ui/aura/desktop.h)63
-rw-r--r--ui/aura/root_window_host.h (renamed from ui/aura/desktop_host.h)35
-rw-r--r--ui/aura/root_window_host_linux.cc (renamed from ui/aura/desktop_host_linux.cc)103
-rw-r--r--ui/aura/root_window_host_win.cc (renamed from ui/aura/desktop_host_win.cc)68
-rw-r--r--ui/aura/root_window_host_win.h (renamed from ui/aura/desktop_host_win.h)24
-rw-r--r--ui/aura/root_window_observer.h (renamed from ui/aura/desktop_observer.h)14
-rw-r--r--ui/aura/root_window_unittest.cc (renamed from ui/aura/desktop_unittest.cc)34
-rw-r--r--ui/aura/screen_aura.cc8
-rw-r--r--ui/aura/test/aura_test_base.cc16
-rw-r--r--ui/aura/test/event_generator.cc16
-rw-r--r--ui/aura/test/test_stacking_client.cc8
-rw-r--r--ui/aura/window.cc56
-rw-r--r--ui/aura/window.h15
-rw-r--r--ui/aura/window_unittest.cc80
-rw-r--r--ui/aura_shell/app_list.cc4
-rw-r--r--ui/aura_shell/aura_shell.gyp10
-rw-r--r--ui/aura_shell/default_container_layout_manager.cc6
-rw-r--r--ui/aura_shell/default_container_layout_manager_unittest.cc38
-rw-r--r--ui/aura_shell/desktop_background_view.cc2
-rw-r--r--ui/aura_shell/drag_drop_controller.cc22
-rw-r--r--ui/aura_shell/drag_drop_controller_unittest.cc38
-rw-r--r--ui/aura_shell/examples/aura_shell_main.cc8
-rw-r--r--ui/aura_shell/examples/lock_view.cc8
-rw-r--r--ui/aura_shell/examples/window_type_launcher.cc2
-rw-r--r--ui/aura_shell/modal_container_layout_manager.cc6
-rw-r--r--ui/aura_shell/modal_container_layout_manager_unittest.cc22
-rw-r--r--ui/aura_shell/root_window_event_filter.cc (renamed from ui/aura_shell/desktop_event_filter.cc)59
-rw-r--r--ui/aura_shell/root_window_event_filter.h (renamed from ui/aura_shell/desktop_event_filter.h)25
-rw-r--r--ui/aura_shell/root_window_event_filter_unittest.cc (renamed from ui/aura_shell/desktop_event_filter_unittest.cc)175
-rw-r--r--ui/aura_shell/root_window_layout_manager.cc (renamed from ui/aura_shell/desktop_layout_manager.cc)27
-rw-r--r--ui/aura_shell/root_window_layout_manager.h (renamed from ui/aura_shell/desktop_layout_manager.h)14
-rw-r--r--ui/aura_shell/shadow_controller.cc6
-rw-r--r--ui/aura_shell/shadow_controller.h6
-rw-r--r--ui/aura_shell/shadow_controller_unittest.cc2
-rw-r--r--ui/aura_shell/shelf_layout_manager.cc8
-rw-r--r--ui/aura_shell/shell.cc68
-rw-r--r--ui/aura_shell/shell.h12
-rw-r--r--ui/aura_shell/shell_accelerator_controller.cc24
-rw-r--r--ui/aura_shell/shell_accelerator_filter.cc4
-rw-r--r--ui/aura_shell/stacking_controller.cc4
-rw-r--r--ui/aura_shell/stacking_controller_unittest.cc10
-rw-r--r--ui/aura_shell/status_area_view.cc2
-rw-r--r--ui/aura_shell/toplevel_layout_manager_unittest.cc6
-rw-r--r--ui/aura_shell/toplevel_window_event_filter.cc2
-rw-r--r--ui/aura_shell/toplevel_window_event_filter_unittest.cc4
-rw-r--r--ui/aura_shell/workspace/workspace.cc4
-rw-r--r--ui/aura_shell/workspace/workspace_manager.cc4
-rw-r--r--ui/aura_shell/workspace/workspace_manager_unittest.cc4
-rw-r--r--ui/aura_shell/workspace_controller.cc10
-rw-r--r--ui/aura_shell/workspace_controller.h10
-rw-r--r--ui/base/ime/input_method.h6
-rw-r--r--ui/views/controls/menu/menu_controller.cc8
-rw-r--r--ui/views/test/views_test_base.cc4
-rw-r--r--ui/views/view_unittest.cc2
-rw-r--r--ui/views/widget/native_widget_aura.cc33
-rw-r--r--ui/views/widget/native_widget_aura.h4
-rw-r--r--ui/views/widget/tooltip_manager_aura.cc20
64 files changed, 757 insertions, 734 deletions
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp
index 6d98b42..735f067 100644
--- a/ui/aura/aura.gyp
+++ b/ui/aura/aura.gyp
@@ -32,12 +32,12 @@
'client/tooltip_client.h',
'client/window_drag_drop_delegate.h',
'cursor.h',
- 'desktop_host.h',
- 'desktop_host_linux.cc',
- 'desktop_host_win.cc',
- 'desktop_host_win.h',
- 'desktop.cc',
- 'desktop.h',
+ 'root_window_host.h',
+ 'root_window_host_linux.cc',
+ 'root_window_host_win.cc',
+ 'root_window_host_win.h',
+ 'root_window.cc',
+ 'root_window.h',
'event.cc',
'event.h',
'event_filter.cc',
@@ -131,7 +131,7 @@
'test/run_all_unittests.cc',
'test/test_suite.cc',
'test/test_suite.h',
- 'desktop_unittest.cc',
+ 'root_window_unittest.cc',
'event_filter_unittest.cc',
'window_unittest.cc',
'<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.rc',
diff --git a/ui/aura/client/aura_constants.cc b/ui/aura/client/aura_constants.cc
index e23b7a0..9536a1f 100644
--- a/ui/aura/client/aura_constants.cc
+++ b/ui/aura/client/aura_constants.cc
@@ -12,8 +12,8 @@ const char kShowStateKey[] = "ShowState";
const char kTooltipTextKey[] = "TooltipText";
const char kModalKey[] = "Modal";
const char kShadowTypeKey[] = "ShadowType";
-const char kDesktopDragDropClientKey[] = "DesktopDragDropClient";
+const char kRootWindowDragDropClientKey[] = "RootWindowDragDropClient";
const char kDragDropDelegateKey[] = "DragDropDelegate";
-const char kDesktopTooltipClientKey[] = "DesktopTooltipClient";
+const char kRootWindowTooltipClientKey[] = "RootWindowTooltipClient";
} // namespace aura
diff --git a/ui/aura/client/aura_constants.h b/ui/aura/client/aura_constants.h
index dbc321d..c756396 100644
--- a/ui/aura/client/aura_constants.h
+++ b/ui/aura/client/aura_constants.h
@@ -33,17 +33,17 @@ AURA_EXPORT extern const char kModalKey[];
// that should be displayed under the window. If unset, no shadow is displayed.
AURA_EXPORT extern const char kShadowTypeKey[];
-// A property key to store the drag and drop client for the desktop. The type of
-// the value is |aura::DragDropClient*|.
-AURA_EXPORT extern const char kDesktopDragDropClientKey[];
+// A property key to store the drag and drop client for the root window. The
+// type of the value is |aura::DragDropClient*|.
+AURA_EXPORT extern const char kRootWindowDragDropClientKey[];
// A property key to store the drag and drop delegate for a window. The type of
// the value is |aura::WindowDragDropDelegate*|.
AURA_EXPORT extern const char kDragDropDelegateKey[];
-// A property key to store the tooltip client for the desktop. The type of
+// A property key to store the tooltip client for the root window. The type of
// the value is |aura::TooltipClient*|.
-AURA_EXPORT extern const char kDesktopTooltipClientKey[];
+AURA_EXPORT extern const char kRootWindowTooltipClientKey[];
} // namespace aura
#endif // UI_AURA_CLIENT_AURA_CONSTANTS_H_
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc
index 0795067..76b87bd 100644
--- a/ui/aura/demo/demo_main.cc
+++ b/ui/aura/demo/demo_main.cc
@@ -8,12 +8,12 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "third_party/skia/include/core/SkXfermode.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/base/hit_test.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/aura/root_window.h"
#include "ui/base/ui_base_paths.h"
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/compositor/test/compositor_test_support.h"
@@ -84,11 +84,11 @@ int main(int argc, char** argv) {
icu_util::Initialize();
ResourceBundle::InitSharedInstance("en-US");
- // Create the message-loop here before creating the desktop.
+ // Create the message-loop here before creating the root window.
MessageLoop message_loop(MessageLoop::TYPE_UI);
ui::CompositorTestSupport::Initialize();
- aura::Desktop::GetInstance();
+ aura::RootWindow::GetInstance();
// Create a hierarchy of test windows.
DemoWindowDelegate window_delegate1(SK_ColorBLUE);
@@ -115,7 +115,7 @@ int main(int argc, char** argv) {
window3.Show();
window3.SetParent(&window2);
- aura::Desktop::GetInstance()->Run();
+ aura::RootWindow::GetInstance()->Run();
ui::CompositorTestSupport::Terminate();
diff --git a/ui/aura/event_filter.cc b/ui/aura/event_filter.cc
index 2f67a11..63ee337 100644
--- a/ui/aura/event_filter.cc
+++ b/ui/aura/event_filter.cc
@@ -4,9 +4,9 @@
#include "ui/aura/event_filter.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
#include "ui/aura/focus_manager.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
diff --git a/ui/aura/event_filter_unittest.cc b/ui/aura/event_filter_unittest.cc
index 2e7ea79..810f5cb 100644
--- a/ui/aura/event_filter_unittest.cc
+++ b/ui/aura/event_filter_unittest.cc
@@ -6,8 +6,8 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_event_filter.h"
@@ -77,22 +77,23 @@ Window* CreateWindow(int id, Window* parent, WindowDelegate* delegate) {
// Creates this hierarchy:
//
-// Desktop Window (EF)
+// RootWindow (EF)
// +- w1 (EF)
// +- w11
// +- w111 (EF)
// +- w1111 <-- target window
TEST_F(EventFilterTest, Basic) {
- scoped_ptr<Window> w1(CreateWindow(1, Desktop::GetInstance(), NULL));
+ scoped_ptr<Window> w1(CreateWindow(1, RootWindow::GetInstance(), NULL));
scoped_ptr<Window> w11(CreateWindow(11, w1.get(), NULL));
scoped_ptr<Window> w111(CreateWindow(111, w11.get(), NULL));
TestEventFilterWindowDelegate* d1111 = new TestEventFilterWindowDelegate;
scoped_ptr<Window> w1111(CreateWindow(1111, w111.get(), d1111));
- TestEventFilter* desktop_filter = new TestEventFilter(Desktop::GetInstance());
+ TestEventFilter* root_window_filter =
+ new TestEventFilter(RootWindow::GetInstance());
TestEventFilter* w1_filter = new TestEventFilter(w1.get());
TestEventFilter* w111_filter = new TestEventFilter(w111.get());
- Desktop::GetInstance()->SetEventFilter(desktop_filter);
+ RootWindow::GetInstance()->SetEventFilter(root_window_filter);
w1->SetEventFilter(w1_filter);
w111->SetEventFilter(w111_filter);
@@ -103,24 +104,24 @@ TEST_F(EventFilterTest, Basic) {
EventGenerator generator(w1111.get());
generator.PressLeftButton();
KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0);
- Desktop::GetInstance()->DispatchKeyEvent(&key_event);
+ RootWindow::GetInstance()->DispatchKeyEvent(&key_event);
// TODO(sadrul): TouchEvent!
- EXPECT_EQ(1, desktop_filter->key_event_count());
+ EXPECT_EQ(1, root_window_filter->key_event_count());
EXPECT_EQ(1, w1_filter->key_event_count());
EXPECT_EQ(1, w111_filter->key_event_count());
EXPECT_EQ(1, d1111->key_event_count());
- EXPECT_EQ(1, desktop_filter->mouse_event_count());
+ EXPECT_EQ(1, root_window_filter->mouse_event_count());
EXPECT_EQ(1, w1_filter->mouse_event_count());
EXPECT_EQ(1, w111_filter->mouse_event_count());
EXPECT_EQ(1, d1111->mouse_event_count());
- EXPECT_EQ(0, desktop_filter->touch_event_count());
+ EXPECT_EQ(0, root_window_filter->touch_event_count());
EXPECT_EQ(0, w1_filter->touch_event_count());
EXPECT_EQ(0, w111_filter->touch_event_count());
EXPECT_EQ(0, d1111->touch_event_count());
d1111->ResetCounts();
- desktop_filter->ResetCounts();
+ root_window_filter->ResetCounts();
w1_filter->ResetCounts();
w111_filter->ResetCounts();
@@ -129,18 +130,18 @@ TEST_F(EventFilterTest, Basic) {
w1_filter->set_consumes_mouse_events(true);
generator.ReleaseLeftButton();
- Desktop::GetInstance()->DispatchKeyEvent(&key_event);
+ RootWindow::GetInstance()->DispatchKeyEvent(&key_event);
// TODO(sadrul): TouchEvent!
- EXPECT_EQ(1, desktop_filter->key_event_count());
+ EXPECT_EQ(1, root_window_filter->key_event_count());
EXPECT_EQ(1, w1_filter->key_event_count());
EXPECT_EQ(0, w111_filter->key_event_count());
EXPECT_EQ(0, d1111->key_event_count());
- EXPECT_EQ(1, desktop_filter->mouse_event_count());
+ EXPECT_EQ(1, root_window_filter->mouse_event_count());
EXPECT_EQ(1, w1_filter->mouse_event_count());
EXPECT_EQ(0, w111_filter->mouse_event_count());
EXPECT_EQ(0, d1111->mouse_event_count());
- EXPECT_EQ(0, desktop_filter->touch_event_count());
+ EXPECT_EQ(0, root_window_filter->touch_event_count());
EXPECT_EQ(0, w1_filter->touch_event_count());
EXPECT_EQ(0, w111_filter->touch_event_count());
EXPECT_EQ(0, d1111->touch_event_count());
diff --git a/ui/aura/desktop.cc b/ui/aura/root_window.cc
index 7bf25d3..bf646fc 100644
--- a/ui/aura/desktop.cc
+++ b/ui/aura/root_window.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 "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include <string>
#include <vector>
@@ -15,8 +15,8 @@
#include "base/string_split.h"
#include "ui/aura/aura_switches.h"
#include "ui/aura/client/stacking_client.h"
-#include "ui/aura/desktop_host.h"
-#include "ui/aura/desktop_observer.h"
+#include "ui/aura/root_window_host.h"
+#include "ui/aura/root_window_observer.h"
#include "ui/aura/event.h"
#include "ui/aura/event_filter.h"
#include "ui/aura/focus_manager.h"
@@ -56,22 +56,23 @@ bool IsNonClientLocation(Window* target, const gfx::Point& location) {
class DefaultStackingClient : public StackingClient {
public:
- explicit DefaultStackingClient(Desktop* desktop) : desktop_(desktop) {}
+ explicit DefaultStackingClient(RootWindow* root_window)
+ : root_window_(root_window) {}
virtual ~DefaultStackingClient() {}
private:
// Overridden from StackingClient:
virtual void AddChildToDefaultParent(Window* window) OVERRIDE {
- desktop_->AddChild(window);
+ root_window_->AddChild(window);
}
virtual bool CanActivateWindow(Window* window) const OVERRIDE {
- return window->parent() == desktop_;
+ return window->parent() == root_window_;
}
virtual Window* GetTopmostWindowToActivate(Window* ignore) const OVERRIDE {
Window::Windows::const_reverse_iterator i;
- for (i = desktop_->children().rbegin();
- i != desktop_->children().rend();
+ for (i = root_window_->children().rbegin();
+ i != root_window_->children().rend();
++i) {
if (*i == ignore)
continue;
@@ -80,7 +81,7 @@ class DefaultStackingClient : public StackingClient {
return NULL;
}
- Desktop* desktop_;
+ RootWindow* root_window_;
DISALLOW_COPY_AND_ASSIGN(DefaultStackingClient);
};
@@ -98,64 +99,64 @@ void GetEventFiltersToNotify(Window* target, EventFilters* filters) {
} // namespace
-Desktop* Desktop::instance_ = NULL;
-bool Desktop::use_fullscreen_host_window_ = false;
+RootWindow* RootWindow::instance_ = NULL;
+bool RootWindow::use_fullscreen_host_window_ = false;
////////////////////////////////////////////////////////////////////////////////
-// Desktop, public:
+// RootWindow, public:
// static
-Desktop* Desktop::GetInstance() {
+RootWindow* RootWindow::GetInstance() {
if (!instance_) {
- instance_ = new Desktop;
+ instance_ = new RootWindow;
instance_->Init();
}
return instance_;
}
// static
-void Desktop::DeleteInstance() {
+void RootWindow::DeleteInstance() {
delete instance_;
instance_ = NULL;
}
-void Desktop::SetStackingClient(StackingClient* stacking_client) {
+void RootWindow::SetStackingClient(StackingClient* stacking_client) {
stacking_client_.reset(stacking_client);
}
-void Desktop::ShowDesktop() {
+void RootWindow::ShowRootWindow() {
host_->Show();
}
-void Desktop::SetHostSize(const gfx::Size& size) {
+void RootWindow::SetHostSize(const gfx::Size& size) {
host_->SetSize(size);
- // Requery the location to constrain it within the new desktop size.
+ // Requery the location to constrain it within the new root window size.
last_mouse_location_ = host_->QueryMouseLocation();
}
-gfx::Size Desktop::GetHostSize() const {
+gfx::Size RootWindow::GetHostSize() const {
gfx::Rect rect(host_->GetSize());
layer()->transform().TransformRect(&rect);
return rect.size();
}
-void Desktop::SetCursor(gfx::NativeCursor cursor) {
+void RootWindow::SetCursor(gfx::NativeCursor cursor) {
last_cursor_ = cursor;
// A lot of code seems to depend on NULL cursors actually showing an arrow,
// so just pass everything along to the host.
host_->SetCursor(cursor);
}
-void Desktop::Run() {
- ShowDesktop();
+void RootWindow::Run() {
+ ShowRootWindow();
MessageLoopForUI::current()->Run();
}
-void Desktop::Draw() {
+void RootWindow::Draw() {
compositor_->Draw(false);
}
-bool Desktop::DispatchMouseEvent(MouseEvent* event) {
+bool RootWindow::DispatchMouseEvent(MouseEvent* event) {
static const int kMouseButtonFlagMask =
ui::EF_LEFT_BUTTON_DOWN |
ui::EF_MIDDLE_BUTTON_DOWN |
@@ -197,7 +198,7 @@ bool Desktop::DispatchMouseEvent(MouseEvent* event) {
return false;
}
-bool Desktop::DispatchKeyEvent(KeyEvent* event) {
+bool RootWindow::DispatchKeyEvent(KeyEvent* event) {
if (focused_window_) {
KeyEvent translated_event(*event);
return ProcessKeyEvent(focused_window_, &translated_event);
@@ -205,7 +206,7 @@ bool Desktop::DispatchKeyEvent(KeyEvent* event) {
return false;
}
-bool Desktop::DispatchTouchEvent(TouchEvent* event) {
+bool RootWindow::DispatchTouchEvent(TouchEvent* event) {
event->UpdateForTransform(layer()->transform());
bool handled = false;
Window* target =
@@ -225,25 +226,25 @@ bool Desktop::DispatchTouchEvent(TouchEvent* event) {
return handled;
}
-void Desktop::OnHostResized(const gfx::Size& size) {
- // The compositor should have the same size as the native desktop host.
+void RootWindow::OnHostResized(const gfx::Size& size) {
+ // The compositor should have the same size as the native root window host.
compositor_->WidgetSizeChanged(size);
// The layer, and all the observers should be notified of the
- // transformed size of the desktop.
+ // transformed size of the root window.
gfx::Rect bounds(size);
layer()->transform().TransformRect(&bounds);
SetBounds(gfx::Rect(bounds.size()));
- FOR_EACH_OBSERVER(DesktopObserver, observers_,
- OnDesktopResized(bounds.size()));
+ FOR_EACH_OBSERVER(RootWindowObserver, observers_,
+ OnRootWindowResized(bounds.size()));
}
-void Desktop::OnNativeScreenResized(const gfx::Size& size) {
+void RootWindow::OnNativeScreenResized(const gfx::Size& size) {
if (use_fullscreen_host_window_)
SetHostSize(size);
}
-void Desktop::SetActiveWindow(Window* window, Window* to_focus) {
+void RootWindow::SetActiveWindow(Window* window, Window* to_focus) {
if (!window)
return;
// The stacking client may impose rules on what window configurations can be
@@ -271,15 +272,15 @@ void Desktop::SetActiveWindow(Window* window, Window* to_focus) {
active_window_->GetFocusManager()->SetFocusedWindow(
to_focus ? to_focus : active_window_);
}
- FOR_EACH_OBSERVER(DesktopObserver, observers_,
+ FOR_EACH_OBSERVER(RootWindowObserver, observers_,
OnActiveWindowChanged(active_window_));
}
-void Desktop::ActivateTopmostWindow() {
+void RootWindow::ActivateTopmostWindow() {
SetActiveWindow(stacking_client_->GetTopmostWindowToActivate(NULL), NULL);
}
-void Desktop::Deactivate(Window* window) {
+void RootWindow::Deactivate(Window* window) {
// The stacking client may impose rules on what window configurations can be
// activated or deactivated.
if (!window || !stacking_client_->CanActivateWindow(window))
@@ -292,11 +293,12 @@ void Desktop::Deactivate(Window* window) {
SetActiveWindow(to_activate, NULL);
}
-void Desktop::WindowInitialized(Window* window) {
- FOR_EACH_OBSERVER(DesktopObserver, observers_, OnWindowInitialized(window));
+void RootWindow::WindowInitialized(Window* window) {
+ FOR_EACH_OBSERVER(RootWindowObserver, observers_,
+ OnWindowInitialized(window));
}
-void Desktop::WindowDestroying(Window* window) {
+void RootWindow::WindowDestroying(Window* window) {
// Update the focused window state if the window was focused.
if (focused_window_ == window)
SetFocusedWindow(NULL);
@@ -322,32 +324,32 @@ void Desktop::WindowDestroying(Window* window) {
SetActiveWindow(stacking_client_->GetTopmostWindowToActivate(window), NULL);
}
-MessageLoop::Dispatcher* Desktop::GetDispatcher() {
+MessageLoop::Dispatcher* RootWindow::GetDispatcher() {
return host_.get();
}
-void Desktop::AddObserver(DesktopObserver* observer) {
+void RootWindow::AddObserver(RootWindowObserver* observer) {
observers_.AddObserver(observer);
}
-void Desktop::RemoveObserver(DesktopObserver* observer) {
+void RootWindow::RemoveObserver(RootWindowObserver* observer) {
observers_.RemoveObserver(observer);
}
-bool Desktop::IsMouseButtonDown() const {
+bool RootWindow::IsMouseButtonDown() const {
return mouse_button_flags_ != 0;
}
-void Desktop::PostNativeEvent(const base::NativeEvent& native_event) {
+void RootWindow::PostNativeEvent(const base::NativeEvent& native_event) {
host_->PostNativeEvent(native_event);
}
-void Desktop::ConvertPointToNativeScreen(gfx::Point* point) const {
+void RootWindow::ConvertPointToNativeScreen(gfx::Point* point) const {
gfx::Point location = host_->GetLocationOnNativeScreen();
point->Offset(location.x(), location.y());
}
-void Desktop::SetCapture(Window* window) {
+void RootWindow::SetCapture(Window* window) {
if (capture_window_ == window)
return;
@@ -370,13 +372,13 @@ void Desktop::SetCapture(Window* window) {
}
}
-void Desktop::ReleaseCapture(Window* window) {
+void RootWindow::ReleaseCapture(Window* window) {
if (capture_window_ != window)
return;
SetCapture(NULL);
}
-void Desktop::SetTransform(const ui::Transform& transform) {
+void RootWindow::SetTransform(const ui::Transform& transform) {
Window::SetTransform(transform);
// If the layer is not animating, then we need to update the host size
@@ -386,17 +388,17 @@ void Desktop::SetTransform(const ui::Transform& transform) {
}
#if !defined(NDEBUG)
-void Desktop::ToggleFullScreen() {
+void RootWindow::ToggleFullScreen() {
host_->ToggleFullScreen();
}
#endif
////////////////////////////////////////////////////////////////////////////////
-// Desktop, private:
+// RootWindow, private:
-Desktop::Desktop()
+RootWindow::RootWindow()
: Window(NULL),
- host_(aura::DesktopHost::Create(GetInitialHostWindowBounds())),
+ host_(aura::RootWindowHost::Create(GetInitialHostWindowBounds())),
ALLOW_THIS_IN_INITIALIZER_LIST(
stacking_client_(new DefaultStackingClient(this))),
ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)),
@@ -412,7 +414,7 @@ Desktop::Desktop()
touch_event_handler_(NULL) {
SetName("RootWindow");
gfx::Screen::SetInstance(screen_);
- host_->SetDesktop(this);
+ host_->SetRootWindow(this);
last_mouse_location_ = host_->QueryMouseLocation();
if (ui::Compositor::compositor_factory()) {
@@ -427,7 +429,7 @@ Desktop::Desktop()
DCHECK(compositor_.get());
}
-Desktop::~Desktop() {
+RootWindow::~RootWindow() {
in_destructor_ = true;
// Make sure to destroy the compositor before terminating so that state is
// cleared and we don't hit asserts.
@@ -440,7 +442,7 @@ Desktop::~Desktop() {
instance_ = NULL;
}
-void Desktop::HandleMouseMoved(const MouseEvent& event, Window* target) {
+void RootWindow::HandleMouseMoved(const MouseEvent& event, Window* target) {
if (target == mouse_moved_handler_)
return;
@@ -459,7 +461,7 @@ void Desktop::HandleMouseMoved(const MouseEvent& event, Window* target) {
}
}
-bool Desktop::ProcessMouseEvent(Window* target, MouseEvent* event) {
+bool RootWindow::ProcessMouseEvent(Window* target, MouseEvent* event) {
if (!target->IsVisible())
return false;
@@ -474,7 +476,7 @@ bool Desktop::ProcessMouseEvent(Window* target, MouseEvent* event) {
return target->delegate()->OnMouseEvent(event);
}
-bool Desktop::ProcessKeyEvent(Window* target, KeyEvent* event) {
+bool RootWindow::ProcessKeyEvent(Window* target, KeyEvent* event) {
if (!target->IsVisible())
return false;
@@ -489,7 +491,8 @@ bool Desktop::ProcessKeyEvent(Window* target, KeyEvent* event) {
return target->delegate()->OnKeyEvent(event);
}
-ui::TouchStatus Desktop::ProcessTouchEvent(Window* target, TouchEvent* event) {
+ui::TouchStatus RootWindow::ProcessTouchEvent(Window* target,
+ TouchEvent* event) {
if (!target->IsVisible())
return ui::TOUCH_STATUS_UNKNOWN;
@@ -505,27 +508,27 @@ ui::TouchStatus Desktop::ProcessTouchEvent(Window* target, TouchEvent* event) {
return target->delegate()->OnTouchEvent(event);
}
-void Desktop::ScheduleDraw() {
+void RootWindow::ScheduleDraw() {
if (!schedule_paint_factory_.HasWeakPtrs()) {
MessageLoop::current()->PostTask(
FROM_HERE,
- base::Bind(&Desktop::Draw, schedule_paint_factory_.GetWeakPtr()));
+ base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr()));
}
}
-bool Desktop::CanFocus() const {
+bool RootWindow::CanFocus() const {
return IsVisible();
}
-internal::FocusManager* Desktop::GetFocusManager() {
+internal::FocusManager* RootWindow::GetFocusManager() {
return this;
}
-Desktop* Desktop::GetDesktop() {
+RootWindow* RootWindow::GetRootWindow() {
return this;
}
-void Desktop::WindowDetachedFromDesktop(Window* detached) {
+void RootWindow::WindowDetachedFromRootWindow(Window* detached) {
DCHECK(capture_window_ != this);
// If the ancestor of the capture window is detached,
@@ -548,20 +551,20 @@ void Desktop::WindowDetachedFromDesktop(Window* detached) {
touch_event_handler_ = NULL;
}
-void Desktop::OnLayerAnimationEnded(
+void RootWindow::OnLayerAnimationEnded(
const ui::LayerAnimationSequence* animation) {
OnHostResized(host_->GetSize());
}
-void Desktop::OnLayerAnimationScheduled(
+void RootWindow::OnLayerAnimationScheduled(
const ui::LayerAnimationSequence* animation) {
}
-void Desktop::OnLayerAnimationAborted(
+void RootWindow::OnLayerAnimationAborted(
const ui::LayerAnimationSequence* animation) {
}
-void Desktop::SetFocusedWindow(Window* focused_window) {
+void RootWindow::SetFocusedWindow(Window* focused_window) {
if (focused_window == focused_window_ ||
(focused_window && !focused_window->CanFocus())) {
return;
@@ -573,22 +576,22 @@ void Desktop::SetFocusedWindow(Window* focused_window) {
focused_window_->delegate()->OnFocus();
}
-Window* Desktop::GetFocusedWindow() {
+Window* RootWindow::GetFocusedWindow() {
return focused_window_;
}
-bool Desktop::IsFocusedWindow(const Window* window) const {
+bool RootWindow::IsFocusedWindow(const Window* window) const {
return focused_window_ == window;
}
-void Desktop::Init() {
+void RootWindow::Init() {
Window::Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
SetBounds(gfx::Rect(host_->GetSize()));
Show();
compositor()->SetRootLayer(layer());
}
-gfx::Rect Desktop::GetInitialHostWindowBounds() const {
+gfx::Rect RootWindow::GetInitialHostWindowBounds() const {
gfx::Rect bounds(kDefaultHostWindowX, kDefaultHostWindowY,
kDefaultHostWindowWidth, kDefaultHostWindowHeight);
@@ -602,7 +605,7 @@ gfx::Rect Desktop::GetInitialHostWindowBounds() const {
base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) {
bounds.set_size(gfx::Size(parsed_width, parsed_height));
} else if (use_fullscreen_host_window_) {
- bounds = gfx::Rect(DesktopHost::GetNativeScreenSize());
+ bounds = gfx::Rect(RootWindowHost::GetNativeScreenSize());
}
return bounds;
diff --git a/ui/aura/desktop.h b/ui/aura/root_window.h
index d76e43e..ddefbe7 100644
--- a/ui/aura/desktop.h
+++ b/ui/aura/root_window.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_AURA_DESKTOP_H_
-#define UI_AURA_DESKTOP_H_
+#ifndef UI_AURA_ROOT_WINDOW_H_
+#define UI_AURA_ROOT_WINDOW_H_
#pragma once
#include "base/basictypes.h"
@@ -32,21 +32,21 @@ class Transform;
namespace aura {
-class DesktopHost;
-class DesktopObserver;
+class RootWindowHost;
+class RootWindowObserver;
class KeyEvent;
class MouseEvent;
class ScreenAura;
class StackingClient;
class TouchEvent;
-// Desktop is responsible for hosting a set of windows.
-class AURA_EXPORT Desktop : public ui::CompositorDelegate,
- public Window,
- public internal::FocusManager,
- public ui::LayerAnimationObserver {
+// RootWindow is responsible for hosting a set of windows.
+class AURA_EXPORT RootWindow : public ui::CompositorDelegate,
+ public Window,
+ public internal::FocusManager,
+ public ui::LayerAnimationObserver {
public:
- static Desktop* GetInstance();
+ static RootWindow* GetInstance();
static void DeleteInstance();
static void set_use_fullscreen_host_window(bool use_fullscreen) {
@@ -64,17 +64,17 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate,
void SetStackingClient(StackingClient* stacking_client);
- // Shows the desktop host.
- void ShowDesktop();
+ // Shows the root window host.
+ void ShowRootWindow();
- // Sets the size of the desktop.
+ // Sets the size of the root window.
void SetHostSize(const gfx::Size& size);
gfx::Size GetHostSize() const;
// Shows the specified cursor.
void SetCursor(gfx::NativeCursor cursor);
- // Shows the desktop host and runs an event loop for it.
+ // Shows the root window host and runs an event loop for it.
void Run();
// Draws the necessary set of windows.
@@ -115,15 +115,15 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate,
// Invoked when |window| is being destroyed.
void WindowDestroying(Window* window);
- // Returns the desktop's dispatcher. The result should only be passed to
+ // Returns the root window's dispatcher. The result should only be passed to
// MessageLoopForUI::RunWithDispatcher() or
// MessageLoopForUI::RunAllPendingWithDispatcher(), or used to dispatch
// an event by |Dispatch(const NativeEvent&)| on it. It must never be stored.
MessageLoop::Dispatcher* GetDispatcher();
// Add/remove observer.
- void AddObserver(DesktopObserver* observer);
- void RemoveObserver(DesktopObserver* observer);
+ void AddObserver(RootWindowObserver* observer);
+ void RemoveObserver(RootWindowObserver* observer);
// Are any mouse buttons currently down?
bool IsMouseButtonDown() const;
@@ -131,7 +131,8 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate,
// Posts |native_event| to the platform's event queue.
void PostNativeEvent(const base::NativeEvent& native_event);
- // Converts |point| from the desktop's coordinate system to native screen's.
+ // Converts |point| from the root window's coordinate system to native
+ // screen's.
void ConvertPointToNativeScreen(gfx::Point* point) const;
// Capture -------------------------------------------------------------------
@@ -154,8 +155,8 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate,
virtual void ScheduleDraw();
private:
- Desktop();
- virtual ~Desktop();
+ RootWindow();
+ virtual ~RootWindow();
// Called whenever the mouse moves, tracks the current |mouse_moved_handler_|,
// sending exited and entered events as its value changes.
@@ -168,8 +169,8 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate,
// Overridden from Window:
virtual bool CanFocus() const OVERRIDE;
virtual internal::FocusManager* GetFocusManager() OVERRIDE;
- virtual Desktop* GetDesktop() OVERRIDE;
- virtual void WindowDetachedFromDesktop(Window* window) OVERRIDE;
+ virtual RootWindow* GetRootWindow() OVERRIDE;
+ virtual void WindowDetachedFromRootWindow(Window* window) OVERRIDE;
// Overridden from ui::LayerAnimationObserver:
virtual void OnLayerAnimationEnded(
@@ -184,7 +185,7 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate,
virtual Window* GetFocusedWindow() OVERRIDE;
virtual bool IsFocusedWindow(const Window* window) const OVERRIDE;
- // Initializes the desktop.
+ // Initializes the root window.
void Init();
// Parses the switch describing the initial size for the host window and
@@ -193,19 +194,19 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate,
scoped_refptr<ui::Compositor> compositor_;
- scoped_ptr<DesktopHost> host_;
+ scoped_ptr<RootWindowHost> host_;
scoped_ptr<StackingClient> stacking_client_;
- static Desktop* instance_;
+ static RootWindow* instance_;
- // If set before the Desktop is created, the host window will cover the entire
- // screen. Note that this can still be overridden via the
+ // If set before the RootWindow is created, the host window will cover the
+ // entire screen. Note that this can still be overridden via the
// switches::kAuraHostWindowSize flag.
static bool use_fullscreen_host_window_;
// Used to schedule painting.
- base::WeakPtrFactory<Desktop> schedule_paint_factory_;
+ base::WeakPtrFactory<RootWindow> schedule_paint_factory_;
Window* active_window_;
@@ -222,7 +223,7 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate,
// destruction.
bool in_destructor_;
- ObserverList<DesktopObserver> observers_;
+ ObserverList<RootWindowObserver> observers_;
ScreenAura* screen_;
@@ -235,9 +236,9 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate,
Window* focused_window_;
Window* touch_event_handler_;
- DISALLOW_COPY_AND_ASSIGN(Desktop);
+ DISALLOW_COPY_AND_ASSIGN(RootWindow);
};
} // namespace aura
-#endif // UI_AURA_DESKTOP_H_
+#endif // UI_AURA_ROOT_WINDOW_H_
diff --git a/ui/aura/desktop_host.h b/ui/aura/root_window_host.h
index f72fc52..c88097d 100644
--- a/ui/aura/desktop_host.h
+++ b/ui/aura/root_window_host.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_AURA_DESKTOP_HOST_H_
-#define UI_AURA_DESKTOP_HOST_H_
+#ifndef UI_AURA_ROOT_WINDOW_HOST_H_
+#define UI_AURA_ROOT_WINDOW_HOST_H_
#pragma once
#include "base/message_loop.h"
@@ -18,39 +18,40 @@ class Size;
namespace aura {
-class Desktop;
+class RootWindow;
-// DesktopHost bridges between a native window and the embedded Desktop. It
-// provides the accelerated widget and maps events from the native os to aura.
-class DesktopHost : public MessageLoop::Dispatcher {
+// RootWindowHost bridges between a native window and the embedded RootWindow.
+// It provides the accelerated widget and maps events from the native os to
+// aura.
+class RootWindowHost : public MessageLoop::Dispatcher {
public:
- virtual ~DesktopHost() {}
+ virtual ~RootWindowHost() {}
- // Creates a new DesktopHost. The caller owns the returned value.
- static DesktopHost* Create(const gfx::Rect& bounds);
+ // Creates a new RootWindowHost. The caller owns the returned value.
+ static RootWindowHost* Create(const gfx::Rect& bounds);
// Returns the actual size of the screen.
// (gfx::Screen only reports on the virtual desktop exposed by Aura.)
static gfx::Size GetNativeScreenSize();
- // Sets the Desktop this DesktopHost is hosting. DesktopHost does not own the
- // Desktop.
- virtual void SetDesktop(Desktop* desktop) = 0;
+ // Sets the RootWindow this RootWindowHost is hosting. RootWindowHost does not
+ // own the RootWindow.
+ virtual void SetRootWindow(RootWindow* root_window) = 0;
// Returns the accelerated widget.
virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0;
- // Shows the DesktopHost.
+ // Shows the RootWindowHost.
virtual void Show() = 0;
// Toggles the host's full screen state.
virtual void ToggleFullScreen() = 0;
- // Gets/Sets the size of the DesktopHost.
+ // Gets/Sets the size of the RootWindowHost.
virtual gfx::Size GetSize() const = 0;
virtual void SetSize(const gfx::Size& size) = 0;
- // Returns the location of the desktop on native screen.
+ // Returns the location of the RootWindow on native screen.
virtual gfx::Point GetLocationOnNativeScreen() const = 0;
// Sets the currently displayed cursor.
@@ -58,7 +59,7 @@ class DesktopHost : public MessageLoop::Dispatcher {
// Queries the mouse's current position relative to the host window.
// The position is constrained within the host window.
- // You should probably call Desktop::last_mouse_location() instead; this
+ // You should probably call RootWindow::last_mouse_location() instead; this
// method can be expensive.
virtual gfx::Point QueryMouseLocation() = 0;
@@ -68,4 +69,4 @@ class DesktopHost : public MessageLoop::Dispatcher {
} // namespace aura
-#endif // UI_AURA_DESKTOP_HOST_H_
+#endif // UI_AURA_ROOT_WINDOW_HOST_H_
diff --git a/ui/aura/desktop_host_linux.cc b/ui/aura/root_window_host_linux.cc
index 5743936..5901e5f 100644
--- a/ui/aura/desktop_host_linux.cc
+++ b/ui/aura/root_window_host_linux.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 "ui/aura/desktop_host.h"
+#include "ui/aura/root_window_host.h"
#include <X11/cursorfont.h>
#include <X11/Xlib.h>
@@ -15,8 +15,8 @@
#include "base/message_loop.h"
#include "base/message_pump_x.h"
#include "ui/aura/cursor.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
+#include "ui/aura/root_window.h"
#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/base/touch/touch_factory.h"
#include "ui/base/x/x11_util.h"
@@ -271,18 +271,18 @@ bool ShouldSendCharEventForKeyboardCode(ui::KeyboardCode keycode) {
}
}
-class DesktopHostLinux : public DesktopHost,
- public MessageLoop::DestructionObserver {
+class RootWindowHostLinux : public RootWindowHost,
+ public MessageLoop::DestructionObserver {
public:
- explicit DesktopHostLinux(const gfx::Rect& bounds);
- virtual ~DesktopHostLinux();
+ explicit RootWindowHostLinux(const gfx::Rect& bounds);
+ virtual ~RootWindowHostLinux();
private:
// MessageLoop::Dispatcher Override.
virtual DispatchStatus Dispatch(XEvent* xev) OVERRIDE;
- // DesktopHost Overrides.
- virtual void SetDesktop(Desktop* desktop) OVERRIDE;
+ // RootWindowHost Overrides.
+ virtual void SetRootWindow(RootWindow* root_window) OVERRIDE;
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
virtual void Show() OVERRIDE;
virtual void ToggleFullScreen() OVERRIDE;
@@ -301,14 +301,14 @@ class DesktopHostLinux : public DesktopHost,
// detect that they're there.
bool IsWindowManagerPresent();
- Desktop* desktop_;
+ RootWindow* root_window_;
- // The display and the native X window hosting the desktop.
+ // The display and the native X window hosting the root window.
Display* xdisplay_;
::Window xwindow_;
// The native root window.
- ::Window root_window_;
+ ::Window x_root_window_;
// Current Aura cursor.
gfx::NativeCursor current_cursor_;
@@ -316,17 +316,17 @@ class DesktopHostLinux : public DesktopHost,
// The bounds of |xwindow_|.
gfx::Rect bounds_;
- DISALLOW_COPY_AND_ASSIGN(DesktopHostLinux);
+ DISALLOW_COPY_AND_ASSIGN(RootWindowHostLinux);
};
-DesktopHostLinux::DesktopHostLinux(const gfx::Rect& bounds)
- : desktop_(NULL),
+RootWindowHostLinux::RootWindowHostLinux(const gfx::Rect& bounds)
+ : root_window_(NULL),
xdisplay_(base::MessagePumpX::GetDefaultXDisplay()),
xwindow_(0),
- root_window_(DefaultRootWindow(xdisplay_)),
+ x_root_window_(DefaultRootWindow(xdisplay_)),
current_cursor_(aura::kCursorNull),
bounds_(bounds) {
- xwindow_ = XCreateSimpleWindow(xdisplay_, root_window_,
+ xwindow_ = XCreateSimpleWindow(xdisplay_, x_root_window_,
bounds.x(), bounds.y(),
bounds.width(), bounds.height(),
0, 0, 0);
@@ -338,7 +338,7 @@ DesktopHostLinux::DesktopHostLinux(const gfx::Rect& bounds)
StructureNotifyMask | PropertyChangeMask |
PointerMotionMask;
XSelectInput(xdisplay_, xwindow_, event_mask);
- XSelectInput(xdisplay_, root_window_, StructureNotifyMask);
+ XSelectInput(xdisplay_, x_root_window_, StructureNotifyMask);
XFlush(xdisplay_);
// TODO(sad): Re-enable once crbug.com/106516 is fixed.
@@ -351,7 +351,7 @@ DesktopHostLinux::DesktopHostLinux(const gfx::Rect& bounds)
MessageLoopForUI::current()->AddDestructionObserver(this);
}
-DesktopHostLinux::~DesktopHostLinux() {
+RootWindowHostLinux::~RootWindowHostLinux() {
XDestroyWindow(xdisplay_, xwindow_);
// Clears XCursorCache.
@@ -361,7 +361,7 @@ DesktopHostLinux::~DesktopHostLinux() {
base::MessagePumpX::SetDefaultDispatcher(NULL);
}
-base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch(
+base::MessagePumpDispatcher::DispatchStatus RootWindowHostLinux::Dispatch(
XEvent* xev) {
bool handled = false;
@@ -369,32 +369,32 @@ base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch(
switch (xev->type) {
case Expose:
- desktop_->ScheduleDraw();
+ root_window_->ScheduleDraw();
handled = true;
break;
case KeyPress: {
KeyEvent keydown_event(xev, false);
- handled = desktop_->DispatchKeyEvent(&keydown_event);
+ handled = root_window_->DispatchKeyEvent(&keydown_event);
if (ShouldSendCharEventForKeyboardCode(keydown_event.key_code())) {
KeyEvent char_event(xev, true);
- handled |= desktop_->DispatchKeyEvent(&char_event);
+ handled |= root_window_->DispatchKeyEvent(&char_event);
}
break;
}
case KeyRelease: {
KeyEvent keyup_event(xev, false);
- handled = desktop_->DispatchKeyEvent(&keyup_event);
+ handled = root_window_->DispatchKeyEvent(&keyup_event);
break;
}
case ButtonPress:
case ButtonRelease: {
MouseEvent mouseev(xev);
- handled = desktop_->DispatchMouseEvent(&mouseev);
+ handled = root_window_->DispatchMouseEvent(&mouseev);
break;
}
case ConfigureNotify: {
- if (xev->xconfigure.window == root_window_) {
- desktop_->OnNativeScreenResized(
+ if (xev->xconfigure.window == x_root_window_) {
+ root_window_->OnNativeScreenResized(
gfx::Size(xev->xconfigure.width, xev->xconfigure.height));
handled = true;
break;
@@ -405,13 +405,13 @@ base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch(
// It's possible that the X window may be resized by some other means than
// from within aura (e.g. the X window manager can change the size). Make
- // sure the desktop size is maintained properly.
+ // sure the root window size is maintained properly.
gfx::Rect bounds(xev->xconfigure.x, xev->xconfigure.y,
xev->xconfigure.width, xev->xconfigure.height);
bool size_changed = bounds_.size() != bounds.size();
bounds_ = bounds;
if (size_changed)
- desktop_->OnHostResized(bounds.size());
+ root_window_->OnHostResized(bounds.size());
handled = true;
break;
}
@@ -436,7 +436,7 @@ base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch(
case ui::ET_TOUCH_RELEASED:
case ui::ET_TOUCH_MOVED: {
TouchEvent touchev(xev);
- handled = desktop_->DispatchTouchEvent(&touchev);
+ handled = root_window_->DispatchTouchEvent(&touchev);
break;
}
case ui::ET_MOUSE_PRESSED:
@@ -447,7 +447,7 @@ base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch(
case ui::ET_MOUSE_ENTERED:
case ui::ET_MOUSE_EXITED: {
MouseEvent mouseev(xev);
- handled = desktop_->DispatchMouseEvent(&mouseev);
+ handled = root_window_->DispatchMouseEvent(&mouseev);
break;
}
case ui::ET_UNKNOWN:
@@ -495,34 +495,34 @@ base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch(
}
MouseEvent mouseev(xev);
- handled = desktop_->DispatchMouseEvent(&mouseev);
+ handled = root_window_->DispatchMouseEvent(&mouseev);
break;
}
}
return handled ? EVENT_PROCESSED : EVENT_IGNORED;
}
-void DesktopHostLinux::SetDesktop(Desktop* desktop) {
- desktop_ = desktop;
+void RootWindowHostLinux::SetRootWindow(RootWindow* root_window) {
+ root_window_ = root_window;
}
-gfx::AcceleratedWidget DesktopHostLinux::GetAcceleratedWidget() {
+gfx::AcceleratedWidget RootWindowHostLinux::GetAcceleratedWidget() {
return xwindow_;
}
-void DesktopHostLinux::Show() {
+void RootWindowHostLinux::Show() {
XMapWindow(xdisplay_, xwindow_);
}
-void DesktopHostLinux::ToggleFullScreen() {
+void RootWindowHostLinux::ToggleFullScreen() {
NOTIMPLEMENTED();
}
-gfx::Size DesktopHostLinux::GetSize() const {
+gfx::Size RootWindowHostLinux::GetSize() const {
return bounds_.size();
}
-void DesktopHostLinux::SetSize(const gfx::Size& size) {
+void RootWindowHostLinux::SetSize(const gfx::Size& size) {
if (size == bounds_.size())
return;
@@ -534,14 +534,14 @@ void DesktopHostLinux::SetSize(const gfx::Size& size) {
// (possibly synthetic) ConfigureNotify about the actual size and correct
// |bounds_| later.
bounds_.set_size(size);
- desktop_->OnHostResized(size);
+ root_window_->OnHostResized(size);
}
-gfx::Point DesktopHostLinux::GetLocationOnNativeScreen() const {
+gfx::Point RootWindowHostLinux::GetLocationOnNativeScreen() const {
return bounds_.origin();
}
-void DesktopHostLinux::SetCursor(gfx::NativeCursor cursor) {
+void RootWindowHostLinux::SetCursor(gfx::NativeCursor cursor) {
if (current_cursor_ == cursor)
return;
current_cursor_ = cursor;
@@ -553,7 +553,7 @@ void DesktopHostLinux::SetCursor(gfx::NativeCursor cursor) {
XDefineCursor(xdisplay_, xwindow_, xcursor);
}
-gfx::Point DesktopHostLinux::QueryMouseLocation() {
+gfx::Point RootWindowHostLinux::QueryMouseLocation() {
::Window root_return, child_return;
int root_x_return, root_y_return, win_x_return, win_y_return;
unsigned int mask_return;
@@ -568,7 +568,8 @@ gfx::Point DesktopHostLinux::QueryMouseLocation() {
max(0, min(bounds_.height(), win_y_return)));
}
-void DesktopHostLinux::PostNativeEvent(const base::NativeEvent& native_event) {
+void RootWindowHostLinux::PostNativeEvent(
+ const base::NativeEvent& native_event) {
DCHECK(xwindow_);
DCHECK(xdisplay_);
XEvent xevent = *native_event;
@@ -586,11 +587,11 @@ void DesktopHostLinux::PostNativeEvent(const base::NativeEvent& native_event) {
// The fields used below are in the same place for all of events
// above. Using xmotion from XEvent's unions to avoid repeating
// the code.
- xevent.xmotion.root = root_window_;
+ xevent.xmotion.root = x_root_window_;
xevent.xmotion.time = CurrentTime;
gfx::Point point(xevent.xmotion.x, xevent.xmotion.y);
- desktop_->ConvertPointToNativeScreen(&point);
+ root_window_->ConvertPointToNativeScreen(&point);
xevent.xmotion.x_root = point.x();
xevent.xmotion.y_root = point.y();
}
@@ -600,11 +601,11 @@ void DesktopHostLinux::PostNativeEvent(const base::NativeEvent& native_event) {
XSendEvent(xdisplay_, xwindow_, False, 0, &xevent);
}
-void DesktopHostLinux::WillDestroyCurrentMessageLoop() {
- aura::Desktop::DeleteInstance();
+void RootWindowHostLinux::WillDestroyCurrentMessageLoop() {
+ aura::RootWindow::DeleteInstance();
}
-bool DesktopHostLinux::IsWindowManagerPresent() {
+bool RootWindowHostLinux::IsWindowManagerPresent() {
// Per ICCCM 2.8, "Manager Selections", window managers should take ownership
// of WM_Sn selections (where n is a screen number).
::Atom wm_s0_atom = XInternAtom(xdisplay_, "WM_S0", False);
@@ -614,12 +615,12 @@ bool DesktopHostLinux::IsWindowManagerPresent() {
} // namespace
// static
-DesktopHost* DesktopHost::Create(const gfx::Rect& bounds) {
- return new DesktopHostLinux(bounds);
+RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) {
+ return new RootWindowHostLinux(bounds);
}
// static
-gfx::Size DesktopHost::GetNativeScreenSize() {
+gfx::Size RootWindowHost::GetNativeScreenSize() {
::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay();
return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0));
}
diff --git a/ui/aura/desktop_host_win.cc b/ui/aura/root_window_host_win.cc
index 1809dda..577f5d0 100644
--- a/ui/aura/desktop_host_win.cc
+++ b/ui/aura/root_window_host_win.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/aura/desktop_host_win.h"
+#include "ui/aura/root_window_host_win.h"
#include <windows.h>
#include <algorithm>
#include "base/message_loop.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/event.h"
using std::max;
@@ -102,48 +102,48 @@ const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) {
} // namespace
// static
-DesktopHost* DesktopHost::Create(const gfx::Rect& bounds) {
- return new DesktopHostWin(bounds);
+RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) {
+ return new RootWindowHostWin(bounds);
}
// static
-gfx::Size DesktopHost::GetNativeScreenSize() {
+gfx::Size RootWindowHost::GetNativeScreenSize() {
return gfx::Size(GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN));
}
-DesktopHostWin::DesktopHostWin(const gfx::Rect& bounds)
- : desktop_(NULL),
+RootWindowHostWin::RootWindowHostWin(const gfx::Rect& bounds)
+ : root_window_(NULL),
fullscreen_(false),
saved_window_style_(0),
saved_window_ex_style_(0) {
Init(NULL, bounds);
- SetWindowText(hwnd(), L"aura::Desktop!");
+ SetWindowText(hwnd(), L"aura::RootWindow!");
}
-DesktopHostWin::~DesktopHostWin() {
+RootWindowHostWin::~RootWindowHostWin() {
DestroyWindow(hwnd());
}
-bool DesktopHostWin::Dispatch(const MSG& msg) {
+bool RootWindowHostWin::Dispatch(const MSG& msg) {
TranslateMessage(&msg);
DispatchMessage(&msg);
return true;
}
-void DesktopHostWin::SetDesktop(Desktop* desktop) {
- desktop_ = desktop;
+void RootWindowHostWin::SetRootWindow(RootWindow* root_window) {
+ root_window_ = root_window;
}
-gfx::AcceleratedWidget DesktopHostWin::GetAcceleratedWidget() {
+gfx::AcceleratedWidget RootWindowHostWin::GetAcceleratedWidget() {
return hwnd();
}
-void DesktopHostWin::Show() {
+void RootWindowHostWin::Show() {
ShowWindow(hwnd(), SW_SHOWNORMAL);
}
-void DesktopHostWin::ToggleFullScreen() {
+void RootWindowHostWin::ToggleFullScreen() {
gfx::Rect target_rect;
if (!fullscreen_) {
fullscreen_ = true;
@@ -175,13 +175,13 @@ void DesktopHostWin::ToggleFullScreen() {
SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
}
-gfx::Size DesktopHostWin::GetSize() const {
+gfx::Size RootWindowHostWin::GetSize() const {
RECT r;
GetClientRect(hwnd(), &r);
return gfx::Rect(r).size();
}
-void DesktopHostWin::SetSize(const gfx::Size& size) {
+void RootWindowHostWin::SetSize(const gfx::Size& size) {
if (fullscreen_) {
saved_window_rect_.right = saved_window_rect_.left + size.width();
saved_window_rect_.bottom = saved_window_rect_.top + size.height();
@@ -206,14 +206,14 @@ void DesktopHostWin::SetSize(const gfx::Size& size) {
SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOREPOSITION);
}
-gfx::Point DesktopHostWin::GetLocationOnNativeScreen() const {
+gfx::Point RootWindowHostWin::GetLocationOnNativeScreen() const {
RECT r;
GetClientRect(hwnd(), &r);
return gfx::Point(r.left, r.top);
}
-void DesktopHostWin::SetCursor(gfx::NativeCursor native_cursor) {
+void RootWindowHostWin::SetCursor(gfx::NativeCursor native_cursor) {
// Custom web cursors are handled directly.
if (native_cursor == kCursorCustom)
return;
@@ -223,7 +223,7 @@ void DesktopHostWin::SetCursor(gfx::NativeCursor native_cursor) {
::SetCursor(LoadCursor(NULL, cursor_id));
}
-gfx::Point DesktopHostWin::QueryMouseLocation() {
+gfx::Point RootWindowHostWin::QueryMouseLocation() {
POINT pt;
GetCursorPos(&pt);
ScreenToClient(hwnd(), &pt);
@@ -232,48 +232,48 @@ gfx::Point DesktopHostWin::QueryMouseLocation() {
max(0, min(size.height(), static_cast<int>(pt.y))));
}
-void DesktopHostWin::PostNativeEvent(const base::NativeEvent& native_event) {
+void RootWindowHostWin::PostNativeEvent(const base::NativeEvent& native_event) {
::PostMessage(
hwnd(), native_event.message, native_event.wParam, native_event.lParam);
}
-void DesktopHostWin::OnClose() {
+void RootWindowHostWin::OnClose() {
// TODO: this obviously shouldn't be here.
MessageLoopForUI::current()->Quit();
}
-LRESULT DesktopHostWin::OnKeyEvent(UINT message,
- WPARAM w_param,
- LPARAM l_param) {
+LRESULT RootWindowHostWin::OnKeyEvent(UINT message,
+ WPARAM w_param,
+ LPARAM l_param) {
MSG msg = { hwnd(), message, w_param, l_param };
KeyEvent keyev(msg, message == WM_CHAR);
- SetMsgHandled(desktop_->DispatchKeyEvent(&keyev));
+ SetMsgHandled(root_window_->DispatchKeyEvent(&keyev));
return 0;
}
-LRESULT DesktopHostWin::OnMouseRange(UINT message,
- WPARAM w_param,
- LPARAM l_param) {
+LRESULT RootWindowHostWin::OnMouseRange(UINT message,
+ WPARAM w_param,
+ LPARAM l_param) {
MSG msg = { hwnd(), message, w_param, l_param, 0,
{ GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } };
MouseEvent event(msg);
bool handled = false;
if (!(event.flags() & ui::EF_IS_NON_CLIENT))
- handled = desktop_->DispatchMouseEvent(&event);
+ handled = root_window_->DispatchMouseEvent(&event);
SetMsgHandled(handled);
return 0;
}
-void DesktopHostWin::OnPaint(HDC dc) {
- desktop_->Draw();
+void RootWindowHostWin::OnPaint(HDC dc) {
+ root_window_->Draw();
ValidateRect(hwnd(), NULL);
}
-void DesktopHostWin::OnSize(UINT param, const CSize& size) {
+void RootWindowHostWin::OnSize(UINT param, const CSize& size) {
// Minimizing resizes the window to 0x0 which causes our layout to go all
// screwy, so we just ignore it.
if (param != SIZE_MINIMIZED)
- desktop_->OnHostResized(gfx::Size(size.cx, size.cy));
+ root_window_->OnHostResized(gfx::Size(size.cx, size.cy));
}
} // namespace aura
diff --git a/ui/aura/desktop_host_win.h b/ui/aura/root_window_host_win.h
index cd9c136..29ca65f 100644
--- a/ui/aura/desktop_host_win.h
+++ b/ui/aura/root_window_host_win.h
@@ -2,26 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_AURA_DESKTOP_HOST_WIN_H_
-#define UI_AURA_DESKTOP_HOST_WIN_H_
+#ifndef UI_AURA_ROOT_WINDOW_HOST_WIN_H_
+#define UI_AURA_ROOT_WINDOW_HOST_WIN_H_
#pragma once
#include "base/compiler_specific.h"
-#include "ui/aura/desktop_host.h"
+#include "ui/aura/root_window_host.h"
#include "ui/base/win/window_impl.h"
namespace aura {
-class DesktopHostWin : public DesktopHost, public ui::WindowImpl {
+class RootWindowHostWin : public RootWindowHost, public ui::WindowImpl {
public:
- explicit DesktopHostWin(const gfx::Rect& bounds);
- virtual ~DesktopHostWin();
+ explicit RootWindowHostWin(const gfx::Rect& bounds);
+ virtual ~RootWindowHostWin();
// MessageLoop::Dispatcher:
virtual bool Dispatch(const MSG& msg);
- // DesktopHost:
- virtual void SetDesktop(Desktop* desktop) OVERRIDE;
+ // RootWindowHost:
+ virtual void SetRootWindow(RootWindow* root_window) OVERRIDE;
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
virtual void Show() OVERRIDE;
virtual void ToggleFullScreen() OVERRIDE;
@@ -33,7 +33,7 @@ class DesktopHostWin : public DesktopHost, public ui::WindowImpl {
virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE;
private:
- BEGIN_MSG_MAP_EX(DesktopHostWin)
+ BEGIN_MSG_MAP_EX(RootWindowHostWin)
// Range handlers must go first!
MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange)
MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, WM_NCXBUTTONDBLCLK, OnMouseRange)
@@ -58,16 +58,16 @@ class DesktopHostWin : public DesktopHost, public ui::WindowImpl {
void OnPaint(HDC dc);
void OnSize(UINT param, const CSize& size);
- Desktop* desktop_;
+ RootWindow* root_window_;
bool fullscreen_;
RECT saved_window_rect_;
DWORD saved_window_style_;
DWORD saved_window_ex_style_;
- DISALLOW_COPY_AND_ASSIGN(DesktopHostWin);
+ DISALLOW_COPY_AND_ASSIGN(RootWindowHostWin);
};
} // namespace aura
-#endif // UI_AURA_DESKTOP_HOST_WIN_H_
+#endif // UI_AURA_ROOT_WINDOW_HOST_WIN_H_
diff --git a/ui/aura/desktop_observer.h b/ui/aura/root_window_observer.h
index dba7e5c..41417f2 100644
--- a/ui/aura/desktop_observer.h
+++ b/ui/aura/root_window_observer.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_AURA_DESKTOP_OBSERVER_H_
-#define UI_AURA_DESKTOP_OBSERVER_H_
+#ifndef UI_AURA_ROOT_WINDOW_OBSERVER_H_
+#define UI_AURA_ROOT_WINDOW_OBSERVER_H_
#pragma once
#include "ui/aura/aura_export.h"
@@ -16,10 +16,10 @@ namespace aura {
class Window;
-class AURA_EXPORT DesktopObserver {
+class AURA_EXPORT RootWindowObserver {
public:
- // Invoked after the desktop is resized.
- virtual void OnDesktopResized(const gfx::Size& new_size) {}
+ // Invoked after the RootWindowObserver is resized.
+ virtual void OnRootWindowResized(const gfx::Size& new_size) {}
// Invoked when a new window is initialized.
virtual void OnWindowInitialized(Window* window) {}
@@ -29,9 +29,9 @@ class AURA_EXPORT DesktopObserver {
virtual void OnActiveWindowChanged(Window* active) {}
protected:
- virtual ~DesktopObserver() {}
+ virtual ~RootWindowObserver() {}
};
} // namespace aura
-#endif // UI_AURA_DESKTOP_OBSERVER_H_
+#endif // UI_AURA_ROOT_WINDOW_OBSERVER_H_
diff --git a/ui/aura/desktop_unittest.cc b/ui/aura/root_window_unittest.cc
index 0556019..e23282e 100644
--- a/ui/aura/desktop_unittest.cc
+++ b/ui/aura/root_window_unittest.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 "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/event.h"
@@ -57,9 +57,9 @@ class NonClientDelegate : public TestWindowDelegate {
} // namespace
-typedef AuraTestBase DesktopTest;
+typedef AuraTestBase RootWindowTest;
-TEST_F(DesktopTest, DispatchMouseEvent) {
+TEST_F(RootWindowTest, DispatchMouseEvent) {
// Create two non-overlapping windows so we don't have to worry about which
// is on top.
scoped_ptr<NonClientDelegate> delegate1(new NonClientDelegate());
@@ -76,7 +76,7 @@ TEST_F(DesktopTest, DispatchMouseEvent) {
// Send a mouse event to window1.
gfx::Point point(101, 201);
MouseEvent event1(ui::ET_MOUSE_PRESSED, point, ui::EF_LEFT_BUTTON_DOWN);
- Desktop::GetInstance()->DispatchMouseEvent(&event1);
+ RootWindow::GetInstance()->DispatchMouseEvent(&event1);
// Event was tested for non-client area for the target window.
EXPECT_EQ(1, delegate1->non_client_count());
@@ -94,9 +94,9 @@ TEST_F(DesktopTest, DispatchMouseEvent) {
// Check that we correctly track the state of the mouse buttons in response to
// button press and release events.
-TEST_F(DesktopTest, MouseButtonState) {
- Desktop* desktop = Desktop::GetInstance();
- EXPECT_FALSE(desktop->IsMouseButtonDown());
+TEST_F(RootWindowTest, MouseButtonState) {
+ RootWindow* root_window = RootWindow::GetInstance();
+ EXPECT_FALSE(root_window->IsMouseButtonDown());
gfx::Point location;
scoped_ptr<MouseEvent> event;
@@ -106,40 +106,40 @@ TEST_F(DesktopTest, MouseButtonState) {
ui::ET_MOUSE_PRESSED,
location,
ui::EF_LEFT_BUTTON_DOWN));
- desktop->DispatchMouseEvent(event.get());
- EXPECT_TRUE(desktop->IsMouseButtonDown());
+ root_window->DispatchMouseEvent(event.get());
+ EXPECT_TRUE(root_window->IsMouseButtonDown());
// Additionally press the right.
event.reset(new MouseEvent(
ui::ET_MOUSE_PRESSED,
location,
ui::EF_LEFT_BUTTON_DOWN | ui::EF_RIGHT_BUTTON_DOWN));
- desktop->DispatchMouseEvent(event.get());
- EXPECT_TRUE(desktop->IsMouseButtonDown());
+ root_window->DispatchMouseEvent(event.get());
+ EXPECT_TRUE(root_window->IsMouseButtonDown());
// Release the left button.
event.reset(new MouseEvent(
ui::ET_MOUSE_RELEASED,
location,
ui::EF_RIGHT_BUTTON_DOWN));
- desktop->DispatchMouseEvent(event.get());
- EXPECT_TRUE(desktop->IsMouseButtonDown());
+ root_window->DispatchMouseEvent(event.get());
+ EXPECT_TRUE(root_window->IsMouseButtonDown());
// Release the right button. We should ignore the Shift-is-down flag.
event.reset(new MouseEvent(
ui::ET_MOUSE_RELEASED,
location,
ui::EF_SHIFT_DOWN));
- desktop->DispatchMouseEvent(event.get());
- EXPECT_FALSE(desktop->IsMouseButtonDown());
+ root_window->DispatchMouseEvent(event.get());
+ EXPECT_FALSE(root_window->IsMouseButtonDown());
// Press the middle button.
event.reset(new MouseEvent(
ui::ET_MOUSE_PRESSED,
location,
ui::EF_MIDDLE_BUTTON_DOWN));
- desktop->DispatchMouseEvent(event.get());
- EXPECT_TRUE(desktop->IsMouseButtonDown());
+ root_window->DispatchMouseEvent(event.get());
+ EXPECT_TRUE(root_window->IsMouseButtonDown());
}
} // namespace test
diff --git a/ui/aura/screen_aura.cc b/ui/aura/screen_aura.cc
index c8d64ca..36b493d 100644
--- a/ui/aura/screen_aura.cc
+++ b/ui/aura/screen_aura.cc
@@ -5,7 +5,7 @@
#include "ui/aura/screen_aura.h"
#include "base/logging.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/gfx/native_widget_types.h"
@@ -18,7 +18,7 @@ ScreenAura::~ScreenAura() {
}
gfx::Point ScreenAura::GetCursorScreenPointImpl() {
- return Desktop::GetInstance()->last_mouse_location();
+ return RootWindow::GetInstance()->last_mouse_location();
}
gfx::Rect ScreenAura::GetMonitorWorkAreaNearestWindowImpl(
@@ -42,11 +42,11 @@ gfx::Rect ScreenAura::GetMonitorAreaNearestPointImpl(const gfx::Point& point) {
gfx::NativeWindow ScreenAura::GetWindowAtCursorScreenPointImpl() {
const gfx::Point point = GetCursorScreenPoint();
- return Desktop::GetInstance()->GetTopWindowContainingPoint(point);
+ return RootWindow::GetInstance()->GetTopWindowContainingPoint(point);
}
gfx::Rect ScreenAura::GetBounds() {
- return gfx::Rect(aura::Desktop::GetInstance()->GetHostSize());
+ return gfx::Rect(aura::RootWindow::GetInstance()->GetHostSize());
}
gfx::Rect ScreenAura::GetWorkAreaBounds() {
diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc
index bf180a1..6ffbfb9 100644
--- a/ui/aura/test/aura_test_base.cc
+++ b/ui/aura/test/aura_test_base.cc
@@ -8,7 +8,7 @@
#include <ole2.h>
#endif
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/test/test_stacking_client.h"
namespace aura {
@@ -21,10 +21,10 @@ AuraTestBase::AuraTestBase()
OleInitialize(NULL);
#endif
- // TestStackingClient is owned by the desktop.
+ // TestStackingClient is owned by the root window.
new TestStackingClient();
- Desktop::GetInstance()->Show();
- Desktop::GetInstance()->SetHostSize(gfx::Size(600, 600));
+ RootWindow::GetInstance()->Show();
+ RootWindow::GetInstance()->SetHostSize(gfx::Size(600, 600));
}
AuraTestBase::~AuraTestBase() {
@@ -40,14 +40,14 @@ AuraTestBase::~AuraTestBase() {
// and these tasks if un-executed would upset Valgrind.
RunAllPendingInMessageLoop();
- // Ensure that we don't use the previously-allocated static Desktop object
+ // Ensure that we don't use the previously-allocated static RootWindow object
// later -- on Linux, it holds a reference to our message loop's X connection.
- aura::Desktop::DeleteInstance();
+ aura::RootWindow::DeleteInstance();
}
TestStackingClient* AuraTestBase::GetTestStackingClient() {
return static_cast<TestStackingClient*>(
- aura::Desktop::GetInstance()->stacking_client());
+ aura::RootWindow::GetInstance()->stacking_client());
}
void AuraTestBase::SetUp() {
@@ -62,7 +62,7 @@ void AuraTestBase::TearDown() {
void AuraTestBase::RunAllPendingInMessageLoop() {
message_loop_.RunAllPendingWithDispatcher(
- Desktop::GetInstance()->GetDispatcher());
+ RootWindow::GetInstance()->GetDispatcher());
}
} // namespace test
diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc
index 70ef7fe..573665f 100644
--- a/ui/aura/test/event_generator.cc
+++ b/ui/aura/test/event_generator.cc
@@ -4,15 +4,15 @@
#include "ui/aura/test/event_generator.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
+#include "ui/aura/root_window.h"
namespace {
-gfx::Point CenterOfWindowInDesktopCoordinate(aura::Window* window) {
+gfx::Point CenterOfWindowInRootWindowCoordinate(aura::Window* window) {
gfx::Point center = window->bounds().CenterPoint();
- aura::Desktop* desktop = aura::Desktop::GetInstance();
- aura::Window::ConvertPointToWindow(window->parent(), desktop, &center);
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
+ aura::Window::ConvertPointToWindow(window->parent(), root_window, &center);
return center;
}
@@ -31,7 +31,7 @@ EventGenerator::EventGenerator(const gfx::Point& point)
EventGenerator::EventGenerator(Window* window)
: flags_(0),
- current_location_(CenterOfWindowInDesktopCoordinate(window)) {
+ current_location_(CenterOfWindowInRootWindowCoordinate(window)) {
}
EventGenerator::~EventGenerator() {
@@ -94,7 +94,7 @@ void EventGenerator::Dispatch(Event& event) {
switch (event.type()) {
case ui::ET_KEY_PRESSED:
case ui::ET_KEY_RELEASED:
- aura::Desktop::GetInstance()->DispatchKeyEvent(
+ aura::RootWindow::GetInstance()->DispatchKeyEvent(
static_cast<KeyEvent*>(&event));
break;
case ui::ET_MOUSE_PRESSED:
@@ -104,7 +104,7 @@ void EventGenerator::Dispatch(Event& event) {
case ui::ET_MOUSE_ENTERED:
case ui::ET_MOUSE_EXITED:
case ui::ET_MOUSEWHEEL:
- aura::Desktop::GetInstance()->DispatchMouseEvent(
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(
static_cast<MouseEvent*>(&event));
break;
default:
@@ -114,7 +114,7 @@ void EventGenerator::Dispatch(Event& event) {
}
void EventGenerator::MoveMouseToCenterOf(Window* window) {
- MoveMouseTo(CenterOfWindowInDesktopCoordinate(window));
+ MoveMouseTo(CenterOfWindowInRootWindowCoordinate(window));
}
} // namespace test
diff --git a/ui/aura/test/test_stacking_client.cc b/ui/aura/test/test_stacking_client.cc
index 3191a84..4c3ce31 100644
--- a/ui/aura/test/test_stacking_client.cc
+++ b/ui/aura/test/test_stacking_client.cc
@@ -4,18 +4,18 @@
#include "ui/aura/test/test_stacking_client.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
namespace aura {
namespace test {
TestStackingClient::TestStackingClient()
: default_container_(new Window(NULL)) {
- Desktop::GetInstance()->SetStackingClient(this);
+ RootWindow::GetInstance()->SetStackingClient(this);
default_container_->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
default_container_->SetBounds(
- gfx::Rect(gfx::Point(), Desktop::GetInstance()->GetHostSize()));
- Desktop::GetInstance()->AddChild(default_container_.get());
+ gfx::Rect(gfx::Point(), RootWindow::GetInstance()->GetHostSize()));
+ RootWindow::GetInstance()->AddChild(default_container_.get());
default_container_->Show();
}
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index c243997..74721fa 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -10,10 +10,10 @@
#include "base/stl_util.h"
#include "base/string_util.h"
#include "ui/aura/client/stacking_client.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
#include "ui/aura/event_filter.h"
#include "ui/aura/layout_manager.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_observer.h"
#include "ui/aura/window_types.h"
@@ -41,9 +41,9 @@ Window::~Window() {
delegate_->OnWindowDestroying();
// Let the root know so that it can remove any references to us.
- Desktop* desktop = GetDesktop();
- if (desktop)
- desktop->WindowDestroying(this);
+ RootWindow* root_window = GetRootWindow();
+ if (root_window)
+ root_window->WindowDestroying(this);
// Then destroy the children.
while (!children_.empty()) {
@@ -80,7 +80,7 @@ void Window::Init(ui::Layer::LayerType layer_type) {
layer_->set_delegate(this);
UpdateLayerName(name_);
- Desktop::GetInstance()->WindowInitialized(this);
+ RootWindow::GetInstance()->WindowInitialized(this);
}
void Window::SetType(WindowType type) {
@@ -103,9 +103,9 @@ void Window::Show() {
void Window::Hide() {
SetVisible(false);
ReleaseCapture();
- if (Desktop::GetInstance()->active_window() == this ||
- !Desktop::GetInstance()->active_window()) {
- Desktop::GetInstance()->ActivateTopmostWindow();
+ if (RootWindow::GetInstance()->active_window() == this ||
+ !RootWindow::GetInstance()->active_window()) {
+ RootWindow::GetInstance()->ActivateTopmostWindow();
}
}
@@ -116,22 +116,22 @@ bool Window::IsVisible() const {
gfx::Rect Window::GetScreenBounds() const {
gfx::Point origin = bounds().origin();
Window::ConvertPointToWindow(parent_,
- aura::Desktop::GetInstance(),
+ aura::RootWindow::GetInstance(),
&origin);
return gfx::Rect(origin, bounds().size());
}
void Window::Activate() {
// If we support minimization need to ensure this restores the window first.
- aura::Desktop::GetInstance()->SetActiveWindow(this, this);
+ aura::RootWindow::GetInstance()->SetActiveWindow(this, this);
}
void Window::Deactivate() {
- aura::Desktop::GetInstance()->Deactivate(this);
+ aura::RootWindow::GetInstance()->Deactivate(this);
}
bool Window::IsActive() const {
- return aura::Desktop::GetInstance()->active_window() == this;
+ return aura::RootWindow::GetInstance()->active_window() == this;
}
void Window::SetTransform(const ui::Transform& transform) {
@@ -172,8 +172,8 @@ void Window::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin) {
void Window::SetParent(Window* parent) {
if (parent)
parent->AddChild(this);
- else if (Desktop::GetInstance()->stacking_client())
- Desktop::GetInstance()->stacking_client()->AddChildToDefaultParent(this);
+ else if (RootWindow::GetInstance()->stacking_client())
+ RootWindow::GetInstance()->stacking_client()->AddChildToDefaultParent(this);
else
NOTREACHED();
}
@@ -263,10 +263,10 @@ void Window::RemoveChild(Window* child) {
if (layout_manager_.get())
layout_manager_->OnWillRemoveWindowFromLayout(child);
FOR_EACH_OBSERVER(WindowObserver, observers_, OnWillRemoveWindow(child));
- aura::Window* desktop = child->GetDesktop();
+ aura::Window* root_window = child->GetRootWindow();
child->parent_ = NULL;
- if (desktop)
- desktop->WindowDetachedFromDesktop(child);
+ if (root_window)
+ root_window->WindowDetachedFromRootWindow(child);
layer_->Remove(child->layer_.get());
children_.erase(i);
child->OnParentChanged();
@@ -394,24 +394,24 @@ void Window::SetCapture() {
if (!IsVisible())
return;
- Desktop* desktop = GetDesktop();
- if (!desktop)
+ RootWindow* root_window = GetRootWindow();
+ if (!root_window)
return;
- desktop->SetCapture(this);
+ root_window->SetCapture(this);
}
void Window::ReleaseCapture() {
- Desktop* desktop = GetDesktop();
- if (!desktop)
+ RootWindow* root_window = GetRootWindow();
+ if (!root_window)
return;
- desktop->ReleaseCapture(this);
+ root_window->ReleaseCapture(this);
}
bool Window::HasCapture() {
- Desktop* desktop = GetDesktop();
- return desktop && desktop->capture_window() == this;
+ RootWindow* root_window = GetRootWindow();
+ return root_window && root_window->capture_window() == this;
}
void Window::SetProperty(const char* name, void* value) {
@@ -440,11 +440,11 @@ int Window::GetIntProperty(const char* name) const {
GetProperty(name)));
}
-Desktop* Window::GetDesktop() {
- return parent_ ? parent_->GetDesktop() : NULL;
+RootWindow* Window::GetRootWindow() {
+ return parent_ ? parent_->GetRootWindow() : NULL;
}
-void Window::WindowDetachedFromDesktop(aura::Window* window) {
+void Window::WindowDetachedFromRootWindow(aura::Window* window) {
}
void Window::SetBoundsInternal(const gfx::Rect& new_bounds) {
diff --git a/ui/aura/window.h b/ui/aura/window.h
index 6fa3adc..2c77d39 100644
--- a/ui/aura/window.h
+++ b/ui/aura/window.h
@@ -32,9 +32,9 @@ class Transform;
namespace aura {
-class Desktop;
class EventFilter;
class LayoutManager;
+class RootWindow;
class WindowDelegate;
class WindowObserver;
@@ -125,7 +125,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin);
// Sets the parent window of the window. If NULL, the window is parented to
- // the desktop's window.
+ // the root window.
void SetParent(Window* parent);
// Stacks the specified child of this Window at the front of the z-order.
@@ -261,12 +261,13 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
int GetIntProperty(const char* name) const;
protected:
- // Returns the desktop or NULL if we aren't yet attached to a desktop.
- virtual Desktop* GetDesktop();
+ // Returns the root window or NULL if we aren't yet attached to the root
+ // window.
+ virtual RootWindow* GetRootWindow();
- // Called when the |window| is detached from the desktop by being
- // removed from its parent.
- virtual void WindowDetachedFromDesktop(aura::Window* window);
+ // Called when the |window| is detached from the root window by being removed
+ // from its parent.
+ virtual void WindowDetachedFromRootWindow(aura::Window* window);
private:
friend class LayoutManager;
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index 2e782cf..f16fd54 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -9,10 +9,10 @@
#include "base/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/stacking_client.h"
-#include "ui/aura/desktop.h"
-#include "ui/aura/desktop_observer.h"
#include "ui/aura/event.h"
#include "ui/aura/focus_manager.h"
+#include "ui/aura/root_window.h"
+#include "ui/aura/root_window_observer.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_windows.h"
@@ -202,7 +202,7 @@ TEST_F(WindowTest, GetEventHandlerForPoint) {
scoped_ptr<Window> w13(
CreateTestWindow(SK_ColorGRAY, 13, gfx::Rect(5, 470, 50, 50), w1.get()));
- Window* root = Desktop::GetInstance();
+ Window* root = RootWindow::GetInstance();
w1->parent()->SetBounds(gfx::Rect(500, 500));
EXPECT_EQ(NULL, root->GetEventHandlerForPoint(gfx::Point(5, 5)));
EXPECT_EQ(w1.get(), root->GetEventHandlerForPoint(gfx::Point(11, 11)));
@@ -215,7 +215,7 @@ TEST_F(WindowTest, GetEventHandlerForPoint) {
}
TEST_F(WindowTest, GetTopWindowContainingPoint) {
- Window* root = Desktop::GetInstance();
+ Window* root = RootWindow::GetInstance();
root->SetBounds(gfx::Rect(0, 0, 300, 300));
scoped_ptr<Window> w1(
@@ -254,7 +254,7 @@ TEST_F(WindowTest, GetToplevelWindow) {
const gfx::Rect kBounds(0, 0, 10, 10);
TestWindowDelegate delegate;
- Window* root = aura::Desktop::GetInstance();
+ Window* root = aura::RootWindow::GetInstance();
scoped_ptr<Window> w1(CreateTestWindowWithId(1, root));
scoped_ptr<Window> w11(
CreateTestWindowWithDelegate(&delegate, 11, kBounds, w1.get()));
@@ -373,7 +373,7 @@ TEST_F(WindowTest, StackChildAbove) {
// Various destruction assertions.
TEST_F(WindowTest, CaptureTests) {
- aura::Desktop* desktop = aura::Desktop::GetInstance();
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
CaptureWindowDelegateImpl delegate;
scoped_ptr<Window> window(CreateTestWindowWithDelegate(
&delegate, 0, gfx::Rect(0, 0, 20, 20), NULL));
@@ -392,7 +392,7 @@ TEST_F(WindowTest, CaptureTests) {
delegate.set_mouse_event_count(0);
TouchEvent touchev(ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0);
- desktop->DispatchTouchEvent(&touchev);
+ root_window->DispatchTouchEvent(&touchev);
EXPECT_EQ(1, delegate.touch_event_count());
delegate.set_touch_event_count(0);
@@ -403,21 +403,21 @@ TEST_F(WindowTest, CaptureTests) {
generator.PressLeftButton();
EXPECT_EQ(0, delegate.mouse_event_count());
- desktop->DispatchTouchEvent(&touchev);
+ root_window->DispatchTouchEvent(&touchev);
EXPECT_EQ(0, delegate.touch_event_count());
// Removing the capture window from parent should reset the capture window
- // in the desktop.
+ // in the root window.
window->SetCapture();
- EXPECT_EQ(window.get(), desktop->capture_window());
+ EXPECT_EQ(window.get(), root_window->capture_window());
window->parent()->RemoveChild(window.get());
EXPECT_FALSE(window->HasCapture());
- EXPECT_EQ(NULL, desktop->capture_window());
+ EXPECT_EQ(NULL, root_window->capture_window());
}
// Verifies capture is reset when a window is destroyed.
TEST_F(WindowTest, ReleaseCaptureOnDestroy) {
- Desktop* desktop = Desktop::GetInstance();
+ RootWindow* root_window = RootWindow::GetInstance();
CaptureWindowDelegateImpl delegate;
scoped_ptr<Window> window(CreateTestWindowWithDelegate(
&delegate, 0, gfx::Rect(0, 0, 20, 20), NULL));
@@ -430,9 +430,9 @@ TEST_F(WindowTest, ReleaseCaptureOnDestroy) {
// Destroy the window.
window.reset();
- // Make sure the desktop doesn't reference the window anymore.
- EXPECT_EQ(NULL, desktop->mouse_pressed_handler());
- EXPECT_EQ(NULL, desktop->capture_window());
+ // Make sure the root window doesn't reference the window anymore.
+ EXPECT_EQ(NULL, root_window->mouse_pressed_handler());
+ EXPECT_EQ(NULL, root_window->capture_window());
}
TEST_F(WindowTest, GetScreenBounds) {
@@ -485,7 +485,7 @@ class MouseEnterExitWindowDelegate : public TestWindowDelegate {
// Verifies that the WindowDelegate receives MouseExit and MouseEnter events for
// mouse transitions from window to window.
TEST_F(WindowTest, MouseEnterExit) {
- Desktop* desktop = Desktop::GetInstance();
+ RootWindow* root_window = RootWindow::GetInstance();
MouseEnterExitWindowDelegate d1;
scoped_ptr<Window> w1(
@@ -495,9 +495,9 @@ TEST_F(WindowTest, MouseEnterExit) {
CreateTestWindowWithDelegate(&d2, 2, gfx::Rect(70, 70, 50, 50), NULL));
gfx::Point move_point = w1->bounds().CenterPoint();
- Window::ConvertPointToWindow(w1->parent(), desktop, &move_point);
+ Window::ConvertPointToWindow(w1->parent(), root_window, &move_point);
MouseEvent mouseev1(ui::ET_MOUSE_MOVED, move_point, 0);
- desktop->DispatchMouseEvent(&mouseev1);
+ root_window->DispatchMouseEvent(&mouseev1);
EXPECT_TRUE(d1.entered());
EXPECT_FALSE(d1.exited());
@@ -505,9 +505,9 @@ TEST_F(WindowTest, MouseEnterExit) {
EXPECT_FALSE(d2.exited());
move_point = w2->bounds().CenterPoint();
- Window::ConvertPointToWindow(w2->parent(), desktop, &move_point);
+ Window::ConvertPointToWindow(w2->parent(), root_window, &move_point);
MouseEvent mouseev2(ui::ET_MOUSE_MOVED, move_point, 0);
- desktop->DispatchMouseEvent(&mouseev2);
+ root_window->DispatchMouseEvent(&mouseev2);
EXPECT_TRUE(d1.entered());
EXPECT_TRUE(d1.exited());
@@ -550,7 +550,7 @@ class ActiveWindowDelegate : public TestWindowDelegate {
// Verifies that when WindowDelegate::OnLostActive is invoked the window is not
// active.
TEST_F(WindowTest, NotActiveInLostActive) {
- Desktop* desktop = Desktop::GetInstance();
+ RootWindow* root_window = RootWindow::GetInstance();
ActiveWindowDelegate d1;
scoped_ptr<Window> w1(
@@ -560,18 +560,18 @@ TEST_F(WindowTest, NotActiveInLostActive) {
CreateTestWindowWithDelegate(NULL, 1, gfx::Rect(10, 10, 50, 50), NULL));
// Activate w1.
- desktop->SetActiveWindow(w1.get(), NULL);
- EXPECT_EQ(w1.get(), desktop->active_window());
+ root_window->SetActiveWindow(w1.get(), NULL);
+ EXPECT_EQ(w1.get(), root_window->active_window());
// Should not have gotten a OnLostActive yet.
EXPECT_EQ(0, d1.hit_count());
// SetActiveWindow(NULL) should not change the active window.
- desktop->SetActiveWindow(NULL, NULL);
- EXPECT_TRUE(desktop->active_window() == w1.get());
+ root_window->SetActiveWindow(NULL, NULL);
+ EXPECT_TRUE(root_window->active_window() == w1.get());
// Now activate another window.
- desktop->SetActiveWindow(w2.get(), NULL);
+ root_window->SetActiveWindow(w2.get(), NULL);
// Should have gotten OnLostActive and w1 should not have been active at that
// time.
@@ -777,10 +777,10 @@ TEST_F(WindowTest, Deactivate) {
EXPECT_EQ(w2.get(), parent->children()[1]);
}
-// Tests transformation on the desktop.
+// Tests transformation on the root window.
TEST_F(WindowTest, Transform) {
- Desktop* desktop = Desktop::GetInstance();
- gfx::Size size = desktop->GetHostSize();
+ RootWindow* root_window = RootWindow::GetInstance();
+ gfx::Size size = root_window->GetHostSize();
EXPECT_EQ(gfx::Rect(size),
gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point()));
@@ -788,13 +788,13 @@ TEST_F(WindowTest, Transform) {
ui::Transform transform;
transform.SetRotate(90.0f);
transform.ConcatTranslate(size.width(), 0);
- desktop->SetTransform(transform);
+ root_window->SetTransform(transform);
// The size should be the transformed size.
gfx::Size transformed_size(size.height(), size.width());
- EXPECT_EQ(transformed_size.ToString(), desktop->GetHostSize().ToString());
+ EXPECT_EQ(transformed_size.ToString(), root_window->GetHostSize().ToString());
EXPECT_EQ(gfx::Rect(transformed_size).ToString(),
- desktop->bounds().ToString());
+ root_window->bounds().ToString());
EXPECT_EQ(gfx::Rect(transformed_size).ToString(),
gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point()).ToString());
}
@@ -1092,13 +1092,13 @@ TEST_F(WindowObserverTest, PropertyChanged) {
EXPECT_EQ("name= old=0 new=0", PropertyChangeInfoAndClear());
}
-class DesktopObserverTest : public WindowTest,
- public DesktopObserver {
+class RootWindowObserverTest : public WindowTest,
+ public RootWindowObserver {
public:
- DesktopObserverTest() : active_(NULL) {
+ RootWindowObserverTest() : active_(NULL) {
}
- virtual ~DesktopObserverTest() {}
+ virtual ~RootWindowObserverTest() {}
Window* active() const { return active_; }
@@ -1109,11 +1109,11 @@ class DesktopObserverTest : public WindowTest,
private:
virtual void SetUp() OVERRIDE {
WindowTest::SetUp();
- Desktop::GetInstance()->AddObserver(this);
+ RootWindow::GetInstance()->AddObserver(this);
}
virtual void TearDown() OVERRIDE {
- Desktop::GetInstance()->RemoveObserver(this);
+ RootWindow::GetInstance()->RemoveObserver(this);
WindowTest::TearDown();
}
@@ -1123,10 +1123,10 @@ class DesktopObserverTest : public WindowTest,
Window* active_;
- DISALLOW_COPY_AND_ASSIGN(DesktopObserverTest);
+ DISALLOW_COPY_AND_ASSIGN(RootWindowObserverTest);
};
-TEST_F(DesktopObserverTest, WindowActivationObserve) {
+TEST_F(RootWindowObserverTest, WindowActivationObserve) {
scoped_ptr<Window> w1(CreateTestWindowWithId(1, NULL));
scoped_ptr<Window> w2(CreateTestWindowWithId(2, NULL));
scoped_ptr<Window> w3(CreateTestWindowWithId(3, w1.get()));
diff --git a/ui/aura_shell/app_list.cc b/ui/aura_shell/app_list.cc
index d6f6f76..6e21601 100644
--- a/ui/aura_shell/app_list.cc
+++ b/ui/aura_shell/app_list.cc
@@ -82,7 +82,7 @@ void AppList::SetWidget(views::Widget* widget) {
widget_ = widget;
widget_->AddObserver(this);
GetLayer(widget_)->GetAnimator()->AddObserver(this);
- Shell::GetInstance()->AddDesktopEventFilter(this);
+ Shell::GetInstance()->AddRootWindowEventFilter(this);
widget_->SetBounds(GetPreferredBounds(false));
widget_->SetOpacity(0);
@@ -100,7 +100,7 @@ void AppList::ResetWidget() {
widget_->RemoveObserver(this);
GetLayer(widget_)->GetAnimator()->RemoveObserver(this);
- Shell::GetInstance()->RemoveDesktopEventFilter(this);
+ Shell::GetInstance()->RemoveRootWindowEventFilter(this);
widget_ = NULL;
}
diff --git a/ui/aura_shell/aura_shell.gyp b/ui/aura_shell/aura_shell.gyp
index 74f9431..2e1d430 100644
--- a/ui/aura_shell/aura_shell.gyp
+++ b/ui/aura_shell/aura_shell.gyp
@@ -43,10 +43,10 @@
'default_container_layout_manager.h',
'desktop_background_view.cc',
'desktop_background_view.h',
- 'desktop_event_filter.cc',
- 'desktop_event_filter.h',
- 'desktop_layout_manager.cc',
- 'desktop_layout_manager.h',
+ 'root_window_event_filter.cc',
+ 'root_window_event_filter.h',
+ 'root_window_layout_manager.cc',
+ 'root_window_layout_manager.h',
'drag_drop_controller.cc',
'drag_drop_controller.h',
'drag_image_view.cc',
@@ -145,7 +145,7 @@
],
'sources': [
'default_container_layout_manager_unittest.cc',
- 'desktop_event_filter_unittest.cc',
+ 'root_window_event_filter_unittest.cc',
'drag_drop_controller_unittest.cc',
'image_grid_unittest.cc',
'launcher/launcher_model_unittest.cc',
diff --git a/ui/aura_shell/default_container_layout_manager.cc b/ui/aura_shell/default_container_layout_manager.cc
index 6e80d49..a9a93be 100644
--- a/ui/aura_shell/default_container_layout_manager.cc
+++ b/ui/aura_shell/default_container_layout_manager.cc
@@ -5,8 +5,8 @@
#include "ui/aura_shell/default_container_layout_manager.h"
#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/screen_aura.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
@@ -91,7 +91,7 @@ void DefaultContainerLayoutManager::EndResize(
// DefaultContainerLayoutManager, aura::LayoutManager implementation:
void DefaultContainerLayoutManager::OnWindowResized() {
- // Workspace is updated via DesktopObserver::OnDesktopResized.
+ // Workspace is updated via RootWindowObserver::OnRootWindowResized.
}
void DefaultContainerLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
@@ -105,7 +105,7 @@ void DefaultContainerLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
Workspace* workspace = workspace_manager_->GetActiveWorkspace();
if (workspace) {
- aura::Window* active = aura::Desktop::GetInstance()->active_window();
+ aura::Window* active = aura::RootWindow::GetInstance()->active_window();
// Active window may not be in the default container layer.
if (!workspace->Contains(active))
active = NULL;
diff --git a/ui/aura_shell/default_container_layout_manager_unittest.cc b/ui/aura_shell/default_container_layout_manager_unittest.cc
index 73c22f0..0cc0e89 100644
--- a/ui/aura_shell/default_container_layout_manager_unittest.cc
+++ b/ui/aura_shell/default_container_layout_manager_unittest.cc
@@ -8,7 +8,7 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_vector.h"
#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/screen_aura.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/window.h"
@@ -33,16 +33,16 @@ class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase {
virtual void SetUp() OVERRIDE {
aura::test::AuraTestBase::SetUp();
- aura::Desktop* desktop = aura::Desktop::GetInstance();
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
container_.reset(
- CreateTestWindow(gfx::Rect(0, 0, 500, 400), desktop));
+ CreateTestWindow(gfx::Rect(0, 0, 500, 400), root_window));
workspace_controller_.reset(
new aura_shell::internal::WorkspaceController(container_.get()));
layout_manager_ = new DefaultContainerLayoutManager(
workspace_controller_->workspace_manager());
container_->SetLayoutManager(layout_manager_);
- desktop->SetHostSize(gfx::Size(500, 400));
+ root_window->SetHostSize(gfx::Size(500, 400));
}
aura::Window* CreateTestWindowWithType(const gfx::Rect& bounds,
@@ -166,7 +166,7 @@ TEST_F(DefaultContainerLayoutManagerTest, IgnoreTransient) {
scoped_ptr<aura::Window> window(new aura::Window(NULL));
window->SetType(aura::WINDOW_TYPE_NORMAL);
window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
- aura::Desktop::GetInstance()->AddTransientChild(window.get());
+ aura::RootWindow::GetInstance()->AddTransientChild(window.get());
window->SetBounds(gfx::Rect(0, 0, 200, 200));
window->Show();
window->SetParent(container());
@@ -265,8 +265,8 @@ TEST_F(DefaultContainerLayoutManagerTest, Maximized) {
EXPECT_EQ(50, w->bounds().height());
}
-// Tests that fullscreen windows get resized after desktop is resized.
-TEST_F(DefaultContainerLayoutManagerTest, FullscreenAfterDesktopResize) {
+// Tests that fullscreen windows get resized after root window is resized.
+TEST_F(DefaultContainerLayoutManagerTest, FullscreenAfterRootWindowResize) {
scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(300, 400),
container()));
gfx::Rect window_bounds = w1->GetTargetBounds();
@@ -279,11 +279,11 @@ TEST_F(DefaultContainerLayoutManagerTest, FullscreenAfterDesktopResize) {
Fullscreen(w1.get());
EXPECT_EQ(fullscreen_bounds.ToString(), w1->bounds().ToString());
- // Resize the desktop.
- aura::Desktop* desktop = aura::Desktop::GetInstance();
- gfx::Size new_desktop_size = desktop->GetHostSize();
- new_desktop_size.Enlarge(100, 200);
- desktop->OnHostResized(new_desktop_size);
+ // Resize the root window.
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
+ gfx::Size new_root_window_size = root_window->GetHostSize();
+ new_root_window_size.Enlarge(100, 200);
+ root_window->OnHostResized(new_root_window_size);
gfx::Rect new_fullscreen_bounds =
workspace_manager()->FindBy(w1.get())->bounds();
@@ -301,8 +301,8 @@ TEST_F(DefaultContainerLayoutManagerTest, FullscreenAfterDesktopResize) {
// w1->GetTargetBounds().size().ToString());
}
-// Tests that maximized windows get resized after desktop is resized.
-TEST_F(DefaultContainerLayoutManagerTest, MaximizeAfterDesktopResize) {
+// Tests that maximized windows get resized after root_window is resized.
+TEST_F(DefaultContainerLayoutManagerTest, MaximizeAfterRootWindowResize) {
scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(300, 400),
container()));
gfx::Rect window_bounds = w1->GetTargetBounds();
@@ -315,11 +315,11 @@ TEST_F(DefaultContainerLayoutManagerTest, MaximizeAfterDesktopResize) {
Maximize(w1.get());
EXPECT_EQ(work_area_bounds.ToString(), w1->bounds().ToString());
- // Resize the desktop.
- aura::Desktop* desktop = aura::Desktop::GetInstance();
- gfx::Size new_desktop_size = desktop->GetHostSize();
- new_desktop_size.Enlarge(100, 200);
- desktop->OnHostResized(new_desktop_size);
+ // Resize the root window.
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
+ gfx::Size new_root_window_size = root_window->GetHostSize();
+ new_root_window_size.Enlarge(100, 200);
+ root_window->OnHostResized(new_root_window_size);
gfx::Rect new_work_area_bounds =
workspace_manager()->FindBy(w1.get())->bounds();
diff --git a/ui/aura_shell/desktop_background_view.cc b/ui/aura_shell/desktop_background_view.cc
index 25532bb..92d8764 100644
--- a/ui/aura_shell/desktop_background_view.cc
+++ b/ui/aura_shell/desktop_background_view.cc
@@ -6,7 +6,7 @@
#include "base/utf_string_conversions.h"
#include "grit/ui_resources.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura_shell/aura_shell_export.h"
#include "ui/aura_shell/shell.h"
#include "ui/aura_shell/shell_window_ids.h"
diff --git a/ui/aura_shell/drag_drop_controller.cc b/ui/aura_shell/drag_drop_controller.cc
index 7d08eb3..3ba5810 100644
--- a/ui/aura_shell/drag_drop_controller.cc
+++ b/ui/aura_shell/drag_drop_controller.cc
@@ -7,7 +7,7 @@
#include "base/message_loop.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/window_drag_drop_delegate.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/drag_image_view.h"
#include "ui/aura_shell/shell.h"
@@ -20,7 +20,7 @@
namespace aura_shell {
namespace internal {
-using aura::Desktop;
+using aura::RootWindow;
namespace {
aura::WindowDragDropDelegate* GetDragDropDelegate(aura::Window* window) {
@@ -40,32 +40,32 @@ const gfx::Point kDragDropWidgetOffset(0, 0);
// DragDropController, public:
DragDropController::DragDropController()
- : aura::EventFilter(Desktop::GetInstance()),
+ : aura::EventFilter(RootWindow::GetInstance()),
drag_image_(NULL),
drag_data_(NULL),
drag_operation_(0),
dragged_window_(NULL),
drag_drop_in_progress_(false),
should_block_during_drag_drop_(true) {
- Shell::GetInstance()->AddDesktopEventFilter(this);
+ Shell::GetInstance()->AddRootWindowEventFilter(this);
}
DragDropController::~DragDropController() {
- Shell::GetInstance()->RemoveDesktopEventFilter(this);
+ Shell::GetInstance()->RemoveRootWindowEventFilter(this);
Cleanup();
}
int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data,
int operation) {
DCHECK(!drag_drop_in_progress_);
- aura::Window* capture_window = Desktop::GetInstance()->capture_window();
+ aura::Window* capture_window = RootWindow::GetInstance()->capture_window();
if (capture_window)
- Desktop::GetInstance()->ReleaseCapture(capture_window);
+ RootWindow::GetInstance()->ReleaseCapture(capture_window);
drag_drop_in_progress_ = true;
drag_data_ = &data;
drag_operation_ = operation;
- gfx::Point location = Desktop::GetInstance()->last_mouse_location();
+ gfx::Point location = RootWindow::GetInstance()->last_mouse_location();
const ui::OSExchangeDataProviderAura& provider =
static_cast<const ui::OSExchangeDataProviderAura&>(data.provider());
@@ -79,7 +79,7 @@ int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data,
if (should_block_during_drag_drop_) {
MessageLoopForUI::current()->RunWithDispatcher(
- Desktop::GetInstance()->GetDispatcher());
+ RootWindow::GetInstance()->GetDispatcher());
}
return drag_operation_;
}
@@ -101,13 +101,13 @@ void DragDropController::DragUpdate(aura::Window* target,
int op = delegate->OnDragUpdated(e);
gfx::NativeCursor cursor = (op == ui::DragDropTypes::DRAG_NONE)?
aura::kCursorMove : aura::kCursorHand;
- Desktop::GetInstance()->SetCursor(cursor);
+ RootWindow::GetInstance()->SetCursor(cursor);
}
}
DCHECK(drag_image_.get());
if (drag_image_->IsVisible()) {
- drag_image_->SetScreenPosition(Desktop::GetInstance()->
+ drag_image_->SetScreenPosition(RootWindow::GetInstance()->
last_mouse_location().Add(kDragDropWidgetOffset));
}
}
diff --git a/ui/aura_shell/drag_drop_controller_unittest.cc b/ui/aura_shell/drag_drop_controller_unittest.cc
index 6464a50..6ef90f0 100644
--- a/ui/aura_shell/drag_drop_controller_unittest.cc
+++ b/ui/aura_shell/drag_drop_controller_unittest.cc
@@ -7,9 +7,9 @@
#include "base/location.h"
#include "base/utf_string_conversions.h"
#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
-#include "ui/aura_shell/desktop_event_filter.h"
+#include "ui/aura/root_window.h"
+#include "ui/aura_shell/root_window_event_filter.h"
#include "ui/aura_shell/test/aura_shell_test_base.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/os_exchange_data.h"
@@ -146,7 +146,7 @@ views::Widget* CreateNewWidget() {
params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
params.accept_events = true;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
- params.parent = aura::Desktop::GetInstance();
+ params.parent = aura::RootWindow::GetInstance();
params.child = true;
widget->Init(params);
widget->Show();
@@ -176,7 +176,8 @@ class DragDropControllerTest : public AuraShellTestBase {
}
virtual ~DragDropControllerTest() {
- aura::Desktop::GetInstance()->SetProperty(aura::kDesktopDragDropClientKey,
+ aura::RootWindow::GetInstance()->SetProperty(
+ aura::kRootWindowDragDropClientKey,
NULL);
}
@@ -184,7 +185,8 @@ class DragDropControllerTest : public AuraShellTestBase {
AuraShellTestBase::SetUp();
drag_drop_controller_ = new TestDragDropController;
drag_drop_controller_->set_should_block_during_drag_drop(false);
- aura::Desktop::GetInstance()->SetProperty(aura::kDesktopDragDropClientKey,
+ aura::RootWindow::GetInstance()->SetProperty(
+ aura::kRootWindowDragDropClientKey,
drag_drop_controller_);
}
@@ -214,7 +216,7 @@ TEST_F(DragDropControllerTest, DragDropInSingleViewTest) {
data.SetString(UTF8ToUTF16("I am being dragged"));
aura::MouseEvent event1(ui::ET_MOUSE_PRESSED, point, ui::EF_LEFT_BUTTON_DOWN);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&event1);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&event1);
int num_drags = 17;
for (int i = 0; i < num_drags; ++i) {
@@ -227,11 +229,11 @@ TEST_F(DragDropControllerTest, DragDropInSingleViewTest) {
point.Offset(0, 1);
aura::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, point,
ui::EF_LEFT_BUTTON_DOWN);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&drag_event);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&drag_event);
}
aura::MouseEvent event2(ui::ET_MOUSE_RELEASED, point, 0);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&event2);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&event2);
EXPECT_TRUE(drag_drop_controller_->drag_start_received_);
EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(),
@@ -261,7 +263,7 @@ TEST_F(DragDropControllerTest, DragDropInMultipleViewsSingleWidgetTest) {
data.SetString(UTF8ToUTF16("I am being dragged"));
aura::MouseEvent event1(ui::ET_MOUSE_PRESSED, point, ui::EF_LEFT_BUTTON_DOWN);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&event1);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&event1);
int num_drags = drag_view1->width();
for (int i = 0; i < num_drags; ++i) {
@@ -274,11 +276,11 @@ TEST_F(DragDropControllerTest, DragDropInMultipleViewsSingleWidgetTest) {
point.Offset(1, 0);
aura::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, point,
ui::EF_LEFT_BUTTON_DOWN);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&drag_event);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&drag_event);
}
aura::MouseEvent event2(ui::ET_MOUSE_RELEASED, point, 0);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&event2);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&event2);
EXPECT_TRUE(drag_drop_controller_->drag_start_received_);
EXPECT_EQ(num_drags - 1 - drag_view1->HorizontalDragThreshold(),
@@ -322,7 +324,7 @@ TEST_F(DragDropControllerTest, DragDropInMultipleViewsMultipleWidgetsTest) {
data.SetString(UTF8ToUTF16("I am being dragged"));
aura::MouseEvent event1(ui::ET_MOUSE_PRESSED, point, ui::EF_LEFT_BUTTON_DOWN);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&event1);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&event1);
int num_drags = drag_view1->width();
for (int i = 0; i < num_drags; ++i) {
@@ -335,11 +337,11 @@ TEST_F(DragDropControllerTest, DragDropInMultipleViewsMultipleWidgetsTest) {
point.Offset(1, 0);
aura::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, point,
ui::EF_LEFT_BUTTON_DOWN);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&drag_event);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&drag_event);
}
aura::MouseEvent event2(ui::ET_MOUSE_RELEASED, point, 0);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&event2);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&event2);
EXPECT_TRUE(drag_drop_controller_->drag_start_received_);
EXPECT_EQ(num_drags - 1 - drag_view1->HorizontalDragThreshold(),
@@ -376,7 +378,7 @@ TEST_F(DragDropControllerTest, ViewRemovedWhileInDragDropTest) {
data.SetString(UTF8ToUTF16("I am being dragged"));
aura::MouseEvent event1(ui::ET_MOUSE_PRESSED, point, ui::EF_LEFT_BUTTON_DOWN);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&event1);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&event1);
int num_drags_1 = 17;
for (int i = 0; i < num_drags_1; ++i) {
@@ -389,7 +391,7 @@ TEST_F(DragDropControllerTest, ViewRemovedWhileInDragDropTest) {
point.Offset(0, 1);
aura::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, point,
ui::EF_LEFT_BUTTON_DOWN);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&drag_event);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&drag_event);
}
drag_view->parent()->RemoveChildView(drag_view);
@@ -400,11 +402,11 @@ TEST_F(DragDropControllerTest, ViewRemovedWhileInDragDropTest) {
point.Offset(0, 1);
aura::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, point,
ui::EF_LEFT_BUTTON_DOWN);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&drag_event);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&drag_event);
}
aura::MouseEvent event2(ui::ET_MOUSE_RELEASED, point, 0);
- aura::Desktop::GetInstance()->DispatchMouseEvent(&event2);
+ aura::RootWindow::GetInstance()->DispatchMouseEvent(&event2);
EXPECT_TRUE(drag_drop_controller_->drag_start_received_);
EXPECT_EQ(num_drags_1 + num_drags_2 - 1 - drag_view->VerticalDragThreshold(),
diff --git a/ui/aura_shell/examples/aura_shell_main.cc b/ui/aura_shell/examples/aura_shell_main.cc
index e15957f..8a8ee4c 100644
--- a/ui/aura_shell/examples/aura_shell_main.cc
+++ b/ui/aura_shell/examples/aura_shell_main.cc
@@ -7,7 +7,7 @@
#include "base/i18n/icu_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura_shell/examples/toplevel_window.h"
#include "ui/aura_shell/launcher/launcher_types.h"
#include "ui/aura_shell/shell.h"
@@ -113,7 +113,7 @@ int main(int argc, char** argv) {
icu_util::Initialize();
ResourceBundle::InitSharedInstance("en-US");
- // Create the message-loop here before creating the desktop.
+ // Create the message-loop here before creating the root window.
MessageLoop message_loop(MessageLoop::TYPE_UI);
ui::CompositorTestSupport::Initialize();
@@ -121,9 +121,9 @@ int main(int argc, char** argv) {
aura_shell::examples::InitWindowTypeLauncher();
- aura::Desktop::GetInstance()->Run();
+ aura::RootWindow::GetInstance()->Run();
- aura::Desktop::DeleteInstance();
+ aura::RootWindow::DeleteInstance();
ui::CompositorTestSupport::Terminate();
diff --git a/ui/aura_shell/examples/lock_view.cc b/ui/aura_shell/examples/lock_view.cc
index 9929d16..d3f570d 100644
--- a/ui/aura_shell/examples/lock_view.cc
+++ b/ui/aura_shell/examples/lock_view.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/utf_string_conversions.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/examples/example_factory.h"
#include "ui/aura_shell/shell.h"
@@ -54,9 +54,9 @@ void CreateLockScreen() {
views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
gfx::Size ps = lock_view->GetPreferredSize();
- gfx::Size desktop_size = aura::Desktop::GetInstance()->GetHostSize();
- params.bounds = gfx::Rect((desktop_size.width() - ps.width()) / 2,
- (desktop_size.height() - ps.height()) / 2,
+ gfx::Size root_window_size = aura::RootWindow::GetInstance()->GetHostSize();
+ params.bounds = gfx::Rect((root_window_size.width() - ps.width()) / 2,
+ (root_window_size.height() - ps.height()) / 2,
ps.width(), ps.height());
params.delegate = lock_view;
widget->Init(params);
diff --git a/ui/aura_shell/examples/window_type_launcher.cc b/ui/aura_shell/examples/window_type_launcher.cc
index 395f614..c795ff2 100644
--- a/ui/aura_shell/examples/window_type_launcher.cc
+++ b/ui/aura_shell/examples/window_type_launcher.cc
@@ -5,7 +5,7 @@
#include "ui/aura_shell/examples/window_type_launcher.h"
#include "base/utf_string_conversions.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/examples/example_factory.h"
#include "ui/aura_shell/examples/toplevel_window.h"
diff --git a/ui/aura_shell/modal_container_layout_manager.cc b/ui/aura_shell/modal_container_layout_manager.cc
index 3b94903..9a29337 100644
--- a/ui/aura_shell/modal_container_layout_manager.cc
+++ b/ui/aura_shell/modal_container_layout_manager.cc
@@ -6,8 +6,8 @@
#include "base/bind.h"
#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/modality_event_filter.h"
#include "ui/aura_shell/shell.h"
@@ -166,7 +166,7 @@ void ModalContainerLayoutManager::CreateModalScreen() {
modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f);
modal_screen_->GetNativeView()->layer()->GetAnimator()->AddObserver(this);
- Shell::GetInstance()->AddDesktopEventFilter(modality_filter_.get());
+ Shell::GetInstance()->AddRootWindowEventFilter(modality_filter_.get());
ui::LayerAnimator::ScopedSettings settings(
modal_screen_->GetNativeView()->layer()->GetAnimator());
@@ -182,7 +182,7 @@ void ModalContainerLayoutManager::DestroyModalScreen() {
}
void ModalContainerLayoutManager::HideModalScreen() {
- Shell::GetInstance()->RemoveDesktopEventFilter(modality_filter_.get());
+ Shell::GetInstance()->RemoveRootWindowEventFilter(modality_filter_.get());
ui::LayerAnimator::ScopedSettings settings(
modal_screen_->GetNativeView()->layer()->GetAnimator());
modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f);
diff --git a/ui/aura_shell/modal_container_layout_manager_unittest.cc b/ui/aura_shell/modal_container_layout_manager_unittest.cc
index aad19c6..6adcce0 100644
--- a/ui/aura_shell/modal_container_layout_manager_unittest.cc
+++ b/ui/aura_shell/modal_container_layout_manager_unittest.cc
@@ -5,7 +5,7 @@
#include "ui/aura_shell/modal_container_layout_manager.h"
#include "base/compiler_specific.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/shell.h"
@@ -100,7 +100,7 @@ TEST_F(ModalContainerLayoutManagerTest, NonModalTransient) {
TEST_F(ModalContainerLayoutManagerTest, ModalTransient) {
scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false));
// parent should be active.
- EXPECT_EQ(parent.get(), aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(parent.get(), aura::RootWindow::GetInstance()->active_window());
aura::Window* t1 = TestWindow::OpenTestWindow(parent.get(), true);
TransientWindowObserver do1;
@@ -110,19 +110,19 @@ TEST_F(ModalContainerLayoutManagerTest, ModalTransient) {
EXPECT_EQ(GetModalContainer(), t1->parent());
// t1 should now be active.
- EXPECT_EQ(t1, aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(t1, aura::RootWindow::GetInstance()->active_window());
// Attempting to click the parent should result in no activation change.
aura::test::EventGenerator e1(parent.get());
e1.ClickLeftButton();
- EXPECT_EQ(t1, aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(t1, aura::RootWindow::GetInstance()->active_window());
// Now open another modal transient parented to the original modal transient.
aura::Window* t2 = TestWindow::OpenTestWindow(t1, true);
TransientWindowObserver do2;
t2->AddObserver(&do2);
- EXPECT_EQ(t2, aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(t2, aura::RootWindow::GetInstance()->active_window());
EXPECT_EQ(t1, t2->transient_parent());
EXPECT_EQ(GetModalContainer(), t2->parent());
@@ -130,7 +130,7 @@ TEST_F(ModalContainerLayoutManagerTest, ModalTransient) {
// t2 should still be active, even after clicking on t1.
aura::test::EventGenerator e2(t1);
e2.ClickLeftButton();
- EXPECT_EQ(t2, aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(t2, aura::RootWindow::GetInstance()->active_window());
// Both transients should be destroyed with parent.
parent.reset();
@@ -145,28 +145,28 @@ TEST_F(ModalContainerLayoutManagerTest, CanActivateAfterEndModalSession) {
unrelated->SetBounds(gfx::Rect(100, 100, 50, 50));
scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false));
// parent should be active.
- EXPECT_EQ(parent.get(), aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(parent.get(), aura::RootWindow::GetInstance()->active_window());
scoped_ptr<aura::Window> transient(
TestWindow::OpenTestWindow(parent.get(), true));
// t1 should now be active.
- EXPECT_EQ(transient.get(), aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(transient.get(), aura::RootWindow::GetInstance()->active_window());
// Attempting to click the parent should result in no activation change.
aura::test::EventGenerator e1(parent.get());
e1.ClickLeftButton();
- EXPECT_EQ(transient.get(), aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(transient.get(), aura::RootWindow::GetInstance()->active_window());
// Now close the transient.
transient.reset();
// parent should now be active again.
- EXPECT_EQ(parent.get(), aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(parent.get(), aura::RootWindow::GetInstance()->active_window());
// Attempting to click unrelated should activate it.
aura::test::EventGenerator e2(unrelated.get());
e2.ClickLeftButton();
- EXPECT_EQ(unrelated.get(), aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(unrelated.get(), aura::RootWindow::GetInstance()->active_window());
}
} // namespace test
diff --git a/ui/aura_shell/desktop_event_filter.cc b/ui/aura_shell/root_window_event_filter.cc
index dc4b4cf..9d1f3db 100644
--- a/ui/aura_shell/desktop_event_filter.cc
+++ b/ui/aura_shell/root_window_event_filter.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/aura_shell/desktop_event_filter.h"
+#include "ui/aura_shell/root_window_event_filter.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
#include "ui/aura/focus_manager.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window_delegate.h"
#include "ui/aura_shell/shell.h"
#include "ui/aura_shell/stacking_controller.h"
@@ -40,36 +40,36 @@ gfx::NativeCursor CursorForWindowComponent(int window_component) {
}
////////////////////////////////////////////////////////////////////////////////
-// DesktopEventFilter, public:
+// RootWindowEventFilter, public:
-DesktopEventFilter::DesktopEventFilter()
- : EventFilter(aura::Desktop::GetInstance()) {
+RootWindowEventFilter::RootWindowEventFilter()
+ : EventFilter(aura::RootWindow::GetInstance()) {
}
-DesktopEventFilter::~DesktopEventFilter() {
- // Additional filters are not owned by DesktopEventFilter and they
+RootWindowEventFilter::~RootWindowEventFilter() {
+ // Additional filters are not owned by RootWindowEventFilter and they
// should all be removed when running here. |filters_| has
// check_empty == true and will DCHECK failure if it is not empty.
}
-void DesktopEventFilter::AddFilter(aura::EventFilter* filter) {
+void RootWindowEventFilter::AddFilter(aura::EventFilter* filter) {
filters_.AddObserver(filter);
}
-void DesktopEventFilter::RemoveFilter(aura::EventFilter* filter) {
+void RootWindowEventFilter::RemoveFilter(aura::EventFilter* filter) {
filters_.RemoveObserver(filter);
}
////////////////////////////////////////////////////////////////////////////////
-// DesktopEventFilter, EventFilter implementation:
+// RootWindowEventFilter, EventFilter implementation:
-bool DesktopEventFilter::PreHandleKeyEvent(aura::Window* target,
- aura::KeyEvent* event) {
+bool RootWindowEventFilter::PreHandleKeyEvent(aura::Window* target,
+ aura::KeyEvent* event) {
return FilterKeyEvent(target, event);
}
-bool DesktopEventFilter::PreHandleMouseEvent(aura::Window* target,
- aura::MouseEvent* event) {
+bool RootWindowEventFilter::PreHandleMouseEvent(aura::Window* target,
+ aura::MouseEvent* event) {
// We must always update the cursor, otherwise the cursor can get stuck if an
// event filter registered with us consumes the event.
if (event->type() == ui::ET_MOUSE_MOVED)
@@ -84,7 +84,7 @@ bool DesktopEventFilter::PreHandleMouseEvent(aura::Window* target,
return false;
}
-ui::TouchStatus DesktopEventFilter::PreHandleTouchEvent(
+ui::TouchStatus RootWindowEventFilter::PreHandleTouchEvent(
aura::Window* target,
aura::TouchEvent* event) {
ui::TouchStatus status = FilterTouchEvent(target, event);
@@ -97,32 +97,32 @@ ui::TouchStatus DesktopEventFilter::PreHandleTouchEvent(
}
////////////////////////////////////////////////////////////////////////////////
-// DesktopEventFilter, private:
+// RootWindowEventFilter, private:
-void DesktopEventFilter::ActivateIfNecessary(aura::Window* window,
- aura::Event* event) {
+void RootWindowEventFilter::ActivateIfNecessary(aura::Window* window,
+ aura::Event* event) {
aura::Window* activatable = StackingController::GetActivatableWindow(window);
- if (activatable == aura::Desktop::GetInstance()->active_window()) {
+ if (activatable == aura::RootWindow::GetInstance()->active_window()) {
// |window| is a descendant of the active window, no need to activate.
window->GetFocusManager()->SetFocusedWindow(window);
} else {
- aura::Desktop::GetInstance()->SetActiveWindow(activatable, window);
+ aura::RootWindow::GetInstance()->SetActiveWindow(activatable, window);
}
}
-void DesktopEventFilter::UpdateCursor(aura::Window* target,
- aura::MouseEvent* event) {
+void RootWindowEventFilter::UpdateCursor(aura::Window* target,
+ aura::MouseEvent* event) {
gfx::NativeCursor cursor = target->GetCursor(event->location());
if (event->flags() & ui::EF_IS_NON_CLIENT) {
int window_component =
target->delegate()->GetNonClientComponent(event->location());
cursor = CursorForWindowComponent(window_component);
}
- aura::Desktop::GetInstance()->SetCursor(cursor);
+ aura::RootWindow::GetInstance()->SetCursor(cursor);
}
-bool DesktopEventFilter::FilterKeyEvent(aura::Window* target,
- aura::KeyEvent* event) {
+bool RootWindowEventFilter::FilterKeyEvent(aura::Window* target,
+ aura::KeyEvent* event) {
bool handled = false;
if (filters_.might_have_observers()) {
ObserverListBase<aura::EventFilter>::Iterator it(filters_);
@@ -133,8 +133,8 @@ bool DesktopEventFilter::FilterKeyEvent(aura::Window* target,
return handled;
}
-bool DesktopEventFilter::FilterMouseEvent(aura::Window* target,
- aura::MouseEvent* event) {
+bool RootWindowEventFilter::FilterMouseEvent(aura::Window* target,
+ aura::MouseEvent* event) {
bool handled = false;
if (filters_.might_have_observers()) {
ObserverListBase<aura::EventFilter>::Iterator it(filters_);
@@ -145,8 +145,9 @@ bool DesktopEventFilter::FilterMouseEvent(aura::Window* target,
return handled;
}
-ui::TouchStatus DesktopEventFilter::FilterTouchEvent(aura::Window* target,
- aura::TouchEvent* event) {
+ui::TouchStatus RootWindowEventFilter::FilterTouchEvent(
+ aura::Window* target,
+ aura::TouchEvent* event) {
ui::TouchStatus status = ui::TOUCH_STATUS_UNKNOWN;
if (filters_.might_have_observers()) {
ObserverListBase<aura::EventFilter>::Iterator it(filters_);
diff --git a/ui/aura_shell/desktop_event_filter.h b/ui/aura_shell/root_window_event_filter.h
index e4d1c45..20afc03 100644
--- a/ui/aura_shell/desktop_event_filter.h
+++ b/ui/aura_shell/root_window_event_filter.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_AURA_SHELL_DESKTOP_EVENT_FILTER_H_
-#define UI_AURA_SHELL_DESKTOP_EVENT_FILTER_H_
+#ifndef UI_AURA_SHELL_ROOT_WINDOW_EVENT_FILTER_H_
+#define UI_AURA_SHELL_ROOT_WINDOW_EVENT_FILTER_H_
#pragma once
#include "base/compiler_specific.h"
@@ -14,17 +14,18 @@
namespace aura_shell {
namespace internal {
-// DesktopEventFilter gets all desktop events first and can provide actions to
-// those events. It implements desktop features such as click to activate a
-// window and cursor change when moving mouse.
-// Additional event filters can be added to DesktopEventFilter. Events will
+// RootWindowEventFilter gets all root window events first and can provide
+// actions to those events. It implements root window features such as click to
+// activate a window and cursor change when moving mouse.
+// Additional event filters can be added to RootWIndowEventFilter. Events will
// pass through those additional filters in their addition order and could be
// consumed by any of those filters. If an event is consumed by a filter, the
-// rest of the filter(s) and DesktopEventFilter will not see the consumed event.
-class AURA_SHELL_EXPORT DesktopEventFilter : public aura::EventFilter {
+// rest of the filter(s) and RootWindowEventFilter will not see the consumed
+// event.
+class AURA_SHELL_EXPORT RootWindowEventFilter : public aura::EventFilter {
public:
- DesktopEventFilter();
- virtual ~DesktopEventFilter();
+ RootWindowEventFilter();
+ virtual ~RootWindowEventFilter();
// Adds/removes additional event filters.
void AddFilter(aura::EventFilter* filter);
@@ -56,10 +57,10 @@ class AURA_SHELL_EXPORT DesktopEventFilter : public aura::EventFilter {
// Additional event filters that pre-handles events.
ObserverList<aura::EventFilter, true> filters_;
- DISALLOW_COPY_AND_ASSIGN(DesktopEventFilter);
+ DISALLOW_COPY_AND_ASSIGN(RootWindowEventFilter);
};
} // namespace internal
} // namespace aura_shell
-#endif // UI_AURA_SHELL_DESKTOP_EVENT_FILTER_H_
+#endif // UI_AURA_SHELL_ROOT_WINDOW_EVENT_FILTER_H_
diff --git a/ui/aura_shell/desktop_event_filter_unittest.cc b/ui/aura_shell/root_window_event_filter_unittest.cc
index 504f1ec..0f4302b 100644
--- a/ui/aura_shell/desktop_event_filter_unittest.cc
+++ b/ui/aura_shell/root_window_event_filter_unittest.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/aura_shell/desktop_event_filter.h"
+#include "ui/aura_shell/root_window_event_filter.h"
#include "ui/aura/cursor.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_windows.h"
@@ -20,24 +20,24 @@
namespace aura_shell {
namespace test {
-class DesktopEventFilterTest : public aura::test::AuraTestBase {
+class RootWindowEventFilterTest : public aura::test::AuraTestBase {
public:
- DesktopEventFilterTest() {
- aura::Desktop::GetInstance()->SetEventFilter(
- new internal::DesktopEventFilter);
+ RootWindowEventFilterTest() {
+ aura::RootWindow::GetInstance()->SetEventFilter(
+ new internal::RootWindowEventFilter);
aura::test::TestStackingClient* stacking_client =
static_cast<aura::test::TestStackingClient*>(
- aura::Desktop::GetInstance()->stacking_client());
+ aura::RootWindow::GetInstance()->stacking_client());
stacking_client->default_container()->set_id(
internal::kShellWindowId_DefaultContainer);
}
- virtual ~DesktopEventFilterTest() {
- aura::Desktop::GetInstance()->SetEventFilter(NULL);
+ virtual ~RootWindowEventFilterTest() {
+ aura::RootWindow::GetInstance()->SetEventFilter(NULL);
}
private:
- DISALLOW_COPY_AND_ASSIGN(DesktopEventFilterTest);
+ DISALLOW_COPY_AND_ASSIGN(RootWindowEventFilterTest);
};
class HitTestWindowDelegate : public aura::test::TestWindowDelegate {
@@ -59,9 +59,9 @@ class HitTestWindowDelegate : public aura::test::TestWindowDelegate {
DISALLOW_COPY_AND_ASSIGN(HitTestWindowDelegate);
};
-TEST_F(DesktopEventFilterTest, Focus) {
- aura::Desktop* desktop = aura::Desktop::GetInstance();
- desktop->SetBounds(gfx::Rect(0, 0, 510, 510));
+TEST_F(RootWindowEventFilterTest, Focus) {
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
+ root_window->SetBounds(gfx::Rect(0, 0, 510, 510));
// Supplied ids are negative so as not to collide with shell ids.
// TODO(beng): maybe introduce a MAKE_SHELL_ID() macro that generates a safe
@@ -89,40 +89,40 @@ TEST_F(DesktopEventFilterTest, Focus) {
// Click on a sub-window (w121) to focus it.
gfx::Point click_point = w121->bounds().CenterPoint();
- aura::Window::ConvertPointToWindow(w121->parent(), desktop, &click_point);
+ aura::Window::ConvertPointToWindow(w121->parent(), root_window, &click_point);
aura::MouseEvent mouse(ui::ET_MOUSE_PRESSED, click_point,
ui::EF_LEFT_BUTTON_DOWN);
- desktop->DispatchMouseEvent(&mouse);
+ root_window->DispatchMouseEvent(&mouse);
aura::internal::FocusManager* focus_manager = w121->GetFocusManager();
EXPECT_EQ(w121.get(), focus_manager->GetFocusedWindow());
// The key press should be sent to the focused sub-window.
aura::KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_E, 0);
- desktop->DispatchKeyEvent(&keyev);
+ root_window->DispatchKeyEvent(&keyev);
EXPECT_EQ(ui::VKEY_E, w121delegate->last_key_code());
// Touch on a sub-window (w122) to focus it.
click_point = w122->bounds().CenterPoint();
- aura::Window::ConvertPointToWindow(w122->parent(), desktop, &click_point);
+ aura::Window::ConvertPointToWindow(w122->parent(), root_window, &click_point);
aura::TouchEvent touchev(ui::ET_TOUCH_PRESSED, click_point, 0);
- desktop->DispatchTouchEvent(&touchev);
+ root_window->DispatchTouchEvent(&touchev);
focus_manager = w122->GetFocusManager();
EXPECT_EQ(w122.get(), focus_manager->GetFocusedWindow());
// The key press should be sent to the focused sub-window.
- desktop->DispatchKeyEvent(&keyev);
+ root_window->DispatchKeyEvent(&keyev);
EXPECT_EQ(ui::VKEY_E, w122delegate->last_key_code());
// Removing the focused window from parent should reset the focused window.
w12->RemoveChild(w122.get());
EXPECT_EQ(NULL, w122->GetFocusManager());
EXPECT_EQ(NULL, w12->GetFocusManager()->GetFocusedWindow());
- EXPECT_FALSE(desktop->DispatchKeyEvent(&keyev));
+ EXPECT_FALSE(root_window->DispatchKeyEvent(&keyev));
}
// Various assertion testing for activating windows.
-TEST_F(DesktopEventFilterTest, ActivateOnMouse) {
- aura::Desktop* desktop = aura::Desktop::GetInstance();
+TEST_F(RootWindowEventFilterTest, ActivateOnMouse) {
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
aura::test::ActivateWindowDelegate d1;
scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(
@@ -136,8 +136,8 @@ TEST_F(DesktopEventFilterTest, ActivateOnMouse) {
d2.Clear();
// Activate window1.
- desktop->SetActiveWindow(w1.get(), NULL);
- EXPECT_EQ(w1.get(), desktop->active_window());
+ root_window->SetActiveWindow(w1.get(), NULL);
+ EXPECT_EQ(w1.get(), root_window->active_window());
EXPECT_EQ(w1.get(), focus_manager->GetFocusedWindow());
EXPECT_EQ(1, d1.activated_count());
EXPECT_EQ(0, d1.lost_active_count());
@@ -145,12 +145,12 @@ TEST_F(DesktopEventFilterTest, ActivateOnMouse) {
// Click on window2.
gfx::Point press_point = w2->bounds().CenterPoint();
- aura::Window::ConvertPointToWindow(w2->parent(), desktop, &press_point);
+ aura::Window::ConvertPointToWindow(w2->parent(), root_window, &press_point);
aura::test::EventGenerator generator(press_point);
generator.ClickLeftButton();
// Window2 should have become active.
- EXPECT_EQ(w2.get(), desktop->active_window());
+ EXPECT_EQ(w2.get(), root_window->active_window());
EXPECT_EQ(w2.get(), focus_manager->GetFocusedWindow());
EXPECT_EQ(0, d1.activated_count());
EXPECT_EQ(1, d1.lost_active_count());
@@ -161,12 +161,12 @@ TEST_F(DesktopEventFilterTest, ActivateOnMouse) {
// Click back on window1, but set it up so w1 doesn't activate on click.
press_point = w1->bounds().CenterPoint();
- aura::Window::ConvertPointToWindow(w1->parent(), desktop, &press_point);
+ aura::Window::ConvertPointToWindow(w1->parent(), root_window, &press_point);
d1.set_activate(false);
generator.ClickLeftButton();
// Window2 should still be active and focused.
- EXPECT_EQ(w2.get(), desktop->active_window());
+ EXPECT_EQ(w2.get(), root_window->active_window());
EXPECT_EQ(w2.get(), focus_manager->GetFocusedWindow());
EXPECT_EQ(0, d1.activated_count());
EXPECT_EQ(0, d1.lost_active_count());
@@ -180,15 +180,15 @@ TEST_F(DesktopEventFilterTest, ActivateOnMouse) {
w2.reset();
EXPECT_EQ(0, d2.activated_count());
EXPECT_EQ(0, d2.lost_active_count());
- EXPECT_EQ(w1.get(), desktop->active_window());
+ EXPECT_EQ(w1.get(), root_window->active_window());
EXPECT_EQ(w1.get(), focus_manager->GetFocusedWindow());
EXPECT_EQ(1, d1.activated_count());
EXPECT_EQ(0, d1.lost_active_count());
}
// Essentially the same as ActivateOnMouse, but for touch events.
-TEST_F(DesktopEventFilterTest, ActivateOnTouch) {
- aura::Desktop* desktop = aura::Desktop::GetInstance();
+TEST_F(RootWindowEventFilterTest, ActivateOnTouch) {
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
aura::test::ActivateWindowDelegate d1;
scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(
@@ -202,8 +202,8 @@ TEST_F(DesktopEventFilterTest, ActivateOnTouch) {
d2.Clear();
// Activate window1.
- desktop->SetActiveWindow(w1.get(), NULL);
- EXPECT_EQ(w1.get(), desktop->active_window());
+ root_window->SetActiveWindow(w1.get(), NULL);
+ EXPECT_EQ(w1.get(), root_window->active_window());
EXPECT_EQ(w1.get(), focus_manager->GetFocusedWindow());
EXPECT_EQ(1, d1.activated_count());
EXPECT_EQ(0, d1.lost_active_count());
@@ -211,12 +211,12 @@ TEST_F(DesktopEventFilterTest, ActivateOnTouch) {
// Touch window2.
gfx::Point press_point = w2->bounds().CenterPoint();
- aura::Window::ConvertPointToWindow(w2->parent(), desktop, &press_point);
+ aura::Window::ConvertPointToWindow(w2->parent(), root_window, &press_point);
aura::TouchEvent touchev1(ui::ET_TOUCH_PRESSED, press_point, 0);
- desktop->DispatchTouchEvent(&touchev1);
+ root_window->DispatchTouchEvent(&touchev1);
// Window2 should have become active.
- EXPECT_EQ(w2.get(), desktop->active_window());
+ EXPECT_EQ(w2.get(), root_window->active_window());
EXPECT_EQ(w2.get(), focus_manager->GetFocusedWindow());
EXPECT_EQ(0, d1.activated_count());
EXPECT_EQ(1, d1.lost_active_count());
@@ -227,13 +227,13 @@ TEST_F(DesktopEventFilterTest, ActivateOnTouch) {
// Touch window1, but set it up so w1 doesn't activate on touch.
press_point = w1->bounds().CenterPoint();
- aura::Window::ConvertPointToWindow(w1->parent(), desktop, &press_point);
+ aura::Window::ConvertPointToWindow(w1->parent(), root_window, &press_point);
d1.set_activate(false);
aura::TouchEvent touchev2(ui::ET_TOUCH_PRESSED, press_point, 0);
- desktop->DispatchTouchEvent(&touchev2);
+ root_window->DispatchTouchEvent(&touchev2);
// Window2 should still be active and focused.
- EXPECT_EQ(w2.get(), desktop->active_window());
+ EXPECT_EQ(w2.get(), root_window->active_window());
EXPECT_EQ(w2.get(), focus_manager->GetFocusedWindow());
EXPECT_EQ(0, d1.activated_count());
EXPECT_EQ(0, d1.lost_active_count());
@@ -247,14 +247,14 @@ TEST_F(DesktopEventFilterTest, ActivateOnTouch) {
w2.reset();
EXPECT_EQ(0, d2.activated_count());
EXPECT_EQ(0, d2.lost_active_count());
- EXPECT_EQ(w1.get(), desktop->active_window());
+ EXPECT_EQ(w1.get(), root_window->active_window());
EXPECT_EQ(w1.get(), focus_manager->GetFocusedWindow());
EXPECT_EQ(1, d1.activated_count());
EXPECT_EQ(0, d1.lost_active_count());
}
-TEST_F(DesktopEventFilterTest, MouseEventCursors) {
- aura::Desktop* desktop = aura::Desktop::GetInstance();
+TEST_F(RootWindowEventFilterTest, MouseEventCursors) {
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
// Create a window.
const int kWindowLeft = 123;
@@ -268,58 +268,58 @@ TEST_F(DesktopEventFilterTest, MouseEventCursors) {
// Create two mouse movement events we can switch between.
gfx::Point point1(kWindowLeft, kWindowTop);
- aura::Window::ConvertPointToWindow(window->parent(), desktop, &point1);
+ aura::Window::ConvertPointToWindow(window->parent(), root_window, &point1);
aura::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, 0x0);
gfx::Point point2(kWindowLeft + 1, kWindowTop + 1);
- aura::Window::ConvertPointToWindow(window->parent(), desktop, &point2);
+ aura::Window::ConvertPointToWindow(window->parent(), root_window, &point2);
aura::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, 0x0);
// Cursor starts as null.
- EXPECT_EQ(aura::kCursorNull, desktop->last_cursor());
+ EXPECT_EQ(aura::kCursorNull, root_window->last_cursor());
// Resize edges and corners show proper cursors.
window_delegate.set_hittest_code(HTBOTTOM);
- desktop->DispatchMouseEvent(&move1);
- EXPECT_EQ(aura::kCursorSouthResize, desktop->last_cursor());
+ root_window->DispatchMouseEvent(&move1);
+ EXPECT_EQ(aura::kCursorSouthResize, root_window->last_cursor());
window_delegate.set_hittest_code(HTBOTTOMLEFT);
- desktop->DispatchMouseEvent(&move2);
- EXPECT_EQ(aura::kCursorSouthWestResize, desktop->last_cursor());
+ root_window->DispatchMouseEvent(&move2);
+ EXPECT_EQ(aura::kCursorSouthWestResize, root_window->last_cursor());
window_delegate.set_hittest_code(HTBOTTOMRIGHT);
- desktop->DispatchMouseEvent(&move1);
- EXPECT_EQ(aura::kCursorSouthEastResize, desktop->last_cursor());
+ root_window->DispatchMouseEvent(&move1);
+ EXPECT_EQ(aura::kCursorSouthEastResize, root_window->last_cursor());
window_delegate.set_hittest_code(HTLEFT);
- desktop->DispatchMouseEvent(&move2);
- EXPECT_EQ(aura::kCursorWestResize, desktop->last_cursor());
+ root_window->DispatchMouseEvent(&move2);
+ EXPECT_EQ(aura::kCursorWestResize, root_window->last_cursor());
window_delegate.set_hittest_code(HTRIGHT);
- desktop->DispatchMouseEvent(&move1);
- EXPECT_EQ(aura::kCursorEastResize, desktop->last_cursor());
+ root_window->DispatchMouseEvent(&move1);
+ EXPECT_EQ(aura::kCursorEastResize, root_window->last_cursor());
window_delegate.set_hittest_code(HTTOP);
- desktop->DispatchMouseEvent(&move2);
- EXPECT_EQ(aura::kCursorNorthResize, desktop->last_cursor());
+ root_window->DispatchMouseEvent(&move2);
+ EXPECT_EQ(aura::kCursorNorthResize, root_window->last_cursor());
window_delegate.set_hittest_code(HTTOPLEFT);
- desktop->DispatchMouseEvent(&move1);
- EXPECT_EQ(aura::kCursorNorthWestResize, desktop->last_cursor());
+ root_window->DispatchMouseEvent(&move1);
+ EXPECT_EQ(aura::kCursorNorthWestResize, root_window->last_cursor());
window_delegate.set_hittest_code(HTTOPRIGHT);
- desktop->DispatchMouseEvent(&move2);
- EXPECT_EQ(aura::kCursorNorthEastResize, desktop->last_cursor());
+ root_window->DispatchMouseEvent(&move2);
+ EXPECT_EQ(aura::kCursorNorthEastResize, root_window->last_cursor());
// Client area uses null cursor.
window_delegate.set_hittest_code(HTCLIENT);
- desktop->DispatchMouseEvent(&move1);
- EXPECT_EQ(aura::kCursorNull, desktop->last_cursor());
+ root_window->DispatchMouseEvent(&move1);
+ EXPECT_EQ(aura::kCursorNull, root_window->last_cursor());
}
-TEST_F(DesktopEventFilterTest, TransformActivate) {
- aura::Desktop* desktop = aura::Desktop::GetInstance();
- gfx::Size size = desktop->GetHostSize();
+TEST_F(RootWindowEventFilterTest, TransformActivate) {
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
+ gfx::Size size = root_window->GetHostSize();
EXPECT_EQ(gfx::Rect(size),
gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point()));
@@ -327,7 +327,7 @@ TEST_F(DesktopEventFilterTest, TransformActivate) {
ui::Transform transform;
transform.SetRotate(90.0f);
transform.ConcatTranslate(size.width(), 0);
- desktop->SetTransform(transform);
+ root_window->SetTransform(transform);
aura::test::ActivateWindowDelegate d1;
scoped_ptr<aura::Window> w1(
@@ -339,30 +339,30 @@ TEST_F(DesktopEventFilterTest, TransformActivate) {
aura::MouseEvent mouseev1(ui::ET_MOUSE_PRESSED,
miss_point,
ui::EF_LEFT_BUTTON_DOWN);
- desktop->DispatchMouseEvent(&mouseev1);
+ root_window->DispatchMouseEvent(&mouseev1);
EXPECT_FALSE(w1->GetFocusManager()->GetFocusedWindow());
aura::MouseEvent mouseup(ui::ET_MOUSE_RELEASED,
miss_point,
ui::EF_LEFT_BUTTON_DOWN);
- desktop->DispatchMouseEvent(&mouseup);
+ root_window->DispatchMouseEvent(&mouseup);
gfx::Point hit_point(5, 15);
transform.TransformPoint(hit_point);
aura::MouseEvent mouseev2(ui::ET_MOUSE_PRESSED,
hit_point,
ui::EF_LEFT_BUTTON_DOWN);
- desktop->DispatchMouseEvent(&mouseev2);
- EXPECT_EQ(w1.get(), desktop->active_window());
+ root_window->DispatchMouseEvent(&mouseev2);
+ EXPECT_EQ(w1.get(), root_window->active_window());
EXPECT_EQ(w1.get(), w1->GetFocusManager()->GetFocusedWindow());
}
-TEST_F(DesktopEventFilterTest, AdditionalFilters) {
- aura::Desktop* desktop = aura::Desktop::GetInstance();
+TEST_F(RootWindowEventFilterTest, AdditionalFilters) {
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
// Creates a window and make it active
scoped_ptr<aura::Window> w1(aura::test::CreateTestWindow(
SK_ColorWHITE, -1, gfx::Rect(0, 0, 100, 100), NULL));
- desktop->SetActiveWindow(w1.get(), NULL);
+ root_window->SetActiveWindow(w1.get(), NULL);
// Creates two addition filters
scoped_ptr<aura::test::TestEventFilter> f1(
@@ -370,17 +370,18 @@ TEST_F(DesktopEventFilterTest, AdditionalFilters) {
scoped_ptr<aura::test::TestEventFilter> f2(
new aura::test::TestEventFilter(NULL));
- // Adds them to desktop event filter.
- internal::DesktopEventFilter* desktop_filter =
- static_cast<internal::DesktopEventFilter*>(desktop->event_filter());
- desktop_filter->AddFilter(f1.get());
- desktop_filter->AddFilter(f2.get());
+ // Adds them to root window event filter.
+ internal::RootWindowEventFilter* root_window_filter =
+ static_cast<internal::RootWindowEventFilter*>(
+ root_window->event_filter());
+ root_window_filter->AddFilter(f1.get());
+ root_window_filter->AddFilter(f2.get());
// Dispatches mouse and keyboard events.
aura::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0);
- desktop->DispatchKeyEvent(&key_event);
+ root_window->DispatchKeyEvent(&key_event);
aura::MouseEvent mouse_pressed(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), 0x0);
- desktop->DispatchMouseEvent(&mouse_pressed);
+ root_window->DispatchMouseEvent(&mouse_pressed);
// Both filters should get the events.
EXPECT_EQ(1, f1->key_event_count());
@@ -396,9 +397,9 @@ TEST_F(DesktopEventFilterTest, AdditionalFilters) {
f1->set_consumes_mouse_events(true);
// Dispatches events.
- desktop->DispatchKeyEvent(&key_event);
+ root_window->DispatchKeyEvent(&key_event);
aura::MouseEvent mouse_released(ui::ET_MOUSE_RELEASED, gfx::Point(0, 0), 0x0);
- desktop->DispatchMouseEvent(&mouse_released);
+ root_window->DispatchMouseEvent(&mouse_released);
// f1 should still get the events but f2 no longer gets them.
EXPECT_EQ(1, f1->key_event_count());
@@ -410,11 +411,11 @@ TEST_F(DesktopEventFilterTest, AdditionalFilters) {
f2->ResetCounts();
// Remove f1 from additonal filters list.
- desktop_filter->RemoveFilter(f1.get());
+ root_window_filter->RemoveFilter(f1.get());
// Dispatches events.
- desktop->DispatchKeyEvent(&key_event);
- desktop->DispatchMouseEvent(&mouse_pressed);
+ root_window->DispatchKeyEvent(&key_event);
+ root_window->DispatchMouseEvent(&mouse_pressed);
// f1 should get no events since it's out and f2 should get them.
EXPECT_EQ(0, f1->key_event_count());
@@ -422,7 +423,7 @@ TEST_F(DesktopEventFilterTest, AdditionalFilters) {
EXPECT_EQ(1, f2->key_event_count());
EXPECT_EQ(1, f2->mouse_event_count());
- desktop_filter->RemoveFilter(f2.get());
+ root_window_filter->RemoveFilter(f2.get());
}
} // namespace test
diff --git a/ui/aura_shell/desktop_layout_manager.cc b/ui/aura_shell/root_window_layout_manager.cc
index 7c05e1b..36417cc 100644
--- a/ui/aura_shell/desktop_layout_manager.cc
+++ b/ui/aura_shell/root_window_layout_manager.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 "ui/aura_shell/desktop_layout_manager.h"
+#include "ui/aura_shell/root_window_layout_manager.h"
#include "ui/aura/window.h"
#include "ui/views/widget/widget.h"
@@ -11,20 +11,20 @@ namespace aura_shell {
namespace internal {
////////////////////////////////////////////////////////////////////////////////
-// DesktopLayoutManager, public:
+// RootWindowLayoutManager, public:
-DesktopLayoutManager::DesktopLayoutManager(aura::Window* owner)
+RootWindowLayoutManager::RootWindowLayoutManager(aura::Window* owner)
: owner_(owner),
background_widget_(NULL) {
}
-DesktopLayoutManager::~DesktopLayoutManager() {
+RootWindowLayoutManager::~RootWindowLayoutManager() {
}
////////////////////////////////////////////////////////////////////////////////
-// DesktopLayoutManager, aura::LayoutManager implementation:
+// RootWindowLayoutManager, aura::LayoutManager implementation:
-void DesktopLayoutManager::OnWindowResized() {
+void RootWindowLayoutManager::OnWindowResized() {
gfx::Rect fullscreen_bounds =
gfx::Rect(owner_->bounds().width(), owner_->bounds().height());
@@ -35,18 +35,21 @@ void DesktopLayoutManager::OnWindowResized() {
background_widget_->SetBounds(fullscreen_bounds);
}
-void DesktopLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
+void RootWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
}
-void DesktopLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
+void RootWindowLayoutManager::OnWillRemoveWindowFromLayout(
+ aura::Window* child) {
}
-void DesktopLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child,
- bool visible) {
+void RootWindowLayoutManager::OnChildWindowVisibilityChanged(
+ aura::Window* child,
+ bool visible) {
}
-void DesktopLayoutManager::SetChildBounds(aura::Window* child,
- const gfx::Rect& requested_bounds) {
+void RootWindowLayoutManager::SetChildBounds(
+ aura::Window* child,
+ const gfx::Rect& requested_bounds) {
SetChildBoundsDirect(child, requested_bounds);
}
diff --git a/ui/aura_shell/desktop_layout_manager.h b/ui/aura_shell/root_window_layout_manager.h
index 80efb19..d420a40 100644
--- a/ui/aura_shell/desktop_layout_manager.h
+++ b/ui/aura_shell/root_window_layout_manager.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_AURA_SHELL_DESKTOP_LAYOUT_MANAGER_H_
-#define UI_AURA_SHELL_DESKTOP_LAYOUT_MANAGER_H_
+#ifndef UI_AURA_SHELL_ROOT_WINDOW_LAYOUT_MANAGER_H_
+#define UI_AURA_SHELL_ROOT_WINDOW_LAYOUT_MANAGER_H_
#pragma once
#include "base/basictypes.h"
@@ -25,10 +25,10 @@ namespace internal {
// A layout manager for the root window.
// Resizes all of its immediate children to fill the bounds of the root window.
-class DesktopLayoutManager : public aura::LayoutManager {
+class RootWindowLayoutManager : public aura::LayoutManager {
public:
- explicit DesktopLayoutManager(aura::Window* owner);
- virtual ~DesktopLayoutManager();
+ explicit RootWindowLayoutManager(aura::Window* owner);
+ virtual ~RootWindowLayoutManager();
void set_background_widget(views::Widget* background_widget) {
background_widget_ = background_widget;
@@ -48,10 +48,10 @@ class DesktopLayoutManager : public aura::LayoutManager {
views::Widget* background_widget_;
- DISALLOW_COPY_AND_ASSIGN(DesktopLayoutManager);
+ DISALLOW_COPY_AND_ASSIGN(RootWindowLayoutManager);
};
} // namespace internal
} // namespace aura_shell
-#endif // UI_AURA_SHELL_DESKTOP_LAYOUT_MANAGER_H_
+#endif // UI_AURA_SHELL_ROOT_WINDOW_LAYOUT_MANAGER_H_
diff --git a/ui/aura_shell/shadow_controller.cc b/ui/aura_shell/shadow_controller.cc
index c4edf19..b93876e 100644
--- a/ui/aura_shell/shadow_controller.cc
+++ b/ui/aura_shell/shadow_controller.cc
@@ -9,7 +9,7 @@
#include "base/logging.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/shadow_types.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/shadow.h"
@@ -19,7 +19,7 @@ namespace aura_shell {
namespace internal {
ShadowController::ShadowController() {
- aura::Desktop::GetInstance()->AddObserver(this);
+ aura::RootWindow::GetInstance()->AddObserver(this);
}
ShadowController::~ShadowController() {
@@ -27,7 +27,7 @@ ShadowController::~ShadowController() {
it != window_shadows_.end(); ++it) {
it->first->RemoveObserver(this);
}
- aura::Desktop::GetInstance()->RemoveObserver(this);
+ aura::RootWindow::GetInstance()->RemoveObserver(this);
}
void ShadowController::OnWindowInitialized(aura::Window* window) {
diff --git a/ui/aura_shell/shadow_controller.h b/ui/aura_shell/shadow_controller.h
index 2b2077b..7b6e96e67 100644
--- a/ui/aura_shell/shadow_controller.h
+++ b/ui/aura_shell/shadow_controller.h
@@ -11,7 +11,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/linked_ptr.h"
-#include "ui/aura/desktop_observer.h"
+#include "ui/aura/root_window_observer.h"
#include "ui/aura/window_observer.h"
#include "ui/aura_shell/aura_shell_export.h"
@@ -29,7 +29,7 @@ class Shadow;
// ShadowController observes changes to windows and creates and updates drop
// shadows as needed.
-class AURA_SHELL_EXPORT ShadowController : public aura::DesktopObserver,
+class AURA_SHELL_EXPORT ShadowController : public aura::RootWindowObserver,
public aura::WindowObserver {
public:
class TestApi {
@@ -50,7 +50,7 @@ public:
explicit ShadowController();
virtual ~ShadowController();
- // aura::DesktopObserver override:
+ // aura::RootWindowObserver override:
virtual void OnWindowInitialized(aura::Window* window) OVERRIDE;
// aura::WindowObserver overrides:
diff --git a/ui/aura_shell/shadow_controller_unittest.cc b/ui/aura_shell/shadow_controller_unittest.cc
index a3dddb4..e172598 100644
--- a/ui/aura_shell/shadow_controller_unittest.cc
+++ b/ui/aura_shell/shadow_controller_unittest.cc
@@ -10,7 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/shadow_types.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/shadow.h"
#include "ui/aura_shell/shell.h"
diff --git a/ui/aura_shell/shelf_layout_manager.cc b/ui/aura_shell/shelf_layout_manager.cc
index c01d112..cdca6d8 100644
--- a/ui/aura_shell/shelf_layout_manager.cc
+++ b/ui/aura_shell/shelf_layout_manager.cc
@@ -5,7 +5,7 @@
#include "ui/aura_shell/shelf_layout_manager.h"
#include "base/auto_reset.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/screen_aura.h"
#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/layer_animator.h"
@@ -55,7 +55,7 @@ void ShelfLayoutManager::LayoutShelf() {
GetLayer(status_)->SetOpacity(target_opacity);
launcher_->SetBounds(target_bounds.launcher_bounds);
status_->SetBounds(target_bounds.status_bounds);
- aura::Desktop::GetInstance()->screen()->set_work_area_insets(
+ aura::RootWindow::GetInstance()->screen()->set_work_area_insets(
target_bounds.work_area_insets);
}
@@ -112,7 +112,7 @@ void ShelfLayoutManager::StopAnimating() {
void ShelfLayoutManager::CalculateTargetBounds(bool visible,
TargetBounds* target_bounds) {
- const gfx::Rect& available_bounds(aura::Desktop::GetInstance()->bounds());
+ const gfx::Rect& available_bounds(aura::RootWindow::GetInstance()->bounds());
int y = available_bounds.bottom() - (visible ? max_height_ : 0);
gfx::Rect status_bounds(status_->GetWindowScreenBounds());
target_bounds->status_bounds = gfx::Rect(
@@ -145,7 +145,7 @@ void ShelfLayoutManager::OnLayerAnimationEnded(
visible_ = !visible_;
TargetBounds target_bounds;
CalculateTargetBounds(visible_, &target_bounds);
- aura::Desktop::GetInstance()->screen()->set_work_area_insets(
+ aura::RootWindow::GetInstance()->screen()->set_work_area_insets(
target_bounds.work_area_insets);
}
diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc
index 53acecb..406215e 100644
--- a/ui/aura_shell/shell.cc
+++ b/ui/aura_shell/shell.cc
@@ -9,15 +9,15 @@
#include "ui/aura/aura_switches.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/drag_drop_client.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/window.h"
#include "ui/aura/window_types.h"
#include "ui/aura_shell/app_list.h"
#include "ui/aura_shell/default_container_event_filter.h"
#include "ui/aura_shell/default_container_layout_manager.h"
-#include "ui/aura_shell/desktop_event_filter.h"
-#include "ui/aura_shell/desktop_layout_manager.h"
+#include "ui/aura_shell/root_window_event_filter.h"
+#include "ui/aura_shell/root_window_layout_manager.h"
#include "ui/aura_shell/drag_drop_controller.h"
#include "ui/aura_shell/launcher/launcher.h"
#include "ui/aura_shell/modal_container_layout_manager.h"
@@ -115,19 +115,20 @@ Shell::Shell(ShellDelegate* delegate)
: ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
accelerator_controller_(new ShellAcceleratorController),
delegate_(delegate) {
- aura::Desktop::GetInstance()->SetEventFilter(
- new internal::DesktopEventFilter);
- aura::Desktop::GetInstance()->SetStackingClient(
+ aura::RootWindow::GetInstance()->SetEventFilter(
+ new internal::RootWindowEventFilter);
+ aura::RootWindow::GetInstance()->SetStackingClient(
new internal::StackingController);
}
Shell::~Shell() {
- RemoveDesktopEventFilter(accelerator_filter_.get());
+ RemoveRootWindowEventFilter(accelerator_filter_.get());
// ShellTooltipManager needs a valid shell instance. We delete it before
// deleting the shell |instance_|.
- RemoveDesktopEventFilter(tooltip_manager_.get());
- aura::Desktop::GetInstance()->SetProperty(aura::kDesktopTooltipClientKey,
+ RemoveRootWindowEventFilter(tooltip_manager_.get());
+ aura::RootWindow::GetInstance()->SetProperty(
+ aura::kRootWindowTooltipClientKey,
NULL);
// Make sure we delete WorkspaceController before launcher is
@@ -138,9 +139,9 @@ Shell::~Shell() {
// Delete containers now so that child windows does not access
// observers when they are destructed. This has to be after launcher
// is destructed because launcher closes the widget in its destructor.
- aura::Desktop* desktop_window = aura::Desktop::GetInstance();
- while (!desktop_window->children().empty()) {
- aura::Window* child = desktop_window->children()[0];
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
+ while (!root_window->children().empty()) {
+ aura::Window* child = root_window->children()[0];
delete child;
}
@@ -174,28 +175,29 @@ void Shell::DeleteInstance() {
}
void Shell::Init() {
- aura::Desktop* desktop_window = aura::Desktop::GetInstance();
- desktop_window->SetCursor(aura::kCursorPointer);
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
+ root_window->SetCursor(aura::kCursorPointer);
aura::Window::Windows containers;
CreateSpecialContainers(&containers);
aura::Window::Windows::const_iterator i;
for (i = containers.begin(); i != containers.end(); ++i) {
(*i)->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
- desktop_window->AddChild(*i);
+ root_window->AddChild(*i);
(*i)->Show();
}
internal::StackingController* stacking_controller =
static_cast<internal::StackingController*>(
- desktop_window->stacking_client());
+ root_window->stacking_client());
stacking_controller->Init();
- internal::DesktopLayoutManager* desktop_layout =
- new internal::DesktopLayoutManager(desktop_window);
- desktop_window->SetLayoutManager(desktop_layout);
+ internal::RootWindowLayoutManager* root_window_layout =
+ new internal::RootWindowLayoutManager(root_window);
+ root_window->SetLayoutManager(root_window_layout);
- desktop_layout->set_background_widget(internal::CreateDesktopBackground());
+ root_window_layout->set_background_widget(
+ internal::CreateDesktopBackground());
aura::Window* default_container =
GetContainer(internal::kShellWindowId_DefaultContainer);
launcher_.reset(new Launcher(default_container));
@@ -229,21 +231,23 @@ void Shell::Init() {
}
// Force a layout.
- desktop_layout->OnWindowResized();
+ root_window_layout->OnWindowResized();
// Initialize ShellAcceleratorFilter
accelerator_filter_.reset(new internal::ShellAcceleratorFilter);
- AddDesktopEventFilter(accelerator_filter_.get());
+ AddRootWindowEventFilter(accelerator_filter_.get());
// Initialize ShellTooltipManager
tooltip_manager_.reset(new ShellTooltipManager);
- aura::Desktop::GetInstance()->SetProperty(aura::kDesktopTooltipClientKey,
+ aura::RootWindow::GetInstance()->SetProperty(
+ aura::kRootWindowTooltipClientKey,
static_cast<aura::TooltipClient*>(tooltip_manager_.get()));
- AddDesktopEventFilter(tooltip_manager_.get());
+ AddRootWindowEventFilter(tooltip_manager_.get());
// Initialize drag drop controller.
drag_drop_controller_.reset(new internal::DragDropController);
- aura::Desktop::GetInstance()->SetProperty(aura::kDesktopDragDropClientKey,
+ aura::RootWindow::GetInstance()->SetProperty(
+ aura::kRootWindowDragDropClientKey,
static_cast<aura::DragDropClient*>(drag_drop_controller_.get()));
}
@@ -253,17 +257,17 @@ aura::Window* Shell::GetContainer(int container_id) {
}
const aura::Window* Shell::GetContainer(int container_id) const {
- return aura::Desktop::GetInstance()->GetChildById(container_id);
+ return aura::RootWindow::GetInstance()->GetChildById(container_id);
}
-void Shell::AddDesktopEventFilter(aura::EventFilter* filter) {
- static_cast<internal::DesktopEventFilter*>(
- aura::Desktop::GetInstance()->event_filter())->AddFilter(filter);
+void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) {
+ static_cast<internal::RootWindowEventFilter*>(
+ aura::RootWindow::GetInstance()->event_filter())->AddFilter(filter);
}
-void Shell::RemoveDesktopEventFilter(aura::EventFilter* filter) {
- static_cast<internal::DesktopEventFilter*>(
- aura::Desktop::GetInstance()->event_filter())->RemoveFilter(filter);
+void Shell::RemoveRootWindowEventFilter(aura::EventFilter* filter) {
+ static_cast<internal::RootWindowEventFilter*>(
+ aura::RootWindow::GetInstance()->event_filter())->RemoveFilter(filter);
}
void Shell::ToggleOverview() {
diff --git a/ui/aura_shell/shell.h b/ui/aura_shell/shell.h
index ca8d2bf..a877863 100644
--- a/ui/aura_shell/shell.h
+++ b/ui/aura_shell/shell.h
@@ -40,11 +40,11 @@ class WorkspaceController;
}
// Shell is a singleton object that presents the Shell API and implements the
-// Desktop's delegate interface.
+// RootWindow's delegate interface.
class AURA_SHELL_EXPORT Shell {
public:
- // Upon creation, the Shell sets itself as the Desktop's delegate, which takes
- // ownership of the Shell.
+ // Upon creation, the Shell sets itself as the RootWindow's delegate, which
+ // takes ownership of the Shell.
// A shell must be explicitly created so that it can call |Init()| with the
// delegate set. |delegate| can be NULL (if not required for initialization).
@@ -58,9 +58,9 @@ class AURA_SHELL_EXPORT Shell {
aura::Window* GetContainer(int container_id);
const aura::Window* GetContainer(int container_id) const;
- // Adds or removes |filter| from the DesktopEventFilter.
- void AddDesktopEventFilter(aura::EventFilter* filter);
- void RemoveDesktopEventFilter(aura::EventFilter* filter);
+ // Adds or removes |filter| from the RootWindowEventFilter.
+ void AddRootWindowEventFilter(aura::EventFilter* filter);
+ void RemoveRootWindowEventFilter(aura::EventFilter* filter);
// Toggles between overview mode and normal mode.
void ToggleOverview();
diff --git a/ui/aura_shell/shell_accelerator_controller.cc b/ui/aura_shell/shell_accelerator_controller.cc
index cc4a6ac..74e36d5 100644
--- a/ui/aura_shell/shell_accelerator_controller.cc
+++ b/ui/aura_shell/shell_accelerator_controller.cc
@@ -5,8 +5,8 @@
#include "ui/aura_shell/shell_accelerator_controller.h"
#include "base/logging.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
+#include "ui/aura/root_window.h"
#include "ui/aura_shell/shell.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/accelerators/accelerator_manager.h"
@@ -24,7 +24,7 @@ enum AcceleratorAction {
#if !defined(NDEBUG)
ROTATE_SCREEN,
PRINT_LAYER_HIERARCHY,
- TOGGLE_DESKTOP_FULL_SCREEN,
+ TOGGLE_ROOT_WINDOW_FULL_SCREEN,
#endif
};
@@ -42,7 +42,7 @@ struct AcceleratorData {
{ ui::VKEY_PRINT, false, false, false, TAKE_SCREENSHOT },
#if !defined(NDEBUG)
{ ui::VKEY_HOME, false, true, false, ROTATE_SCREEN },
- { ui::VKEY_F11, false, true, false, TOGGLE_DESKTOP_FULL_SCREEN },
+ { ui::VKEY_F11, false, true, false, TOGGLE_ROOT_WINDOW_FULL_SCREEN },
{ ui::VKEY_L, false, false, true, PRINT_LAYER_HIERARCHY },
#endif
};
@@ -87,23 +87,23 @@ bool HandleRotateScreen() {
case 13: delta = 180; break;
}
i = (i + 1) % 14;
- aura::Desktop::GetInstance()->layer()->GetAnimator()->set_preemption_strategy(
- ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
+ aura::RootWindow::GetInstance()->layer()->GetAnimator()->
+ set_preemption_strategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
scoped_ptr<ui::LayerAnimationSequence> screen_rotation(
new ui::LayerAnimationSequence(new ui::ScreenRotation(delta)));
- screen_rotation->AddObserver(aura::Desktop::GetInstance());
- aura::Desktop::GetInstance()->layer()->GetAnimator()->StartAnimation(
+ screen_rotation->AddObserver(aura::RootWindow::GetInstance());
+ aura::RootWindow::GetInstance()->layer()->GetAnimator()->StartAnimation(
screen_rotation.release());
return true;
}
-bool HandleToggleDesktopFullScreen() {
- aura::Desktop::GetInstance()->ToggleFullScreen();
+bool HandleToggleRootWindowFullScreen() {
+ aura::RootWindow::GetInstance()->ToggleFullScreen();
return true;
}
bool HandlePrintLayerHierarchy() {
- ui::PrintLayerHierarchy(aura::Desktop::GetInstance()->layer());
+ ui::PrintLayerHierarchy(aura::RootWindow::GetInstance()->layer());
return true;
}
#endif
@@ -174,8 +174,8 @@ bool ShellAcceleratorController::AcceleratorPressed(
#if !defined(NDEBUG)
case ROTATE_SCREEN:
return HandleRotateScreen();
- case TOGGLE_DESKTOP_FULL_SCREEN:
- return HandleToggleDesktopFullScreen();
+ case TOGGLE_ROOT_WINDOW_FULL_SCREEN:
+ return HandleToggleRootWindowFullScreen();
case PRINT_LAYER_HIERARCHY:
return HandlePrintLayerHierarchy();
#endif
diff --git a/ui/aura_shell/shell_accelerator_filter.cc b/ui/aura_shell/shell_accelerator_filter.cc
index aeacf8e..d64a02f 100644
--- a/ui/aura_shell/shell_accelerator_filter.cc
+++ b/ui/aura_shell/shell_accelerator_filter.cc
@@ -4,8 +4,8 @@
#include "ui/aura_shell/shell_accelerator_filter.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
+#include "ui/aura/root_window.h"
#include "ui/aura_shell/shell.h"
#include "ui/aura_shell/shell_accelerator_controller.h"
#include "ui/base/accelerators/accelerator.h"
@@ -24,7 +24,7 @@ namespace internal {
// ShellAcceleratorFilter, public:
ShellAcceleratorFilter::ShellAcceleratorFilter()
- : EventFilter(aura::Desktop::GetInstance()) {
+ : EventFilter(aura::RootWindow::GetInstance()) {
}
ShellAcceleratorFilter::~ShellAcceleratorFilter() {
diff --git a/ui/aura_shell/stacking_controller.cc b/ui/aura_shell/stacking_controller.cc
index fe1f3c4..08c7da8 100644
--- a/ui/aura_shell/stacking_controller.cc
+++ b/ui/aura_shell/stacking_controller.cc
@@ -5,7 +5,7 @@
#include "ui/aura_shell/stacking_controller.h"
#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/always_on_top_controller.h"
#include "ui/aura_shell/shell.h"
@@ -37,7 +37,7 @@ bool IsWindowModal(aura::Window* window) {
// StackingController, public:
StackingController::StackingController() {
- aura::Desktop::GetInstance()->SetStackingClient(this);
+ aura::RootWindow::GetInstance()->SetStackingClient(this);
}
StackingController::~StackingController() {
diff --git a/ui/aura_shell/stacking_controller_unittest.cc b/ui/aura_shell/stacking_controller_unittest.cc
index 61e0efe..5b8fa09 100644
--- a/ui/aura_shell/stacking_controller_unittest.cc
+++ b/ui/aura_shell/stacking_controller_unittest.cc
@@ -4,7 +4,7 @@
#include "ui/aura_shell/stacking_controller.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/test/test_window_delegate.h"
@@ -25,7 +25,7 @@ TEST_F(StackingControllerTest, GetTopmostWindowToActivate) {
&activate, 2, gfx::Rect(), NULL));
scoped_ptr<aura::Window> w3(aura::test::CreateTestWindowWithDelegate(
&non_activate, 3, gfx::Rect(), NULL));
- EXPECT_EQ(w2.get(), aura::Desktop::GetInstance()->stacking_client()->
+ EXPECT_EQ(w2.get(), aura::RootWindow::GetInstance()->stacking_client()->
GetTopmostWindowToActivate(NULL));
}
@@ -37,12 +37,12 @@ TEST_F(StackingControllerTest, ClickOnMenu) {
scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(
&activate, 1, gfx::Rect(100, 100), NULL));
- EXPECT_EQ(NULL, aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(NULL, aura::RootWindow::GetInstance()->active_window());
// Clicking on an activatable window activtes the window.
aura::test::EventGenerator generator(w1.get());
generator.ClickLeftButton();
- EXPECT_EQ(w1.get(), aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(w1.get(), aura::RootWindow::GetInstance()->active_window());
// Creates a menu that covers the transient parent.
scoped_ptr<aura::Window> menu(aura::test::CreateTestWindowWithDelegateAndType(
@@ -52,7 +52,7 @@ TEST_F(StackingControllerTest, ClickOnMenu) {
// Clicking on a menu whose transient parent is active window shouldn't
// change the active window.
generator.ClickLeftButton();
- EXPECT_EQ(w1.get(), aura::Desktop::GetInstance()->active_window());
+ EXPECT_EQ(w1.get(), aura::RootWindow::GetInstance()->active_window());
}
} // namespace test
diff --git a/ui/aura_shell/status_area_view.cc b/ui/aura_shell/status_area_view.cc
index af95c3a..85b839b 100644
--- a/ui/aura_shell/status_area_view.cc
+++ b/ui/aura_shell/status_area_view.cc
@@ -6,7 +6,7 @@
#include "base/utf_string_conversions.h"
#include "grit/ui_resources.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura_shell/aura_shell_export.h"
#include "ui/aura_shell/shell.h"
#include "ui/aura_shell/shell_window_ids.h"
diff --git a/ui/aura_shell/toplevel_layout_manager_unittest.cc b/ui/aura_shell/toplevel_layout_manager_unittest.cc
index c02069f..c852395 100644
--- a/ui/aura_shell/toplevel_layout_manager_unittest.cc
+++ b/ui/aura_shell/toplevel_layout_manager_unittest.cc
@@ -7,7 +7,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/screen_aura.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/base/ui_base_types.h"
@@ -24,9 +24,9 @@ class ToplevelLayoutManagerTest : public aura::test::AuraTestBase {
virtual void SetUp() OVERRIDE {
aura::test::AuraTestBase::SetUp();
- aura::Desktop::GetInstance()->screen()->set_work_area_insets(
+ aura::RootWindow::GetInstance()->screen()->set_work_area_insets(
gfx::Insets(1, 2, 3, 4));
- aura::Desktop::GetInstance()->SetHostSize(gfx::Size(500, 400));
+ aura::RootWindow::GetInstance()->SetHostSize(gfx::Size(500, 400));
container_.reset(new aura::Window(NULL));
container_->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
container_->SetBounds(gfx::Rect(0, 0, 500, 500));
diff --git a/ui/aura_shell/toplevel_window_event_filter.cc b/ui/aura_shell/toplevel_window_event_filter.cc
index 29dd9f3..ccdde0f 100644
--- a/ui/aura_shell/toplevel_window_event_filter.cc
+++ b/ui/aura_shell/toplevel_window_event_filter.cc
@@ -6,8 +6,8 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/cursor.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/aura_shell/window_util.h"
diff --git a/ui/aura_shell/toplevel_window_event_filter_unittest.cc b/ui/aura_shell/toplevel_window_event_filter_unittest.cc
index fc0938f..f4cc00e 100644
--- a/ui/aura_shell/toplevel_window_event_filter_unittest.cc
+++ b/ui/aura_shell/toplevel_window_event_filter_unittest.cc
@@ -5,8 +5,8 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_stacking_client.h"
@@ -69,7 +69,7 @@ class ToplevelWindowEventFilterTest : public aura::test::AuraTestBase {
aura::test::AuraTestBase::SetUp();
aura::Window* default_container =
static_cast<aura::test::TestStackingClient*>(
- aura::Desktop::GetInstance()->stacking_client())->
+ aura::RootWindow::GetInstance()->stacking_client())->
default_container();
default_container->SetEventFilter(
new ToplevelWindowEventFilter(default_container));
diff --git a/ui/aura_shell/workspace/workspace.cc b/ui/aura_shell/workspace/workspace.cc
index a810bd3..ba25771 100644
--- a/ui/aura_shell/workspace/workspace.cc
+++ b/ui/aura_shell/workspace/workspace.cc
@@ -8,7 +8,7 @@
#include "base/logging.h"
#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/property_util.h"
#include "ui/aura_shell/workspace/workspace_manager.h"
@@ -95,7 +95,7 @@ bool Workspace::Contains(aura::Window* window) const {
aura::Window* Workspace::FindRotateWindowForLocation(
const gfx::Point& position) {
- aura::Window* active = aura::Desktop::GetInstance()->active_window();
+ aura::Window* active = aura::RootWindow::GetInstance()->active_window();
if (GetTotalWindowsWidth() < bounds_.width()) {
// If all windows fit to the width of the workspace, it returns the
// window which contains |position|'s x coordinate.
diff --git a/ui/aura_shell/workspace/workspace_manager.cc b/ui/aura_shell/workspace/workspace_manager.cc
index 597bf39..bcc1a1b 100644
--- a/ui/aura_shell/workspace/workspace_manager.cc
+++ b/ui/aura_shell/workspace/workspace_manager.cc
@@ -9,7 +9,7 @@
#include "base/auto_reset.h"
#include "base/logging.h"
#include "base/stl_util.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/screen_aura.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/workspace/workspace.h"
@@ -238,7 +238,7 @@ gfx::Rect WorkspaceManager::GetWorkAreaBounds(
const gfx::Rect& workspace_bounds) {
gfx::Rect bounds = workspace_bounds;
bounds.Inset(
- aura::Desktop::GetInstance()->screen()->work_area_insets());
+ aura::RootWindow::GetInstance()->screen()->work_area_insets());
return bounds;
}
diff --git a/ui/aura_shell/workspace/workspace_manager_unittest.cc b/ui/aura_shell/workspace/workspace_manager_unittest.cc
index 44811ea..d54fb2d 100644
--- a/ui/aura_shell/workspace/workspace_manager_unittest.cc
+++ b/ui/aura_shell/workspace/workspace_manager_unittest.cc
@@ -5,7 +5,7 @@
#include "ui/aura_shell/workspace/workspace_manager.h"
#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/screen_aura.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/test_stacking_client.h"
@@ -173,7 +173,7 @@ TEST_F(WorkspaceManagerTest, ResizeDuringLayout) {
}
TEST_F(WorkspaceManagerTest, WorkspaceManagerDragArea) {
- aura::Desktop::GetInstance()->screen()->set_work_area_insets(
+ aura::RootWindow::GetInstance()->screen()->set_work_area_insets(
gfx::Insets(10, 10, 10, 10));
viewport()->SetBounds(gfx::Rect(0, 0, 200, 200));
EXPECT_EQ("10,10 180x180", manager_->GetDragAreaBounds().ToString());
diff --git a/ui/aura_shell/workspace_controller.cc b/ui/aura_shell/workspace_controller.cc
index 9131bee..b8c8bf1 100644
--- a/ui/aura_shell/workspace_controller.cc
+++ b/ui/aura_shell/workspace_controller.cc
@@ -4,7 +4,7 @@
#include "ui/aura_shell/workspace_controller.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/default_container_layout_manager.h"
#include "ui/aura_shell/launcher/launcher.h"
@@ -21,14 +21,14 @@ WorkspaceController::WorkspaceController(aura::Window* viewport)
launcher_model_(NULL),
ignore_move_event_(false) {
workspace_manager_->AddObserver(this);
- aura::Desktop::GetInstance()->AddObserver(this);
+ aura::RootWindow::GetInstance()->AddObserver(this);
}
WorkspaceController::~WorkspaceController() {
workspace_manager_->RemoveObserver(this);
if (launcher_model_)
launcher_model_->RemoveObserver(this);
- aura::Desktop::GetInstance()->RemoveObserver(this);
+ aura::RootWindow::GetInstance()->RemoveObserver(this);
}
void WorkspaceController::ToggleOverview() {
@@ -42,9 +42,9 @@ void WorkspaceController::SetLauncherModel(LauncherModel* launcher_model) {
}
////////////////////////////////////////////////////////////////////////////////
-// WorkspaceController, aura::DesktopObserver overrides:
+// WorkspaceController, aura::RootWindowObserver overrides:
-void WorkspaceController::OnDesktopResized(const gfx::Size& new_size) {
+void WorkspaceController::OnRootWindowResized(const gfx::Size& new_size) {
workspace_manager_->SetWorkspaceSize(new_size);
}
diff --git a/ui/aura_shell/workspace_controller.h b/ui/aura_shell/workspace_controller.h
index f90b043..e41899e 100644
--- a/ui/aura_shell/workspace_controller.h
+++ b/ui/aura_shell/workspace_controller.h
@@ -8,7 +8,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/aura/desktop_observer.h"
+#include "ui/aura/root_window_observer.h"
#include "ui/aura_shell/aura_shell_export.h"
#include "ui/aura_shell/launcher/launcher_model_observer.h"
#include "ui/aura_shell/workspace/workspace_observer.h"
@@ -29,10 +29,10 @@ namespace internal {
class WorkspaceManager;
// WorkspaceControlls owns a WorkspaceManager. WorkspaceControlls bridges
-// events From DesktopObserver translating them to WorkspaceManager, and
+// events From RootWindowObserver translating them to WorkspaceManager, and
// a move event between Laucher and Workspace.
class AURA_SHELL_EXPORT WorkspaceController :
- public aura::DesktopObserver,
+ public aura::RootWindowObserver,
public aura_shell::internal::WorkspaceObserver,
public aura_shell::LauncherModelObserver {
public:
@@ -48,8 +48,8 @@ class AURA_SHELL_EXPORT WorkspaceController :
return workspace_manager_.get();
}
- // DesktopObserver overrides:
- virtual void OnDesktopResized(const gfx::Size& new_size) OVERRIDE;
+ // RootWindowObserver overrides:
+ virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE;
virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE;
// WorkspaceObserver overrides:
diff --git a/ui/base/ime/input_method.h b/ui/base/ime/input_method.h
index 2112660..891b18a 100644
--- a/ui/base/ime/input_method.h
+++ b/ui/base/ime/input_method.h
@@ -43,14 +43,14 @@ class TextInputClient;
// - Keeps track of the focused TextInputClient to see which client can call
// APIs, OnTextInputTypeChanged, OnCaretBoundsChanged, and CancelComposition,
// that change the state of the input method.
-// In Aura environment, aura::DesktopHost creates an instance of ui::InputMethod
-// and owns it.
+// In Aura environment, aura::RootWindowHost creates an instance of
+// ui::InputMethod and owns it.
class UI_EXPORT InputMethod {
public:
virtual ~InputMethod() {}
// Sets the delegate used by this InputMethod instance. It should only be
- // called by an object which manages the whole UI (e.g. aura::DesktopHost).
+ // called by an object which manages the whole UI (e.g. aura::RootWindowHost).
virtual void SetDelegate(internal::InputMethodDelegate* delegate) = 0;
// Initializes the InputMethod object. Pass true if the system toplevel window
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index c81f32f..128d530 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -25,7 +25,7 @@
#include "ui/views/widget/widget.h"
#if defined(USE_AURA)
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#elif defined(TOOLKIT_USES_GTK)
#include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
#endif
@@ -884,7 +884,7 @@ base::MessagePumpDispatcher::DispatchStatus
base::MessagePumpDispatcher::DispatchStatus
MenuController::Dispatch(XEvent* xev) {
if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED) {
- aura::Desktop::GetInstance()->GetDispatcher()->Dispatch(xev);
+ aura::RootWindow::GetInstance()->GetDispatcher()->Dispatch(xev);
return base::MessagePumpDispatcher::EVENT_QUIT;
}
switch (ui::EventTypeFromNative(xev)) {
@@ -904,7 +904,7 @@ base::MessagePumpDispatcher::DispatchStatus
// TODO(oshima): Update Windows' Dispatcher to return DispatchStatus
// instead of bool.
- if (aura::Desktop::GetInstance()->GetDispatcher()->Dispatch(xev) ==
+ if (aura::RootWindow::GetInstance()->GetDispatcher()->Dispatch(xev) ==
base::MessagePumpDispatcher::EVENT_IGNORED)
return EVENT_IGNORED;
return exit_type_ != EXIT_NONE ?
@@ -1947,7 +1947,7 @@ void MenuController::SetExitType(ExitType type) {
// Send non-op event so that Dispatch method will always be called.
// crbug.com/104684.
if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED)
- aura::Desktop::GetInstance()->PostNativeEvent(ui::CreateNoopEvent());
+ aura::RootWindow::GetInstance()->PostNativeEvent(ui::CreateNoopEvent());
#endif
}
diff --git a/ui/views/test/views_test_base.cc b/ui/views/test/views_test_base.cc
index b427004..e57b2d6 100644
--- a/ui/views/test/views_test_base.cc
+++ b/ui/views/test/views_test_base.cc
@@ -9,7 +9,7 @@
#endif
#if defined(USE_AURA)
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/test/test_stacking_client.h"
#endif
@@ -55,7 +55,7 @@ void ViewsTestBase::TearDown() {
void ViewsTestBase::RunPendingMessages() {
#if defined(USE_AURA)
message_loop_.RunAllPendingWithDispatcher(
- aura::Desktop::GetInstance()->GetDispatcher());
+ aura::RootWindow::GetInstance()->GetDispatcher());
#else
message_loop_.RunAllPending();
#endif
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc
index 224b5c9c..4aa93b0 100644
--- a/ui/views/view_unittest.cc
+++ b/ui/views/view_unittest.cc
@@ -42,7 +42,7 @@
#include "ui/views/test/test_views_delegate.h"
#endif
#if defined(USE_AURA)
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#endif
using ::testing::_;
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index aca71bd..b13182d 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -9,9 +9,9 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/shadow_types.h"
-#include "ui/aura/desktop.h"
-#include "ui/aura/desktop_observer.h"
#include "ui/aura/event.h"
+#include "ui/aura/root_window.h"
+#include "ui/aura/root_window_observer.h"
#include "ui/aura/window.h"
#include "ui/aura/window_types.h"
#include "ui/base/dragdrop/os_exchange_data.h"
@@ -64,18 +64,19 @@ aura::WindowType GetAuraWindowTypeForWidgetType(Widget::InitParams::Type type) {
// Used when SetInactiveRenderingDisabled() is invoked to track when active
// status changes in such a way that we should enable inactive rendering.
-class NativeWidgetAura::DesktopObserverImpl : public aura::DesktopObserver {
+class NativeWidgetAura::RootWindowObserverImpl
+ : public aura::RootWindowObserver {
public:
- explicit DesktopObserverImpl(NativeWidgetAura* host)
+ explicit RootWindowObserverImpl(NativeWidgetAura* host)
: host_(host) {
- aura::Desktop::GetInstance()->AddObserver(this);
+ aura::RootWindow::GetInstance()->AddObserver(this);
}
- virtual ~DesktopObserverImpl() {
- aura::Desktop::GetInstance()->RemoveObserver(this);
+ virtual ~RootWindowObserverImpl() {
+ aura::RootWindow::GetInstance()->RemoveObserver(this);
}
- // DesktopObserver overrides:
+ // RootWindowObserver overrides:
virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE {
if (!active || (active != host_->window_ &&
active->transient_parent() != host_->window_)) {
@@ -86,7 +87,7 @@ class NativeWidgetAura::DesktopObserverImpl : public aura::DesktopObserver {
private:
NativeWidgetAura* host_;
- DISALLOW_COPY_AND_ASSIGN(DesktopObserverImpl);
+ DISALLOW_COPY_AND_ASSIGN(RootWindowObserverImpl);
};
////////////////////////////////////////////////////////////////////////////////
@@ -429,7 +430,7 @@ void NativeWidgetAura::Deactivate() {
}
bool NativeWidgetAura::IsActive() const {
- return aura::Desktop::GetInstance()->active_window() == window_;
+ return aura::RootWindow::GetInstance()->active_window() == window_;
}
void NativeWidgetAura::SetAlwaysOnTop(bool on_top) {
@@ -488,8 +489,8 @@ void NativeWidgetAura::RunShellDrag(View* view,
const ui::OSExchangeData& data,
int operation) {
aura::DragDropClient* client = static_cast<aura::DragDropClient*>(
- aura::Desktop::GetInstance()->GetProperty(
- aura::kDesktopDragDropClientKey));
+ aura::RootWindow::GetInstance()->GetProperty(
+ aura::kRootWindowDragDropClientKey));
if (client)
client->StartDragAndDrop(data, operation);
}
@@ -501,7 +502,7 @@ void NativeWidgetAura::SchedulePaintInRect(const gfx::Rect& rect) {
void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) {
cursor_ = cursor;
- aura::Desktop::GetInstance()->SetCursor(cursor);
+ aura::RootWindow::GetInstance()->SetCursor(cursor);
}
void NativeWidgetAura::ClearNativeFocus() {
@@ -519,9 +520,9 @@ gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const {
void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) {
if (!value)
- desktop_observer_.reset();
+ root_window_observer_.reset();
else
- desktop_observer_.reset(new DesktopObserverImpl(this));
+ root_window_observer_.reset(new RootWindowObserverImpl(this));
}
////////////////////////////////////////////////////////////////////////////////
@@ -792,7 +793,7 @@ void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view,
// static
bool NativeWidgetPrivate::IsMouseButtonDown() {
- return aura::Desktop::GetInstance()->IsMouseButtonDown();
+ return aura::RootWindow::GetInstance()->IsMouseButtonDown();
}
} // namespace internal
diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h
index 4a0f11a..aedfeb6 100644
--- a/ui/views/widget/native_widget_aura.h
+++ b/ui/views/widget/native_widget_aura.h
@@ -151,7 +151,7 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate,
internal::NativeWidgetDelegate* delegate() { return delegate_; }
private:
- class DesktopObserverImpl;
+ class RootWindowObserverImpl;
internal::NativeWidgetDelegate* delegate_;
@@ -171,7 +171,7 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate,
scoped_ptr<TooltipManagerAura> tooltip_manager_;
- scoped_ptr<DesktopObserverImpl> desktop_observer_;
+ scoped_ptr<RootWindowObserverImpl> root_window_observer_;
scoped_ptr<DropHelper> drop_helper_;
diff --git a/ui/views/widget/tooltip_manager_aura.cc b/ui/views/widget/tooltip_manager_aura.cc
index 0847ed3..cfc4c61 100644
--- a/ui/views/widget/tooltip_manager_aura.cc
+++ b/ui/views/widget/tooltip_manager_aura.cc
@@ -5,7 +5,7 @@
#include "base/logging.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/tooltip_client.h"
-#include "ui/aura/desktop.h"
+#include "ui/aura/root_window.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/font.h"
#include "ui/gfx/rect.h"
@@ -50,11 +50,12 @@ TooltipManagerAura::~TooltipManagerAura() {
// TooltipManagerAura, TooltipManager implementation:
void TooltipManagerAura::UpdateTooltip() {
- void* property = aura::Desktop::GetInstance()->GetProperty(
- aura::kDesktopTooltipClientKey);
+ void* property = aura::RootWindow::GetInstance()->GetProperty(
+ aura::kRootWindowTooltipClientKey);
if (property) {
- gfx::Point view_point = aura::Desktop::GetInstance()->last_mouse_location();
- aura::Window::ConvertPointToWindow(aura::Desktop::GetInstance(),
+ gfx::Point view_point =
+ aura::RootWindow::GetInstance()->last_mouse_location();
+ aura::Window::ConvertPointToWindow(aura::RootWindow::GetInstance(),
native_widget_aura_->GetNativeView(), &view_point);
View* view = GetViewUnderPoint(view_point);
if (view) {
@@ -70,11 +71,12 @@ void TooltipManagerAura::UpdateTooltip() {
}
void TooltipManagerAura::TooltipTextChanged(View* view) {
- void* property = aura::Desktop::GetInstance()->GetProperty(
- aura::kDesktopTooltipClientKey);
+ void* property = aura::RootWindow::GetInstance()->GetProperty(
+ aura::kRootWindowTooltipClientKey);
if (property) {
- gfx::Point view_point = aura::Desktop::GetInstance()->last_mouse_location();
- aura::Window::ConvertPointToWindow(aura::Desktop::GetInstance(),
+ gfx::Point view_point =
+ aura::RootWindow::GetInstance()->last_mouse_location();
+ aura::Window::ConvertPointToWindow(aura::RootWindow::GetInstance(),
native_widget_aura_->GetNativeView(), &view_point);
View* target = GetViewUnderPoint(view_point);
if (target != view)