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

Side by Side Diff: ash/wm/immersive_fullscreen_controller.cc

Issue 1759453002: Convert location bar bubble delegates to bubble dialog delegates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ImmersiveFullscreenController Created 4 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "ash/wm/immersive_fullscreen_controller.h" 5 #include "ash/wm/immersive_fullscreen_controller.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/wm/resize_handle_window_targeter.h" 11 #include "ash/wm/resize_handle_window_targeter.h"
12 #include "ash/wm/window_state.h" 12 #include "ash/wm/window_state.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "ui/aura/client/aura_constants.h" 14 #include "ui/aura/client/aura_constants.h"
15 #include "ui/aura/client/capture_client.h" 15 #include "ui/aura/client/capture_client.h"
16 #include "ui/aura/client/cursor_client.h" 16 #include "ui/aura/client/cursor_client.h"
17 #include "ui/aura/client/screen_position_client.h" 17 #include "ui/aura/client/screen_position_client.h"
18 #include "ui/aura/env.h" 18 #include "ui/aura/env.h"
19 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
20 #include "ui/aura/window_event_dispatcher.h" 20 #include "ui/aura/window_event_dispatcher.h"
21 #include "ui/gfx/animation/slide_animation.h" 21 #include "ui/gfx/animation/slide_animation.h"
22 #include "ui/gfx/display.h" 22 #include "ui/gfx/display.h"
23 #include "ui/gfx/geometry/point.h" 23 #include "ui/gfx/geometry/point.h"
24 #include "ui/gfx/geometry/rect.h" 24 #include "ui/gfx/geometry/rect.h"
25 #include "ui/gfx/screen.h" 25 #include "ui/gfx/screen.h"
26 #include "ui/views/bubble/bubble_delegate.h" 26 #include "ui/views/bubble/bubble_delegate.h"
27 #include "ui/views/bubble/bubble_dialog_delegate.h"
27 #include "ui/views/view.h" 28 #include "ui/views/view.h"
28 #include "ui/views/widget/widget.h" 29 #include "ui/views/widget/widget.h"
29 #include "ui/wm/core/transient_window_manager.h" 30 #include "ui/wm/core/transient_window_manager.h"
30 #include "ui/wm/core/window_util.h" 31 #include "ui/wm/core/window_util.h"
31 #include "ui/wm/public/activation_client.h" 32 #include "ui/wm/public/activation_client.h"
32 33
33 using views::View; 34 using views::View;
34 35
35 namespace ash { 36 namespace ash {
36 37
(...skipping 19 matching lines...) Expand all
56 // of just more vertical then horizontal. 57 // of just more vertical then horizontal.
57 const int kSwipeVerticalThresholdMultiplier = 3; 58 const int kSwipeVerticalThresholdMultiplier = 3;
58 59
59 // The height in pixels of the region above the top edge of the display which 60 // The height in pixels of the region above the top edge of the display which
60 // hosts the immersive fullscreen window in which mouse events are ignored 61 // hosts the immersive fullscreen window in which mouse events are ignored
61 // (cannot reveal or unreveal the top-of-window views). 62 // (cannot reveal or unreveal the top-of-window views).
62 // See ShouldIgnoreMouseEventAtLocation() for more details. 63 // See ShouldIgnoreMouseEventAtLocation() for more details.
63 const int kHeightOfDeadRegionAboveTopContainer = 10; 64 const int kHeightOfDeadRegionAboveTopContainer = 10;
64 65
65 // Returns the BubbleDelegateView corresponding to |maybe_bubble| if 66 // Returns the BubbleDelegateView corresponding to |maybe_bubble| if
66 // |maybe_bubble| is a bubble. 67 // |maybe_bubble| is a bubble. TODO(estade): remove this when all bubbles are
68 // BubbleDialogDelegateViews, or create a common interface for the two bubble
69 // types.
67 views::BubbleDelegateView* AsBubbleDelegate(aura::Window* maybe_bubble) { 70 views::BubbleDelegateView* AsBubbleDelegate(aura::Window* maybe_bubble) {
68 if (!maybe_bubble) 71 if (!maybe_bubble)
69 return NULL; 72 return nullptr;
70 views::Widget* widget = views::Widget::GetWidgetForNativeView(maybe_bubble); 73 views::Widget* widget = views::Widget::GetWidgetForNativeView(maybe_bubble);
71 if (!widget) 74 if (!widget)
72 return NULL; 75 return nullptr;
73 return widget->widget_delegate()->AsBubbleDelegate(); 76 return widget->widget_delegate()->AsBubbleDelegate();
74 } 77 }
75 78
79 // Returns the BubbleDialogDelegateView corresponding to |maybe_bubble| if
80 // |maybe_bubble| is a bubble.
81 views::BubbleDialogDelegateView* AsBubbleDialogDelegate(
82 aura::Window* maybe_bubble) {
83 if (!maybe_bubble)
84 return nullptr;
85 views::Widget* widget = views::Widget::GetWidgetForNativeView(maybe_bubble);
86 if (!widget)
87 return nullptr;
88 return widget->widget_delegate()->AsBubbleDialogDelegate();
89 }
90
91 views::View* GetAnchorView(aura::Window* maybe_bubble) {
92 views::BubbleDelegateView* bubble = AsBubbleDelegate(maybe_bubble);
93 if (bubble)
94 return bubble->GetAnchorView();
95
96 views::BubbleDialogDelegateView* bubble_dialog =
97 AsBubbleDialogDelegate(maybe_bubble);
98 return bubble_dialog ? bubble_dialog->GetAnchorView() : nullptr;
99 }
100
76 // Returns true if |maybe_transient| is a transient child of |toplevel|. 101 // Returns true if |maybe_transient| is a transient child of |toplevel|.
77 bool IsWindowTransientChildOf(aura::Window* maybe_transient, 102 bool IsWindowTransientChildOf(aura::Window* maybe_transient,
78 aura::Window* toplevel) { 103 aura::Window* toplevel) {
79 if (!maybe_transient || !toplevel) 104 if (!maybe_transient || !toplevel)
80 return false; 105 return false;
81 106
82 for (aura::Window* window = maybe_transient; window; 107 for (aura::Window* window = maybe_transient; window;
83 window = ::wm::GetTransientParent(window)) { 108 window = ::wm::GetTransientParent(window)) {
84 if (window == toplevel) 109 if (window == toplevel)
85 return true; 110 return true;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 //////////////////////////////////////////////////////////////////////////////// 146 ////////////////////////////////////////////////////////////////////////////////
122 147
123 // Class which keeps the top-of-window views revealed as long as one of the 148 // Class which keeps the top-of-window views revealed as long as one of the
124 // bubbles it is observing is visible. The logic to keep the top-of-window 149 // bubbles it is observing is visible. The logic to keep the top-of-window
125 // views revealed based on the visibility of bubbles anchored to 150 // views revealed based on the visibility of bubbles anchored to
126 // children of |ImmersiveFullscreenController::top_container_| is separate from 151 // children of |ImmersiveFullscreenController::top_container_| is separate from
127 // the logic related to |ImmersiveFullscreenController::focus_revealed_lock_| 152 // the logic related to |ImmersiveFullscreenController::focus_revealed_lock_|
128 // so that bubbles which are not activatable and bubbles which do not close 153 // so that bubbles which are not activatable and bubbles which do not close
129 // upon deactivation also keep the top-of-window views revealed for the 154 // upon deactivation also keep the top-of-window views revealed for the
130 // duration of their visibility. 155 // duration of their visibility.
131 class ImmersiveFullscreenController::BubbleManager 156 class ImmersiveFullscreenController::BubbleObserver
132 : public aura::WindowObserver { 157 : public aura::WindowObserver {
133 public: 158 public:
134 explicit BubbleManager(ImmersiveFullscreenController* controller); 159 explicit BubbleObserver(ImmersiveFullscreenController* controller);
135 ~BubbleManager() override; 160 ~BubbleObserver() override;
136 161
137 // Start / stop observing changes to |bubble|'s visibility. 162 // Start / stop observing changes to |bubble|'s visibility.
138 void StartObserving(aura::Window* bubble); 163 void StartObserving(aura::Window* bubble);
139 void StopObserving(aura::Window* bubble); 164 void StopObserving(aura::Window* bubble);
140 165
141 private: 166 private:
142 // Updates |revealed_lock_| based on whether any of |bubbles_| is visible. 167 // Updates |revealed_lock_| based on whether any of |bubbles_| is visible.
143 void UpdateRevealedLock(); 168 void UpdateRevealedLock();
144 169
145 // aura::WindowObserver overrides: 170 // aura::WindowObserver overrides:
146 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; 171 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override;
147 void OnWindowDestroying(aura::Window* window) override; 172 void OnWindowDestroying(aura::Window* window) override;
148 173
149 ImmersiveFullscreenController* controller_; 174 ImmersiveFullscreenController* controller_;
150 175
151 std::set<aura::Window*> bubbles_; 176 std::set<aura::Window*> bubbles_;
152 177
153 // Lock which keeps the top-of-window views revealed based on whether any of 178 // Lock which keeps the top-of-window views revealed based on whether any of
154 // |bubbles_| is visible. 179 // |bubbles_| is visible.
155 scoped_ptr<ImmersiveRevealedLock> revealed_lock_; 180 scoped_ptr<ImmersiveRevealedLock> revealed_lock_;
156 181
157 DISALLOW_COPY_AND_ASSIGN(BubbleManager); 182 DISALLOW_COPY_AND_ASSIGN(BubbleObserver);
158 }; 183 };
159 184
160 ImmersiveFullscreenController::BubbleManager::BubbleManager( 185 ImmersiveFullscreenController::BubbleObserver::BubbleObserver(
161 ImmersiveFullscreenController* controller) 186 ImmersiveFullscreenController* controller)
162 : controller_(controller) { 187 : controller_(controller) {}
163 }
164 188
165 ImmersiveFullscreenController::BubbleManager::~BubbleManager() { 189 ImmersiveFullscreenController::BubbleObserver::~BubbleObserver() {
166 for (std::set<aura::Window*>::const_iterator it = bubbles_.begin(); 190 for (std::set<aura::Window*>::const_iterator it = bubbles_.begin();
167 it != bubbles_.end(); ++it) { 191 it != bubbles_.end(); ++it) {
168 (*it)->RemoveObserver(this); 192 (*it)->RemoveObserver(this);
169 } 193 }
170 } 194 }
171 195
172 void ImmersiveFullscreenController::BubbleManager::StartObserving( 196 void ImmersiveFullscreenController::BubbleObserver::StartObserving(
173 aura::Window* bubble) { 197 aura::Window* bubble) {
174 if (bubbles_.insert(bubble).second) { 198 if (bubbles_.insert(bubble).second) {
175 bubble->AddObserver(this); 199 bubble->AddObserver(this);
176 UpdateRevealedLock(); 200 UpdateRevealedLock();
177 } 201 }
178 } 202 }
179 203
180 void ImmersiveFullscreenController::BubbleManager::StopObserving( 204 void ImmersiveFullscreenController::BubbleObserver::StopObserving(
181 aura::Window* bubble) { 205 aura::Window* bubble) {
182 if (bubbles_.erase(bubble)) { 206 if (bubbles_.erase(bubble)) {
183 bubble->RemoveObserver(this); 207 bubble->RemoveObserver(this);
184 UpdateRevealedLock(); 208 UpdateRevealedLock();
185 } 209 }
186 } 210 }
187 211
188 void ImmersiveFullscreenController::BubbleManager::UpdateRevealedLock() { 212 void ImmersiveFullscreenController::BubbleObserver::UpdateRevealedLock() {
189 bool has_visible_bubble = false; 213 bool has_visible_bubble = false;
190 for (std::set<aura::Window*>::const_iterator it = bubbles_.begin(); 214 for (std::set<aura::Window*>::const_iterator it = bubbles_.begin();
191 it != bubbles_.end(); ++it) { 215 it != bubbles_.end(); ++it) {
192 if ((*it)->IsVisible()) { 216 if ((*it)->IsVisible()) {
193 has_visible_bubble = true; 217 has_visible_bubble = true;
194 break; 218 break;
195 } 219 }
196 } 220 }
197 221
198 bool was_revealed = controller_->IsRevealed(); 222 bool was_revealed = controller_->IsRevealed();
(...skipping 10 matching lines...) Expand all
209 } 233 }
210 234
211 if (!was_revealed && revealed_lock_.get()) { 235 if (!was_revealed && revealed_lock_.get()) {
212 // Currently, there is no nice way for bubbles to reposition themselves 236 // Currently, there is no nice way for bubbles to reposition themselves
213 // whenever the anchor view moves. Tell the bubbles to reposition themselves 237 // whenever the anchor view moves. Tell the bubbles to reposition themselves
214 // explicitly instead. The hidden bubbles are also repositioned because 238 // explicitly instead. The hidden bubbles are also repositioned because
215 // BubbleDelegateView does not reposition its widget as a result of a 239 // BubbleDelegateView does not reposition its widget as a result of a
216 // visibility change. 240 // visibility change.
217 for (std::set<aura::Window*>::const_iterator it = bubbles_.begin(); 241 for (std::set<aura::Window*>::const_iterator it = bubbles_.begin();
218 it != bubbles_.end(); ++it) { 242 it != bubbles_.end(); ++it) {
219 AsBubbleDelegate(*it)->OnAnchorBoundsChanged(); 243 views::BubbleDelegateView* bubble = AsBubbleDelegate(*it);
244 if (bubble)
245 bubble->OnAnchorBoundsChanged();
246 else
247 AsBubbleDialogDelegate(*it)->OnAnchorBoundsChanged();
220 } 248 }
221 } 249 }
222 } 250 }
223 251
224 void ImmersiveFullscreenController::BubbleManager::OnWindowVisibilityChanged( 252 void ImmersiveFullscreenController::BubbleObserver::OnWindowVisibilityChanged(
225 aura::Window*, 253 aura::Window*,
226 bool visible) { 254 bool visible) {
227 UpdateRevealedLock(); 255 UpdateRevealedLock();
228 } 256 }
229 257
230 void ImmersiveFullscreenController::BubbleManager::OnWindowDestroying( 258 void ImmersiveFullscreenController::BubbleObserver::OnWindowDestroying(
231 aura::Window* window) { 259 aura::Window* window) {
232 StopObserving(window); 260 StopObserving(window);
233 } 261 }
234 262
235 //////////////////////////////////////////////////////////////////////////////// 263 ////////////////////////////////////////////////////////////////////////////////
236 264
237 ImmersiveFullscreenController::ImmersiveFullscreenController() 265 ImmersiveFullscreenController::ImmersiveFullscreenController()
238 : delegate_(NULL), 266 : delegate_(NULL),
239 top_container_(NULL), 267 top_container_(NULL),
240 widget_(NULL), 268 widget_(NULL),
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 const gfx::Animation* animation) { 510 const gfx::Animation* animation) {
483 delegate_->SetVisibleFraction(animation->GetCurrentValue()); 511 delegate_->SetVisibleFraction(animation->GetCurrentValue());
484 } 512 }
485 513
486 //////////////////////////////////////////////////////////////////////////////// 514 ////////////////////////////////////////////////////////////////////////////////
487 // aura::WindowObserver overrides: 515 // aura::WindowObserver overrides:
488 516
489 void ImmersiveFullscreenController::OnTransientChildAdded( 517 void ImmersiveFullscreenController::OnTransientChildAdded(
490 aura::Window* window, 518 aura::Window* window,
491 aura::Window* transient) { 519 aura::Window* transient) {
492 views::BubbleDelegateView* bubble_delegate = AsBubbleDelegate(transient); 520 views::View* anchor = GetAnchorView(transient);
493 if (bubble_delegate && 521 if (anchor && top_container_->Contains(anchor)) {
494 bubble_delegate->GetAnchorView() &&
495 top_container_->Contains(bubble_delegate->GetAnchorView())) {
496 // Observe the aura::Window because the BubbleDelegateView may not be 522 // Observe the aura::Window because the BubbleDelegateView may not be
497 // parented to the widget's root view yet so |bubble_delegate->GetWidget()| 523 // parented to the widget's root view yet so |bubble_delegate->GetWidget()|
498 // may still return NULL. 524 // may still return NULL.
499 bubble_manager_->StartObserving(transient); 525 bubble_observer_->StartObserving(transient);
500 } 526 }
501 } 527 }
502 528
503 void ImmersiveFullscreenController::OnTransientChildRemoved( 529 void ImmersiveFullscreenController::OnTransientChildRemoved(
504 aura::Window* window, 530 aura::Window* window,
505 aura::Window* transient) { 531 aura::Window* transient) {
506 bubble_manager_->StopObserving(transient); 532 bubble_observer_->StopObserving(transient);
507 } 533 }
508 534
509 //////////////////////////////////////////////////////////////////////////////// 535 ////////////////////////////////////////////////////////////////////////////////
510 // ash::ImmersiveRevealedLock::Delegate overrides: 536 // ash::ImmersiveRevealedLock::Delegate overrides:
511 537
512 void ImmersiveFullscreenController::LockRevealedState( 538 void ImmersiveFullscreenController::LockRevealedState(
513 AnimateReveal animate_reveal) { 539 AnimateReveal animate_reveal) {
514 ++revealed_lock_count_; 540 ++revealed_lock_count_;
515 Animate animate = (animate_reveal == ANIMATE_REVEAL_YES) ? 541 Animate animate = (animate_reveal == ANIMATE_REVEAL_YES) ?
516 ANIMATE_FAST : ANIMATE_NO; 542 ANIMATE_FAST : ANIMATE_NO;
(...skipping 19 matching lines...) Expand all
536 562
537 views::FocusManager* focus_manager = widget_->GetFocusManager(); 563 views::FocusManager* focus_manager = widget_->GetFocusManager();
538 564
539 if (enable) { 565 if (enable) {
540 widget_->AddObserver(this); 566 widget_->AddObserver(this);
541 focus_manager->AddFocusChangeListener(this); 567 focus_manager->AddFocusChangeListener(this);
542 Shell::GetInstance()->AddPreTargetHandler(this); 568 Shell::GetInstance()->AddPreTargetHandler(this);
543 ::wm::TransientWindowManager::Get(native_window_)-> 569 ::wm::TransientWindowManager::Get(native_window_)->
544 AddObserver(this); 570 AddObserver(this);
545 571
546 RecreateBubbleManager(); 572 RecreateBubbleObserver();
547 } else { 573 } else {
548 widget_->RemoveObserver(this); 574 widget_->RemoveObserver(this);
549 focus_manager->RemoveFocusChangeListener(this); 575 focus_manager->RemoveFocusChangeListener(this);
550 Shell::GetInstance()->RemovePreTargetHandler(this); 576 Shell::GetInstance()->RemovePreTargetHandler(this);
551 ::wm::TransientWindowManager::Get(native_window_)-> 577 ::wm::TransientWindowManager::Get(native_window_)->
552 RemoveObserver(this); 578 RemoveObserver(this);
553 579
554 // We have stopped observing whether transient children are added or removed 580 // We have stopped observing whether transient children are added or removed
555 // to |native_window_|. The set of bubbles that BubbleManager is observing 581 // to |native_window_|. The set of bubbles that BubbleObserver is observing
556 // will become stale really quickly. Destroy BubbleManager and recreate it 582 // will become stale really quickly. Destroy BubbleObserver and recreate it
557 // when we start observing |native_window_| again. 583 // when we start observing |native_window_| again.
558 bubble_manager_.reset(); 584 bubble_observer_.reset();
559 585
560 animation_->Stop(); 586 animation_->Stop();
561 } 587 }
562 } 588 }
563 589
564 void ImmersiveFullscreenController::UpdateTopEdgeHoverTimer( 590 void ImmersiveFullscreenController::UpdateTopEdgeHoverTimer(
565 ui::MouseEvent* event) { 591 ui::MouseEvent* event) {
566 DCHECK(enabled_); 592 DCHECK(enabled_);
567 DCHECK(reveal_state_ == SLIDING_CLOSED || reveal_state_ == CLOSED); 593 DCHECK(reveal_state_ == SLIDING_CLOSED || reveal_state_ == CLOSED);
568 594
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 return; 724 return;
699 725
700 bool hold_lock = false; 726 bool hold_lock = false;
701 if (widget_->IsActive()) { 727 if (widget_->IsActive()) {
702 views::View* focused_view = widget_->GetFocusManager()->GetFocusedView(); 728 views::View* focused_view = widget_->GetFocusManager()->GetFocusedView();
703 if (top_container_->Contains(focused_view)) 729 if (top_container_->Contains(focused_view))
704 hold_lock = true; 730 hold_lock = true;
705 } else { 731 } else {
706 aura::Window* active_window = aura::client::GetActivationClient( 732 aura::Window* active_window = aura::client::GetActivationClient(
707 native_window_->GetRootWindow())->GetActiveWindow(); 733 native_window_->GetRootWindow())->GetActiveWindow();
708 views::BubbleDelegateView* bubble_delegate = 734 if (GetAnchorView(active_window)) {
709 AsBubbleDelegate(active_window); 735 // BubbleObserver will already have locked the top-of-window views if the
710 if (bubble_delegate && bubble_delegate->anchor_widget()) {
711 // BubbleManager will already have locked the top-of-window views if the
712 // bubble is anchored to a child of |top_container_|. Don't acquire 736 // bubble is anchored to a child of |top_container_|. Don't acquire
713 // |focus_revealed_lock_| here for the sake of simplicity. 737 // |focus_revealed_lock_| here for the sake of simplicity.
714 // Note: Instead of checking for the existence of the |anchor_view|, 738 // Note: Instead of checking for the existence of the |anchor_view|,
715 // the existence of the |anchor_widget| is performed to avoid the case 739 // the existence of the |anchor_widget| is performed to avoid the case
716 // where the view is already gone (and the widget is still running). 740 // where the view is already gone (and the widget is still running).
717 } else { 741 } else {
718 // The currently active window is not |native_window_| and it is not a 742 // The currently active window is not |native_window_| and it is not a
719 // bubble with an anchor view. The top-of-window views should be revealed 743 // bubble with an anchor view. The top-of-window views should be revealed
720 // if: 744 // if:
721 // 1) The active window is a transient child of |native_window_|. 745 // 1) The active window is a transient child of |native_window_|.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 // closest screen ensures that the event is from a valid bezel (as opposed to 950 // closest screen ensures that the event is from a valid bezel (as opposed to
927 // another screen in an extended desktop). 951 // another screen in an extended desktop).
928 gfx::Rect screen_bounds = 952 gfx::Rect screen_bounds =
929 gfx::Screen::GetScreen()->GetDisplayNearestPoint(location).bounds(); 953 gfx::Screen::GetScreen()->GetDisplayNearestPoint(location).bounds();
930 return (!screen_bounds.Contains(location) && 954 return (!screen_bounds.Contains(location) &&
931 location.y() < hit_bounds_in_screen.y() && 955 location.y() < hit_bounds_in_screen.y() &&
932 location.x() >= hit_bounds_in_screen.x() && 956 location.x() >= hit_bounds_in_screen.x() &&
933 location.x() < hit_bounds_in_screen.right()); 957 location.x() < hit_bounds_in_screen.right());
934 } 958 }
935 959
936 void ImmersiveFullscreenController::RecreateBubbleManager() { 960 void ImmersiveFullscreenController::RecreateBubbleObserver() {
937 bubble_manager_.reset(new BubbleManager(this)); 961 bubble_observer_.reset(new BubbleObserver(this));
938 const std::vector<aura::Window*> transient_children = 962 const std::vector<aura::Window*> transient_children =
939 ::wm::GetTransientChildren(native_window_); 963 ::wm::GetTransientChildren(native_window_);
940 for (size_t i = 0; i < transient_children.size(); ++i) { 964 for (size_t i = 0; i < transient_children.size(); ++i) {
941 aura::Window* transient_child = transient_children[i]; 965 aura::Window* transient_child = transient_children[i];
942 views::BubbleDelegateView* bubble_delegate = 966 views::View* anchor_view = GetAnchorView(transient_child);
943 AsBubbleDelegate(transient_child); 967 if (anchor_view && top_container_->Contains(anchor_view))
944 if (bubble_delegate && 968 bubble_observer_->StartObserving(transient_child);
945 bubble_delegate->GetAnchorView() &&
946 top_container_->Contains(bubble_delegate->GetAnchorView())) {
947 bubble_manager_->StartObserving(transient_child);
948 }
949 } 969 }
950 } 970 }
951 971
952 } // namespace ash 972 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698