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 "chrome/browser/chromeos/status/network_menu.h" | 5 #include "chrome/browser/chromeos/status/network_menu.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 DISALLOW_COPY_AND_ASSIGN(MainMenuModel); | 207 DISALLOW_COPY_AND_ASSIGN(MainMenuModel); |
208 }; | 208 }; |
209 | 209 |
210 //////////////////////////////////////////////////////////////////////////////// | 210 //////////////////////////////////////////////////////////////////////////////// |
211 // NetworkMenuModel, public methods: | 211 // NetworkMenuModel, public methods: |
212 | 212 |
213 void NetworkMenuModel::ConnectToNetworkAt(int index) { | 213 void NetworkMenuModel::ConnectToNetworkAt(int index) { |
214 const std::string& service_path = menu_items_[index].service_path; | 214 const std::string& service_path = menu_items_[index].service_path; |
215 gfx::NativeWindow native_window = owner_->delegate()->GetNativeWindow(); | 215 gfx::NativeWindow native_window = owner_->delegate()->GetNativeWindow(); |
216 ash::network_connect::ConnectToNetwork(service_path, native_window); | 216 ash::network_connect::ConnectToNetwork(service_path, native_window); |
217 owner_->delegate()->OnConnectToNetworkRequested(service_path); | |
218 } | 217 } |
219 | 218 |
220 //////////////////////////////////////////////////////////////////////////////// | 219 //////////////////////////////////////////////////////////////////////////////// |
221 // NetworkMenuModel, ui::MenuModel implementation: | 220 // NetworkMenuModel, ui::MenuModel implementation: |
222 | 221 |
223 bool NetworkMenuModel::HasIcons() const { | 222 bool NetworkMenuModel::HasIcons() const { |
224 return true; | 223 return true; |
225 } | 224 } |
226 | 225 |
227 int NetworkMenuModel::GetItemCount() const { | 226 int NetworkMenuModel::GetItemCount() const { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 return; | 302 return; |
304 | 303 |
305 int flags = menu_items_[index].flags; | 304 int flags = menu_items_[index].flags; |
306 if (flags & FLAG_OPTIONS) { | 305 if (flags & FLAG_OPTIONS) { |
307 owner_->delegate()->OpenButtonOptions(); | 306 owner_->delegate()->OpenButtonOptions(); |
308 } else if (flags & FLAG_TOGGLE_WIFI) { | 307 } else if (flags & FLAG_TOGGLE_WIFI) { |
309 ToggleTechnology(flimflam::kTypeWifi); | 308 ToggleTechnology(flimflam::kTypeWifi); |
310 } else if (flags & FLAG_TOGGLE_MOBILE) { | 309 } else if (flags & FLAG_TOGGLE_MOBILE) { |
311 ToggleTechnology(NetworkStateHandler::kMatchTypeMobile); | 310 ToggleTechnology(NetworkStateHandler::kMatchTypeMobile); |
312 } else if (flags & FLAG_ETHERNET) { | 311 } else if (flags & FLAG_ETHERNET) { |
313 // Do nothing (used in login screen only) | 312 owner_->delegate()->OnConnectToNetworkRequested( |
| 313 menu_items_[index].service_path); |
314 } else if (flags & (FLAG_WIFI | FLAG_WIMAX | FLAG_CELLULAR)) { | 314 } else if (flags & (FLAG_WIFI | FLAG_WIMAX | FLAG_CELLULAR)) { |
315 ConnectToNetworkAt(index); | 315 ConnectToNetworkAt(index); |
| 316 owner_->delegate()->OnConnectToNetworkRequested( |
| 317 menu_items_[index].service_path); |
316 } else if (flags & FLAG_ADD_WIFI) { | 318 } else if (flags & FLAG_ADD_WIFI) { |
317 ShowOther(flimflam::kTypeWifi); | 319 ShowOther(flimflam::kTypeWifi); |
318 } else if (flags & FLAG_ADD_CELLULAR) { | 320 } else if (flags & FLAG_ADD_CELLULAR) { |
319 ShowOther(flimflam::kTypeCellular); | 321 ShowOther(flimflam::kTypeCellular); |
320 } | 322 } |
321 } | 323 } |
322 | 324 |
323 void NetworkMenuModel::SetMenuModelDelegate(ui::MenuModelDelegate* delegate) { | 325 void NetworkMenuModel::SetMenuModelDelegate(ui::MenuModelDelegate* delegate) { |
324 } | 326 } |
325 | 327 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 return main_menu_model_.get(); | 671 return main_menu_model_.get(); |
670 } | 672 } |
671 | 673 |
672 void NetworkMenu::UpdateMenu() { | 674 void NetworkMenu::UpdateMenu() { |
673 refreshing_menu_ = true; | 675 refreshing_menu_ = true; |
674 main_menu_model_->InitMenuItems(delegate_->ShouldOpenButtonOptions()); | 676 main_menu_model_->InitMenuItems(delegate_->ShouldOpenButtonOptions()); |
675 refreshing_menu_ = false; | 677 refreshing_menu_ = false; |
676 } | 678 } |
677 | 679 |
678 } // namespace chromeos | 680 } // namespace chromeos |
OLD | NEW |