'atom/browser/ui/views/submenu_button.h',
'atom/browser/ui/views/win_frame_view.cc',
'atom/browser/ui/views/win_frame_view.h',
+ 'atom/browser/ui/views/window_state_watcher.cc',
+ 'atom/browser/ui/views/window_state_watcher.h',
'atom/browser/ui/win/notify_icon_host.cc',
'atom/browser/ui/win/notify_icon_host.h',
'atom/browser/ui/win/notify_icon.cc',
#include "atom/browser/ui/views/menu_bar.h"
#include "atom/browser/ui/views/menu_layout.h"
+#include "atom/browser/ui/views/window_state_watcher.h"
#include "atom/common/draggable_region.h"
#include "atom/common/options_switches.h"
#include "base/strings/utf_string_conversions.h"
window_->Init(params);
+ // Start monitoring window states.
+ window_state_watcher_.reset(new WindowStateWatcher(this));
+
#if defined(USE_X11)
// Set _GTK_THEME_VARIANT to dark if we have "dark-theme" option set.
bool use_dark_theme = false;
class GlobalMenuBarX11;
class MenuBar;
+class WindowStateWatcher;
class NativeWindowViews : public NativeWindow,
public views::WidgetDelegateView,
scoped_ptr<GlobalMenuBarX11> global_menu_bar_;
#endif
+ // Handles window state events.
+ scoped_ptr<WindowStateWatcher> window_state_watcher_;
+
// Handles unhandled keyboard messages coming back from the renderer process.
scoped_ptr<views::UnhandledKeyboardEventHandler> keyboard_event_handler_;
--- /dev/null
+// Copyright (c) 2014 GitHub, Inc.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#include "atom/browser/ui/views/window_state_watcher.h"
+
+#include "ui/events/platform/platform_event_source.h"
+
+namespace atom {
+
+WindowStateWatcher::WindowStateWatcher(NativeWindowViews* window)
+ : window_(window),
+ widget_(window->GetAcceleratedWidget()) {
+ ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this);
+}
+
+WindowStateWatcher::~WindowStateWatcher() {
+ ui::PlatformEventSource::GetInstance()->RemovePlatformEventObserver(this);
+}
+
+void WindowStateWatcher::WillProcessEvent(const ui::PlatformEvent& event) {
+ LOG(ERROR) << "WillProcessEvent";
+}
+
+void WindowStateWatcher::DidProcessEvent(const ui::PlatformEvent& event) {
+}
+
+} // namespace atom
--- /dev/null
+// Copyright (c) 2014 GitHub, Inc.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#include "ui/events/platform/platform_event_observer.h"
+
+#include "atom/browser/native_window_views.h"
+
+namespace atom {
+
+class WindowStateWatcher : public ui::PlatformEventObserver {
+ public:
+ explicit WindowStateWatcher(NativeWindowViews* window);
+ virtual ~WindowStateWatcher();
+
+ protected:
+ // ui::PlatformEventObserver:
+ void WillProcessEvent(const ui::PlatformEvent& event) override;
+ void DidProcessEvent(const ui::PlatformEvent& event) override;
+
+ private:
+ NativeWindowViews* window_;
+ gfx::AcceleratedWidget widget_;
+
+ DISALLOW_COPY_AND_ASSIGN(WindowStateWatcher);
+};
+
+} // namespace atom