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

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: fit nit. 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(
271 (height() - image_view_->GetPreferredSize().height()) / 2);
272 label_view_->SetY(
273 (height() - label_view_->GetPreferredSize().height()) / 2);
274 }
275
267 void Update() { 276 void Update() {
268 bool wifi_enabled = NetworkHandler::Get()->network_state_handler()-> 277 bool wifi_enabled = NetworkHandler::Get()->network_state_handler()->
269 IsTechnologyEnabled(flimflam::kTypeWifi); 278 IsTechnologyEnabled(flimflam::kTypeWifi);
270 const int image_id = wifi_enabled ? 279 const int image_id = wifi_enabled ?
271 IDR_AURA_UBER_TRAY_WIFI_ENABLED : IDR_AURA_UBER_TRAY_WIFI_DISABLED; 280 IDR_AURA_UBER_TRAY_WIFI_ENABLED : IDR_AURA_UBER_TRAY_WIFI_DISABLED;
272 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 281 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
273 image_view_->SetImage(bundle.GetImageNamed(image_id).ToImageSkia()); 282 image_view_->SetImage(bundle.GetImageNamed(image_id).ToImageSkia());
274 283
275 const int string_id = wifi_enabled ? 284 const int string_id = wifi_enabled ?
276 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED : 285 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED :
277 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_DISABLED; 286 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_DISABLED;
278 label_view_->SetText(bundle.GetLocalizedString(string_id)); 287 label_view_->SetText(bundle.GetLocalizedString(string_id));
288 label_view_->SizeToFit(kTrayPopupMinWidth -
289 kTrayPopupPaddingHorizontal * 2 - kTrayPopupPaddingBetweenItems -
290 kTrayPopupDetailsIconWidth);
279 } 291 }
280 292
281 views::ImageView* image_view_; 293 views::ImageView* image_view_;
282 views::Label* label_view_; 294 views::Label* label_view_;
283 295
284 DISALLOW_COPY_AND_ASSIGN(NetworkWifiDetailedView); 296 DISALLOW_COPY_AND_ASSIGN(NetworkWifiDetailedView);
285 }; 297 };
286 298
287 class NetworkMessageView : public views::View, 299 class NetworkMessageView : public views::View,
288 public views::LinkListener { 300 public views::LinkListener {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 550
539 void TrayNetwork::LinkClicked(MessageType message_type, int link_id) { 551 void TrayNetwork::LinkClicked(MessageType message_type, int link_id) {
540 tray::NetworkMessages::MessageMap::const_iterator iter = 552 tray::NetworkMessages::MessageMap::const_iterator iter =
541 messages()->messages().find(message_type); 553 messages()->messages().find(message_type);
542 if (iter != messages()->messages().end() && iter->second.delegate) 554 if (iter != messages()->messages().end() && iter->second.delegate)
543 iter->second.delegate->NotificationLinkClicked(message_type, link_id); 555 iter->second.delegate->NotificationLinkClicked(message_type, link_id);
544 } 556 }
545 557
546 } // namespace internal 558 } // namespace internal
547 } // namespace ash 559 } // 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