| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Highlight any connected or connecting networks in the UI. | 56 // Highlight any connected or connecting networks in the UI. |
| 57 bool ShouldHighlightNetwork(const NetworkState* network) { | 57 bool ShouldHighlightNetwork(const NetworkState* network) { |
| 58 return network->IsConnectedState() || network->IsConnectingState(); | 58 return network->IsConnectedState() || network->IsConnectingState(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void ToggleTechnology(const NetworkTypePattern& technology) { | 61 void ToggleTechnology(const NetworkTypePattern& technology) { |
| 62 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); | 62 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); |
| 63 bool is_enabled = handler->IsTechnologyEnabled(technology); | 63 bool is_enabled = handler->IsTechnologyEnabled(technology); |
| 64 ash::network_connect::SetTechnologyEnabled(technology, !is_enabled); | 64 ash::NetworkConnect::Get()->SetTechnologyEnabled(technology, !is_enabled); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace | 67 } // namespace |
| 68 | 68 |
| 69 class NetworkMenuModel : public ui::MenuModel { | 69 class NetworkMenuModel : public ui::MenuModel { |
| 70 public: | 70 public: |
| 71 struct MenuItem { | 71 struct MenuItem { |
| 72 MenuItem() | 72 MenuItem() |
| 73 : type(ui::MenuModel::TYPE_SEPARATOR), | 73 : type(ui::MenuModel::TYPE_SEPARATOR), |
| 74 sub_menu_model(NULL), | 74 sub_menu_model(NULL), |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 scoped_ptr<MoreMenuModel> more_menu_model_; | 210 scoped_ptr<MoreMenuModel> more_menu_model_; |
| 211 | 211 |
| 212 DISALLOW_COPY_AND_ASSIGN(MainMenuModel); | 212 DISALLOW_COPY_AND_ASSIGN(MainMenuModel); |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 //////////////////////////////////////////////////////////////////////////////// | 215 //////////////////////////////////////////////////////////////////////////////// |
| 216 // NetworkMenuModel, public methods: | 216 // NetworkMenuModel, public methods: |
| 217 | 217 |
| 218 void NetworkMenuModel::ConnectToNetworkAt(int index) { | 218 void NetworkMenuModel::ConnectToNetworkAt(int index) { |
| 219 const std::string& service_path = menu_items_[index].service_path; | 219 const std::string& service_path = menu_items_[index].service_path; |
| 220 ash::network_connect::ConnectToNetwork(service_path); | 220 ash::NetworkConnect::Get()->ConnectToNetwork(service_path); |
| 221 } | 221 } |
| 222 | 222 |
| 223 //////////////////////////////////////////////////////////////////////////////// | 223 //////////////////////////////////////////////////////////////////////////////// |
| 224 // NetworkMenuModel, ui::MenuModel implementation: | 224 // NetworkMenuModel, ui::MenuModel implementation: |
| 225 | 225 |
| 226 bool NetworkMenuModel::HasIcons() const { | 226 bool NetworkMenuModel::HasIcons() const { |
| 227 return true; | 227 return true; |
| 228 } | 228 } |
| 229 | 229 |
| 230 int NetworkMenuModel::GetItemCount() const { | 230 int NetworkMenuModel::GetItemCount() const { |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 return main_menu_model_.get(); | 673 return main_menu_model_.get(); |
| 674 } | 674 } |
| 675 | 675 |
| 676 void NetworkMenu::UpdateMenu() { | 676 void NetworkMenu::UpdateMenu() { |
| 677 refreshing_menu_ = true; | 677 refreshing_menu_ = true; |
| 678 main_menu_model_->InitMenuItems(delegate_->ShouldOpenButtonOptions()); | 678 main_menu_model_->InitMenuItems(delegate_->ShouldOpenButtonOptions()); |
| 679 refreshing_menu_ = false; | 679 refreshing_menu_ = false; |
| 680 } | 680 } |
| 681 | 681 |
| 682 } // namespace chromeos | 682 } // namespace chromeos |
| OLD | NEW |