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

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

Issue 22601007: Adjust wifi toggle message layout to avoid the wrapping of the message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | « no previous file | no next file » | 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/chromeos/network/tray_network.h" 5 #include "ash/system/chromeos/network/tray_network.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/system/chromeos/network/network_icon_animation.h" 9 #include "ash/system/chromeos/network/network_icon_animation.h"
10 #include "ash/system/chromeos/network/network_state_list_detailed_view.h" 10 #include "ash/system/chromeos/network/network_state_list_detailed_view.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 virtual void NetworkListChanged() OVERRIDE { 258 virtual void NetworkListChanged() OVERRIDE {
259 Update(); 259 Update();
260 } 260 }
261 261
262 virtual void NetworkServiceChanged( 262 virtual void NetworkServiceChanged(
263 const chromeos::NetworkState* network) OVERRIDE { 263 const chromeos::NetworkState* network) OVERRIDE {
264 } 264 }
265 265
266 private: 266 private:
267 virtual void Layout() OVERRIDE {
268 // Center both views vertically.
269 views::View::Layout();
270 image_view_->SetY((height()-image_view_->GetPreferredSize().height())/2);
271 label_view_->SetY((height()-label_view_->GetPreferredSize().height())/2);
stevenjb 2013/08/09 23:54:47 ' ' around '-' and '/' for both lines
jennyz 2013/08/10 00:13:57 Done.
272 }
273
267 void Update() { 274 void Update() {
268 bool wifi_enabled = NetworkHandler::Get()->network_state_handler()-> 275 bool wifi_enabled = NetworkHandler::Get()->network_state_handler()->
269 IsTechnologyEnabled(flimflam::kTypeWifi); 276 IsTechnologyEnabled(flimflam::kTypeWifi);
270 const int image_id = wifi_enabled ? 277 const int image_id = wifi_enabled ?
271 IDR_AURA_UBER_TRAY_WIFI_ENABLED : IDR_AURA_UBER_TRAY_WIFI_DISABLED; 278 IDR_AURA_UBER_TRAY_WIFI_ENABLED : IDR_AURA_UBER_TRAY_WIFI_DISABLED;
272 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 279 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
273 image_view_->SetImage(bundle.GetImageNamed(image_id).ToImageSkia()); 280 image_view_->SetImage(bundle.GetImageNamed(image_id).ToImageSkia());
274 281
275 const int string_id = wifi_enabled ? 282 const int string_id = wifi_enabled ?
276 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED : 283 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED :
277 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_DISABLED; 284 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_DISABLED;
278 label_view_->SetText(bundle.GetLocalizedString(string_id)); 285 label_view_->SetText(bundle.GetLocalizedString(string_id));
286 label_view_->SizeToFit(kTrayPopupMinWidth -
287 kTrayPopupPaddingHorizontal * 2 - kTrayPopupPaddingBetweenItems -
288 kTrayPopupDetailsIconWidth);
279 } 289 }
280 290
281 views::ImageView* image_view_; 291 views::ImageView* image_view_;
282 views::Label* label_view_; 292 views::Label* label_view_;
283 293
284 DISALLOW_COPY_AND_ASSIGN(NetworkWifiDetailedView); 294 DISALLOW_COPY_AND_ASSIGN(NetworkWifiDetailedView);
285 }; 295 };
286 296
287 class NetworkMessageView : public views::View, 297 class NetworkMessageView : public views::View,
288 public views::LinkListener { 298 public views::LinkListener {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 548
539 void TrayNetwork::LinkClicked(MessageType message_type, int link_id) { 549 void TrayNetwork::LinkClicked(MessageType message_type, int link_id) {
540 tray::NetworkMessages::MessageMap::const_iterator iter = 550 tray::NetworkMessages::MessageMap::const_iterator iter =
541 messages()->messages().find(message_type); 551 messages()->messages().find(message_type);
542 if (iter != messages()->messages().end() && iter->second.delegate) 552 if (iter != messages()->messages().end() && iter->second.delegate)
543 iter->second.delegate->NotificationLinkClicked(message_type, link_id); 553 iter->second.delegate->NotificationLinkClicked(message_type, link_id);
544 } 554 }
545 555
546 } // namespace internal 556 } // namespace internal
547 } // namespace ash 557 } // namespace ash
OLDNEW
« 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