Index: ash/system/network/tray_network.cc |
=================================================================== |
--- ash/system/network/tray_network.cc (revision 133697) |
+++ ash/system/network/tray_network.cc (working copy) |
@@ -379,17 +379,24 @@ |
} |
void ToggleInfoBubble() { |
- if (info_bubble_) { |
- info_bubble_->GetWidget()->CloseNow(); |
- info_bubble_ = NULL; |
+ if (ResetInfoBubble()) |
return; |
- } |
+ |
info_bubble_ = new NonActivatableSettingsBubble( |
info_icon_, CreateNetworkInfoView()); |
views::BubbleDelegateView::CreateBubble(info_bubble_); |
info_bubble_->Show(); |
} |
+ // Returns whether an existing info-bubble was closed. |
+ bool ResetInfoBubble() { |
+ if (!info_bubble_) |
+ return false; |
+ info_bubble_->GetWidget()->Close(); |
+ info_bubble_ = NULL; |
+ return true; |
+ } |
+ |
// Overridden from views::View. |
virtual void Layout() OVERRIDE { |
views::View::Layout(); |
@@ -410,9 +417,15 @@ |
const views::Event& event) OVERRIDE { |
ash::SystemTrayDelegate* delegate = |
ash::Shell::GetInstance()->tray_delegate(); |
- if (sender == info_icon_) |
+ if (sender == info_icon_) { |
ToggleInfoBubble(); |
- else if (sender == button_wifi_) |
+ return; |
+ } |
+ |
+ // If the info bubble was visible, close it when some other item is clicked |
+ // on. |
+ ResetInfoBubble(); |
+ if (sender == button_wifi_) |
delegate->ToggleWifi(); |
else if (sender == button_cellular_) |
delegate->ToggleCellular(); |
@@ -434,10 +447,7 @@ |
ash::Shell::GetInstance()->tray_delegate(); |
// If the info bubble was visible, close it when some other item is clicked |
// on. |
- if (info_bubble_) { |
- info_bubble_->GetWidget()->Close(); |
- info_bubble_ = NULL; |
- } |
+ ResetInfoBubble(); |
if (sender == header_text_) |
Shell::GetInstance()->tray()->ShowDefaultView(); |
Property changes on: ash/system/network/tray_network.cc |
___________________________________________________________________ |
Added: svn:mergeinfo |