summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-08 22:59:44 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-08 22:59:44 +0000
commite87687feb9cace286a412def5e199033d3fe4fd1 (patch)
tree6a3d5241cf94e12110ba642c819516431c489f25 /ui
parentc750bb202fef68a9521c1ae8e1dec8bd74146be5 (diff)
downloadchromium_src-e87687feb9cace286a412def5e199033d3fe4fd1.zip
chromium_src-e87687feb9cace286a412def5e199033d3fe4fd1.tar.gz
chromium_src-e87687feb9cace286a412def5e199033d3fe4fd1.tar.bz2
Gets component build to work with aura. As part of this I needed to
break screen_aura in two. Otherwise we end up with a circular dependency between ui and aura. BUG=none TEST=none R=ben@chromium.org Review URL: http://codereview.chromium.org/8205018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104662 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/aura.gyp4
-rw-r--r--ui/aura/desktop.cc2
-rw-r--r--ui/aura/desktop_delegate.h4
-rw-r--r--ui/aura/layout_manager.h4
-rw-r--r--ui/aura/screen_aura.cc59
-rw-r--r--ui/aura/screen_aura.h40
-rw-r--r--ui/aura/window_delegate.h3
-rw-r--r--ui/aura_shell/aura_shell.gyp3
-rw-r--r--ui/aura_shell/desktop_layout_manager.h2
-rw-r--r--ui/gfx/DEPS1
-rw-r--r--ui/gfx/screen.h25
-rw-r--r--ui/gfx/screen_aura.cc41
12 files changed, 161 insertions, 27 deletions
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp
index ba45038..977d15ab 100644
--- a/ui/aura/aura.gyp
+++ b/ui/aura/aura.gyp
@@ -40,6 +40,8 @@
'layout_manager.h',
'root_window.cc',
'root_window.h',
+ 'screen_aura.cc',
+ 'screen_aura.h',
'toplevel_window_container.cc',
'toplevel_window_container.h',
'toplevel_window_event_filter.cc',
@@ -47,7 +49,7 @@
'window.cc',
'window.h',
'window_delegate.h',
- 'window_type.h',
+ 'window_types.h',
],
},
{
diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc
index e28fcf6..c2f6d44 100644
--- a/ui/aura/desktop.cc
+++ b/ui/aura/desktop.cc
@@ -10,6 +10,7 @@
#include "ui/aura/desktop_host.h"
#include "ui/aura/focus_manager.h"
#include "ui/aura/root_window.h"
+#include "ui/aura/screen_aura.h"
#include "ui/aura/toplevel_window_container.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
@@ -36,6 +37,7 @@ Desktop::Desktop()
compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(),
host_->GetSize());
}
+ gfx::Screen::SetInstance(new internal::ScreenAura);
host_->SetDesktop(this);
DCHECK(compositor_.get());
window_.reset(new internal::RootWindow);
diff --git a/ui/aura/desktop_delegate.h b/ui/aura/desktop_delegate.h
index b968670..5438533 100644
--- a/ui/aura/desktop_delegate.h
+++ b/ui/aura/desktop_delegate.h
@@ -6,11 +6,13 @@
#define UI_AURA_DESKTOP_DELEGATE_H_
#pragma once
+#include "ui/aura/aura_export.h"
+
namespace aura {
class Window;
-class DesktopDelegate {
+class AURA_EXPORT DesktopDelegate {
public:
virtual ~DesktopDelegate() {}
diff --git a/ui/aura/layout_manager.h b/ui/aura/layout_manager.h
index 0d41468..be4e856 100644
--- a/ui/aura/layout_manager.h
+++ b/ui/aura/layout_manager.h
@@ -6,12 +6,12 @@
#define UI_AURA_LAYOUT_MANAGER_H_
#pragma once
-#include "ui/aura_shell/aura_shell_export.h"
+#include "ui/aura/aura_export.h"
namespace aura {
// An interface implemented by an object that places child windows.
-class AURA_SHELL_EXPORT LayoutManager {
+class AURA_EXPORT LayoutManager {
public:
virtual ~LayoutManager() {}
diff --git a/ui/aura/screen_aura.cc b/ui/aura/screen_aura.cc
new file mode 100644
index 0000000..876f140
--- /dev/null
+++ b/ui/aura/screen_aura.cc
@@ -0,0 +1,59 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/aura/screen_aura.h"
+
+#include "base/logging.h"
+#include "ui/aura/desktop.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace {
+
+gfx::Rect GetMonitorAreaOrWorkAreaNearestPoint(const gfx::Point& point,
+ bool work_area) {
+ // TODO(oshima): Take point/work_area into account. Support multiple monitors.
+ return gfx::Rect(aura::Desktop::GetInstance()->GetSize());
+}
+
+} // namespace
+
+namespace aura {
+namespace internal {
+
+ScreenAura::ScreenAura() {
+}
+
+ScreenAura::~ScreenAura() {
+}
+
+gfx::Rect ScreenAura::GetMonitorWorkAreaNearestWindowImpl(
+ gfx::NativeWindow window) {
+ gfx::Rect bounds = GetMonitorAreaNearestWindow(window);
+ // Emulate that a work area can be smaller than its monitor.
+ bounds.Inset(10, 10, 10, 10);
+ return bounds;
+}
+
+gfx::Rect ScreenAura::GetMonitorAreaNearestWindowImpl(
+ gfx::NativeWindow window) {
+ // TODO(oshima): Take point/work_area into account. Support multiple monitors.
+ return gfx::Rect(aura::Desktop::GetInstance()->GetSize());
+}
+
+gfx::Rect ScreenAura::GetMonitorWorkAreaNearestPointImpl(
+ const gfx::Point& point) {
+ return GetMonitorAreaOrWorkAreaNearestPoint(point, true);
+}
+
+gfx::Rect ScreenAura::GetMonitorAreaNearestPointImpl(const gfx::Point& point) {
+ return GetMonitorAreaOrWorkAreaNearestPoint(point, false);
+}
+
+gfx::NativeWindow ScreenAura::GetWindowAtCursorScreenPointImpl() {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+} // namespace internal
+} // namespace aura
diff --git a/ui/aura/screen_aura.h b/ui/aura/screen_aura.h
new file mode 100644
index 0000000..eaafbf0
--- /dev/null
+++ b/ui/aura/screen_aura.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_AURA_SCREEN_AURA_H_
+#define UI_AURA_SCREEN_AURA_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#include "ui/gfx/screen.h"
+
+namespace aura {
+namespace internal {
+
+// Aura implementation of gfx::Screen. Implemented here to avoid circular
+// dependencies.
+class ScreenAura : public gfx::Screen {
+ public:
+ ScreenAura();
+ virtual ~ScreenAura();
+
+ protected:
+ virtual gfx::Rect GetMonitorWorkAreaNearestWindowImpl(
+ gfx::NativeView view) OVERRIDE;
+ virtual gfx::Rect GetMonitorAreaNearestWindowImpl(
+ gfx::NativeView view) OVERRIDE;
+ virtual gfx::Rect GetMonitorWorkAreaNearestPointImpl(
+ const gfx::Point& point) OVERRIDE;
+ virtual gfx::Rect GetMonitorAreaNearestPointImpl(
+ const gfx::Point& point) OVERRIDE;
+ virtual gfx::NativeWindow GetWindowAtCursorScreenPointImpl() OVERRIDE;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ScreenAura);
+};
+
+} // namespace internal
+} // namespace aura
+
+#endif // UI_AURA_SCREEN_AURA_H_
diff --git a/ui/aura/window_delegate.h b/ui/aura/window_delegate.h
index 03d562b..3e81515 100644
--- a/ui/aura/window_delegate.h
+++ b/ui/aura/window_delegate.h
@@ -6,6 +6,7 @@
#define UI_AURA_WINDOW_DELEGATE_H_
#pragma once
+#include "ui/aura/aura_export.h"
#include "ui/gfx/native_widget_types.h"
namespace gfx {
@@ -20,7 +21,7 @@ class KeyEvent;
class MouseEvent;
// Delegate interface for aura::Window.
-class WindowDelegate {
+class AURA_EXPORT WindowDelegate {
public:
// Called when the Window's position and/or size changes.
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
diff --git a/ui/aura_shell/aura_shell.gyp b/ui/aura_shell/aura_shell.gyp
index cbae29f..6ad6874 100644
--- a/ui/aura_shell/aura_shell.gyp
+++ b/ui/aura_shell/aura_shell.gyp
@@ -28,6 +28,9 @@
'../ui.gyp:ui_resources',
'../ui.gyp:ui_resources_standard',
],
+ 'defines': [
+ 'AURA_SHELL_IMPLEMENTATION',
+ ],
'sources': [
# All .cc, .h under views, except unittests
'desktop_background_view.cc',
diff --git a/ui/aura_shell/desktop_layout_manager.h b/ui/aura_shell/desktop_layout_manager.h
index 9afc89a..28e1f02 100644
--- a/ui/aura_shell/desktop_layout_manager.h
+++ b/ui/aura_shell/desktop_layout_manager.h
@@ -22,7 +22,7 @@ namespace internal {
// A layout manager for the root window.
// Resizes all of its immediate children to fill the bounds of the root window.
-class AURA_SHELL_EXPORT DesktopLayoutManager : public aura::LayoutManager {
+class DesktopLayoutManager : public aura::LayoutManager {
public:
explicit DesktopLayoutManager(aura::Window* owner);
virtual ~DesktopLayoutManager();
diff --git a/ui/gfx/DEPS b/ui/gfx/DEPS
index fd66273..548fe15 100644
--- a/ui/gfx/DEPS
+++ b/ui/gfx/DEPS
@@ -1,5 +1,4 @@
include_rules = [
- "+aura",
"+base",
"+grit/gfx_resources.h",
"+skia",
diff --git a/ui/gfx/screen.h b/ui/gfx/screen.h
index efecc87..7779fe5 100644
--- a/ui/gfx/screen.h
+++ b/ui/gfx/screen.h
@@ -17,6 +17,15 @@ namespace gfx {
// TODO(erikkay) add more of those methods here
class UI_EXPORT Screen {
public:
+ virtual ~Screen() {}
+
+#if defined(USE_AURA)
+ // Sets the instance to use. This takes owernship of |screen|, deleting the
+ // old instance. This is used on aura to avoid circular dependencies between
+ // ui and aura.
+ static void SetInstance(Screen* screen);
+#endif
+
static gfx::Point GetCursorScreenPoint();
// Returns the work area of the monitor nearest the specified window.
@@ -34,6 +43,22 @@ class UI_EXPORT Screen {
// Returns the window under the cursor.
static gfx::NativeWindow GetWindowAtCursorScreenPoint();
+
+ protected:
+ virtual gfx::Rect GetMonitorWorkAreaNearestWindowImpl(
+ gfx::NativeView view) = 0;
+ virtual gfx::Rect GetMonitorAreaNearestWindowImpl(
+ gfx::NativeView view) = 0;
+ virtual gfx::Rect GetMonitorWorkAreaNearestPointImpl(
+ const gfx::Point& point) = 0;
+ virtual gfx::Rect GetMonitorAreaNearestPointImpl(const gfx::Point& point) = 0;
+ virtual gfx::NativeWindow GetWindowAtCursorScreenPointImpl() = 0;
+
+private:
+#if defined(USE_AURA)
+ // The singleton screen instance. Only used on aura.
+ static Screen* instance_;
+#endif
};
} // namespace gfx
diff --git a/ui/gfx/screen_aura.cc b/ui/gfx/screen_aura.cc
index b343f36..db21a92 100644
--- a/ui/gfx/screen_aura.cc
+++ b/ui/gfx/screen_aura.cc
@@ -9,21 +9,22 @@
#endif
#include "base/logging.h"
-#include "ui/aura/desktop.h"
-#include "ui/aura/window.h"
#include "ui/gfx/native_widget_types.h"
-namespace {
+namespace gfx {
-gfx::Rect GetMonitorAreaOrWorkAreaNearestPoint(const gfx::Point& point,
- bool work_area) {
- // TODO(oshima): Take point/work_area into account. Support multiple monitors.
- return gfx::Rect(aura::Desktop::GetInstance()->GetSize());
-}
+// gfx can't depend upon aura, otherwise we have circular dependencies. So,
+// gfx::Screen is pluggable for aura and Desktop plugs in the real
+// implementation.
-} // namespace
+// static
+Screen* Screen::instance_ = NULL;
-namespace gfx {
+// static
+void Screen::SetInstance(Screen* screen) {
+ delete instance_;
+ instance_ = screen;
+}
// static
gfx::Point Screen::GetCursorScreenPoint() {
@@ -38,31 +39,31 @@ gfx::Point Screen::GetCursorScreenPoint() {
// static
gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(gfx::NativeWindow window) {
- gfx::Rect bounds = GetMonitorAreaNearestWindow(window);
- // Emulate that a work area can be smaller than its monitor.
- bounds.Inset(10, 10, 10, 10);
- return bounds;
+ DCHECK(instance_);
+ return instance_->GetMonitorWorkAreaNearestWindowImpl(window);
}
// static
gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeWindow window) {
- // TODO(oshima): Take point/work_area into account. Support multiple monitors.
- return gfx::Rect(aura::Desktop::GetInstance()->GetSize());
+ DCHECK(instance_);
+ return instance_->GetMonitorAreaNearestWindowImpl(window);
}
// static
gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) {
- return GetMonitorAreaOrWorkAreaNearestPoint(point, true);
+ DCHECK(instance_);
+ return instance_->GetMonitorWorkAreaNearestPointImpl(point);
}
// static
gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) {
- return GetMonitorAreaOrWorkAreaNearestPoint(point, false);
+ DCHECK(instance_);
+ return instance_->GetMonitorAreaNearestPointImpl(point);
}
gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
- NOTIMPLEMENTED();
- return NULL;
+ DCHECK(instance_);
+ return instance_->GetWindowAtCursorScreenPointImpl();
}
} // namespace gfx