OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "ui/views/controls/native/native_view_host_aura.h" | 5 #include "ui/views/controls/native/native_view_host_aura.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 }; | 39 }; |
40 | 40 |
41 NativeViewHostWindowObserver() {} | 41 NativeViewHostWindowObserver() {} |
42 virtual ~NativeViewHostWindowObserver() {} | 42 virtual ~NativeViewHostWindowObserver() {} |
43 | 43 |
44 const std::vector<EventDetails>& events() const { return events_; } | 44 const std::vector<EventDetails>& events() const { return events_; } |
45 | 45 |
46 // aura::WindowObserver overrides | 46 // aura::WindowObserver overrides |
47 virtual void OnWindowVisibilityChanged(aura::Window* window, | 47 virtual void OnWindowVisibilityChanged(aura::Window* window, |
48 bool visible) OVERRIDE { | 48 bool visible) override { |
49 EventDetails event; | 49 EventDetails event; |
50 event.type = visible ? EVENT_SHOWN : EVENT_HIDDEN; | 50 event.type = visible ? EVENT_SHOWN : EVENT_HIDDEN; |
51 event.window = window; | 51 event.window = window; |
52 event.bounds = window->GetBoundsInRootWindow(); | 52 event.bounds = window->GetBoundsInRootWindow(); |
53 | 53 |
54 // Dedupe events as a single Hide() call can result in several | 54 // Dedupe events as a single Hide() call can result in several |
55 // notifications. | 55 // notifications. |
56 if (events_.size() == 0u || events_.back() != event) | 56 if (events_.size() == 0u || events_.back() != event) |
57 events_.push_back(event); | 57 events_.push_back(event); |
58 } | 58 } |
59 | 59 |
60 virtual void OnWindowBoundsChanged(aura::Window* window, | 60 virtual void OnWindowBoundsChanged(aura::Window* window, |
61 const gfx::Rect& old_bounds, | 61 const gfx::Rect& old_bounds, |
62 const gfx::Rect& new_bounds) OVERRIDE { | 62 const gfx::Rect& new_bounds) override { |
63 EventDetails event; | 63 EventDetails event; |
64 event.type = EVENT_BOUNDS_CHANGED; | 64 event.type = EVENT_BOUNDS_CHANGED; |
65 event.window = window; | 65 event.window = window; |
66 event.bounds = window->GetBoundsInRootWindow(); | 66 event.bounds = window->GetBoundsInRootWindow(); |
67 events_.push_back(event); | 67 events_.push_back(event); |
68 } | 68 } |
69 | 69 |
70 private: | 70 private: |
71 std::vector<EventDetails> events_; | 71 std::vector<EventDetails> events_; |
72 gfx::Rect bounds_at_visibility_changed_; | 72 gfx::Rect bounds_at_visibility_changed_; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 host()->SetVisible(false); | 341 host()->SetVisible(false); |
342 EXPECT_FALSE(clipping_window()->IsVisible()); | 342 EXPECT_FALSE(clipping_window()->IsVisible()); |
343 EXPECT_FALSE(child()->IsVisible()); | 343 EXPECT_FALSE(child()->IsVisible()); |
344 | 344 |
345 DestroyHost(); | 345 DestroyHost(); |
346 DestroyTopLevel(); | 346 DestroyTopLevel(); |
347 } | 347 } |
348 | 348 |
349 } // namespace views | 349 } // namespace views |
OLD | NEW |