Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1772)

Unified Diff: views/widget/window_manager.cc

Issue 8562003: Revert "views: Move widget/ directory to ui/views." properly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/widget/window_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/window_manager.cc
diff --git a/views/widget/window_manager.cc b/views/widget/window_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7e5e7cafd7db56929ff624c9e16035315bd5b36b
--- /dev/null
+++ b/views/widget/window_manager.cc
@@ -0,0 +1,100 @@
+// 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 "views/widget/window_manager.h"
+
+#include "base/compiler_specific.h"
+#include "ui/views/events/event.h"
+#include "views/widget/widget.h"
+
+namespace {
+
+views::WindowManager* window_manager = NULL;
+
+class NullWindowManager : public views::WindowManager {
+ public:
+ NullWindowManager() : mouse_capture_(NULL) {
+ }
+
+ virtual void StartMoveDrag(views::Widget* widget,
+ const gfx::Point& screen_point) OVERRIDE {
+ NOTIMPLEMENTED();
+ }
+
+ virtual void StartResizeDrag(views::Widget* widget,
+ const gfx::Point& screen_point,
+ int hittest_code) OVERRIDE {
+ NOTIMPLEMENTED();
+ }
+
+ virtual bool SetMouseCapture(views::Widget* widget) OVERRIDE {
+ if (mouse_capture_ == widget)
+ return true;
+ if (mouse_capture_)
+ return false;
+ mouse_capture_ = widget;
+ return true;
+ }
+
+ virtual bool ReleaseMouseCapture(views::Widget* widget) OVERRIDE {
+ if (widget && mouse_capture_ != widget)
+ return false;
+ mouse_capture_ = NULL;
+ return true;
+ }
+
+ virtual bool HasMouseCapture(const views::Widget* widget) const OVERRIDE {
+ return mouse_capture_ == widget;
+ }
+
+ virtual bool HandleKeyEvent(views::Widget* widget,
+ const views::KeyEvent& event) OVERRIDE {
+ return false;
+ }
+
+ virtual bool HandleMouseEvent(views::Widget* widget,
+ const views::MouseEvent& event) OVERRIDE {
+ if (mouse_capture_) {
+ views::MouseEvent translated(event, widget->GetRootView(),
+ mouse_capture_->GetRootView());
+ mouse_capture_->OnMouseEvent(translated);
+ return true;
+ }
+ return false;
+ }
+
+ virtual ui::TouchStatus HandleTouchEvent(views::Widget* widget,
+ const views::TouchEvent& event) OVERRIDE {
+ return ui::TOUCH_STATUS_UNKNOWN;
+ }
+
+ void Register(views::Widget* widget) OVERRIDE {}
+
+ private:
+ views::Widget* mouse_capture_;
+};
+
+} // namespace
+
+namespace views {
+
+WindowManager::WindowManager() {
+}
+
+WindowManager::~WindowManager() {
+}
+
+// static
+void WindowManager::Install(WindowManager* wm) {
+ window_manager = wm;
+}
+
+// static
+WindowManager* WindowManager::Get() {
+ if (!window_manager)
+ window_manager = new NullWindowManager();
+ return window_manager;
+}
+
+} // namespace views
« no previous file with comments | « views/widget/window_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698