| OLD | NEW |
| 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 <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/string16.h" | 15 #include "base/string16.h" |
| 16 #include "ui/base/events.h" | 16 #include "ui/base/events.h" |
| 17 #include "ui/base/ui_base_types.h" | 17 #include "ui/base/ui_base_types.h" |
| 18 #include "ui/aura/aura_export.h" | 18 #include "ui/aura/aura_export.h" |
| 19 #include "ui/aura/window_types.h" |
| 19 #include "ui/gfx/compositor/layer.h" | 20 #include "ui/gfx/compositor/layer.h" |
| 20 #include "ui/gfx/compositor/layer_delegate.h" | 21 #include "ui/gfx/compositor/layer_delegate.h" |
| 21 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
| 22 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
| 23 | 24 |
| 24 class SkCanvas; | 25 class SkCanvas; |
| 25 | 26 |
| 26 namespace ui { | 27 namespace ui { |
| 27 class Animation; | 28 class Animation; |
| 28 class Compositor; | 29 class Compositor; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 47 class FocusManager; | 48 class FocusManager; |
| 48 } | 49 } |
| 49 | 50 |
| 50 // Aura window implementation. Interesting events are sent to the | 51 // Aura window implementation. Interesting events are sent to the |
| 51 // WindowDelegate. | 52 // WindowDelegate. |
| 52 // TODO(beng): resolve ownership. | 53 // TODO(beng): resolve ownership. |
| 53 class AURA_EXPORT Window : public ui::LayerDelegate { | 54 class AURA_EXPORT Window : public ui::LayerDelegate { |
| 54 public: | 55 public: |
| 55 typedef std::vector<Window*> Windows; | 56 typedef std::vector<Window*> Windows; |
| 56 | 57 |
| 58 // Parameter for Init() describing this Window's layer's initial state. |
| 59 enum LayerInitialState { |
| 60 LAYER_INITIALLY_VISIBLE = 0, |
| 61 LAYER_INITIALLY_INVISIBLE |
| 62 }; |
| 63 |
| 57 explicit Window(WindowDelegate* delegate); | 64 explicit Window(WindowDelegate* delegate); |
| 58 virtual ~Window(); | 65 virtual ~Window(); |
| 59 | 66 |
| 60 void Init(ui::Layer::LayerType layer_type); | 67 void Init(ui::Layer::LayerType layer_type, |
| 68 LayerInitialState layer_state); |
| 61 | 69 |
| 62 // A type is used to identify a class of Windows and customize behavior such | 70 // A type is used to identify a class of Windows and customize behavior such |
| 63 // as event handling and parenting. The value can be any of those in | 71 // as event handling and parenting. This field should only be consumed by the |
| 64 // window_types.h or a user defined value. | 72 // shell -- Aura itself shouldn't contain type-specific logic. |
| 65 int type() const { return type_; } | 73 WindowType type() const { return type_; } |
| 66 void SetType(int type); | 74 void SetType(WindowType type); |
| 67 | 75 |
| 68 int id() const { return id_; } | 76 int id() const { return id_; } |
| 69 void set_id(int id) { id_ = id; } | 77 void set_id(int id) { id_ = id; } |
| 70 | 78 |
| 71 const std::string& name() const { return name_; } | 79 const std::string& name() const { return name_; } |
| 72 void set_name(const std::string& name) { name_ = name; } | 80 void set_name(const std::string& name) { name_ = name; } |
| 73 | 81 |
| 74 ui::Layer* layer() { return layer_.get(); } | 82 ui::Layer* layer() { return layer_.get(); } |
| 75 const ui::Layer* layer() const { return layer_.get(); } | 83 const ui::Layer* layer() const { return layer_.get(); } |
| 76 | 84 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // and StopsEventPropagation() are honored; otherwise, only bounds checks are | 312 // and StopsEventPropagation() are honored; otherwise, only bounds checks are |
| 305 // performed. | 313 // performed. |
| 306 Window* GetWindowForPoint(const gfx::Point& local_point, | 314 Window* GetWindowForPoint(const gfx::Point& local_point, |
| 307 bool return_tightest, | 315 bool return_tightest, |
| 308 bool for_event_handling); | 316 bool for_event_handling); |
| 309 | 317 |
| 310 // Overridden from ui::LayerDelegate: | 318 // Overridden from ui::LayerDelegate: |
| 311 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; | 319 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; |
| 312 virtual void OnLayerAnimationEnded(const ui::Animation* animation) OVERRIDE; | 320 virtual void OnLayerAnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 313 | 321 |
| 314 int type_; | 322 WindowType type_; |
| 315 | 323 |
| 316 WindowDelegate* delegate_; | 324 WindowDelegate* delegate_; |
| 317 | 325 |
| 318 ui::WindowShowState show_state_; | 326 ui::WindowShowState show_state_; |
| 319 | 327 |
| 320 // The original bounds of a maximized/fullscreen window. | 328 // The original bounds of a maximized/fullscreen window. |
| 321 gfx::Rect restore_bounds_; | 329 gfx::Rect restore_bounds_; |
| 322 | 330 |
| 323 // The minimum size of the window a user can resize to. | 331 // The minimum size of the window a user can resize to. |
| 324 gfx::Size minimum_size_; | 332 gfx::Size minimum_size_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 // TODO(oshima): Consolidcate ViewProp and aura::window property | 364 // TODO(oshima): Consolidcate ViewProp and aura::window property |
| 357 // implementation. | 365 // implementation. |
| 358 std::map<const char*, ui::ViewProp*> prop_map_; | 366 std::map<const char*, ui::ViewProp*> prop_map_; |
| 359 | 367 |
| 360 DISALLOW_COPY_AND_ASSIGN(Window); | 368 DISALLOW_COPY_AND_ASSIGN(Window); |
| 361 }; | 369 }; |
| 362 | 370 |
| 363 } // namespace aura | 371 } // namespace aura |
| 364 | 372 |
| 365 #endif // UI_AURA_WINDOW_H_ | 373 #endif // UI_AURA_WINDOW_H_ |
| OLD | NEW |