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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 | 900 |
901 void MoreMenuModel::InitMenuItems(bool should_open_button_options) { | 901 void MoreMenuModel::InitMenuItems(bool should_open_button_options) { |
902 // This gets called on initialization, so any changes should be reflected | 902 // This gets called on initialization, so any changes should be reflected |
903 // in CrosMock::SetNetworkLibraryStatusAreaExpectations(). | 903 // in CrosMock::SetNetworkLibraryStatusAreaExpectations(). |
904 | 904 |
905 menu_items_.clear(); | 905 menu_items_.clear(); |
906 MenuItemVector link_items; | 906 MenuItemVector link_items; |
907 MenuItemVector address_items; | 907 MenuItemVector address_items; |
908 | 908 |
909 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); | 909 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); |
910 bool oobe = !should_open_button_options; // we don't show options for OOBE. | |
911 bool connected = cros->Connected(); // always call for test expectations. | 910 bool connected = cros->Connected(); // always call for test expectations. |
912 if (!oobe) { | 911 |
913 int message_id = -1; | 912 int message_id = -1; |
914 if (StatusAreaViewChromeos::IsBrowserMode()) | 913 if (StatusAreaViewChromeos::IsBrowserMode()) |
915 message_id = IDS_STATUSBAR_NETWORK_OPEN_OPTIONS_DIALOG; | 914 message_id = IDS_STATUSBAR_NETWORK_OPEN_OPTIONS_DIALOG; |
916 else if (connected) | 915 else if (connected) |
917 message_id = IDS_STATUSBAR_NETWORK_OPEN_PROXY_SETTINGS_DIALOG; | 916 message_id = IDS_STATUSBAR_NETWORK_OPEN_PROXY_SETTINGS_DIALOG; |
918 if (message_id != -1) { | 917 if (message_id != -1) { |
919 link_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, | 918 link_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, |
920 l10n_util::GetStringUTF16(message_id), | 919 l10n_util::GetStringUTF16(message_id), |
921 SkBitmap(), std::string(), FLAG_OPTIONS)); | 920 SkBitmap(), std::string(), FLAG_OPTIONS)); |
922 } | |
923 } | 921 } |
924 | 922 |
925 if (connected) { | 923 if (connected) { |
926 std::string ip_address = cros->IPAddress(); | 924 std::string ip_address = cros->IPAddress(); |
927 if (!ip_address.empty()) { | 925 if (!ip_address.empty()) { |
928 address_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, | 926 address_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, |
929 ASCIIToUTF16(cros->IPAddress()), SkBitmap(), std::string(), | 927 ASCIIToUTF16(cros->IPAddress()), SkBitmap(), std::string(), |
930 FLAG_DISABLED)); | 928 FLAG_DISABLED)); |
931 } | 929 } |
932 } | 930 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 std::string page = StringPrintf( | 1043 std::string page = StringPrintf( |
1046 "%s?servicePath=%s&networkType=%d&networkName=%s", | 1044 "%s?servicePath=%s&networkType=%d&networkName=%s", |
1047 chrome::kInternetOptionsSubPage, | 1045 chrome::kInternetOptionsSubPage, |
1048 net::EscapeUrlEncodedData(network->service_path(), true).c_str(), | 1046 net::EscapeUrlEncodedData(network->service_path(), true).c_str(), |
1049 network->type(), | 1047 network->type(), |
1050 net::EscapeUrlEncodedData(network_name, false).c_str()); | 1048 net::EscapeUrlEncodedData(network_name, false).c_str()); |
1051 browser->ShowOptionsTab(page); | 1049 browser->ShowOptionsTab(page); |
1052 } | 1050 } |
1053 | 1051 |
1054 } // namespace chromeos | 1052 } // namespace chromeos |
OLD | NEW |