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

Unified Diff: ash/system/network/tray_network.cc

Issue 10206016: ash: Make sure the network info bubble is closed when clicking on other items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/network/tray_network.cc
diff --git a/ash/system/network/tray_network.cc b/ash/system/network/tray_network.cc
index f3aedef6538addd8e2e24f79570ab035e8da22ea..1dd542b6b0a7e7d1e42cd814c7ed6585d23d7d12 100644
--- a/ash/system/network/tray_network.cc
+++ b/ash/system/network/tray_network.cc
@@ -379,17 +379,24 @@ class NetworkDetailedView : public views::View,
}
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 @@ class NetworkDetailedView : public views::View,
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 @@ class NetworkDetailedView : public views::View,
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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698