| 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" |
| 11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/chromeos/choose_mobile_network_dialog.h" | 13 #include "chrome/browser/chromeos/choose_mobile_network_dialog.h" |
| 14 #include "chrome/browser/chromeos/cros/cros_library.h" | 14 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 15 #include "chrome/browser/chromeos/customization_document.h" | 15 #include "chrome/browser/chromeos/customization_document.h" |
| 16 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | 16 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
| 17 #include "chrome/browser/defaults.h" |
| 17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
| 19 #include "chrome/browser/ui/views/window.h" | 20 #include "chrome/browser/ui/views/window.h" |
| 20 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| 21 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 22 #include "content/browser/browser_thread.h" | 23 #include "content/browser/browser_thread.h" |
| 23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 24 #include "grit/theme_resources.h" | 25 #include "grit/theme_resources.h" |
| 25 #include "net/base/escape.h" | 26 #include "net/base/escape.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 424 |
| 424 ui::MenuModel::ItemType NetworkMenuModel::GetTypeAt(int index) const { | 425 ui::MenuModel::ItemType NetworkMenuModel::GetTypeAt(int index) const { |
| 425 return menu_items_[index].type; | 426 return menu_items_[index].type; |
| 426 } | 427 } |
| 427 | 428 |
| 428 string16 NetworkMenuModel::GetLabelAt(int index) const { | 429 string16 NetworkMenuModel::GetLabelAt(int index) const { |
| 429 return menu_items_[index].label; | 430 return menu_items_[index].label; |
| 430 } | 431 } |
| 431 | 432 |
| 432 const gfx::Font* NetworkMenuModel::GetLabelFontAt(int index) const { | 433 const gfx::Font* NetworkMenuModel::GetLabelFontAt(int index) const { |
| 433 return (menu_items_[index].flags & FLAG_ASSOCIATED) ? | 434 const gfx::Font* font = NULL; |
| 434 &ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BoldFont) : | 435 if (menu_items_[index].flags & FLAG_ASSOCIATED) { |
| 435 NULL; | 436 ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance(); |
| 437 font = &resource_bundle.GetFont( |
| 438 browser_defaults::kAssociatedNetworkFontStyle); |
| 439 } |
| 440 |
| 441 return font; |
| 436 } | 442 } |
| 437 | 443 |
| 438 bool NetworkMenuModel::IsItemCheckedAt(int index) const { | 444 bool NetworkMenuModel::IsItemCheckedAt(int index) const { |
| 439 // All ui::MenuModel::TYPE_CHECK menu items are checked. | 445 // All ui::MenuModel::TYPE_CHECK menu items are checked. |
| 440 return true; | 446 return true; |
| 441 } | 447 } |
| 442 | 448 |
| 443 bool NetworkMenuModel::GetIconAt(int index, SkBitmap* icon) { | 449 bool NetworkMenuModel::GetIconAt(int index, SkBitmap* icon) { |
| 444 if (!menu_items_[index].icon.empty()) { | 450 if (!menu_items_[index].icon.empty()) { |
| 445 *icon = menu_items_[index].icon; | 451 *icon = menu_items_[index].icon; |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 | 1518 |
| 1513 gfx::Point screen_loc; | 1519 gfx::Point screen_loc; |
| 1514 views::View::ConvertPointToScreen(source, &screen_loc); | 1520 views::View::ConvertPointToScreen(source, &screen_loc); |
| 1515 gfx::Rect bounds(screen_loc, source->size()); | 1521 gfx::Rect bounds(screen_loc, source->size()); |
| 1516 network_menu_->GetSubmenu()->set_minimum_preferred_width(min_width_); | 1522 network_menu_->GetSubmenu()->set_minimum_preferred_width(min_width_); |
| 1517 network_menu_->RunMenuAt(window, GetMenuButton(), bounds, | 1523 network_menu_->RunMenuAt(window, GetMenuButton(), bounds, |
| 1518 views::MenuItemView::TOPRIGHT, true); | 1524 views::MenuItemView::TOPRIGHT, true); |
| 1519 } | 1525 } |
| 1520 | 1526 |
| 1521 } // namespace chromeos | 1527 } // namespace chromeos |
| OLD | NEW |