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

Side by Side Diff: ui/aura/window.h

Issue 8253001: aura: Some changes in Window and Desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_AURA_WINDOW_H_ 5 #ifndef UI_AURA_WINDOW_H_
6 #define UI_AURA_WINDOW_H_ 6 #define UI_AURA_WINDOW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h"
13 #include "base/string16.h" 14 #include "base/string16.h"
14 #include "ui/base/ui_base_types.h" 15 #include "ui/base/ui_base_types.h"
15 #include "ui/aura/aura_export.h" 16 #include "ui/aura/aura_export.h"
16 #include "ui/gfx/compositor/layer_delegate.h" 17 #include "ui/gfx/compositor/layer_delegate.h"
17 #include "ui/gfx/native_widget_types.h" 18 #include "ui/gfx/native_widget_types.h"
18 #include "ui/gfx/rect.h" 19 #include "ui/gfx/rect.h"
19 20
20 class SkCanvas; 21 class SkCanvas;
21 22
22 namespace ui { 23 namespace ui {
(...skipping 15 matching lines...) Expand all
38 namespace internal { 39 namespace internal {
39 class FocusManager; 40 class FocusManager;
40 class RootWindow; 41 class RootWindow;
41 } 42 }
42 43
43 // Aura window implementation. Interesting events are sent to the 44 // Aura window implementation. Interesting events are sent to the
44 // WindowDelegate. 45 // WindowDelegate.
45 // TODO(beng): resolve ownership. 46 // TODO(beng): resolve ownership.
46 class AURA_EXPORT Window : public ui::LayerDelegate { 47 class AURA_EXPORT Window : public ui::LayerDelegate {
47 public: 48 public:
49 // Observers can listen to various events on the Windows.
50 class Observer {
51 public:
52 virtual void OnWindowClosing(Window* widget) {}
sky 2011/10/12 21:11:27 Same comments as for Desktop::Observer.
53 virtual void OnWindowVisibilityChanged(Window* widget, bool visible) {}
54 virtual void OnWindowActivationChanged(Window* widget, bool active) {}
55 };
56
48 typedef std::vector<Window*> Windows; 57 typedef std::vector<Window*> Windows;
49 58
50 explicit Window(WindowDelegate* delegate); 59 explicit Window(WindowDelegate* delegate);
51 virtual ~Window(); 60 virtual ~Window();
52 61
53 void Init(); 62 void Init();
54 63
55 // A type is used to identify a class of Windows and customize behavior such 64 // A type is used to identify a class of Windows and customize behavior such
56 // as event handling and parenting. The value can be any of those in 65 // as event handling and parenting. The value can be any of those in
57 // window_types.h or a user defined value. 66 // window_types.h or a user defined value.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void SetEventFilter(EventFilter* event_filter); 160 void SetEventFilter(EventFilter* event_filter);
152 161
153 // Handles a mouse event. Returns true if handled. 162 // Handles a mouse event. Returns true if handled.
154 bool OnMouseEvent(MouseEvent* event); 163 bool OnMouseEvent(MouseEvent* event);
155 164
156 // Handles a key event. Returns true if handled. 165 // Handles a key event. Returns true if handled.
157 bool OnKeyEvent(KeyEvent* event); 166 bool OnKeyEvent(KeyEvent* event);
158 167
159 WindowDelegate* delegate() { return delegate_; } 168 WindowDelegate* delegate() { return delegate_; }
160 169
170 // Add/remove observer.
171 void AddObserver(Observer* observer);
172 void RemoveObserver(Observer* observer);
173 bool HasObserver(Observer* observer);
174
161 // When set to true, this Window will stop propagation of all events targeted 175 // When set to true, this Window will stop propagation of all events targeted
162 // at Windows below it in the z-order, but only if this Window has children. 176 // at Windows below it in the z-order, but only if this Window has children.
163 // This is used to implement lock-screen type functionality where we do not 177 // This is used to implement lock-screen type functionality where we do not
164 // want events to be sent to running logged-in windows when the lock screen is 178 // want events to be sent to running logged-in windows when the lock screen is
165 // displayed. 179 // displayed.
166 void set_stops_event_propagation(bool stops_event_propagation) { 180 void set_stops_event_propagation(bool stops_event_propagation) {
167 stops_event_propagation_ = stops_event_propagation; 181 stops_event_propagation_ = stops_event_propagation;
168 } 182 }
169 183
170 // Returns true if the mouse pointer at the specified |point| can trigger an 184 // Returns true if the mouse pointer at the specified |point| can trigger an
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 270
257 scoped_ptr<EventFilter> event_filter_; 271 scoped_ptr<EventFilter> event_filter_;
258 scoped_ptr<LayoutManager> layout_manager_; 272 scoped_ptr<LayoutManager> layout_manager_;
259 273
260 void* user_data_; 274 void* user_data_;
261 275
262 // When true, events are not sent to windows behind this one in the z-order, 276 // When true, events are not sent to windows behind this one in the z-order,
263 // provided this window has children. See set_stops_event_propagation(). 277 // provided this window has children. See set_stops_event_propagation().
264 bool stops_event_propagation_; 278 bool stops_event_propagation_;
265 279
280 ObserverList<Observer> observers_;
281
266 DISALLOW_COPY_AND_ASSIGN(Window); 282 DISALLOW_COPY_AND_ASSIGN(Window);
267 }; 283 };
268 284
269 } // namespace aura 285 } // namespace aura
270 286
271 #endif // UI_AURA_WINDOW_H_ 287 #endif // UI_AURA_WINDOW_H_
OLDNEW
« ui/aura/desktop.h ('K') | « ui/aura/desktop_host_linux.cc ('k') | ui/aura/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698