| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chromeos/network/network_state.h" | 25 #include "chromeos/network/network_state.h" |
| 26 #include "chromeos/network/network_state_handler.h" | 26 #include "chromeos/network/network_state_handler.h" |
| 27 #include "third_party/cros_system_api/dbus/service_constants.h" | 27 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/models/menu_model.h" | 29 #include "ui/base/models/menu_model.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 31 #include "ui/chromeos/network/network_connect.h" | 31 #include "ui/chromeos/network/network_connect.h" |
| 32 #include "ui/chromeos/network/network_icon.h" | 32 #include "ui/chromeos/network/network_icon.h" |
| 33 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" | 33 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" |
| 34 #include "ui/gfx/image/image_skia.h" | 34 #include "ui/gfx/image/image_skia.h" |
| 35 #include "ui/views/widget/widget_parent.h" |
| 35 | 36 |
| 36 namespace chromeos { | 37 namespace chromeos { |
| 37 | 38 |
| 38 namespace { | 39 namespace { |
| 39 | 40 |
| 40 // Offsets for views menu ids (main menu and submenu ids use the same | 41 // Offsets for views menu ids (main menu and submenu ids use the same |
| 41 // namespace). | 42 // namespace). |
| 42 const int kMainIndexMask = 0x1000; | 43 const int kMainIndexMask = 0x1000; |
| 43 const int kMoreIndexMask = 0x4000; | 44 const int kMoreIndexMask = 0x4000; |
| 44 | 45 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 330 |
| 330 ui::MenuModelDelegate* NetworkMenuModel::GetMenuModelDelegate() const { | 331 ui::MenuModelDelegate* NetworkMenuModel::GetMenuModelDelegate() const { |
| 331 return NULL; | 332 return NULL; |
| 332 } | 333 } |
| 333 | 334 |
| 334 //////////////////////////////////////////////////////////////////////////////// | 335 //////////////////////////////////////////////////////////////////////////////// |
| 335 // NetworkMenuModel, private methods: | 336 // NetworkMenuModel, private methods: |
| 336 | 337 |
| 337 void NetworkMenuModel::ShowOther(const std::string& type) const { | 338 void NetworkMenuModel::ShowOther(const std::string& type) const { |
| 338 gfx::NativeWindow native_window = owner_->delegate()->GetNativeWindow(); | 339 gfx::NativeWindow native_window = owner_->delegate()->GetNativeWindow(); |
| 339 if (type == shill::kTypeCellular) | 340 if (type == shill::kTypeCellular) { |
| 340 ChooseMobileNetworkDialog::ShowDialog(native_window); | 341 ChooseMobileNetworkDialog::ShowDialog(native_window); |
| 341 else | 342 } else { |
| 342 NetworkConfigView::ShowForType(shill::kTypeWifi, native_window); | 343 views::WidgetParent widget_parent; |
| 344 widget_parent.native_parent = native_window; |
| 345 NetworkConfigView::ShowForType(shill::kTypeWifi, widget_parent); |
| 346 } |
| 343 } | 347 } |
| 344 | 348 |
| 345 //////////////////////////////////////////////////////////////////////////////// | 349 //////////////////////////////////////////////////////////////////////////////// |
| 346 // MainMenuModel | 350 // MainMenuModel |
| 347 | 351 |
| 348 void MainMenuModel::AddWirelessNetworkMenuItem(const NetworkState* network, | 352 void MainMenuModel::AddWirelessNetworkMenuItem(const NetworkState* network, |
| 349 int flag) { | 353 int flag) { |
| 350 base::string16 label; | 354 base::string16 label; |
| 351 // Ampersand is a valid character in an SSID, but menu2 uses it to mark | 355 // Ampersand is a valid character in an SSID, but menu2 uses it to mark |
| 352 // "mnemonics" for keyboard shortcuts. | 356 // "mnemonics" for keyboard shortcuts. |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 return main_menu_model_.get(); | 677 return main_menu_model_.get(); |
| 674 } | 678 } |
| 675 | 679 |
| 676 void NetworkMenu::UpdateMenu() { | 680 void NetworkMenu::UpdateMenu() { |
| 677 refreshing_menu_ = true; | 681 refreshing_menu_ = true; |
| 678 main_menu_model_->InitMenuItems(delegate_->ShouldOpenButtonOptions()); | 682 main_menu_model_->InitMenuItems(delegate_->ShouldOpenButtonOptions()); |
| 679 refreshing_menu_ = false; | 683 refreshing_menu_ = false; |
| 680 } | 684 } |
| 681 | 685 |
| 682 } // namespace chromeos | 686 } // namespace chromeos |
| OLD | NEW |