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

Side by Side Diff: chrome/browser/chromeos/status/network_menu_icon.cc

Issue 12186029: Merge 180012 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 years, 10 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 | « chrome/browser/chromeos/status/network_menu_icon.h ('k') | 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 "chrome/browser/chromeos/status/network_menu_icon.h" 5 #include "chrome/browser/chromeos/status/network_menu_icon.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
11 11
12 #include "ash/system/chromeos/network/network_icon_animation.h"
12 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" 14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
14 #include "chrome/browser/chromeos/cros/cros_library.h" 15 #include "chrome/browser/chromeos/cros/cros_library.h"
15 #include "grit/ash_resources.h" 16 #include "grit/ash_resources.h"
16 #include "grit/ash_strings.h" 17 #include "grit/ash_strings.h"
17 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
18 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/gfx/canvas.h" 21 #include "ui/gfx/canvas.h"
21 #include "ui/gfx/image/image_skia_operations.h" 22 #include "ui/gfx/image/image_skia_operations.h"
22 #include "ui/gfx/image/image_skia_source.h" 23 #include "ui/gfx/image/image_skia_source.h"
23 #include "ui/gfx/size_conversions.h" 24 #include "ui/gfx/size_conversions.h"
24 25
25 using std::max; 26 using std::max;
26 using std::min; 27 using std::min;
27 28
29 using ash::network_icon::NetworkIconAnimation;
30
28 namespace chromeos { 31 namespace chromeos {
29 32
30 namespace { 33 namespace {
31 34
32 // Amount to fade icons while connecting. 35 // Amount to fade icons while connecting.
33 const double kConnectingImageAlpha = 0.5; 36 const double kConnectingImageAlpha = 0.5;
34 37
35 // Animation cycle length.
36 const int kThrobDurationMs = 750;
37
38 // Images for strength bars for wired networks. 38 // Images for strength bars for wired networks.
39 const int kNumBarsImages = 5; 39 const int kNumBarsImages = 5;
40 gfx::ImageSkia* kBarsImagesAnimatingDark[kNumBarsImages - 1]; 40 gfx::ImageSkia* kBarsImagesAnimatingDark[kNumBarsImages - 1];
41 gfx::ImageSkia* kBarsImagesAnimatingLight[kNumBarsImages - 1]; 41 gfx::ImageSkia* kBarsImagesAnimatingLight[kNumBarsImages - 1];
42 42
43 // Imagaes for strength arcs for wireless networks. 43 // Imagaes for strength arcs for wireless networks.
44 const int kNumArcsImages = 5; 44 const int kNumArcsImages = 5;
45 gfx::ImageSkia* kArcsImagesAnimatingDark[kNumArcsImages - 1]; 45 gfx::ImageSkia* kArcsImagesAnimatingDark[kNumArcsImages - 1];
46 gfx::ImageSkia* kArcsImagesAnimatingLight[kNumArcsImages - 1]; 46 gfx::ImageSkia* kArcsImagesAnimatingLight[kNumArcsImages - 1];
47 47
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // Clears any previous state then sets the base icon and badges. 275 // Clears any previous state then sets the base icon and badges.
276 void UpdateIcon(const Network* network); 276 void UpdateIcon(const Network* network);
277 277
278 // Generates the image. Call after setting the icon and badges. 278 // Generates the image. Call after setting the icon and badges.
279 void GenerateImage(); 279 void GenerateImage();
280 280
281 const gfx::ImageSkia GetImage() const { return image_; } 281 const gfx::ImageSkia GetImage() const { return image_; }
282 282
283 bool ShouldShowInTray() const; 283 bool ShouldShowInTray() const;
284 284
285 ConnectionType type() { return type_; }
285 void set_type(ConnectionType type) { type_ = type; } 286 void set_type(ConnectionType type) { type_ = type; }
286 void set_state(ConnectionState state) { state_ = state; } 287 void set_state(ConnectionState state) { state_ = state; }
287 void set_icon(const gfx::ImageSkia& icon) { icon_ = icon; } 288 void set_icon(const gfx::ImageSkia& icon) { icon_ = icon; }
288 void set_top_left_badge(const gfx::ImageSkia* badge) { 289 void set_top_left_badge(const gfx::ImageSkia* badge) {
289 top_left_badge_ = badge; 290 top_left_badge_ = badge;
290 } 291 }
291 void set_top_right_badge(const gfx::ImageSkia* badge) { 292 void set_top_right_badge(const gfx::ImageSkia* badge) {
292 top_right_badge_ = badge; 293 top_right_badge_ = badge;
293 } 294 }
294 void set_bottom_left_badge(const gfx::ImageSkia* badge) { 295 void set_bottom_left_badge(const gfx::ImageSkia* badge) {
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 return dirty; 601 return dirty;
601 } 602 }
602 603
603 //////////////////////////////////////////////////////////////////////////////// 604 ////////////////////////////////////////////////////////////////////////////////
604 // NetworkMenuIcon 605 // NetworkMenuIcon
605 606
606 NetworkMenuIcon::NetworkMenuIcon(Delegate* delegate, Mode mode) 607 NetworkMenuIcon::NetworkMenuIcon(Delegate* delegate, Mode mode)
607 : mode_(mode), 608 : mode_(mode),
608 delegate_(delegate), 609 delegate_(delegate),
609 resource_color_theme_(COLOR_DARK), 610 resource_color_theme_(COLOR_DARK),
610 ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)), 611 connecting_index_(-1) {
611 connecting_network_(NULL) {
612 // Set up the connection animation throbber.
613 animation_connecting_.SetThrobDuration(kThrobDurationMs);
614 animation_connecting_.SetTweenType(ui::Tween::LINEAR);
615
616 // Initialize the icon. 612 // Initialize the icon.
617 icon_.reset(new NetworkIcon(resource_color_theme_)); 613 icon_.reset(new NetworkIcon(resource_color_theme_));
618 } 614 }
619 615
620 NetworkMenuIcon::~NetworkMenuIcon() { 616 NetworkMenuIcon::~NetworkMenuIcon() {
621 } 617 }
622 618
623 // Public methods: 619 // Public methods:
624 620
625 void NetworkMenuIcon::SetResourceColorTheme(ResourceColorTheme color) { 621 void NetworkMenuIcon::SetResourceColorTheme(ResourceColorTheme color) {
626 if (color == resource_color_theme_) 622 if (color == resource_color_theme_)
627 return; 623 return;
628 624
629 resource_color_theme_ = color; 625 resource_color_theme_ = color;
630 icon_.reset(new NetworkIcon(resource_color_theme_)); 626 icon_.reset(new NetworkIcon(resource_color_theme_));
631 } 627 }
632 628
633 bool NetworkMenuIcon::ShouldShowIconInTray() { 629 bool NetworkMenuIcon::ShouldShowIconInTray() {
634 if (!icon_.get()) 630 if (!icon_.get())
635 return false; 631 return false;
636 return icon_->ShouldShowInTray(); 632 return icon_->ShouldShowInTray();
637 } 633 }
638 634
639 const gfx::ImageSkia NetworkMenuIcon::GetIconAndText(string16* text) { 635 const gfx::ImageSkia NetworkMenuIcon::GetIconAndText(string16* text) {
640 SetIconAndText(); 636 if (SetIconAndText())
637 NetworkIconAnimation::GetInstance()->AddObserver(this);
638 else
639 NetworkIconAnimation::GetInstance()->RemoveObserver(this);
641 if (text) 640 if (text)
642 *text = text_; 641 *text = text_;
643 icon_->GenerateImage(); 642 icon_->GenerateImage();
644 return icon_->GetImage(); 643 return icon_->GetImage();
645 } 644 }
646 645
647 const gfx::ImageSkia NetworkMenuIcon::GetVpnIconAndText(string16* text) { 646 const gfx::ImageSkia NetworkMenuIcon::GetVpnIconAndText(string16* text) {
648 SetVpnIconAndText(); 647 if (SetVpnIconAndText())
648 NetworkIconAnimation::GetInstance()->AddObserver(this);
649 else
650 NetworkIconAnimation::GetInstance()->RemoveObserver(this);
649 if (text) 651 if (text)
650 *text = text_; 652 *text = text_;
651 icon_->GenerateImage(); 653 icon_->GenerateImage();
652 return icon_->GetImage(); 654 return icon_->GetImage();
653 } 655 }
654 656
655 void NetworkMenuIcon::AnimationProgressed(const ui::Animation* animation) { 657 void NetworkMenuIcon::NetworkIconChanged() {
656 if (animation == &animation_connecting_ && delegate_) { 658 if (!delegate_ || !icon_.get())
657 // Only update the connecting network from here. 659 return;
658 if (GetConnectingNetwork() == connecting_network_) 660 // Only send a message when the icon would change.
659 delegate_->NetworkMenuIconChanged(); 661 int connecting_index = GetConnectingIndex();
662 if (connecting_index != connecting_index_) {
663 connecting_index_ = connecting_index;
664 delegate_->NetworkMenuIconChanged();
660 } 665 }
661 } 666 }
662 667
663 // Private methods: 668 // Private methods:
664 669
665 // If disconnected: returns any connecting non-ethernet network. 670 // If disconnected: returns any connecting non-ethernet network.
666 // Otherwise, only return a network if the conenction was user initiated. 671 // Otherwise, only return a network if the conenction was user initiated.
667 const Network* NetworkMenuIcon::GetConnectingNetwork() { 672 const Network* NetworkMenuIcon::GetConnectingNetwork() {
668 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); 673 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
669 const Network* connecting_network = cros->connecting_network(); 674 const Network* connecting_network = cros->connecting_network();
670 if (connecting_network && 675 if (connecting_network &&
671 connecting_network->type() != TYPE_ETHERNET && 676 connecting_network->type() != TYPE_ETHERNET &&
672 (!cros->connected_network() || 677 (!cros->connected_network() ||
673 connecting_network->connection_started())) { 678 connecting_network->connection_started())) {
674 return connecting_network; 679 return connecting_network;
675 } 680 }
676 return NULL; 681 return NULL;
677 } 682 }
678 683
679 double NetworkMenuIcon::GetAnimation() { 684 double NetworkMenuIcon::GetAnimation() {
680 if (!animation_connecting_.is_animating()) { 685 return NetworkIconAnimation::GetInstance()->GetAnimation();
681 animation_connecting_.Reset();
682 animation_connecting_.StartThrobbing(-1 /*throb indefinitely*/);
683 return 0;
684 }
685 return animation_connecting_.GetCurrentValue();
686 } 686 }
687 687
688 int NetworkMenuIcon::GetConnectingIndex() {
689 DCHECK(icon_.get());
690 double animation = GetAnimation();
691 int image_count =
692 (icon_->type() == TYPE_WIFI) ? kNumArcsImages - 1 : kNumBarsImages - 1;
693 int index = animation * nextafter(static_cast<float>(image_count), 0);
694 return std::max(std::min(index, image_count - 1), 0);
695 }
696
697
688 // TODO(stevenjb): move below SetIconAndText. 698 // TODO(stevenjb): move below SetIconAndText.
689 void NetworkMenuIcon::SetConnectingIconAndText() { 699 void NetworkMenuIcon::SetConnectingIconAndText(
690 int image_count; 700 const Network* connecting_network) {
691 ImageType image_type; 701 connecting_network_ = connecting_network;
692 gfx::ImageSkia** images;
693
694 ConnectionType type; 702 ConnectionType type;
695 ConnectionState state; 703 ConnectionState state;
696 if (connecting_network_) { 704 if (connecting_network_) {
697 type = connecting_network_->type(); 705 type = connecting_network_->type();
698 state = connecting_network_->state(); 706 state = connecting_network_->state();
699 if (mode_ == MENU_MODE) { 707 if (mode_ == MENU_MODE) {
700 text_ = l10n_util::GetStringFUTF16( 708 text_ = l10n_util::GetStringFUTF16(
701 IDS_STATUSBAR_NETWORK_CONNECTING_TOOLTIP, 709 IDS_STATUSBAR_NETWORK_CONNECTING_TOOLTIP,
702 UTF8ToUTF16(connecting_network_->name())); 710 UTF8ToUTF16(connecting_network_->name()));
703 } else { 711 } else {
704 text_ = UTF8ToUTF16(connecting_network_->name()); 712 text_ = UTF8ToUTF16(connecting_network_->name());
705 } 713 }
706 } else { 714 } else {
707 // When called with no connecting network, cellular is initializing. 715 // When called with no connecting network, cellular is initializing.
708 type = TYPE_CELLULAR; 716 type = TYPE_CELLULAR;
709 state = STATE_ASSOCIATION; 717 state = STATE_ASSOCIATION;
710 text_ = l10n_util::GetStringUTF16( 718 text_ = l10n_util::GetStringUTF16(
711 IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR); 719 IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR);
712 } 720 }
713 icon_->set_type(type); 721 icon_->set_type(type);
714 icon_->set_state(state); 722 icon_->set_state(state);
715 723
724 ImageType image_type;
725 gfx::ImageSkia** images;
716 if (type == TYPE_WIFI) { 726 if (type == TYPE_WIFI) {
717 image_count = kNumArcsImages - 1;
718 image_type = ARCS; 727 image_type = ARCS;
719 images = resource_color_theme_ == COLOR_DARK ? kArcsImagesAnimatingDark : 728 images = resource_color_theme_ == COLOR_DARK ? kArcsImagesAnimatingDark :
720 kArcsImagesAnimatingLight; 729 kArcsImagesAnimatingLight;
721 } else { 730 } else {
722 image_count = kNumBarsImages - 1;
723 image_type = BARS; 731 image_type = BARS;
724 images = resource_color_theme_ == COLOR_DARK ? kBarsImagesAnimatingDark : 732 images = resource_color_theme_ == COLOR_DARK ? kBarsImagesAnimatingDark :
725 kBarsImagesAnimatingLight; 733 kBarsImagesAnimatingLight;
726 } 734 }
727 int index = GetAnimation() * nextafter(static_cast<float>(image_count), 0); 735 int index = GetConnectingIndex();
728 index = std::max(std::min(index, image_count - 1), 0);
729 736
730 // Lazily cache images. 737 // Lazily cache images.
731 if (!images[index]) { 738 if (!images[index]) {
732 gfx::ImageSkia source = 739 gfx::ImageSkia source =
733 GetImage(image_type, index + 1, resource_color_theme_); 740 GetImage(image_type, index + 1, resource_color_theme_);
734 images[index] = 741 images[index] =
735 new gfx::ImageSkia(NetworkMenuIcon::GenerateConnectingImage(source)); 742 new gfx::ImageSkia(NetworkMenuIcon::GenerateConnectingImage(source));
736 } 743 }
737 icon_->set_icon(*images[index]); 744 icon_->set_icon(*images[index]);
738 if (connecting_network_) 745 if (connecting_network_)
739 icon_->SetBadges(connecting_network_); 746 icon_->SetBadges(connecting_network_);
740 } 747 }
741 748
742 // Sets up the icon and badges for GenerateBitmap(). 749 // Sets up the icon and badges for GenerateBitmap().
743 void NetworkMenuIcon::SetIconAndText() { 750 bool NetworkMenuIcon::SetIconAndText() {
744 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); 751 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
745 DCHECK(cros); 752 DCHECK(cros);
746 753
747 icon_->ClearIconAndBadges(); 754 icon_->ClearIconAndBadges();
748 755
749 // If we are connecting to a network and it was user-initiated or we are 756 // If we are connecting to a network and it was user-initiated or we are
750 // not connected, display that. 757 // not connected, display that.
751 connecting_network_ = GetConnectingNetwork(); 758 const Network* connecting_network = GetConnectingNetwork();
752 if (connecting_network_) { 759 if (connecting_network) {
753 SetConnectingIconAndText(); 760 SetConnectingIconAndText(connecting_network);
754 return; 761 return true;
755 } 762 }
756 763
757 // If not connecting to a network, show the active or connected network. 764 // If not connecting to a network, show the active or connected network.
758 const Network* network; 765 const Network* network;
759 if (mode_ == DROPDOWN_MODE && cros->connected_network()) 766 if (mode_ == DROPDOWN_MODE && cros->connected_network())
760 network = cros->connected_network(); 767 network = cros->connected_network();
761 else 768 else
762 network = cros->active_nonvirtual_network(); 769 network = cros->active_nonvirtual_network();
763 if (network) { 770 if (network)
764 SetActiveNetworkIconAndText(network); 771 return SetActiveNetworkIconAndText(network);
765 return;
766 }
767 772
768 // If no connected network, check if we are initializing Cellular. 773 // If no connected network, check if we are initializing Cellular.
769 if (mode_ != DROPDOWN_MODE && cros->cellular_initializing()) { 774 if (mode_ != DROPDOWN_MODE && cros->cellular_initializing()) {
770 initialize_state_time_ = base::Time::Now(); 775 initialize_state_time_ = base::Time::Now();
771 SetConnectingIconAndText(); 776 SetConnectingIconAndText(NULL);
772 return; 777 return true;
773 } 778 }
774 // There can be a delay between leaving the Initializing state and when a 779 // There can be a delay between leaving the Initializing state and when a
775 // Cellular device shows up, so keep showing the initializing animation 780 // Cellular device shows up, so keep showing the initializing animation
776 // for a few extra seconds to avoid flashing the disconnect icon. 781 // for a few extra seconds to avoid flashing the disconnect icon.
777 const int kInitializingDelaySeconds = 1; 782 const int kInitializingDelaySeconds = 1;
778 base::TimeDelta dtime = base::Time::Now() - initialize_state_time_; 783 base::TimeDelta dtime = base::Time::Now() - initialize_state_time_;
779 if (dtime.InSeconds() < kInitializingDelaySeconds) { 784 if (dtime.InSeconds() < kInitializingDelaySeconds) {
780 SetConnectingIconAndText(); 785 SetConnectingIconAndText(NULL);
781 return; 786 return true;
782 } 787 }
783 788
784 // Not connecting, so stop animation.
785 animation_connecting_.Stop();
786
787 // No connecting, connected, or active network. 789 // No connecting, connected, or active network.
788 SetDisconnectedIconAndText(); 790 SetDisconnectedIconAndText();
791 return false;
789 } 792 }
790 793
791 void NetworkMenuIcon::SetVpnIconAndText() { 794 bool NetworkMenuIcon::SetVpnIconAndText() {
792 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); 795 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
793 DCHECK(cros); 796 DCHECK(cros);
794 797
795 icon_->ClearIconAndBadges(); 798 icon_->ClearIconAndBadges();
796 const VirtualNetwork* vpn = cros->virtual_network(); 799 const VirtualNetwork* vpn = cros->virtual_network();
797 if (!vpn) { 800 if (!vpn) {
798 NOTREACHED(); 801 LOG(WARNING) << "SetVpnIconAndText called with no VPN";
799 SetDisconnectedIconAndText(); 802 SetDisconnectedIconAndText();
800 return; 803 return false;
801 } 804 }
802 if (vpn->connecting()) { 805 if (vpn->connecting()) {
803 connecting_network_ = vpn; 806 SetConnectingIconAndText(vpn);
804 SetConnectingIconAndText(); 807 return true;
805 return;
806 } 808 }
807 809
808 // If not connecting to a network, show the active/connected VPN. 810 // If not connecting to a VPN, show the active/connected VPN.
809 SetActiveNetworkIconAndText(vpn); 811 return SetActiveNetworkIconAndText(vpn);
810 } 812 }
811 813
812 void NetworkMenuIcon::SetActiveNetworkIconAndText(const Network* network) { 814 bool NetworkMenuIcon::SetActiveNetworkIconAndText(const Network* network) {
813 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); 815 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
814 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 816 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
815 bool animating = false; 817 bool animating = false;
816 818
817 // Set icon and badges. Call SetDirty() since network may have changed. 819 // Set icon and badges. Call SetDirty() since network may have changed.
818 icon_->SetDirty(); 820 icon_->SetDirty();
819 icon_->SetOrClearVpnConnected(network); 821 icon_->SetOrClearVpnConnected(network);
820 icon_->UpdateIcon(network); 822 icon_->UpdateIcon(network);
821 // Overlay the VPN badge if connecting to a VPN. 823 // Overlay the VPN badge if connecting to a VPN.
822 if (network->type() != TYPE_VPN && 824 if (network->type() != TYPE_VPN &&
823 cros->virtual_network() && cros->virtual_network()->connecting()) { 825 cros->virtual_network() && cros->virtual_network()->connecting()) {
824 const gfx::ImageSkia* vpn_badge = 826 const gfx::ImageSkia* vpn_badge =
825 rb.GetImageSkiaNamed(IDR_AURA_UBER_TRAY_NETWORK_VPN_BADGE); 827 rb.GetImageSkiaNamed(IDR_AURA_UBER_TRAY_NETWORK_VPN_BADGE);
826 const double animation = GetAnimation(); 828 const double animation = GetAnimation();
827 animating = true; 829 animating = true;
828 // Even though this is the only place we use vpn_connecting_badge_, 830 // Even though this is the only place we use vpn_connecting_badge_,
829 // it is important that this is a member variable since we set a 831 // it is important that this is a member variable since we set a
830 // pointer to it and access that pointer in icon_->GenerateImage(). 832 // pointer to it and access that pointer in icon_->GenerateImage().
831 vpn_connecting_badge_ = gfx::ImageSkiaOperations::CreateBlendedImage( 833 vpn_connecting_badge_ = gfx::ImageSkiaOperations::CreateBlendedImage(
832 GetEmptyImage(vpn_badge->size()), *vpn_badge, animation); 834 GetEmptyImage(vpn_badge->size()), *vpn_badge, animation);
833 icon_->set_bottom_left_badge(&vpn_connecting_badge_); 835 icon_->set_bottom_left_badge(&vpn_connecting_badge_);
834 } 836 }
835 if (!animating)
836 animation_connecting_.Stop();
837 837
838 // Set the text to display. 838 // Set the text to display.
839 if (network->type() == TYPE_ETHERNET) { 839 if (network->type() == TYPE_ETHERNET) {
840 if (mode_ == MENU_MODE) { 840 if (mode_ == MENU_MODE) {
841 text_ = l10n_util::GetStringFUTF16( 841 text_ = l10n_util::GetStringFUTF16(
842 IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP, 842 IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP,
843 l10n_util::GetStringUTF16( 843 l10n_util::GetStringUTF16(
844 IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)); 844 IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET));
845 } else { 845 } else {
846 text_ = l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); 846 text_ = l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET);
847 } 847 }
848 } else { 848 } else {
849 if (mode_ == MENU_MODE) { 849 if (mode_ == MENU_MODE) {
850 text_ = l10n_util::GetStringFUTF16( 850 text_ = l10n_util::GetStringFUTF16(
851 IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP, 851 IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP,
852 UTF8ToUTF16(network->name())); 852 UTF8ToUTF16(network->name()));
853 } else { 853 } else {
854 text_ = UTF8ToUTF16(network->name()); 854 text_ = UTF8ToUTF16(network->name());
855 } 855 }
856 } 856 }
857 return animating;
857 } 858 }
858 859
859 void NetworkMenuIcon::SetDisconnectedIconAndText() { 860 void NetworkMenuIcon::SetDisconnectedIconAndText() {
860 icon_->set_icon(GetDisconnectedImage(ARCS, resource_color_theme_)); 861 icon_->set_icon(GetDisconnectedImage(ARCS, resource_color_theme_));
861 if (mode_ == MENU_MODE) 862 if (mode_ == MENU_MODE)
862 text_ = l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_NO_NETWORK_TOOLTIP); 863 text_ = l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_NO_NETWORK_TOOLTIP);
863 else 864 else
864 text_ = l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_NONE_SELECTED); 865 text_ = l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_NONE_SELECTED);
865 } 866 }
866 867
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 gfx::ImageSkia* NetworkMenuIcon::GetVirtualNetworkImage() { 969 gfx::ImageSkia* NetworkMenuIcon::GetVirtualNetworkImage() {
969 return ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 970 return ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
970 IDR_AURA_UBER_TRAY_NETWORK_VPN); 971 IDR_AURA_UBER_TRAY_NETWORK_VPN);
971 } 972 }
972 973
973 int NetworkMenuIcon::NumImages(ImageType type) { 974 int NetworkMenuIcon::NumImages(ImageType type) {
974 return (type == ARCS) ? kNumArcsImages : kNumBarsImages; 975 return (type == ARCS) ? kNumArcsImages : kNumBarsImages;
975 } 976 }
976 977
977 } // chromeos 978 } // chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/network_menu_icon.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698