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