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

Side by Side Diff: views/widget/window_manager.cc

Issue 8598031: views: Move widget/ directory to ui/views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reland for real 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/widget/window_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "views/widget/window_manager.h"
6
7 #include "base/compiler_specific.h"
8 #include "ui/views/events/event.h"
9 #include "views/widget/widget.h"
10
11 namespace {
12
13 views::WindowManager* window_manager = NULL;
14
15 class NullWindowManager : public views::WindowManager {
16 public:
17 NullWindowManager() : mouse_capture_(NULL) {
18 }
19
20 virtual void StartMoveDrag(views::Widget* widget,
21 const gfx::Point& screen_point) OVERRIDE {
22 NOTIMPLEMENTED();
23 }
24
25 virtual void StartResizeDrag(views::Widget* widget,
26 const gfx::Point& screen_point,
27 int hittest_code) OVERRIDE {
28 NOTIMPLEMENTED();
29 }
30
31 virtual bool SetMouseCapture(views::Widget* widget) OVERRIDE {
32 if (mouse_capture_ == widget)
33 return true;
34 if (mouse_capture_)
35 return false;
36 mouse_capture_ = widget;
37 return true;
38 }
39
40 virtual bool ReleaseMouseCapture(views::Widget* widget) OVERRIDE {
41 if (widget && mouse_capture_ != widget)
42 return false;
43 mouse_capture_ = NULL;
44 return true;
45 }
46
47 virtual bool HasMouseCapture(const views::Widget* widget) const OVERRIDE {
48 return mouse_capture_ == widget;
49 }
50
51 virtual bool HandleKeyEvent(views::Widget* widget,
52 const views::KeyEvent& event) OVERRIDE {
53 return false;
54 }
55
56 virtual bool HandleMouseEvent(views::Widget* widget,
57 const views::MouseEvent& event) OVERRIDE {
58 if (mouse_capture_) {
59 views::MouseEvent translated(event, widget->GetRootView(),
60 mouse_capture_->GetRootView());
61 mouse_capture_->OnMouseEvent(translated);
62 return true;
63 }
64 return false;
65 }
66
67 virtual ui::TouchStatus HandleTouchEvent(views::Widget* widget,
68 const views::TouchEvent& event) OVERRIDE {
69 return ui::TOUCH_STATUS_UNKNOWN;
70 }
71
72 void Register(views::Widget* widget) OVERRIDE {}
73
74 private:
75 views::Widget* mouse_capture_;
76 };
77
78 } // namespace
79
80 namespace views {
81
82 WindowManager::WindowManager() {
83 }
84
85 WindowManager::~WindowManager() {
86 }
87
88 // static
89 void WindowManager::Install(WindowManager* wm) {
90 window_manager = wm;
91 }
92
93 // static
94 WindowManager* WindowManager::Get() {
95 if (!window_manager)
96 window_manager = new NullWindowManager();
97 return window_manager;
98 }
99
100 } // namespace views
OLDNEW
« 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