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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 } | 773 } |
774 | 774 |
775 // No networks available message. | 775 // No networks available message. |
776 if (menu_items_.empty()) { | 776 if (menu_items_.empty()) { |
777 label = l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_MENU_ITEM_INDENT, | 777 label = l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_MENU_ITEM_INDENT, |
778 l10n_util::GetStringUTF16(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)); | 778 l10n_util::GetStringUTF16(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)); |
779 menu_items_.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, label, | 779 menu_items_.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, label, |
780 SkBitmap(), std::string(), FLAG_DISABLED)); | 780 SkBitmap(), std::string(), FLAG_DISABLED)); |
781 } | 781 } |
782 | 782 |
783 // If there's a connected network, add submenu for Private Networks. | 783 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableVPN)) { |
784 const Network* connected_network = cros->connected_network(); | 784 // If there's a connected network, add submenu for Private Networks. |
785 if (connected_network) { | 785 const Network* connected_network = cros->connected_network(); |
786 menu_items_.push_back(MenuItem()); // Separator | 786 if (connected_network) { |
787 menu_items_.push_back(MenuItem( | 787 menu_items_.push_back(MenuItem()); // Separator |
788 ui::MenuModel::TYPE_SUBMENU, | 788 menu_items_.push_back(MenuItem( |
789 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_PRIVATE_NETWORKS), | 789 ui::MenuModel::TYPE_SUBMENU, |
790 VPNMenuModel::IconForDisplay(connected_network), | 790 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_PRIVATE_NETWORKS), |
791 vpn_menu_model_.get(), FLAG_NONE)); | 791 VPNMenuModel::IconForDisplay(connected_network), |
792 vpn_menu_model_->InitMenuItems( | 792 vpn_menu_model_.get(), FLAG_NONE)); |
793 is_browser_mode, should_open_button_options); | 793 vpn_menu_model_->InitMenuItems( |
| 794 is_browser_mode, should_open_button_options); |
| 795 } |
794 } | 796 } |
795 | 797 |
796 // Enable / disable wireless. | 798 // Enable / disable wireless. |
797 if (wifi_available || cellular_available) { | 799 if (wifi_available || cellular_available) { |
798 menu_items_.push_back(MenuItem()); // Separator | 800 menu_items_.push_back(MenuItem()); // Separator |
799 | 801 |
800 if (wifi_available) { | 802 if (wifi_available) { |
801 // Add 'Scanning...' | 803 // Add 'Scanning...' |
802 if (cros->wifi_scanning()) { | 804 if (cros->wifi_scanning()) { |
803 label = l10n_util::GetStringUTF16(IDS_STATUSBAR_WIFI_SCANNING_MESSAGE); | 805 label = l10n_util::GetStringUTF16(IDS_STATUSBAR_WIFI_SCANNING_MESSAGE); |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 | 1435 |
1434 gfx::Point screen_loc; | 1436 gfx::Point screen_loc; |
1435 views::View::ConvertPointToScreen(source, &screen_loc); | 1437 views::View::ConvertPointToScreen(source, &screen_loc); |
1436 gfx::Rect bounds(screen_loc, source->size()); | 1438 gfx::Rect bounds(screen_loc, source->size()); |
1437 network_menu_->GetSubmenu()->set_minimum_preferred_width(min_width_); | 1439 network_menu_->GetSubmenu()->set_minimum_preferred_width(min_width_); |
1438 network_menu_->RunMenuAt(window, GetMenuButton(), bounds, | 1440 network_menu_->RunMenuAt(window, GetMenuButton(), bounds, |
1439 views::MenuItemView::TOPRIGHT, true); | 1441 views::MenuItemView::TOPRIGHT, true); |
1440 } | 1442 } |
1441 | 1443 |
1442 } // namespace chromeos | 1444 } // namespace chromeos |
OLD | NEW |