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

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

Issue 10202012: Revert 133691 because it accidentally reverted revs 133686 and 133684. (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 | « ash/status_area/status_area_view.cc ('k') | ash/system/tray/system_tray.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ash/status_area/status_area_view.cc ('k') | ash/system/tray/system_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698