summaryrefslogtreecommitdiffstats
path: root/ui/aura
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-09 22:48:57 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-09 22:48:57 +0000
commit9823481646ee68ca96b77099ba3ebc12ade27f58 (patch)
tree909b6ea3b680656d27b19d049d9a816911100106 /ui/aura
parent82987d6363d1a724b12575a9167752ad3baa3e27 (diff)
downloadchromium_src-9823481646ee68ca96b77099ba3ebc12ade27f58.zip
chromium_src-9823481646ee68ca96b77099ba3ebc12ade27f58.tar.gz
chromium_src-9823481646ee68ca96b77099ba3ebc12ade27f58.tar.bz2
Create a new aura client API dir and move constants and desktop delegate to it.
Rename DesktopDelegate to StackingClient. BUG=none TEST=none Review URL: http://codereview.chromium.org/8508020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109323 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura')
-rw-r--r--ui/aura/aura.gyp10
-rw-r--r--ui/aura/client/aura_constants.cc (renamed from ui/aura/aura_constants.cc)2
-rw-r--r--ui/aura/client/aura_constants.h (renamed from ui/aura/aura_constants.h)6
-rw-r--r--ui/aura/client/stacking_client.h (renamed from ui/aura/desktop_delegate.h)11
-rw-r--r--ui/aura/desktop.cc22
-rw-r--r--ui/aura/desktop.h8
-rw-r--r--ui/aura/event_filter_unittest.cc1
-rw-r--r--ui/aura/test/aura_test_base.cc12
-rw-r--r--ui/aura/test/aura_test_base.h4
-rw-r--r--ui/aura/test/test_stacking_client.cc (renamed from ui/aura/test/test_desktop_delegate.cc)12
-rw-r--r--ui/aura/test/test_stacking_client.h (renamed from ui/aura/test/test_desktop_delegate.h)22
-rw-r--r--ui/aura/test/test_window_delegate.h3
-rw-r--r--ui/aura/window.cc6
-rw-r--r--ui/aura/window_unittest.cc2
14 files changed, 60 insertions, 61 deletions
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp
index 3a31af9..144069c 100644
--- a/ui/aura/aura.gyp
+++ b/ui/aura/aura.gyp
@@ -23,10 +23,11 @@
'AURA_IMPLEMENTATION',
],
'sources': [
- 'aura_constants.cc',
- 'aura_constants.h',
'aura_switches.cc',
'aura_switches.h',
+ 'client/aura_constants.cc',
+ 'client/aura_constants.h',
+ 'client/stacking_client.h',
'cursor.h',
'desktop_host.h',
'desktop_host_linux.cc',
@@ -34,7 +35,6 @@
'desktop_host_win.h',
'desktop.cc',
'desktop.h',
- 'desktop_delegate.h',
'event.cc',
'event.h',
'event_filter.cc',
@@ -71,8 +71,8 @@
'test/aura_test_base.h',
'test/event_generator.cc',
'test/event_generator.h',
- 'test/test_desktop_delegate.cc',
- 'test/test_desktop_delegate.h',
+ 'test/test_stacking_client.cc',
+ 'test/test_stacking_client.h',
'test/test_window_delegate.cc',
'test/test_window_delegate.h',
],
diff --git a/ui/aura/aura_constants.cc b/ui/aura/client/aura_constants.cc
index c6e5235..fb6aa65 100644
--- a/ui/aura/aura_constants.cc
+++ b/ui/aura/client/aura_constants.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/aura_constants.h"
+#include "ui/aura/client/aura_constants.h"
namespace aura {
diff --git a/ui/aura/aura_constants.h b/ui/aura/client/aura_constants.h
index 66a6911..1c7def54 100644
--- a/ui/aura/aura_constants.h
+++ b/ui/aura/client/aura_constants.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_AURA_CONSTANTS_H_
-#define UI_AURA_AURA_CONSTANTS_H_
+#ifndef UI_AURA_CLIENT_AURA_CONSTANTS_H_
+#define UI_AURA_CLIENT_AURA_CONSTANTS_H_
#pragma once
#include "ui/aura/aura_export.h"
@@ -25,4 +25,4 @@ AURA_EXPORT extern const char* kTooltipTextKey;
} // namespace aura
-#endif // UI_AURA_AURA_CONSTANTS_H_
+#endif // UI_AURA_CLIENT_AURA_CONSTANTS_H_
diff --git a/ui/aura/desktop_delegate.h b/ui/aura/client/stacking_client.h
index 5438533..c56e319 100644
--- a/ui/aura/desktop_delegate.h
+++ b/ui/aura/client/stacking_client.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_DELEGATE_H_
-#define UI_AURA_DESKTOP_DELEGATE_H_
+#ifndef UI_AURA_CLIENT_STACKING_CLIENT_H_
+#define UI_AURA_CLIENT_STACKING_CLIENT_H_
#pragma once
#include "ui/aura/aura_export.h"
@@ -12,9 +12,10 @@ namespace aura {
class Window;
-class AURA_EXPORT DesktopDelegate {
+// An interface implemented by an object that stacks windows.
+class AURA_EXPORT StackingClient {
public:
- virtual ~DesktopDelegate() {}
+ virtual ~StackingClient() {}
// Called by the Window when its parent is set to NULL. The delegate is given
// an opportunity to inspect the window and add it to a default parent window
@@ -27,4 +28,4 @@ class AURA_EXPORT DesktopDelegate {
} // namespace aura
-#endif // UI_AURA_DESKTOP_DELEGATE_H_
+#endif // UI_AURA_CLIENT_STACKING_CLIENT_H_
diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc
index cdef3e2..36b9e2d 100644
--- a/ui/aura/desktop.cc
+++ b/ui/aura/desktop.cc
@@ -14,7 +14,7 @@
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "ui/aura/aura_switches.h"
-#include "ui/aura/desktop_delegate.h"
+#include "ui/aura/client/stacking_client.h"
#include "ui/aura/desktop_host.h"
#include "ui/aura/desktop_observer.h"
#include "ui/aura/event.h"
@@ -76,10 +76,10 @@ bool IsNonClientLocation(Window* target, const gfx::Point& location) {
return hit_test_code != HTCLIENT && hit_test_code != HTNOWHERE;
}
-class DefaultDesktopDelegate : public DesktopDelegate {
+class DefaultStackingClient : public StackingClient {
public:
- explicit DefaultDesktopDelegate(Desktop* desktop) : desktop_(desktop) {}
- virtual ~DefaultDesktopDelegate() {}
+ explicit DefaultStackingClient(Desktop* desktop) : desktop_(desktop) {}
+ virtual ~DefaultStackingClient() {}
private:
virtual void AddChildToDefaultParent(Window* window) OVERRIDE {
@@ -100,7 +100,7 @@ class DefaultDesktopDelegate : public DesktopDelegate {
Desktop* desktop_;
- DISALLOW_COPY_AND_ASSIGN(DefaultDesktopDelegate);
+ DISALLOW_COPY_AND_ASSIGN(DefaultStackingClient);
};
class DesktopEventFilter : public EventFilter {
@@ -240,7 +240,7 @@ Desktop::Desktop()
: Window(NULL),
host_(aura::DesktopHost::Create(GetInitialHostWindowBounds())),
ALLOW_THIS_IN_INITIALIZER_LIST(
- delegate_(new DefaultDesktopDelegate(this))),
+ stacking_client_(new DefaultStackingClient(this))),
ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)),
active_window_(NULL),
last_cursor_(kCursorNull),
@@ -287,8 +287,8 @@ void Desktop::DeleteInstanceForTesting() {
instance_ = NULL;
}
-void Desktop::SetDelegate(DesktopDelegate* delegate) {
- delegate_.reset(delegate);
+void Desktop::SetStackingClient(StackingClient* stacking_client) {
+ stacking_client_.reset(stacking_client);
}
void Desktop::ShowDesktop() {
@@ -433,7 +433,7 @@ void Desktop::SetActiveWindow(Window* window, Window* to_focus) {
}
void Desktop::ActivateTopmostWindow() {
- SetActiveWindow(delegate_->GetTopmostWindowToActivate(NULL), NULL);
+ SetActiveWindow(stacking_client_->GetTopmostWindowToActivate(NULL), NULL);
}
void Desktop::Deactivate(Window* window) {
@@ -448,7 +448,7 @@ void Desktop::Deactivate(Window* window) {
return; // Top level ancestor is already not active.
Window* to_activate =
- delegate_->GetTopmostWindowToActivate(toplevel_ancestor);
+ stacking_client_->GetTopmostWindowToActivate(toplevel_ancestor);
if (to_activate)
SetActiveWindow(to_activate, NULL);
}
@@ -476,7 +476,7 @@ void Desktop::WindowDestroying(Window* window) {
// Reset active_window_ before invoking SetActiveWindow so that we don't
// attempt to notify it while running its destructor.
active_window_ = NULL;
- SetActiveWindow(delegate_->GetTopmostWindowToActivate(window), NULL);
+ SetActiveWindow(stacking_client_->GetTopmostWindowToActivate(window), NULL);
}
MessageLoop::Dispatcher* Desktop::GetDispatcher() {
diff --git a/ui/aura/desktop.h b/ui/aura/desktop.h
index 579c2d7..003985c 100644
--- a/ui/aura/desktop.h
+++ b/ui/aura/desktop.h
@@ -32,12 +32,12 @@ class Transform;
namespace aura {
-class DesktopDelegate;
class DesktopHost;
class DesktopObserver;
class KeyEvent;
class MouseEvent;
class ScreenAura;
+class StackingClient;
class TouchEvent;
// Desktop is responsible for hosting a set of windows.
@@ -59,13 +59,13 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate,
ui::Compositor* compositor() { return compositor_.get(); }
gfx::Point last_mouse_location() const { return last_mouse_location_; }
gfx::NativeCursor last_cursor() const { return last_cursor_; }
- DesktopDelegate* delegate() { return delegate_.get(); }
+ StackingClient* stacking_client() { return stacking_client_.get(); }
Window* active_window() { return active_window_; }
Window* mouse_pressed_handler() { return mouse_pressed_handler_; }
Window* capture_window() { return capture_window_; }
ScreenAura* screen() { return screen_; }
- void SetDelegate(DesktopDelegate* delegate);
+ void SetStackingClient(StackingClient* stacking_client);
// Shows the desktop host.
void ShowDesktop();
@@ -173,7 +173,7 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate,
scoped_ptr<DesktopHost> host_;
- scoped_ptr<DesktopDelegate> delegate_;
+ scoped_ptr<StackingClient> stacking_client_;
static Desktop* instance_;
diff --git a/ui/aura/event_filter_unittest.cc b/ui/aura/event_filter_unittest.cc
index 7c08c7e..03f01db 100644
--- a/ui/aura/event_filter_unittest.cc
+++ b/ui/aura/event_filter_unittest.cc
@@ -10,7 +10,6 @@
#include "ui/aura/event.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/event_generator.h"
-#include "ui/aura/test/test_desktop_delegate.h"
#include "ui/aura/test/test_window_delegate.h"
#if defined(OS_WIN)
diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc
index b14c0cd..8d7a7bc 100644
--- a/ui/aura/test/aura_test_base.cc
+++ b/ui/aura/test/aura_test_base.cc
@@ -9,7 +9,7 @@
#endif
#include "ui/aura/desktop.h"
-#include "ui/aura/test/test_desktop_delegate.h"
+#include "ui/aura/test/test_stacking_client.h"
namespace aura {
namespace test {
@@ -21,8 +21,8 @@ AuraTestBase::AuraTestBase()
OleInitialize(NULL);
#endif
- // TestDesktopDelegate is owned by the desktop.
- new TestDesktopDelegate();
+ // TestStackingClient is owned by the desktop.
+ new TestStackingClient();
Desktop::GetInstance()->Show();
Desktop::GetInstance()->SetHostSize(gfx::Size(600, 600));
}
@@ -46,9 +46,9 @@ AuraTestBase::~AuraTestBase() {
aura::Desktop::DeleteInstanceForTesting();
}
-TestDesktopDelegate* AuraTestBase::GetTestDesktopDelegate() {
- return static_cast<TestDesktopDelegate*>(
- aura::Desktop::GetInstance()->delegate());
+TestStackingClient* AuraTestBase::GetTestStackingClient() {
+ return static_cast<TestStackingClient*>(
+ aura::Desktop::GetInstance()->stacking_client());
}
void AuraTestBase::SetUp() {
diff --git a/ui/aura/test/aura_test_base.h b/ui/aura/test/aura_test_base.h
index 6c9d3ff..bea5a75 100644
--- a/ui/aura/test/aura_test_base.h
+++ b/ui/aura/test/aura_test_base.h
@@ -14,7 +14,7 @@
namespace aura {
namespace test {
-class TestDesktopDelegate;
+class TestStackingClient;
// A base class for aura unit tests.
class AuraTestBase : public testing::Test {
@@ -22,7 +22,7 @@ class AuraTestBase : public testing::Test {
AuraTestBase();
virtual ~AuraTestBase();
- TestDesktopDelegate* GetTestDesktopDelegate();
+ TestStackingClient* GetTestStackingClient();
// testing::Test:
virtual void SetUp() OVERRIDE;
diff --git a/ui/aura/test/test_desktop_delegate.cc b/ui/aura/test/test_stacking_client.cc
index 251d241..37ce262 100644
--- a/ui/aura/test/test_desktop_delegate.cc
+++ b/ui/aura/test/test_stacking_client.cc
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/aura/test/test_desktop_delegate.h"
+#include "ui/aura/test/test_stacking_client.h"
#include "ui/aura/desktop.h"
namespace aura {
namespace test {
-TestDesktopDelegate::TestDesktopDelegate()
+TestStackingClient::TestStackingClient()
: default_container_(new ToplevelWindowContainer) {
- Desktop::GetInstance()->SetDelegate(this);
+ Desktop::GetInstance()->SetStackingClient(this);
default_container_->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
default_container_->SetBounds(
gfx::Rect(gfx::Point(), Desktop::GetInstance()->GetHostSize()));
@@ -19,14 +19,14 @@ TestDesktopDelegate::TestDesktopDelegate()
default_container_->Show();
}
-TestDesktopDelegate::~TestDesktopDelegate() {
+TestStackingClient::~TestStackingClient() {
}
-void TestDesktopDelegate::AddChildToDefaultParent(Window* window) {
+void TestStackingClient::AddChildToDefaultParent(Window* window) {
default_container_->AddChild(window);
}
-Window* TestDesktopDelegate::GetTopmostWindowToActivate(Window* ignore) const {
+Window* TestStackingClient::GetTopmostWindowToActivate(Window* ignore) const {
return default_container_->GetTopmostWindowToActivate(ignore);
}
diff --git a/ui/aura/test/test_desktop_delegate.h b/ui/aura/test/test_stacking_client.h
index 09bfc31e..bf77ff8 100644
--- a/ui/aura/test/test_desktop_delegate.h
+++ b/ui/aura/test/test_stacking_client.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_AURA_TEST_TEST_DESKTOP_DELEGATE_H_
-#define UI_AURA_TEST_TEST_DESKTOP_DELEGATE_H_
+#ifndef UI_AURA_TEST_TEST_STACKING_CLIENT_H_
+#define UI_AURA_TEST_TEST_STACKING_CLIENT_H_
#pragma once
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/aura/desktop_delegate.h"
+#include "ui/aura/client/stacking_client.h"
#include "ui/aura/toplevel_window_container.h"
namespace aura {
@@ -17,27 +17,27 @@ class ToplevelWindowContainer;
namespace test {
-class TestDesktopDelegate : public DesktopDelegate {
+class TestStackingClient : public StackingClient {
public:
- // Callers should allocate a TestDesktopDelegate on the heap and then forget
- // about it -- the c'tor passes ownership of the TestDesktopDelegate to the
+ // Callers should allocate a TestStackingClient on the heap and then forget
+ // about it -- the c'tor passes ownership of the TestStackingClient to the
// static Desktop object.
- TestDesktopDelegate();
- virtual ~TestDesktopDelegate();
+ TestStackingClient();
+ virtual ~TestStackingClient();
Window* default_container() { return default_container_.get(); }
private:
- // Overridden from DesktopDelegate:
+ // Overridden from StackingClient:
virtual void AddChildToDefaultParent(Window* window) OVERRIDE;
virtual Window* GetTopmostWindowToActivate(Window* ignore) const OVERRIDE;
scoped_ptr<ToplevelWindowContainer> default_container_;
- DISALLOW_COPY_AND_ASSIGN(TestDesktopDelegate);
+ DISALLOW_COPY_AND_ASSIGN(TestStackingClient);
};
} // namespace test
} // namespace aura
-#endif // UI_AURA_TEST_TEST_DESKTOP_DELEGATE_H_
+#endif // UI_AURA_TEST_TEST_STACKING_CLIENT_H_
diff --git a/ui/aura/test/test_window_delegate.h b/ui/aura/test/test_window_delegate.h
index 9fcb170..4150f67 100644
--- a/ui/aura/test/test_window_delegate.h
+++ b/ui/aura/test/test_window_delegate.h
@@ -7,14 +7,13 @@
#pragma once
#include "base/compiler_specific.h"
-#include "ui/aura/aura_export.h"
#include "ui/aura/window_delegate.h"
namespace aura {
namespace test {
// WindowDelegate implementation with all methods stubbed out.
-class AURA_EXPORT TestWindowDelegate : public WindowDelegate {
+class TestWindowDelegate : public WindowDelegate {
public:
TestWindowDelegate();
virtual ~TestWindowDelegate();
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 8a4fc4d..89ea1fe 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -8,8 +8,8 @@
#include "base/logging.h"
#include "base/stl_util.h"
+#include "ui/aura/client/stacking_client.h"
#include "ui/aura/desktop.h"
-#include "ui/aura/desktop_delegate.h"
#include "ui/aura/event.h"
#include "ui/aura/event_filter.h"
#include "ui/aura/layout_manager.h"
@@ -166,8 +166,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()->delegate())
- Desktop::GetInstance()->delegate()->AddChildToDefaultParent(this);
+ else if (Desktop::GetInstance()->stacking_client())
+ Desktop::GetInstance()->stacking_client()->AddChildToDefaultParent(this);
else
NOTREACHED();
}
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index b3da954a..707a881 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -14,8 +14,8 @@
#include "ui/aura/focus_manager.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/event_generator.h"
-#include "ui/aura/test/test_desktop_delegate.h"
#include "ui/aura/test/test_window_delegate.h"
+#include "ui/aura/toplevel_window_container.h"
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_observer.h"
#include "ui/base/hit_test.h"