OLD | NEW |
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/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/chromeos/network/network_list_detailed_view_base.h" | 8 #include "ash/system/chromeos/network/network_list_detailed_view_base.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" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 IDR_AURA_UBER_TRAY_WIFI_ENABLED : IDR_AURA_UBER_TRAY_WIFI_DISABLED; | 372 IDR_AURA_UBER_TRAY_WIFI_ENABLED : IDR_AURA_UBER_TRAY_WIFI_DISABLED; |
373 image->SetImage(bundle.GetImageNamed(image_id).ToImageSkia()); | 373 image->SetImage(bundle.GetImageNamed(image_id).ToImageSkia()); |
374 AddChildView(image); | 374 AddChildView(image); |
375 | 375 |
376 const int string_id = wifi_enabled ? | 376 const int string_id = wifi_enabled ? |
377 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED: | 377 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED: |
378 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_DISABLED; | 378 IDS_ASH_STATUS_TRAY_NETWORK_WIFI_DISABLED; |
379 views::Label* label = | 379 views::Label* label = |
380 new views::Label(bundle.GetLocalizedString(string_id)); | 380 new views::Label(bundle.GetLocalizedString(string_id)); |
381 label->SetMultiLine(true); | 381 label->SetMultiLine(true); |
382 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 382 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
383 AddChildView(label); | 383 AddChildView(label); |
384 } | 384 } |
385 | 385 |
386 virtual ~NetworkWifiDetailedView() {} | 386 virtual ~NetworkWifiDetailedView() {} |
387 | 387 |
388 // Overridden from NetworkDetailedView: | 388 // Overridden from NetworkDetailedView: |
389 | 389 |
390 virtual void Init() OVERRIDE { | 390 virtual void Init() OVERRIDE { |
391 } | 391 } |
392 | 392 |
(...skipping 13 matching lines...) Expand all Loading... |
406 NetworkMessageView(TrayNetwork* tray, | 406 NetworkMessageView(TrayNetwork* tray, |
407 TrayNetwork::MessageType message_type, | 407 TrayNetwork::MessageType message_type, |
408 const NetworkMessages::Message& network_msg) | 408 const NetworkMessages::Message& network_msg) |
409 : tray_(tray), | 409 : tray_(tray), |
410 message_type_(message_type) { | 410 message_type_(message_type) { |
411 SetLayoutManager( | 411 SetLayoutManager( |
412 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); | 412 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); |
413 | 413 |
414 if (!network_msg.title.empty()) { | 414 if (!network_msg.title.empty()) { |
415 views::Label* title = new views::Label(network_msg.title); | 415 views::Label* title = new views::Label(network_msg.title); |
416 title->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 416 title->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
417 title->SetFont(title->font().DeriveFont(0, gfx::Font::BOLD)); | 417 title->SetFont(title->font().DeriveFont(0, gfx::Font::BOLD)); |
418 AddChildView(title); | 418 AddChildView(title); |
419 } | 419 } |
420 | 420 |
421 if (!network_msg.message.empty()) { | 421 if (!network_msg.message.empty()) { |
422 views::Label* message = new views::Label(network_msg.message); | 422 views::Label* message = new views::Label(network_msg.message); |
423 message->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 423 message->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
424 message->SetMultiLine(true); | 424 message->SetMultiLine(true); |
425 message->SizeToFit(kTrayNotificationContentsWidth); | 425 message->SizeToFit(kTrayNotificationContentsWidth); |
426 AddChildView(message); | 426 AddChildView(message); |
427 } | 427 } |
428 | 428 |
429 if (!network_msg.links.empty()) { | 429 if (!network_msg.links.empty()) { |
430 for (size_t i = 0; i < network_msg.links.size(); ++i) { | 430 for (size_t i = 0; i < network_msg.links.size(); ++i) { |
431 views::Link* link = new views::Link(network_msg.links[i]); | 431 views::Link* link = new views::Link(network_msg.links[i]); |
432 link->set_id(i); | 432 link->set_id(i); |
433 link->set_listener(this); | 433 link->set_listener(this); |
434 link->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 434 link->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
435 link->SetMultiLine(true); | 435 link->SetMultiLine(true); |
436 link->SizeToFit(kTrayNotificationContentsWidth); | 436 link->SizeToFit(kTrayNotificationContentsWidth); |
437 AddChildView(link); | 437 AddChildView(link); |
438 } | 438 } |
439 } | 439 } |
440 } | 440 } |
441 | 441 |
442 virtual ~NetworkMessageView() { | 442 virtual ~NetworkMessageView() { |
443 } | 443 } |
444 | 444 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 | 623 |
624 void TrayNetwork::LinkClicked(MessageType message_type, int link_id) { | 624 void TrayNetwork::LinkClicked(MessageType message_type, int link_id) { |
625 tray::NetworkMessages::MessageMap::const_iterator iter = | 625 tray::NetworkMessages::MessageMap::const_iterator iter = |
626 messages()->messages().find(message_type); | 626 messages()->messages().find(message_type); |
627 if (iter != messages()->messages().end() && iter->second.delegate) | 627 if (iter != messages()->messages().end() && iter->second.delegate) |
628 iter->second.delegate->NotificationLinkClicked(link_id); | 628 iter->second.delegate->NotificationLinkClicked(link_id); |
629 } | 629 } |
630 | 630 |
631 } // namespace internal | 631 } // namespace internal |
632 } // namespace ash | 632 } // namespace ash |
OLD | NEW |