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/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" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 const ErrorMap& messages() const { return messages_; } | 137 const ErrorMap& messages() const { return messages_; } |
138 | 138 |
139 private: | 139 private: |
140 ErrorMap messages_; | 140 ErrorMap messages_; |
141 }; | 141 }; |
142 | 142 |
143 class NetworkTrayView : public TrayItemView { | 143 class NetworkTrayView : public TrayItemView { |
144 public: | 144 public: |
145 NetworkTrayView(ColorTheme size, bool tray_icon) | 145 NetworkTrayView(ColorTheme size, bool tray_icon) |
146 : color_theme_(size), tray_icon_(tray_icon) { | 146 : color_theme_(size), tray_icon_(tray_icon) { |
147 SetLayoutManager(new views::FillLayout()); | 147 SetLayoutManager( |
| 148 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
148 | 149 |
149 image_view_ = color_theme_ == DARK ? | 150 image_view_ = color_theme_ == DARK ? |
150 new FixedSizedImageView(0, kTrayPopupItemHeight) : | 151 new FixedSizedImageView(0, kTrayPopupItemHeight) : |
151 new views::ImageView; | 152 new views::ImageView; |
152 AddChildView(image_view_); | 153 AddChildView(image_view_); |
153 | 154 |
154 NetworkIconInfo info; | 155 NetworkIconInfo info; |
155 Shell::GetInstance()->tray_delegate()-> | 156 Shell::GetInstance()->tray_delegate()-> |
156 GetMostRelevantNetworkIcon(&info, false); | 157 GetMostRelevantNetworkIcon(&info, false); |
157 Update(info); | 158 Update(info); |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 detailed_ = NULL; | 756 detailed_ = NULL; |
756 } | 757 } |
757 | 758 |
758 void TrayNetwork::DestroyNotificationView() { | 759 void TrayNetwork::DestroyNotificationView() { |
759 notification_ = NULL; | 760 notification_ = NULL; |
760 } | 761 } |
761 | 762 |
762 void TrayNetwork::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 763 void TrayNetwork::UpdateAfterLoginStatusChange(user::LoginStatus status) { |
763 } | 764 } |
764 | 765 |
| 766 void TrayNetwork::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { |
| 767 SetTrayImageItemBorder(tray_, alignment); |
| 768 } |
| 769 |
765 void TrayNetwork::OnNetworkRefresh(const NetworkIconInfo& info) { | 770 void TrayNetwork::OnNetworkRefresh(const NetworkIconInfo& info) { |
766 if (tray_) | 771 if (tray_) |
767 tray_->Update(info); | 772 tray_->Update(info); |
768 if (default_) | 773 if (default_) |
769 default_->Update(); | 774 default_->Update(); |
770 if (detailed_) | 775 if (detailed_) |
771 detailed_->Update(); | 776 detailed_->Update(); |
772 } | 777 } |
773 | 778 |
774 void TrayNetwork::SetNetworkError(NetworkTrayDelegate* delegate, | 779 void TrayNetwork::SetNetworkError(NetworkTrayDelegate* delegate, |
(...skipping 24 matching lines...) Expand all Loading... |
799 | 804 |
800 void TrayNetwork::LinkClicked(ErrorType error_type) { | 805 void TrayNetwork::LinkClicked(ErrorType error_type) { |
801 tray::NetworkErrors::ErrorMap::const_iterator iter = | 806 tray::NetworkErrors::ErrorMap::const_iterator iter = |
802 errors()->messages().find(error_type); | 807 errors()->messages().find(error_type); |
803 if (iter != errors()->messages().end() && iter->second.delegate) | 808 if (iter != errors()->messages().end() && iter->second.delegate) |
804 iter->second.delegate->NotificationLinkClicked(); | 809 iter->second.delegate->NotificationLinkClicked(); |
805 } | 810 } |
806 | 811 |
807 } // namespace internal | 812 } // namespace internal |
808 } // namespace ash | 813 } // namespace ash |
OLD | NEW |