summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 23:48:12 +0000
committerchocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 23:48:12 +0000
commit3c30891915a40bac4cee93a6dc9246cf1e8d9c95 (patch)
tree32044d3196735a4abf1b5533776868de072c9899
parentba388887c335ee6e1c7ef1ff065aa550ad1bd9bf (diff)
downloadchromium_src-3c30891915a40bac4cee93a6dc9246cf1e8d9c95.zip
chromium_src-3c30891915a40bac4cee93a6dc9246cf1e8d9c95.tar.gz
chromium_src-3c30891915a40bac4cee93a6dc9246cf1e8d9c95.tar.bz2
New network menu button UI for ChromeOS.
Added ability to change label font in gtk menu item. TEST=none BUG=none Review URL: http://codereview.chromium.org/650074 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39516 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--app/menus/menu_model.h10
-rw-r--r--app/resource_bundle.cc6
-rw-r--r--app/resource_bundle.h4
-rw-r--r--chrome/app/generated_resources.grd4
-rw-r--r--chrome/browser/chromeos/cros/network_library.cc11
-rw-r--r--chrome/browser/chromeos/cros/network_library.h3
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.cc220
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.h7
-rw-r--r--views/controls/menu/native_menu_gtk.cc11
9 files changed, 133 insertions, 143 deletions
diff --git a/app/menus/menu_model.h b/app/menus/menu_model.h
index 718f3b1..6a522d7 100644
--- a/app/menus/menu_model.h
+++ b/app/menus/menu_model.h
@@ -11,6 +11,12 @@
class SkBitmap;
+namespace gfx {
+
+class Font;
+
+} // namespace gfx
+
namespace menus {
class Accelerator;
@@ -59,6 +65,10 @@ class MenuModel {
// menu item will be updated each time the menu is shown.
virtual bool IsLabelDynamicAt(int index) const = 0;
+ // Returns the font use for the label at the specified index.
+ // If NULL, then use default font.
+ virtual const gfx::Font* GetLabelFontAt(int index) const { return NULL; }
+
// Gets the acclerator information for the specified index, returning true if
// there is a shortcut accelerator for the item, false otherwise.
virtual bool GetAcceleratorAt(int index,
diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc
index 9d9eb21..f0b9923 100644
--- a/app/resource_bundle.cc
+++ b/app/resource_bundle.cc
@@ -146,6 +146,10 @@ void ResourceBundle::LoadFontsIfNecessary() {
if (!base_font_.get()) {
base_font_.reset(new gfx::Font());
+ bold_font_.reset(new gfx::Font());
+ *bold_font_ =
+ base_font_->DeriveFont(0, base_font_->style() | gfx::Font::BOLD);
+
small_font_.reset(new gfx::Font());
*small_font_ = base_font_->DeriveFont(-2);
@@ -164,6 +168,8 @@ void ResourceBundle::LoadFontsIfNecessary() {
const gfx::Font& ResourceBundle::GetFont(FontStyle style) {
LoadFontsIfNecessary();
switch (style) {
+ case BoldFont:
+ return *bold_font_;
case SmallFont:
return *small_font_;
case MediumFont:
diff --git a/app/resource_bundle.h b/app/resource_bundle.h
index 2efd932..a76a426 100644
--- a/app/resource_bundle.h
+++ b/app/resource_bundle.h
@@ -53,10 +53,11 @@ class ResourceBundle {
public:
// An enumeration of the various font styles used throughout Chrome.
// The following holds true for the font sizes:
- // Small <= Base <= Medium <= MediumBold <= Large.
+ // Small <= Base <= Bold <= Medium <= MediumBold <= Large.
enum FontStyle {
SmallFont,
BaseFont,
+ BoldFont,
MediumFont,
// NOTE: depending upon the locale, this may *not* result in a bold font.
MediumBoldFont,
@@ -219,6 +220,7 @@ class ResourceBundle {
// The various fonts used. Cached to avoid repeated GDI creation/destruction.
scoped_ptr<gfx::Font> base_font_;
+ scoped_ptr<gfx::Font> bold_font_;
scoped_ptr<gfx::Font> small_font_;
scoped_ptr<gfx::Font> medium_font_;
scoped_ptr<gfx::Font> medium_bold_font_;
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 22f82c4..5f7874c 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -6646,10 +6646,10 @@ Keep your key file in a safe place. You will need it to create new versions of y
Off
</message>
<message name="IDS_STATUSBAR_NETWORK_DEVICE_ENABLE" desc="Enable the network device.">
- Turn <ph name="NETWORKDEVICE">$1<ex>Wifi</ex></ph> On
+ Enable <ph name="NETWORKDEVICE">$1<ex>Wifi</ex></ph>
</message>
<message name="IDS_STATUSBAR_NETWORK_DEVICE_DISABLE" desc="Disable the network device.">
- Turn <ph name="NETWORKDEVICE">$1<ex>Wifi</ex></ph> Off
+ Disable <ph name="NETWORKDEVICE">$1<ex>Wifi</ex></ph>
</message>
<message name="IDS_STATUSBAR_NETWORK_DEVICE_STATUS" desc="The status of the network device.">
<ph name="NETWORKDEVICE">$1<ex>Wifi</ex></ph>: <ph name="STATUS">$2<ex>Connecting</ex></ph>
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc
index d863dbb..25e53eb 100644
--- a/chrome/browser/chromeos/cros/network_library.cc
+++ b/chrome/browser/chromeos/cros/network_library.cc
@@ -387,4 +387,15 @@ bool NetworkLibrary::Connected() const {
return ethernet_connected() || wifi_connected() || cellular_connected();
}
+const std::string& NetworkLibrary::IPAddress() const {
+ // Returns highest priority IP address.
+ if (ethernet_connected())
+ return ethernet_.ip_address;
+ if (wifi_connected())
+ return wifi_.ip_address;
+ if (cellular_connected())
+ return cellular_.ip_address;
+ return ethernet_.ip_address;
+}
+
} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h
index 57cef8c..94d5ba0 100644
--- a/chrome/browser/chromeos/cros/network_library.h
+++ b/chrome/browser/chromeos/cros/network_library.h
@@ -174,6 +174,9 @@ class NetworkLibrary : public URLRequestJobTracker::JobObserver {
// Return true if any network is currently connected.
bool Connected() const;
+ // Returns the current IP address if connected. If not, returns empty string.
+ const std::string& IPAddress() const;
+
// Returns the current list of wifi networks.
const WifiNetworkVector& wifi_networks() const { return wifi_networks_; }
diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc
index dbeb0f6..26a3653 100644
--- a/chrome/browser/chromeos/status/network_menu_button.cc
+++ b/chrome/browser/chromeos/status/network_menu_button.cc
@@ -55,6 +55,12 @@ string16 NetworkMenuButton::GetLabelAt(int index) const {
return menu_items_[index].label;
}
+const gfx::Font* NetworkMenuButton::GetLabelFontAt(int index) const {
+ return (menu_items_[index].flags & FLAG_BOLD) ?
+ &ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BoldFont) :
+ NULL;
+}
+
bool NetworkMenuButton::IsItemCheckedAt(int index) const {
// All menus::MenuModel::TYPE_CHECK menu items are checked.
return true;
@@ -62,7 +68,10 @@ bool NetworkMenuButton::IsItemCheckedAt(int index) const {
bool NetworkMenuButton::GetIconAt(int index, SkBitmap* icon) const {
if (!menu_items_[index].icon.empty()) {
- *icon = menu_items_[index].icon;
+ // Make icon smaller (if necessary) to look better in the menu.
+ static const int kMinSize = 8;
+ *icon = SkBitmapOperations::DownsampleByTwoUntilSize(
+ menu_items_[index].icon, kMinSize, kMinSize);
return true;
}
return false;
@@ -87,7 +96,7 @@ void NetworkMenuButton::ActivatedAt(int index) {
cros->EnableCellularNetworkDevice(!cros->cellular_enabled());
} else if (menu_items_[index].flags & FLAG_TOGGLE_OFFLINE) {
cros->EnableOfflineMode(!cros->offline_mode());
- } else if (menu_items_[index].flags & FLAG_ACTIVATE_WIFI) {
+ } else if (menu_items_[index].flags & FLAG_WIFI) {
activated_wifi_network_ = menu_items_[index].wifi_network;
// If clicked on a network that we are already connected to or we are
@@ -112,7 +121,12 @@ void NetworkMenuButton::ActivatedAt(int index) {
window->SetBounds(gfx::Rect(point, size), parent_window_);
window->Show();
}
- } else if (menu_items_[index].flags & FLAG_ACTIVATE_CELLULAR) {
+ } else if (menu_items_[index].flags & FLAG_CELLULAR) {
+ // If clicked on a network that we are already connected to or we are
+ // currently trying to connect to, then do nothing.
+ if (menu_items_[index].cellular_network.name == cros->cellular_name())
+ return;
+
cros->ConnectToCellularNetwork(menu_items_[index].cellular_network);
}
}
@@ -348,156 +362,86 @@ void NetworkMenuButton::InitMenuItems() {
NetworkLibrary* cros = NetworkLibrary::Get();
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- bool offline_mode = cros->offline_mode();
-
- // Wifi: Status.
- int status = IDS_STATUSBAR_NETWORK_DEVICE_DISABLED;
- if (cros->wifi_connecting())
- status = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING;
- else if (cros->wifi_connected())
- status = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTED;
- else if (cros->wifi_enabled())
- status = IDS_STATUSBAR_NETWORK_DEVICE_DISCONNECTED;
- string16 label =
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_STATUS,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_WIFI),
- l10n_util::GetStringUTF16(status));
- SkBitmap icon = cros->wifi_connected() ?
- IconForNetworkStrength(cros->wifi_strength(), true) :
+ // Ethernet
+ string16 label = l10n_util::GetStringUTF16(
+ IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET);
+ SkBitmap icon = cros->ethernet_connecting() || cros->ethernet_connected() ?
+ *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED_BLACK) :
*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED);
+ int flag = (cros->ethernet_connecting() || cros->ethernet_connected()) ?
+ FLAG_ETHERNET & FLAG_BOLD : FLAG_ETHERNET;
menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
- icon, WifiNetwork(), CellularNetwork(), FLAG_DISABLED));
+ icon, WifiNetwork(), CellularNetwork(), flag));
+
+ // Wifi
+ const WifiNetworkVector& wifi_networks = cros->wifi_networks();
+ // Wifi networks ssids.
+ for (size_t i = 0; i < wifi_networks.size(); ++i) {
+ label = ASCIIToUTF16(wifi_networks[i].ssid);
+ flag = (wifi_networks[i].ssid == cros->wifi_ssid()) ?
+ FLAG_WIFI & FLAG_BOLD : FLAG_WIFI;
+ menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
+ IconForNetworkStrength(wifi_networks[i].strength, true),
+ wifi_networks[i], CellularNetwork(), flag));
+ }
- // Turn Wifi Off.
- if (!offline_mode) {
- label = cros->wifi_enabled() ?
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_DISABLE,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_WIFI)) :
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ENABLE,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_WIFI));
+ // Cellular
+ const CellularNetworkVector& cell_networks = cros->cellular_networks();
+ // Cellular networks ssids.
+ for (size_t i = 0; i < cell_networks.size(); ++i) {
+ label = ASCIIToUTF16(cell_networks[i].name);
+ flag = (cell_networks[i].name == cros->cellular_name()) ?
+ FLAG_CELLULAR & FLAG_BOLD : FLAG_CELLULAR;
menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
- SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_TOGGLE_WIFI));
-
- const WifiNetworkVector& networks = cros->wifi_networks();
- // Wifi networks ssids.
- if (networks.empty()) {
- // No networks available message.
- label =
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_MENU_ITEM_INDENT,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NO_NETWORKS_MESSAGE));
- menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
- SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_DISABLED));
- } else {
- for (size_t i = 0; i < networks.size(); ++i) {
- label =
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_MENU_ITEM_INDENT,
- ASCIIToUTF16(networks[i].ssid));
- if (networks[i].ssid == cros->wifi_ssid()) {
- menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_CHECK, label,
- SkBitmap(), networks[i], CellularNetwork(), FLAG_ACTIVATE_WIFI));
- } else {
- menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
- SkBitmap(), networks[i], CellularNetwork(), FLAG_ACTIVATE_WIFI));
- }
- }
- }
+ IconForNetworkStrength(cell_networks[i].strength, true),
+ WifiNetwork(), cell_networks[i], flag));
+ }
- // Separator.
- menu_items_.push_back(MenuItem());
+ // No networks available message.
+ if (wifi_networks.empty() && cell_networks.empty()) {
+ label = l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_MENU_ITEM_INDENT,
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NO_NETWORKS_MESSAGE));
+ menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
+ SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_DISABLED));
}
- // Cellular: Status.
- status = IDS_STATUSBAR_NETWORK_DEVICE_DISABLED;
- if (cros->cellular_connecting())
- status = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING;
- else if (cros->cellular_connected())
- status = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTED;
- else if (cros->cellular_enabled())
- status = IDS_STATUSBAR_NETWORK_DEVICE_DISCONNECTED;
- label =
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_STATUS,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR),
- l10n_util::GetStringUTF16(status));
- icon = cros->cellular_connected() ?
- IconForNetworkStrength(cros->cellular_strength(), true) :
- *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED);
- menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
- icon, WifiNetwork(), CellularNetwork(), FLAG_DISABLED));
+ // Separator.
+ menu_items_.push_back(MenuItem());
- // Turn Cellular Off.
- if (!offline_mode) {
- label = cros->cellular_enabled() ?
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_DISABLE,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR)) :
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ENABLE,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR));
- menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
- SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_TOGGLE_CELLULAR));
-
- const CellularNetworkVector& networks = cros->cellular_networks();
- // Cellular networks ssids.
- if (networks.empty()) {
- // No networks available message.
- label =
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_MENU_ITEM_INDENT,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NO_NETWORKS_MESSAGE));
- menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
- SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_DISABLED));
- } else {
- for (size_t i = 0; i < networks.size(); ++i) {
- label =
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_MENU_ITEM_INDENT,
- ASCIIToUTF16(networks[i].name));
- if (networks[i].name == cros->cellular_name()) {
- menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_CHECK, label,
- SkBitmap(), WifiNetwork(), networks[i], FLAG_ACTIVATE_CELLULAR));
- } else {
- menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
- SkBitmap(), WifiNetwork(), networks[i], FLAG_ACTIVATE_CELLULAR));
- }
- }
- }
+ // TODO(chocobo): Uncomment once we figure out how to do offline mode.
+ // Offline mode.
+// menu_items_.push_back(MenuItem(cros->offline_mode() ?
+// menus::MenuModel::TYPE_CHECK : menus::MenuModel::TYPE_COMMAND,
+// l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_OFFLINE_MODE),
+// SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_TOGGLE_OFFLINE));
- // Separator.
- menu_items_.push_back(MenuItem());
- }
+ // Turn Wifi Off.
+ label = cros->wifi_enabled() ?
+ l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_DISABLE,
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_WIFI)) :
+ l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ENABLE,
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_WIFI));
+ menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
+ SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_TOGGLE_WIFI));
- // Ethernet: Status.
- status = IDS_STATUSBAR_NETWORK_DEVICE_DISABLED;
- if (cros->ethernet_connecting())
- status = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING;
- else if (cros->ethernet_connected())
- status = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTED;
- else if (cros->ethernet_enabled())
- status = IDS_STATUSBAR_NETWORK_DEVICE_DISCONNECTED;
- label = l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_STATUS,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET),
- l10n_util::GetStringUTF16(status));
- icon = cros->ethernet_connected() ?
- *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED_BLACK) :
- *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED);
+ // Turn Cellular Off.
+ label = cros->cellular_enabled() ?
+ l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_DISABLE,
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR)) :
+ l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ENABLE,
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR));
menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
- icon, WifiNetwork(), CellularNetwork(), FLAG_DISABLED));
-
- // Turn Ethernet Off.
- if (!offline_mode) {
- label = cros->ethernet_enabled() ?
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_DISABLE,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)) :
- l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ENABLE,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET));
- menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
- SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_TOGGLE_ETHERNET));
+ SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_TOGGLE_CELLULAR));
+ // IP address
+ if (cros->Connected()) {
// Separator.
menu_items_.push_back(MenuItem());
- }
- // Offline mode.
- menu_items_.push_back(MenuItem(offline_mode ?
- menus::MenuModel::TYPE_CHECK : menus::MenuModel::TYPE_COMMAND,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_OFFLINE_MODE),
- SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_TOGGLE_OFFLINE));
+ menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND,
+ ASCIIToUTF16(cros->IPAddress()), SkBitmap(),
+ WifiNetwork(), CellularNetwork(), FLAG_DISABLED));
+ }
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/network_menu_button.h b/chrome/browser/chromeos/status/network_menu_button.h
index 1ebd3db4..97b9841 100644
--- a/chrome/browser/chromeos/status/network_menu_button.h
+++ b/chrome/browser/chromeos/status/network_menu_button.h
@@ -67,6 +67,7 @@ class NetworkMenuButton : public StatusAreaButton,
virtual int GetCommandIdAt(int index) const { return index; }
virtual string16 GetLabelAt(int index) const;
virtual bool IsLabelDynamicAt(int index) const { return true; }
+ virtual const gfx::Font* GetLabelFontAt(int index) const;
virtual bool GetAcceleratorAt(int index,
menus::Accelerator* accelerator) const { return false; }
virtual bool IsItemCheckedAt(int index) const;
@@ -101,8 +102,10 @@ class NetworkMenuButton : public StatusAreaButton,
FLAG_TOGGLE_WIFI = 1 << 2,
FLAG_TOGGLE_CELLULAR = 1 << 3,
FLAG_TOGGLE_OFFLINE = 1 << 4,
- FLAG_ACTIVATE_WIFI = 1 << 5,
- FLAG_ACTIVATE_CELLULAR = 1 << 6
+ FLAG_BOLD = 1 << 5,
+ FLAG_ETHERNET = 1 << 6,
+ FLAG_WIFI = 1 << 7,
+ FLAG_CELLULAR = 1 << 8,
};
struct MenuItem {
diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc
index feb7b0c..693570e 100644
--- a/views/controls/menu/native_menu_gtk.cc
+++ b/views/controls/menu/native_menu_gtk.cc
@@ -7,6 +7,7 @@
#include <map>
#include <string>
+#include "app/gfx/font.h"
#include "app/gfx/gtk_util.h"
#include "app/menus/menu_model.h"
#include "base/keyboard_code_conversion_gtk.h"
@@ -231,6 +232,16 @@ GtkWidget* NativeMenuGtk::AddMenuItemAt(int index,
break;
}
+ // Label font.
+ const gfx::Font* font = model_->GetLabelFontAt(index);
+ if (font) {
+ // The label item is the first child of the menu item.
+ GtkWidget* label_widget = GTK_BIN(menu_item)->child;
+ DCHECK(label_widget && GTK_IS_LABEL(label_widget));
+ gtk_widget_modify_font(label_widget,
+ gfx::Font::PangoFontFromGfxFont(*font));
+ }
+
if (type == menus::MenuModel::TYPE_SUBMENU) {
Menu2* submenu = new Menu2(model_->GetSubmenuModelAt(index));
static_cast<NativeMenuGtk*>(submenu->wrapper_.get())->set_parent(this);