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