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

Side by Side Diff: ash/system/network/tray_network.cc

Issue 10876091: Show tooltips on ash tray network items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ash/system/bluetooth/tray_bluetooth.cc ('k') | ash/tooltips/tooltip_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ash/system/network/tray_network.h" 5 #include "ash/system/network/tray_network.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/system/tray/system_tray.h" 9 #include "ash/system/tray/system_tray.h"
10 #include "ash/system/tray/system_tray_delegate.h" 10 #include "ash/system/tray/system_tray_delegate.h"
11 #include "ash/system/tray/tray_constants.h" 11 #include "ash/system/tray/tray_constants.h"
12 #include "ash/system/tray/tray_details_view.h" 12 #include "ash/system/tray/tray_details_view.h"
13 #include "ash/system/tray/tray_item_more.h" 13 #include "ash/system/tray/tray_item_more.h"
14 #include "ash/system/tray/tray_item_view.h" 14 #include "ash/system/tray/tray_item_view.h"
15 #include "ash/system/tray/tray_notification_view.h" 15 #include "ash/system/tray/tray_notification_view.h"
16 #include "ash/system/tray/tray_views.h" 16 #include "ash/system/tray/tray_views.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "grit/ash_strings.h" 18 #include "grit/ash_strings.h"
19 #include "grit/ui_resources.h" 19 #include "grit/ui_resources.h"
20 #include "third_party/skia/include/core/SkColor.h" 20 #include "third_party/skia/include/core/SkColor.h"
21 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
22 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/gfx/canvas.h" 24 #include "ui/gfx/canvas.h"
24 #include "ui/gfx/font.h" 25 #include "ui/gfx/font.h"
25 #include "ui/gfx/image/image.h" 26 #include "ui/gfx/image/image.h"
26 #include "ui/gfx/skia_util.h" 27 #include "ui/gfx/skia_util.h"
27 #include "ui/views/bubble/bubble_border.h" 28 #include "ui/views/bubble/bubble_border.h"
28 #include "ui/views/bubble/bubble_delegate.h" 29 #include "ui/views/bubble/bubble_delegate.h"
29 #include "ui/views/controls/button/button.h" 30 #include "ui/views/controls/button/button.h"
30 #include "ui/views/controls/button/image_button.h" 31 #include "ui/views/controls/button/image_button.h"
31 #include "ui/views/controls/image_view.h" 32 #include "ui/views/controls/image_view.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 CreateSpecialRow(IDS_ASH_STATUS_TRAY_NETWORK, this); 277 CreateSpecialRow(IDS_ASH_STATUS_TRAY_NETWORK, this);
277 } 278 }
278 279
279 void AppendHeaderButtons() { 280 void AppendHeaderButtons() {
280 button_wifi_ = new TrayPopupHeaderButton(this, 281 button_wifi_ = new TrayPopupHeaderButton(this,
281 IDR_AURA_UBER_TRAY_WIFI_ENABLED, 282 IDR_AURA_UBER_TRAY_WIFI_ENABLED,
282 IDR_AURA_UBER_TRAY_WIFI_DISABLED, 283 IDR_AURA_UBER_TRAY_WIFI_DISABLED,
283 IDR_AURA_UBER_TRAY_WIFI_ENABLED_HOVER, 284 IDR_AURA_UBER_TRAY_WIFI_ENABLED_HOVER,
284 IDR_AURA_UBER_TRAY_WIFI_DISABLED_HOVER, 285 IDR_AURA_UBER_TRAY_WIFI_DISABLED_HOVER,
285 IDS_ASH_STATUS_TRAY_WIFI); 286 IDS_ASH_STATUS_TRAY_WIFI);
287 button_wifi_->SetTooltipText(
288 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISABLE_WIFI));
289 button_wifi_->SetToggledTooltipText(
290 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ENABLE_WIFI));
286 footer()->AddButton(button_wifi_); 291 footer()->AddButton(button_wifi_);
287 292
288 button_mobile_ = new TrayPopupHeaderButton(this, 293 button_mobile_ = new TrayPopupHeaderButton(this,
289 IDR_AURA_UBER_TRAY_CELLULAR_ENABLED, 294 IDR_AURA_UBER_TRAY_CELLULAR_ENABLED,
290 IDR_AURA_UBER_TRAY_CELLULAR_DISABLED, 295 IDR_AURA_UBER_TRAY_CELLULAR_DISABLED,
291 IDR_AURA_UBER_TRAY_CELLULAR_ENABLED_HOVER, 296 IDR_AURA_UBER_TRAY_CELLULAR_ENABLED_HOVER,
292 IDR_AURA_UBER_TRAY_CELLULAR_DISABLED_HOVER, 297 IDR_AURA_UBER_TRAY_CELLULAR_DISABLED_HOVER,
293 IDS_ASH_STATUS_TRAY_CELLULAR); 298 IDS_ASH_STATUS_TRAY_CELLULAR);
299 button_mobile_->SetTooltipText(
300 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISABLE_MOBILE));
301 button_mobile_->SetToggledTooltipText(
302 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ENABLE_MOBILE));
294 footer()->AddButton(button_mobile_); 303 footer()->AddButton(button_mobile_);
295 304
296 info_icon_ = new TrayPopupHeaderButton(this, 305 info_icon_ = new TrayPopupHeaderButton(this,
297 IDR_AURA_UBER_TRAY_NETWORK_INFO, 306 IDR_AURA_UBER_TRAY_NETWORK_INFO,
298 IDR_AURA_UBER_TRAY_NETWORK_INFO, 307 IDR_AURA_UBER_TRAY_NETWORK_INFO,
299 IDR_AURA_UBER_TRAY_NETWORK_INFO_HOVER, 308 IDR_AURA_UBER_TRAY_NETWORK_INFO_HOVER,
300 IDR_AURA_UBER_TRAY_NETWORK_INFO_HOVER, 309 IDR_AURA_UBER_TRAY_NETWORK_INFO_HOVER,
301 IDS_ASH_STATUS_TRAY_NETWORK_INFO); 310 IDS_ASH_STATUS_TRAY_NETWORK_INFO);
311 info_icon_->SetTooltipText(
312 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_INFO));
302 footer()->AddButton(info_icon_); 313 footer()->AddButton(info_icon_);
303 } 314 }
304 315
305 void UpdateHeaderButtons() { 316 void UpdateHeaderButtons() {
306 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); 317 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate();
307 button_wifi_->SetToggled(!delegate->GetWifiEnabled()); 318 button_wifi_->SetToggled(!delegate->GetWifiEnabled());
308 button_mobile_->SetToggled(!delegate->GetMobileEnabled()); 319 button_mobile_->SetToggled(!delegate->GetMobileEnabled());
309 button_mobile_->SetVisible(delegate->GetMobileAvailable()); 320 button_mobile_->SetVisible(delegate->GetMobileAvailable());
310 if (proxy_settings_) 321 if (proxy_settings_)
311 proxy_settings_->SetEnabled(delegate->IsNetworkConnected()); 322 proxy_settings_->SetEnabled(delegate->IsNetworkConnected());
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 886
876 void TrayNetwork::LinkClicked(ErrorType error_type) { 887 void TrayNetwork::LinkClicked(ErrorType error_type) {
877 tray::NetworkErrors::ErrorMap::const_iterator iter = 888 tray::NetworkErrors::ErrorMap::const_iterator iter =
878 errors()->messages().find(error_type); 889 errors()->messages().find(error_type);
879 if (iter != errors()->messages().end() && iter->second.delegate) 890 if (iter != errors()->messages().end() && iter->second.delegate)
880 iter->second.delegate->NotificationLinkClicked(); 891 iter->second.delegate->NotificationLinkClicked();
881 } 892 }
882 893
883 } // namespace internal 894 } // namespace internal
884 } // namespace ash 895 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/bluetooth/tray_bluetooth.cc ('k') | ash/tooltips/tooltip_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698