summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 08:45:04 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 08:45:04 +0000
commitb9329a6c9643cb4d4484d43e10664e418f79d721 (patch)
tree754f064d63e64c75204cc36925a9b8208500234a /ui
parent47092fc95c7980639f5ad5bab0e42f829ea97057 (diff)
downloadchromium_src-b9329a6c9643cb4d4484d43e10664e418f79d721.zip
chromium_src-b9329a6c9643cb4d4484d43e10664e418f79d721.tar.gz
chromium_src-b9329a6c9643cb4d4484d43e10664e418f79d721.tar.bz2
relanding: disabled workspace_window_resizer test. fixed access-after-free.
* MonitorChangeObserverX11 that listen to Xrandr events and update monitor configurations. * Message on secondary monitor view * Accelerator to create/delete/cycle monitors to test multi monitor on linux desktop * unittest for MultiMonitorManager/MonitorController BUG=115510 TEST=multi_monitor_manager_unittests Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=128330 Review URL: https://chromiumcodereview.appspot.com/9754001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128436 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/aura.gyp9
-rw-r--r--ui/aura/dispatcher_linux.cc7
-rw-r--r--ui/aura/env.cc10
-rw-r--r--ui/aura/env.h11
-rw-r--r--ui/aura/monitor_change_observer_x11.cc117
-rw-r--r--ui/aura/monitor_change_observer_x11.h44
-rw-r--r--ui/aura/monitor_manager.cc10
-rw-r--r--ui/aura/monitor_manager.h15
-rw-r--r--ui/aura/root_window.cc4
-rw-r--r--ui/aura/root_window.h3
-rw-r--r--ui/aura/root_window_host.h3
-rw-r--r--ui/aura/root_window_host_linux.cc38
-rw-r--r--ui/aura/root_window_host_linux.h4
-rw-r--r--ui/aura/root_window_host_win.cc8
-rw-r--r--ui/aura/root_window_host_win.h1
-rw-r--r--ui/aura/single_monitor_manager.cc13
-rw-r--r--ui/aura/single_monitor_manager.h3
17 files changed, 272 insertions, 28 deletions
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp
index e46a883..89aea94 100644
--- a/ui/aura/aura.gyp
+++ b/ui/aura/aura.gyp
@@ -75,6 +75,8 @@
'layout_manager.h',
'monitor.cc',
'monitor.h',
+ 'monitor_change_observer_x11.cc',
+ 'monitor_change_observer_x11.h',
'monitor_manager.cc',
'monitor_manager.h',
'single_monitor_manager.h',
@@ -106,6 +108,13 @@
['exclude', 'client/dispatcher_client.h'],
],
}],
+ ['OS=="linux"', {
+ 'link_settings': {
+ 'libraries': [
+ '-lXrandr',
+ ],
+ },
+ }],
],
},
{
diff --git a/ui/aura/dispatcher_linux.cc b/ui/aura/dispatcher_linux.cc
index 9603d11..8fbf7f4 100644
--- a/ui/aura/dispatcher_linux.cc
+++ b/ui/aura/dispatcher_linux.cc
@@ -23,12 +23,15 @@ void DispatcherLinux::RootWindowHostCreated(::Window window,
::Window root,
RootWindowHostLinux* host) {
hosts_.insert(std::make_pair(window, host));
- hosts_.insert(std::make_pair(root, host));
+ // Only the 1st root window listens to the root window.
+ if (hosts_.find(root) == hosts_.end())
+ hosts_.insert(std::make_pair(root, host));
}
void DispatcherLinux::RootWindowHostDestroying(::Window window, ::Window root) {
+ if (hosts_[window] == hosts_[root])
+ hosts_.erase(root);
hosts_.erase(window);
- hosts_.erase(root);
}
base::MessagePumpDispatcher::DispatchStatus DispatcherLinux::Dispatch(
diff --git a/ui/aura/env.cc b/ui/aura/env.cc
index 0e9222c..32ead2b 100644
--- a/ui/aura/env.cc
+++ b/ui/aura/env.cc
@@ -9,6 +9,10 @@
#include "ui/aura/window.h"
#include "ui/gfx/compositor/compositor.h"
+#if defined(USE_X11)
+#include "ui/aura/monitor_change_observer_x11.h"
+#endif
+
namespace aura {
// static
@@ -20,9 +24,11 @@ Env* Env::instance_ = NULL;
Env::Env()
: mouse_button_flags_(0),
stacking_client_(NULL),
- monitor_manager_(NULL)
+ monitor_manager_(new internal::SingleMonitorManager)
+#if defined(USE_X11)
+ , monitor_change_observer_(new MonitorChangeObserverX11())
+#endif
{
- SetMonitorManager(new internal::SingleMonitorManager());
#if !defined(OS_MACOSX)
dispatcher_.reset(CreateDispatcher());
#endif
diff --git a/ui/aura/env.h b/ui/aura/env.h
index 5f6ff6a..4089bff 100644
--- a/ui/aura/env.h
+++ b/ui/aura/env.h
@@ -15,6 +15,7 @@
namespace aura {
class EnvObserver;
+class MonitorChangeObserverX11;
class MonitorManager;
class Window;
@@ -51,6 +52,12 @@ class AURA_EXPORT Env {
stacking_client_ = stacking_client;
}
+#if defined(USE_X11)
+ MonitorChangeObserverX11* monitor_change_observer() {
+ return monitor_change_observer_.get();
+ }
+#endif
+
// Gets/sets MonitorManager. The MonitorManager's ownership is
// transfered.
MonitorManager* monitor_manager() { return monitor_manager_.get(); }
@@ -80,6 +87,10 @@ class AURA_EXPORT Env {
client::StackingClient* stacking_client_;
scoped_ptr<MonitorManager> monitor_manager_;
+#if defined(USE_X11)
+ scoped_ptr<MonitorChangeObserverX11> monitor_change_observer_;
+#endif
+
DISALLOW_COPY_AND_ASSIGN(Env);
};
diff --git a/ui/aura/monitor_change_observer_x11.cc b/ui/aura/monitor_change_observer_x11.cc
new file mode 100644
index 0000000..3dc0716
--- /dev/null
+++ b/ui/aura/monitor_change_observer_x11.cc
@@ -0,0 +1,117 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/aura/monitor_change_observer_x11.h"
+
+#include <algorithm>
+#include <map>
+#include <set>
+#include <vector>
+
+#include <X11/extensions/Xrandr.h>
+
+#include "base/message_pump_x.h"
+#include "base/stl_util.h"
+#include "ui/aura/env.h"
+#include "ui/aura/monitor.h"
+#include "ui/aura/monitor_manager.h"
+
+namespace aura {
+namespace {
+XRRModeInfo* FindMode(XRRScreenResources* screen_resources, XID current_mode) {
+ for (int m = 0; m < screen_resources->nmode; m++) {
+ XRRModeInfo *mode = &screen_resources->modes[m];
+ if (mode->id == current_mode)
+ return mode;
+ }
+ return NULL;
+}
+
+bool CompareMonitorY(const Monitor* lhs, const Monitor* rhs) {
+ return lhs->bounds().y() < rhs->bounds().y();
+}
+
+} // namespace internal
+
+MonitorChangeObserverX11::MonitorChangeObserverX11()
+ : xdisplay_(base::MessagePumpX::GetDefaultXDisplay()),
+ x_root_window_(DefaultRootWindow(xdisplay_)),
+ xrandr_event_base_(0) {
+ XRRSelectInput(xdisplay_, x_root_window_, RRScreenChangeNotifyMask);
+ int error_base_ignored;
+ XRRQueryExtension(xdisplay_, &xrandr_event_base_, &error_base_ignored);
+ NotifyMonitorChange();
+}
+
+MonitorChangeObserverX11::~MonitorChangeObserverX11() {
+}
+
+bool MonitorChangeObserverX11::Dispatch(const XEvent* event) {
+ if (event->type - xrandr_event_base_ == RRScreenChangeNotify) {
+ NotifyMonitorChange();
+ return true;
+ }
+ return false;
+}
+
+void MonitorChangeObserverX11::NotifyMonitorChange() {
+ if (!MonitorManager::use_fullscreen_host_window())
+ return; // Use the default monitor that monitor manager determined.
+
+ XRRScreenResources* screen_resources =
+ XRRGetScreenResources(xdisplay_, x_root_window_);
+ std::map<XID, XRRCrtcInfo*> crtc_info_map;
+
+ for (int c = 0; c < screen_resources->ncrtc; c++) {
+ XID crtc_id = screen_resources->crtcs[c];
+ XRRCrtcInfo *crtc_info =
+ XRRGetCrtcInfo(xdisplay_, screen_resources, crtc_id);
+ crtc_info_map[crtc_id] = crtc_info;
+ }
+
+ std::vector<const Monitor*> monitors;
+ std::set<int> y_coords;
+ for (int o = 0; o < screen_resources->noutput; o++) {
+ XRROutputInfo *output_info =
+ XRRGetOutputInfo(xdisplay_,
+ screen_resources,
+ screen_resources->outputs[o]);
+ if (output_info->connection != RR_Connected) {
+ XRRFreeOutputInfo(output_info);
+ continue;
+ }
+ XRRCrtcInfo* crtc_info = crtc_info_map[output_info->crtc];
+ if (!crtc_info) {
+ LOG(WARNING) << "Crtc not found for output";
+ continue;
+ }
+ XRRModeInfo* mode = FindMode(screen_resources, crtc_info->mode);
+ CHECK(mode);
+ // Mirrored monitors have the same y coordinates.
+ if (y_coords.find(crtc_info->y) != y_coords.end())
+ continue;
+ Monitor* monitor = new Monitor;
+ monitor->set_bounds(gfx::Rect(crtc_info->x, crtc_info->y,
+ mode->width, mode->height));
+ monitors.push_back(monitor);
+ y_coords.insert(crtc_info->y);
+ XRRFreeOutputInfo(output_info);
+ }
+
+ // Free all allocated resources.
+ for (std::map<XID, XRRCrtcInfo*>::const_iterator iter = crtc_info_map.begin();
+ iter != crtc_info_map.end(); ++iter) {
+ XRRFreeCrtcInfo(iter->second);
+ }
+ XRRFreeScreenResources(screen_resources);
+
+ // PowerManager lays out the outputs vertically. Sort them by Y
+ // coordinates.
+ std::sort(monitors.begin(), monitors.end(), CompareMonitorY);
+ aura::Env::GetInstance()->monitor_manager()
+ ->OnNativeMonitorsChanged(monitors);
+ STLDeleteContainerPointers(monitors.begin(), monitors.end());
+}
+
+} // namespace aura
diff --git a/ui/aura/monitor_change_observer_x11.h b/ui/aura/monitor_change_observer_x11.h
new file mode 100644
index 0000000..1c4a323
--- /dev/null
+++ b/ui/aura/monitor_change_observer_x11.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_AURA_MONITOR_CHANGE_OBSERVER_H
+#define UI_AURA_MONITOR_CHANGE_OBSERVER_H
+#pragma once
+
+#include <X11/Xlib.h>
+
+// Xlib.h defines RootWindow.
+#undef RootWindow
+
+#include "base/basictypes.h"
+#include "ui/aura/aura_export.h"
+
+namespace aura {
+
+// An object that observes changes in monitor configuration and
+// update MonitorManagers.
+class AURA_EXPORT MonitorChangeObserverX11 {
+ public:
+ MonitorChangeObserverX11();
+ ~MonitorChangeObserverX11();
+
+ bool Dispatch(const XEvent* event);
+
+ // Reads monitor configurations from the system and notifies
+ // |monitor_manager_| about the change.
+ void NotifyMonitorChange();
+
+ private:
+ Display* xdisplay_;
+
+ ::Window x_root_window_;
+
+ int xrandr_event_base_;
+
+ DISALLOW_COPY_AND_ASSIGN(MonitorChangeObserverX11);
+};
+
+} // namespace aura
+
+#endif // UI_AURA_MONITOR_CHANGE_OBSERVER_H
diff --git a/ui/aura/monitor_manager.cc b/ui/aura/monitor_manager.cc
index bde77bd..c5f8d6a 100644
--- a/ui/aura/monitor_manager.cc
+++ b/ui/aura/monitor_manager.cc
@@ -66,4 +66,14 @@ void MonitorManager::NotifyBoundsChanged(const Monitor* monitor) {
OnMonitorBoundsChanged(monitor));
}
+void MonitorManager::NotifyMonitorAdded(Monitor* monitor) {
+ FOR_EACH_OBSERVER(MonitorObserver, observers_,
+ OnMonitorAdded(monitor));
+}
+
+void MonitorManager::NotifyMonitorRemoved(const Monitor* monitor) {
+ FOR_EACH_OBSERVER(MonitorObserver, observers_,
+ OnMonitorRemoved(monitor));
+}
+
} // namespace aura
diff --git a/ui/aura/monitor_manager.h b/ui/aura/monitor_manager.h
index 77ad274..9bbd028 100644
--- a/ui/aura/monitor_manager.h
+++ b/ui/aura/monitor_manager.h
@@ -7,6 +7,7 @@
#pragma once
#include <string>
+#include <vector>
#include "base/basictypes.h"
#include "base/observer_list.h"
@@ -27,6 +28,8 @@ class Window;
class MonitorObserver {
public:
virtual void OnMonitorBoundsChanged(const Monitor* monitor) = 0;
+ virtual void OnMonitorAdded(Monitor* new_monitor) = 0;
+ virtual void OnMonitorRemoved(const Monitor* old_monitor) = 0;
};
// MonitorManager creates, deletes and updates Monitor objects when
@@ -59,9 +62,11 @@ class AURA_EXPORT MonitorManager {
void AddObserver(MonitorObserver* observer);
void RemoveObserver(MonitorObserver* observer);
- // Called when native window's monitor size has changed.
- // TODO(oshima): multiple monitor support.
- virtual void OnNativeMonitorResized(const gfx::Size& size) = 0;
+ // Called when monitor configuration has changed. The new monitor
+ // configurations is passed as a vector of Monitor object, which
+ // contains each monitor's new infomration.
+ virtual void OnNativeMonitorsChanged(
+ const std::vector<const Monitor*>& monitors) = 0;
// Create a root window for given |monitor|.
virtual RootWindow* CreateRootWindowForMonitor(Monitor* monitor) = 0;
@@ -75,7 +80,7 @@ class AURA_EXPORT MonitorManager {
virtual const Monitor* GetMonitorNearestPoint(
const gfx::Point& point) const = 0;
- // Returns the monitor at |index|. The monitor at 0 is consiered
+ // Returns the monitor at |index|. The monitor at 0 is considered
// "primary".
virtual Monitor* GetMonitorAt(size_t index) = 0;
@@ -84,6 +89,8 @@ class AURA_EXPORT MonitorManager {
protected:
// Calls observers' OnMonitorBoundsChanged methods.
void NotifyBoundsChanged(const Monitor* monitor);
+ void NotifyMonitorAdded(Monitor* monitor);
+ void NotifyMonitorRemoved(const Monitor* monitor);
private:
// If set before the RootWindow is created, the host window will cover the
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 1ba6b1d..34e2a6e 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -394,6 +394,10 @@ void RootWindow::ReleaseMouseMoves() {
}
}
+void RootWindow::SetFocusWhenShown(bool focused) {
+ host_->SetFocusWhenShown(focused);
+}
+
////////////////////////////////////////////////////////////////////////////////
// RootWindow, Window overrides:
diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h
index 948ef2f..246133c 100644
--- a/ui/aura/root_window.h
+++ b/ui/aura/root_window.h
@@ -189,6 +189,9 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate,
void HoldMouseMoves();
void ReleaseMouseMoves();
+ // Sets if the window should be focused when shown.
+ void SetFocusWhenShown(bool focus_when_shown);
+
// Overridden from Window:
virtual RootWindow* GetRootWindow() OVERRIDE;
virtual const RootWindow* GetRootWindow() const OVERRIDE;
diff --git a/ui/aura/root_window_host.h b/ui/aura/root_window_host.h
index 2eb29b9..4ab1830 100644
--- a/ui/aura/root_window_host.h
+++ b/ui/aura/root_window_host.h
@@ -79,6 +79,9 @@ class RootWindowHost {
// Moves the cursor to the specified location relative to the root window.
virtual void MoveCursorTo(const gfx::Point& location) = 0;
+ // Sets if the window should be focused when shown.
+ virtual void SetFocusWhenShown(bool focus_when_shown) = 0;
+
// Posts |native_event| to the platform's event queue.
#if !defined(OS_MACOSX)
virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0;
diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc
index 8fa1cec..aa528b9 100644
--- a/ui/aura/root_window_host_linux.cc
+++ b/ui/aura/root_window_host_linux.cc
@@ -6,13 +6,17 @@
#include <X11/cursorfont.h>
#include <X11/extensions/XInput2.h>
+#include <X11/extensions/Xrandr.h>
#include <algorithm>
#include "base/message_pump_x.h"
+#include "base/stl_util.h"
#include "ui/aura/cursor.h"
#include "ui/aura/dispatcher_linux.h"
#include "ui/aura/env.h"
#include "ui/aura/event.h"
+#include "ui/aura/monitor.h"
+#include "ui/aura/monitor_change_observer_x11.h"
#include "ui/aura/monitor_manager.h"
#include "ui/aura/root_window.h"
#include "ui/base/keycodes/keyboard_codes.h"
@@ -276,7 +280,8 @@ RootWindowHostLinux::RootWindowHostLinux(const gfx::Rect& bounds)
x_root_window_(DefaultRootWindow(xdisplay_)),
current_cursor_(aura::kCursorNull),
cursor_shown_(true),
- bounds_(bounds) {
+ bounds_(bounds),
+ focus_when_shown_(false) {
XSetWindowAttributes swa;
memset(&swa, 0, sizeof(swa));
swa.background_pixmap = None;
@@ -299,7 +304,6 @@ RootWindowHostLinux::RootWindowHostLinux(const gfx::Rect& bounds)
StructureNotifyMask | PropertyChangeMask |
PointerMotionMask;
XSelectInput(xdisplay_, xwindow_, event_mask);
- XSelectInput(xdisplay_, x_root_window_, StructureNotifyMask);
XFlush(xdisplay_);
if (base::MessagePumpForUI::HasXInput2())
@@ -361,13 +365,6 @@ base::MessagePumpDispatcher::DispatchStatus RootWindowHostLinux::Dispatch(
root_window_->SetCapture(NULL);
break;
case ConfigureNotify: {
- if (xev->xconfigure.window == x_root_window_) {
- Env::GetInstance()->monitor_manager()->OnNativeMonitorResized(
- gfx::Size(xev->xconfigure.width, xev->xconfigure.height));
- handled = true;
- break;
- }
-
DCHECK_EQ(xwindow_, xev->xconfigure.window);
DCHECK_EQ(xwindow_, xev->xconfigure.event);
@@ -441,7 +438,7 @@ base::MessagePumpDispatcher::DispatchStatus RootWindowHostLinux::Dispatch(
case MapNotify: {
// If there's no window manager running, we need to assign the X input
// focus to our host window.
- if (!IsWindowManagerPresent())
+ if (!IsWindowManagerPresent() && focus_when_shown_)
XSetInputFocus(xdisplay_, xwindow_, RevertToNone, CurrentTime);
handled = true;
break;
@@ -483,6 +480,12 @@ base::MessagePumpDispatcher::DispatchStatus RootWindowHostLinux::Dispatch(
handled = root_window_->DispatchMouseEvent(&mouseev);
break;
}
+ default: {
+ // TODO(oshima): We probably should change DispatcherLinux so
+ // that it can directly dispatch the event to montor change
+ // observer.
+ Env::GetInstance()->monitor_change_observer()->Dispatch(xev);
+ }
}
return handled ? base::MessagePumpDispatcher::EVENT_PROCESSED :
base::MessagePumpDispatcher::EVENT_IGNORED;
@@ -510,8 +513,10 @@ gfx::Rect RootWindowHostLinux::GetBounds() const {
void RootWindowHostLinux::SetBounds(const gfx::Rect& bounds) {
bool size_changed = bounds_.size() != bounds.size();
- if (bounds == bounds_)
+ if (bounds == bounds_) {
+ root_window_->SchedulePaintInRect(root_window_->bounds());
return;
+ }
if (bounds.size() != bounds_.size())
XResizeWindow(xdisplay_, xwindow_, bounds.width(), bounds.height());
if (bounds.origin() != bounds_.origin())
@@ -593,6 +598,17 @@ void RootWindowHostLinux::MoveCursorTo(const gfx::Point& location) {
location.y());
}
+void RootWindowHostLinux::SetFocusWhenShown(bool focus_when_shown) {
+ static const char* k_NET_WM_USER_TIME = "_NET_WM_USER_TIME";
+ focus_when_shown_ = focus_when_shown;
+ if (IsWindowManagerPresent() && !focus_when_shown_) {
+ ui::SetIntProperty(xwindow_,
+ k_NET_WM_USER_TIME,
+ k_NET_WM_USER_TIME,
+ 0);
+ }
+}
+
void RootWindowHostLinux::PostNativeEvent(
const base::NativeEvent& native_event) {
DCHECK(xwindow_);
diff --git a/ui/aura/root_window_host_linux.h b/ui/aura/root_window_host_linux.h
index a045a52..5b4c96a 100644
--- a/ui/aura/root_window_host_linux.h
+++ b/ui/aura/root_window_host_linux.h
@@ -42,6 +42,7 @@ class RootWindowHostLinux : public RootWindowHost {
virtual bool ConfineCursorToRootWindow() OVERRIDE;
virtual void UnConfineCursor() OVERRIDE;
virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE;
+ virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE;
virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE;
// Returns true if there's an X window manager present... in most cases. Some
@@ -74,6 +75,9 @@ class RootWindowHostLinux : public RootWindowHost {
// The bounds of |xwindow_|.
gfx::Rect bounds_;
+ // True if the window should be focused when the window is shown.
+ bool focus_when_shown_;
+
DISALLOW_COPY_AND_ASSIGN(RootWindowHostLinux);
};
diff --git a/ui/aura/root_window_host_win.cc b/ui/aura/root_window_host_win.cc
index 868173c..2e90ba4 100644
--- a/ui/aura/root_window_host_win.cc
+++ b/ui/aura/root_window_host_win.cc
@@ -186,8 +186,8 @@ void RootWindowHostWin::SetBounds(const gfx::Rect& bounds) {
RECT window_rect;
window_rect.left = bounds.x();
window_rect.top = bounds.y();
- window_rect.right = bounds.width();
- window_rect.bottom = bounds.height();
+ window_rect.right = bounds.right() ;
+ window_rect.bottom = bounds.bottom();
AdjustWindowRectEx(&window_rect,
GetWindowLong(hwnd(), GWL_STYLE),
FALSE,
@@ -262,6 +262,10 @@ void RootWindowHostWin::MoveCursorTo(const gfx::Point& location) {
SetCursorPos(pt.x, pt.y);
}
+void RootWindowHostWin::SetFocusWhenShown(bool focus_when_shown) {
+ NOTIMPLEMENTED();
+}
+
void RootWindowHostWin::PostNativeEvent(const base::NativeEvent& native_event) {
::PostMessage(
hwnd(), native_event.message, native_event.wParam, native_event.lParam);
diff --git a/ui/aura/root_window_host_win.h b/ui/aura/root_window_host_win.h
index e64c40b..56d1fd6 100644
--- a/ui/aura/root_window_host_win.h
+++ b/ui/aura/root_window_host_win.h
@@ -33,6 +33,7 @@ class RootWindowHostWin : public RootWindowHost, public ui::WindowImpl {
virtual bool ConfineCursorToRootWindow() OVERRIDE;
virtual void UnConfineCursor() OVERRIDE;
virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE;
+ virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE;
virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE;
private:
diff --git a/ui/aura/single_monitor_manager.cc b/ui/aura/single_monitor_manager.cc
index 2e1d86d..57e68ac 100644
--- a/ui/aura/single_monitor_manager.cc
+++ b/ui/aura/single_monitor_manager.cc
@@ -27,19 +27,20 @@ static const int kDefaultHostWindowHeight = 1024;
}
SingleMonitorManager::SingleMonitorManager()
- : root_window_(NULL),
- monitor_(new Monitor()) {
+ : root_window_(NULL) {
Init();
}
SingleMonitorManager::~SingleMonitorManager() {
- if (root_window_)
- root_window_->RemoveObserver(this);
+ // All monitors must have been deleted when monitor manager is deleted.
+ CHECK(!root_window_);
}
-void SingleMonitorManager::OnNativeMonitorResized(const gfx::Size& size) {
+void SingleMonitorManager::OnNativeMonitorsChanged(
+ const std::vector<const Monitor*>& monitors) {
+ DCHECK(monitors.size() > 0);
if (use_fullscreen_host_window()) {
- monitor_->set_size(size);
+ monitor_->set_size(monitors[0]->bounds().size());
NotifyBoundsChanged(monitor_.get());
}
}
diff --git a/ui/aura/single_monitor_manager.h b/ui/aura/single_monitor_manager.h
index c13bc18..5afbcd2 100644
--- a/ui/aura/single_monitor_manager.h
+++ b/ui/aura/single_monitor_manager.h
@@ -26,7 +26,8 @@ class SingleMonitorManager : public MonitorManager,
virtual ~SingleMonitorManager();
// MonitorManager overrides:
- virtual void OnNativeMonitorResized(const gfx::Size& size) OVERRIDE;
+ virtual void OnNativeMonitorsChanged(
+ const std::vector<const Monitor*>& monitors) OVERRIDE;
virtual RootWindow* CreateRootWindowForMonitor(
Monitor* monitor) OVERRIDE;
virtual const Monitor* GetMonitorNearestWindow(