| 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_vpn.h" | 5 #include "ash/system/chromeos/network/tray_vpn.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_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
| 10 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 SetLabel(info.description); | 33 SetLabel(info.description); |
| 34 SetAccessibleName(info.description); | 34 SetAccessibleName(info.description); |
| 35 } | 35 } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 DISALLOW_COPY_AND_ASSIGN(VpnDefaultView); | 38 DISALLOW_COPY_AND_ASSIGN(VpnDefaultView); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 class VpnListDetailedView : public NetworkListDetailedViewBase { | 41 class VpnListDetailedView : public NetworkListDetailedViewBase { |
| 42 public: | 42 public: |
| 43 VpnListDetailedView(user::LoginStatus login, int header_string_id) | 43 VpnListDetailedView(SystemTrayItem* owner, |
| 44 : NetworkListDetailedViewBase(login, header_string_id), | 44 user::LoginStatus login, |
| 45 int header_string_id) |
| 46 : NetworkListDetailedViewBase(owner, login, header_string_id), |
| 45 other_vpn_(NULL) { | 47 other_vpn_(NULL) { |
| 46 } | 48 } |
| 47 virtual ~VpnListDetailedView() { | 49 virtual ~VpnListDetailedView() { |
| 48 } | 50 } |
| 49 | 51 |
| 50 // Overridden from NetworkListDetailedViewBase: | 52 // Overridden from NetworkListDetailedViewBase: |
| 51 | 53 |
| 52 virtual void AppendHeaderButtons() OVERRIDE { | 54 virtual void AppendHeaderButtons() OVERRIDE { |
| 53 AppendInfoButtonToHeader(); | 55 AppendInfoButtonToHeader(); |
| 54 } | 56 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 111 } |
| 110 | 112 |
| 111 private: | 113 private: |
| 112 TrayPopupLabelButton* other_vpn_; | 114 TrayPopupLabelButton* other_vpn_; |
| 113 | 115 |
| 114 DISALLOW_COPY_AND_ASSIGN(VpnListDetailedView); | 116 DISALLOW_COPY_AND_ASSIGN(VpnListDetailedView); |
| 115 }; | 117 }; |
| 116 | 118 |
| 117 } // namespace tray | 119 } // namespace tray |
| 118 | 120 |
| 119 TrayVPN::TrayVPN() | 121 TrayVPN::TrayVPN(SystemTray* system_tray) |
| 120 : default_(NULL), | 122 : SystemTrayItem(system_tray), |
| 123 default_(NULL), |
| 121 detailed_(NULL) { | 124 detailed_(NULL) { |
| 122 } | 125 } |
| 123 | 126 |
| 124 TrayVPN::~TrayVPN() { | 127 TrayVPN::~TrayVPN() { |
| 125 } | 128 } |
| 126 | 129 |
| 127 views::View* TrayVPN::CreateTrayView(user::LoginStatus status) { | 130 views::View* TrayVPN::CreateTrayView(user::LoginStatus status) { |
| 128 return NULL; | 131 return NULL; |
| 129 } | 132 } |
| 130 | 133 |
| 131 views::View* TrayVPN::CreateDefaultView(user::LoginStatus status) { | 134 views::View* TrayVPN::CreateDefaultView(user::LoginStatus status) { |
| 132 CHECK(default_ == NULL); | 135 CHECK(default_ == NULL); |
| 133 if (status == user::LOGGED_IN_NONE) | 136 if (status == user::LOGGED_IN_NONE) |
| 134 return NULL; | 137 return NULL; |
| 135 | 138 |
| 136 // Do not show VPN line in uber tray bubble if VPN is not configured. | 139 // Do not show VPN line in uber tray bubble if VPN is not configured. |
| 137 std::vector<NetworkIconInfo> list; | 140 std::vector<NetworkIconInfo> list; |
| 138 Shell::GetInstance()->tray_delegate()->GetVirtualNetworks(&list); | 141 Shell::GetInstance()->tray_delegate()->GetVirtualNetworks(&list); |
| 139 if (list.size() == 0) | 142 if (list.size() == 0) |
| 140 return NULL; | 143 return NULL; |
| 141 | 144 |
| 142 default_ = new tray::VpnDefaultView(this, status != user::LOGGED_IN_LOCKED); | 145 default_ = new tray::VpnDefaultView(this, status != user::LOGGED_IN_LOCKED); |
| 143 return default_; | 146 return default_; |
| 144 } | 147 } |
| 145 | 148 |
| 146 views::View* TrayVPN::CreateDetailedView(user::LoginStatus status) { | 149 views::View* TrayVPN::CreateDetailedView(user::LoginStatus status) { |
| 147 CHECK(detailed_ == NULL); | 150 CHECK(detailed_ == NULL); |
| 148 detailed_ = new tray::VpnListDetailedView(status, IDS_ASH_STATUS_TRAY_VPN); | 151 detailed_ = new tray::VpnListDetailedView( |
| 152 this, status, IDS_ASH_STATUS_TRAY_VPN); |
| 149 detailed_->Init(); | 153 detailed_->Init(); |
| 150 return detailed_; | 154 return detailed_; |
| 151 } | 155 } |
| 152 | 156 |
| 153 views::View* TrayVPN::CreateNotificationView(user::LoginStatus status) { | 157 views::View* TrayVPN::CreateNotificationView(user::LoginStatus status) { |
| 154 return NULL; | 158 return NULL; |
| 155 } | 159 } |
| 156 | 160 |
| 157 void TrayVPN::DestroyTrayView() { | 161 void TrayVPN::DestroyTrayView() { |
| 158 } | 162 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 189 } | 193 } |
| 190 | 194 |
| 191 void TrayVPN::ClearNetworkMessage(MessageType message_type) { | 195 void TrayVPN::ClearNetworkMessage(MessageType message_type) { |
| 192 } | 196 } |
| 193 | 197 |
| 194 void TrayVPN::OnWillToggleWifi() { | 198 void TrayVPN::OnWillToggleWifi() { |
| 195 } | 199 } |
| 196 | 200 |
| 197 } // namespace internal | 201 } // namespace internal |
| 198 } // namespace ash | 202 } // namespace ash |
| OLD | NEW |