OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" | 5 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
579 // ui::SHOW_STATE_MINIMIZED. | 579 // ui::SHOW_STATE_MINIMIZED. |
580 LayoutBrowserRootView(); | 580 LayoutBrowserRootView(); |
581 } | 581 } |
582 } | 582 } |
583 } | 583 } |
584 | 584 |
585 void ImmersiveModeControllerAsh::OnAddTransientChild(aura::Window* window, | 585 void ImmersiveModeControllerAsh::OnAddTransientChild(aura::Window* window, |
586 aura::Window* transient) { | 586 aura::Window* transient) { |
587 views::BubbleDelegateView* bubble_delegate = AsBubbleDelegate(transient); | 587 views::BubbleDelegateView* bubble_delegate = AsBubbleDelegate(transient); |
588 if (bubble_delegate && | 588 if (bubble_delegate && |
589 bubble_delegate->anchor_view() && | 589 bubble_delegate->GetAnchorView() && |
590 top_container_->Contains(bubble_delegate->anchor_view())) { | 590 top_container_->Contains(bubble_delegate->GetAnchorView())) { |
591 // Observe the aura::Window because the BubbleDelegateView may not be | 591 // Observe the aura::Window because the BubbleDelegateView may not be |
592 // parented to the widget's root view yet so |bubble_delegate->GetWidget()| | 592 // parented to the widget's root view yet so |bubble_delegate->GetWidget()| |
593 // may still return NULL. | 593 // may still return NULL. |
594 bubble_manager_->StartObserving(transient); | 594 bubble_manager_->StartObserving(transient); |
595 } | 595 } |
596 } | 596 } |
597 | 597 |
598 void ImmersiveModeControllerAsh::OnRemoveTransientChild( | 598 void ImmersiveModeControllerAsh::OnRemoveTransientChild( |
599 aura::Window* window, | 599 aura::Window* window, |
600 aura::Window* transient) { | 600 aura::Window* transient) { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
830 views::Widget::GetWidgetForNativeWindow(native_window_); | 830 views::Widget::GetWidgetForNativeWindow(native_window_); |
831 if (widget->IsActive()) { | 831 if (widget->IsActive()) { |
832 views::View* focused_view = widget->GetFocusManager()->GetFocusedView(); | 832 views::View* focused_view = widget->GetFocusManager()->GetFocusedView(); |
833 if (top_container_->Contains(focused_view)) | 833 if (top_container_->Contains(focused_view)) |
834 hold_lock = true; | 834 hold_lock = true; |
835 } else { | 835 } else { |
836 aura::Window* active_window = aura::client::GetActivationClient( | 836 aura::Window* active_window = aura::client::GetActivationClient( |
837 native_window_->GetRootWindow())->GetActiveWindow(); | 837 native_window_->GetRootWindow())->GetActiveWindow(); |
838 views::BubbleDelegateView* bubble_delegate = | 838 views::BubbleDelegateView* bubble_delegate = |
839 AsBubbleDelegate(active_window); | 839 AsBubbleDelegate(active_window); |
840 if (bubble_delegate && bubble_delegate->anchor_view()) { | 840 if (bubble_delegate && bubble_delegate->has_anchor_view()) { |
msw
2013/09/27 21:21:53
It seems like this code is avoiding a lock here fo
Mr4D (OOO till 08-26)
2013/09/27 22:52:21
Okay - I see you really really really don't want t
| |
841 // BubbleManager will already have locked the top-of-window views if the | 841 // BubbleManager will already have locked the top-of-window views if the |
842 // bubble is anchored to a child of |top_container_|. Don't acquire | 842 // bubble is anchored to a child of |top_container_|. Don't acquire |
843 // |focus_revealed_lock_| here for the sake of simplicity. | 843 // |focus_revealed_lock_| here for the sake of simplicity. |
844 // Note that even though the anchor view might already be gone, the owning | |
845 // anchor widget does still exist and as such it should be handled as if | |
846 // the view is still there. | |
844 } else { | 847 } else { |
845 // The currently active window is not |native_window_| and it is not a | 848 // The currently active window is not |native_window_| and it is not a |
846 // bubble with an anchor view. The top-of-window views should be revealed | 849 // bubble with an anchor view. The top-of-window views should be revealed |
847 // if: | 850 // if: |
848 // 1) The active window is a transient child of |native_window_|. | 851 // 1) The active window is a transient child of |native_window_|. |
849 // 2) The top-of-window views are already revealed. This restriction | 852 // 2) The top-of-window views are already revealed. This restriction |
850 // prevents a transient window opened by the web contents while the | 853 // prevents a transient window opened by the web contents while the |
851 // top-of-window views are hidden from from initiating a reveal. | 854 // top-of-window views are hidden from from initiating a reveal. |
852 // The top-of-window views will stay revealed till |native_window_| is | 855 // The top-of-window views will stay revealed till |native_window_| is |
853 // reactivated. | 856 // reactivated. |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1163 | 1166 |
1164 void ImmersiveModeControllerAsh::RecreateBubbleManager() { | 1167 void ImmersiveModeControllerAsh::RecreateBubbleManager() { |
1165 bubble_manager_.reset(new BubbleManager(this)); | 1168 bubble_manager_.reset(new BubbleManager(this)); |
1166 const std::vector<aura::Window*> transient_children = | 1169 const std::vector<aura::Window*> transient_children = |
1167 native_window_->transient_children(); | 1170 native_window_->transient_children(); |
1168 for (size_t i = 0; i < transient_children.size(); ++i) { | 1171 for (size_t i = 0; i < transient_children.size(); ++i) { |
1169 aura::Window* transient_child = transient_children[i]; | 1172 aura::Window* transient_child = transient_children[i]; |
1170 views::BubbleDelegateView* bubble_delegate = | 1173 views::BubbleDelegateView* bubble_delegate = |
1171 AsBubbleDelegate(transient_child); | 1174 AsBubbleDelegate(transient_child); |
1172 if (bubble_delegate && | 1175 if (bubble_delegate && |
1173 bubble_delegate->anchor_view() && | 1176 bubble_delegate->GetAnchorView() && |
1174 top_container_->Contains(bubble_delegate->anchor_view())) { | 1177 top_container_->Contains(bubble_delegate->GetAnchorView())) { |
1175 bubble_manager_->StartObserving(transient_child); | 1178 bubble_manager_->StartObserving(transient_child); |
1176 } | 1179 } |
1177 } | 1180 } |
1178 } | 1181 } |
OLD | NEW |