| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/chromeos/cros/cros_library.h" | 11 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 12 #include "chrome/browser/chromeos/sim_unlock_dialog_delegate.h" |
| 12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
| 15 #include "chrome/browser/ui/views/window.h" |
| 14 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 15 #include "chrome/browser/ui/views/window.h" | |
| 16 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 17 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 18 #include "net/base/escape.h" | 19 #include "net/base/escape.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/gfx/canvas_skia.h" | 22 #include "ui/gfx/canvas_skia.h" |
| 22 #include "ui/gfx/skbitmap_operations.h" | 23 #include "ui/gfx/skbitmap_operations.h" |
| 23 #include "views/controls/menu/menu_2.h" | 24 #include "views/controls/menu/menu_2.h" |
| 24 #include "views/window/window.h" | 25 #include "views/window/window.h" |
| 25 | 26 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); | 300 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); |
| 300 int flags = menu_items_[index].flags; | 301 int flags = menu_items_[index].flags; |
| 301 if (flags & FLAG_OPTIONS) { | 302 if (flags & FLAG_OPTIONS) { |
| 302 OpenButtonOptions(); | 303 OpenButtonOptions(); |
| 303 } else if (flags & FLAG_TOGGLE_ETHERNET) { | 304 } else if (flags & FLAG_TOGGLE_ETHERNET) { |
| 304 cros->EnableEthernetNetworkDevice(!cros->ethernet_enabled()); | 305 cros->EnableEthernetNetworkDevice(!cros->ethernet_enabled()); |
| 305 } else if (flags & FLAG_TOGGLE_WIFI) { | 306 } else if (flags & FLAG_TOGGLE_WIFI) { |
| 306 cros->EnableWifiNetworkDevice(!cros->wifi_enabled()); | 307 cros->EnableWifiNetworkDevice(!cros->wifi_enabled()); |
| 307 } else if (flags & FLAG_TOGGLE_CELLULAR) { | 308 } else if (flags & FLAG_TOGGLE_CELLULAR) { |
| 308 cros->EnableCellularNetworkDevice(!cros->cellular_enabled()); | 309 cros->EnableCellularNetworkDevice(!cros->cellular_enabled()); |
| 310 // TODO(nkostylev): Integrate with SIM locked state. crosbug.com/12007. |
| 311 // SimUnlockDialogDelegate::ShowDialog(GetNativeWindow()); |
| 309 } else if (flags & FLAG_TOGGLE_OFFLINE) { | 312 } else if (flags & FLAG_TOGGLE_OFFLINE) { |
| 310 cros->EnableOfflineMode(!cros->offline_mode()); | 313 cros->EnableOfflineMode(!cros->offline_mode()); |
| 311 } else if (flags & FLAG_ETHERNET) { | 314 } else if (flags & FLAG_ETHERNET) { |
| 312 if (cros->ethernet_connected()) { | 315 if (cros->ethernet_connected()) { |
| 313 ShowTabbedNetworkSettings(cros->ethernet_network()); | 316 ShowTabbedNetworkSettings(cros->ethernet_network()); |
| 314 } | 317 } |
| 315 } else if (flags & FLAG_WIFI) { | 318 } else if (flags & FLAG_WIFI) { |
| 316 ConnectToNetworkAt(index, std::string(), std::string(), -1); | 319 ConnectToNetworkAt(index, std::string(), std::string(), -1); |
| 317 } else if (flags & FLAG_OTHER_NETWORK) { | 320 } else if (flags & FLAG_OTHER_NETWORK) { |
| 318 ConnectToNetworkAt(index, std::string(), std::string(), -1); | 321 ConnectToNetworkAt(index, std::string(), std::string(), -1); |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 if (!browser) | 814 if (!browser) |
| 812 return; | 815 return; |
| 813 browser->OpenMobilePlanTabAndActivate(); | 816 browser->OpenMobilePlanTabAndActivate(); |
| 814 } | 817 } |
| 815 | 818 |
| 816 void NetworkMenu::ShowOther() const { | 819 void NetworkMenu::ShowOther() const { |
| 817 ShowNetworkConfigView(new NetworkConfigView()); | 820 ShowNetworkConfigView(new NetworkConfigView()); |
| 818 } | 821 } |
| 819 | 822 |
| 820 } // namespace chromeos | 823 } // namespace chromeos |
| OLD | NEW |