summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 23:40:40 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 23:40:40 +0000
commit1abede9a1dcf4cdbb27c95d247f41733d21ba208 (patch)
tree42ec2f654e839ff7ea954e3d3dc8c2536c95c68b
parent959abf3b1fdbf58974eebe7e42490c2c3ff3e504 (diff)
downloadchromium_src-1abede9a1dcf4cdbb27c95d247f41733d21ba208.zip
chromium_src-1abede9a1dcf4cdbb27c95d247f41733d21ba208.tar.gz
chromium_src-1abede9a1dcf4cdbb27c95d247f41733d21ba208.tar.bz2
views: Change MenuButton API to string16.
BUG=68267 R=sky@chromium.org Review URL: http://codereview.chromium.org/8245013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105196 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/login/network_selection_view.cc8
-rw-r--r--chrome/browser/chromeos/login/new_user_view.cc2
-rw-r--r--chrome/browser/chromeos/notifications/balloon_view.cc4
-rw-r--r--chrome/browser/chromeos/status/network_dropdown_button.cc10
-rw-r--r--chrome/browser/chromeos/status/status_area_button.cc2
-rw-r--r--chrome/browser/chromeos/views/dropdown_button.cc2
-rw-r--r--chrome/browser/chromeos/views/dropdown_button.h4
-rw-r--r--chrome/browser/ui/panels/panel_browser_frame_view.cc2
-rw-r--r--chrome/browser/ui/views/app_menu_button_win.cc2
-rw-r--r--chrome/browser/ui/views/avatar_menu_button.cc2
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc10
-rw-r--r--chrome/browser/ui/views/browser_actions_container.cc12
-rw-r--r--chrome/browser/ui/views/infobars/extension_infobar.cc2
-rw-r--r--chrome/browser/ui/views/infobars/infobar_view.cc4
-rw-r--r--chrome/browser/ui/views/menu_item_view_test.cc4
-rw-r--r--chrome/browser/ui/views/menu_model_adapter_test.cc3
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view.cc2
-rw-r--r--chrome/browser/ui/views/toolbar_view.cc2
-rw-r--r--chrome/browser/ui/webui/chromeos/login/network_dropdown.cc6
-rw-r--r--views/controls/button/menu_button.cc4
-rw-r--r--views/controls/button/menu_button.h4
-rw-r--r--views/examples/menu_example.cc14
22 files changed, 54 insertions, 51 deletions
diff --git a/chrome/browser/chromeos/login/network_selection_view.cc b/chrome/browser/chromeos/login/network_selection_view.cc
index 1b05732..737cd26 100644
--- a/chrome/browser/chromeos/login/network_selection_view.cc
+++ b/chrome/browser/chromeos/login/network_selection_view.cc
@@ -25,9 +25,9 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/size.h"
+#include "views/controls/button/text_button.h"
#include "views/controls/label.h"
#include "views/controls/link.h"
-#include "views/controls/button/text_button.h"
#include "views/controls/throbber.h"
#include "views/layout/fill_layout.h"
#include "views/layout/grid_layout.h"
@@ -126,7 +126,7 @@ class NetworkControlReportOnActivate : public NetworkDropdownButton {
class NotifyingMenuButton : public DropDownButton {
public:
NotifyingMenuButton(views::ButtonListener* listener,
- const std::wstring& text,
+ const string16& text,
views::ViewMenuDelegate* menu_delegate,
bool show_menu_marker,
ViewsNetworkScreenActor* actor)
@@ -303,14 +303,14 @@ void NetworkSelectionView::Init() {
select_language_label_->SetBackgroundColor(background_color);
languages_menubutton_ = new NotifyingMenuButton(
- NULL, std::wstring(), actor_->language_switch_menu(), true, actor_);
+ NULL, string16(), actor_->language_switch_menu(), true, actor_);
InitMenuButtonProperties(languages_menubutton_);
select_keyboard_label_ = new views::Label();
select_keyboard_label_->SetBackgroundColor(background_color);
keyboards_menubutton_ = new DropDownButton(
- NULL /* listener */, L"", actor_->keyboard_switch_menu(),
+ NULL /* listener */, string16(), actor_->keyboard_switch_menu(),
true /* show_menu_marker */);
InitMenuButtonProperties(keyboards_menubutton_);
diff --git a/chrome/browser/chromeos/login/new_user_view.cc b/chrome/browser/chromeos/login/new_user_view.cc
index 9271fc3..694db92 100644
--- a/chrome/browser/chromeos/login/new_user_view.cc
+++ b/chrome/browser/chromeos/login/new_user_view.cc
@@ -230,7 +230,7 @@ void NewUserView::RecreatePeculiarControls() {
// to shrink, only grow; so recreate on text change.
delete languages_menubutton_;
languages_menubutton_ = new views::MenuButton(
- NULL, std::wstring(), &language_switch_menu_, true);
+ NULL, string16(), &language_switch_menu_, true);
languages_menubutton_->set_menu_marker(
ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_MENU_DROPARROW_SHARP));
diff --git a/chrome/browser/chromeos/notifications/balloon_view.cc b/chrome/browser/chromeos/notifications/balloon_view.cc
index b1b4332..d616161 100644
--- a/chrome/browser/chromeos/notifications/balloon_view.cc
+++ b/chrome/browser/chromeos/notifications/balloon_view.cc
@@ -85,8 +85,8 @@ class NotificationControlView : public views::View,
AddChildView(close_button_);
- options_menu_button_
- = new views::MenuButton(NULL, std::wstring(), this, false);
+ options_menu_button_ = new views::MenuButton(
+ NULL, string16(), this, false);
options_menu_button_->SetFont(rb.GetFont(ResourceBundle::SmallFont));
options_menu_button_->SetIcon(*rb.GetBitmapNamed(IDR_NOTIFICATION_MENU));
options_menu_button_->set_border(NULL);
diff --git a/chrome/browser/chromeos/status/network_dropdown_button.cc b/chrome/browser/chromeos/status/network_dropdown_button.cc
index eb45010..ac8e678 100644
--- a/chrome/browser/chromeos/status/network_dropdown_button.cc
+++ b/chrome/browser/chromeos/status/network_dropdown_button.cc
@@ -22,11 +22,11 @@ namespace chromeos {
NetworkDropdownButton::NetworkDropdownButton(bool is_browser_mode,
gfx::NativeWindow parent_window,
bool should_show_options)
- : DropDownButton(NULL,
- UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_STATUSBAR_NO_NETWORKS_MESSAGE)),
- this,
- true),
+ : DropDownButton(
+ NULL,
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NO_NETWORKS_MESSAGE),
+ this,
+ true),
parent_window_(parent_window),
should_show_options_(should_show_options) {
network_menu_.reset(new NetworkMenu(this, is_browser_mode));
diff --git a/chrome/browser/chromeos/status/status_area_button.cc b/chrome/browser/chromeos/status/status_area_button.cc
index 07b82f1..6e0e473 100644
--- a/chrome/browser/chromeos/status/status_area_button.cc
+++ b/chrome/browser/chromeos/status/status_area_button.cc
@@ -37,7 +37,7 @@ namespace chromeos {
StatusAreaButton::StatusAreaButton(StatusAreaHost* host,
views::ViewMenuDelegate* menu_delegate)
- : MenuButton(NULL, std::wstring(), menu_delegate, false),
+ : MenuButton(NULL, string16(), menu_delegate, false),
use_menu_button_paint_(false),
active_(true),
host_(host) {
diff --git a/chrome/browser/chromeos/views/dropdown_button.cc b/chrome/browser/chromeos/views/dropdown_button.cc
index 4da7e75..7d37f9e 100644
--- a/chrome/browser/chromeos/views/dropdown_button.cc
+++ b/chrome/browser/chromeos/views/dropdown_button.cc
@@ -61,7 +61,7 @@ DropDownButtonBorder::DropDownButtonBorder() {
namespace chromeos {
DropDownButton::DropDownButton(views::ButtonListener* listener,
- const std::wstring& text,
+ const string16& text,
views::ViewMenuDelegate* menu_delegate,
bool show_menu_marker)
: MenuButton(listener, text, menu_delegate, show_menu_marker) {
diff --git a/chrome/browser/chromeos/views/dropdown_button.h b/chrome/browser/chromeos/views/dropdown_button.h
index ac9c05c..04c871c 100644
--- a/chrome/browser/chromeos/views/dropdown_button.h
+++ b/chrome/browser/chromeos/views/dropdown_button.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,7 +17,7 @@ namespace chromeos {
class DropDownButton : public views::MenuButton {
public:
DropDownButton(views::ButtonListener* listener,
- const std::wstring& text,
+ const string16& text,
views::ViewMenuDelegate* menu_delegate,
bool show_menu_marker);
virtual ~DropDownButton();
diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc
index 80d19c6..d6b0523 100644
--- a/chrome/browser/ui/panels/panel_browser_frame_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc
@@ -247,7 +247,7 @@ PanelBrowserFrameView::PanelBrowserFrameView(BrowserFrame* frame,
EnsureResourcesInitialized();
frame_->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);
- settings_button_ = new views::MenuButton(NULL, std::wstring(), this, false);
+ settings_button_ = new views::MenuButton(NULL, string16(), this, false);
settings_button_->SetIcon(*(settings_button_resources.normal_image));
settings_button_->SetHoverIcon(*(settings_button_resources.hover_image));
settings_button_->SetPushedIcon(*(settings_button_resources.pushed_image));
diff --git a/chrome/browser/ui/views/app_menu_button_win.cc b/chrome/browser/ui/views/app_menu_button_win.cc
index 0bf0990..0718cb8 100644
--- a/chrome/browser/ui/views/app_menu_button_win.cc
+++ b/chrome/browser/ui/views/app_menu_button_win.cc
@@ -8,7 +8,7 @@
#include "views/widget/widget.h"
AppMenuButtonWin::AppMenuButtonWin(views::ViewMenuDelegate* menu_delegate)
- : views::MenuButton(NULL, std::wstring(), menu_delegate, false) {
+ : views::MenuButton(NULL, string16(), menu_delegate, false) {
}
bool AppMenuButtonWin::OnKeyPressed(const views::KeyEvent& event) {
diff --git a/chrome/browser/ui/views/avatar_menu_button.cc b/chrome/browser/ui/views/avatar_menu_button.cc
index 3cabdf9..f3e8c8e 100644
--- a/chrome/browser/ui/views/avatar_menu_button.cc
+++ b/chrome/browser/ui/views/avatar_menu_button.cc
@@ -75,7 +75,7 @@ void DrawTaskBarDecoration(const Browser* browser, const SkBitmap* bitmap) {
}
AvatarMenuButton::AvatarMenuButton(Browser* browser, bool has_menu)
- : MenuButton(NULL, std::wstring(), this, false),
+ : MenuButton(NULL, string16(), this, false),
browser_(browser),
bubble_(NULL),
has_menu_(has_menu),
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index 765c646..120f451 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -183,7 +183,7 @@ const char BookmarkButton::kViewClassName[] =
class BookmarkFolderButton : public views::MenuButton {
public:
BookmarkFolderButton(views::ButtonListener* listener,
- const std::wstring& title,
+ const string16& title,
views::ViewMenuDelegate* menu_delegate,
bool show_menu_marker)
: MenuButton(listener, title, menu_delegate, show_menu_marker) {
@@ -231,7 +231,7 @@ class BookmarkFolderButton : public views::MenuButton {
class OverFlowButton : public views::MenuButton {
public:
explicit OverFlowButton(BookmarkBarView* owner)
- : MenuButton(NULL, std::wstring(), owner, false),
+ : MenuButton(NULL, string16(), owner, false),
owner_(owner) {}
virtual bool OnMousePressed(const views::MouseEvent& e) {
@@ -1207,7 +1207,7 @@ int BookmarkBarView::GetFirstHiddenNodeIndex() {
MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() {
MenuButton* button = new BookmarkFolderButton(
this,
- UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_OTHER_BOOKMARKED)),
+ l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_OTHER_BOOKMARKED),
this,
false);
button->set_id(VIEW_ID_OTHER_BOOKMARKS);
@@ -1265,8 +1265,8 @@ views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) {
ConfigureButton(node, button);
return button;
} else {
- views::MenuButton* button = new BookmarkFolderButton(this,
- UTF16ToWide(node->GetTitle()), this, false);
+ views::MenuButton* button = new BookmarkFolderButton(
+ this, node->GetTitle(), this, false);
button->SetIcon(GetFolderIcon());
ConfigureButton(node, button);
return button;
diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc
index e06ffa4..c544de8 100644
--- a/chrome/browser/ui/views/browser_actions_container.cc
+++ b/chrome/browser/ui/views/browser_actions_container.cc
@@ -66,7 +66,7 @@ bool BrowserActionsContainer::disable_animations_during_testing_ = false;
BrowserActionButton::BrowserActionButton(const Extension* extension,
BrowserActionsContainer* panel)
: ALLOW_THIS_IN_INITIALIZER_LIST(
- MenuButton(this, std::wstring(), NULL, false)),
+ MenuButton(this, string16(), NULL, false)),
browser_action_(extension->browser_action()),
extension_(extension),
ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)),
@@ -216,8 +216,8 @@ bool BrowserActionButton::Activate() {
bool BrowserActionButton::OnMousePressed(const views::MouseEvent& event) {
if (!event.IsRightMouseButton()) {
- return IsPopup() ?
- MenuButton::OnMousePressed(event) : TextButton::OnMousePressed(event);
+ return IsPopup() ? MenuButton::OnMousePressed(event)
+ : TextButton::OnMousePressed(event);
}
ShowContextMenu(gfx::Point(), true);
@@ -242,8 +242,8 @@ void BrowserActionButton::OnMouseExited(const views::MouseEvent& event) {
}
bool BrowserActionButton::OnKeyReleased(const views::KeyEvent& event) {
- return IsPopup() ?
- MenuButton::OnKeyReleased(event) : TextButton::OnKeyReleased(event);
+ return IsPopup() ? MenuButton::OnKeyReleased(event)
+ : TextButton::OnKeyReleased(event);
}
void BrowserActionButton::ShowContextMenu(const gfx::Point& p,
@@ -377,7 +377,7 @@ BrowserActionsContainer::BrowserActionsContainer(Browser* browser,
resize_area_ = new views::ResizeArea(this);
AddChildView(resize_area_);
- chevron_ = new views::MenuButton(NULL, std::wstring(), this, false);
+ chevron_ = new views::MenuButton(NULL, string16(), this, false);
chevron_->set_border(NULL);
chevron_->EnableCanvasFlippingForRTLUI(true);
chevron_->SetAccessibleName(
diff --git a/chrome/browser/ui/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc
index 16fcf9c..994af4f 100644
--- a/chrome/browser/ui/views/infobars/extension_infobar.cc
+++ b/chrome/browser/ui/views/infobars/extension_infobar.cc
@@ -74,7 +74,7 @@ void ExtensionInfoBar::ViewHierarchyChanged(bool is_add,
return;
}
- menu_ = new views::MenuButton(NULL, std::wstring(), this, false);
+ menu_ = new views::MenuButton(NULL, string16(), this, false);
menu_->SetVisible(false);
AddChildView(menu_);
diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc
index 05369ce..1df535d 100644
--- a/chrome/browser/ui/views/infobars/infobar_view.cc
+++ b/chrome/browser/ui/views/infobars/infobar_view.cc
@@ -101,8 +101,8 @@ views::Link* InfoBarView::CreateLink(const string16& text,
views::MenuButton* InfoBarView::CreateMenuButton(
const string16& text,
views::ViewMenuDelegate* menu_delegate) {
- views::MenuButton* menu_button =
- new views::MenuButton(NULL, UTF16ToWideHack(text), menu_delegate, true);
+ views::MenuButton* menu_button = new views::MenuButton(
+ NULL, text, menu_delegate, true);
menu_button->set_border(new InfoBarButtonBorder);
menu_button->set_animate_on_state_change(false);
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
diff --git a/chrome/browser/ui/views/menu_item_view_test.cc b/chrome/browser/ui/views/menu_item_view_test.cc
index ab23e5d..1bba805 100644
--- a/chrome/browser/ui/views/menu_item_view_test.cc
+++ b/chrome/browser/ui/views/menu_item_view_test.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/utf_string_conversions.h"
#include "chrome/browser/automation/ui_controls.h"
#include "chrome/test/base/view_event_test_base.h"
#include "views/controls/button/menu_button.h"
@@ -43,7 +44,8 @@ class MenuItemViewTestBase : public ViewEventTestBase,
// ViewEventTestBase implementation.
virtual void SetUp() OVERRIDE {
- button_ = new views::MenuButton(NULL, L"Menu Test", this, true);
+ button_ = new views::MenuButton(
+ NULL, ASCIIToUTF16("Menu Test"), this, true);
menu_ = new views::MenuItemView(this);
BuildMenu(menu_);
menu_runner_.reset(new views::MenuRunner(menu_));
diff --git a/chrome/browser/ui/views/menu_model_adapter_test.cc b/chrome/browser/ui/views/menu_model_adapter_test.cc
index 55f7a34..112d42a 100644
--- a/chrome/browser/ui/views/menu_model_adapter_test.cc
+++ b/chrome/browser/ui/views/menu_model_adapter_test.cc
@@ -259,7 +259,8 @@ class MenuModelAdapterTest : public ViewEventTestBase,
// ViewEventTestBase implementation.
virtual void SetUp() OVERRIDE {
- button_ = new views::MenuButton(NULL, L"Menu Adapter Test", this, true);
+ button_ = new views::MenuButton(
+ NULL, ASCIIToUTF16("Menu Adapter Test"), this, true);
menu_ = menu_model_adapter_.CreateMenu();
menu_runner_.reset(new views::MenuRunner(menu_));
diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc
index 9813d46..bf1376b 100644
--- a/chrome/browser/ui/views/notifications/balloon_view.cc
+++ b/chrome/browser/ui/views/notifications/balloon_view.cc
@@ -302,7 +302,7 @@ void BalloonViewImpl::Show(Balloon* balloon) {
source_label_ = new views::Label(source_label_text);
AddChildView(source_label_);
- options_menu_button_ = new views::MenuButton(NULL, L"", this, false);
+ options_menu_button_ = new views::MenuButton(NULL, string16(), this, false);
AddChildView(options_menu_button_);
close_button_ = new views::ImageButton(this);
close_button_->SetTooltipText(l10n_util::GetStringUTF16(
diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc
index fc45d50..5ebe6c7 100644
--- a/chrome/browser/ui/views/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar_view.cc
@@ -177,7 +177,7 @@ void ToolbarView::Init() {
#if defined(OS_WIN) && !defined(USE_AURA)
app_menu_ = new AppMenuButtonWin(this);
#else
- app_menu_ = new views::MenuButton(NULL, std::wstring(), this, false);
+ app_menu_ = new views::MenuButton(NULL, string16(), this, false);
#endif
app_menu_->set_border(NULL);
app_menu_->EnableCanvasFlippingForRTLUI(true);
diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
index 7fc6eb8..9933dbc 100644
--- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
+++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
@@ -7,10 +7,10 @@
#include <string>
#include "base/values.h"
-#include "content/browser/webui/web_ui.h"
-#include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
+#include "content/browser/webui/web_ui.h"
#include "ui/base/models/menu_model.h"
#include "ui/gfx/font.h"
@@ -92,7 +92,7 @@ base::ListValue* NetworkMenuWebUI::ConvertMenuModel(ui::MenuModel* model) {
// NetworkDropdown -------------------------------------------------------------
-NetworkDropdown::NetworkDropdown(WebUI *web_ui, gfx::NativeWindow parent_window)
+NetworkDropdown::NetworkDropdown(WebUI* web_ui, gfx::NativeWindow parent_window)
: parent_window_(parent_window),
web_ui_(web_ui) {
network_menu_.reset(new NetworkMenuWebUI(this, web_ui));
diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc
index b8d0410..4a9e74c 100644
--- a/views/controls/button/menu_button.cc
+++ b/views/controls/button/menu_button.cc
@@ -46,10 +46,10 @@ const char MenuButton::kViewClassName[] = "views/MenuButton";
////////////////////////////////////////////////////////////////////////////////
MenuButton::MenuButton(ButtonListener* listener,
- const std::wstring& text,
+ const string16& text,
ViewMenuDelegate* menu_delegate,
bool show_menu_marker)
- : TextButton(listener, text),
+ : TextButton(listener, UTF16ToWideHack(text)),
menu_visible_(false),
menu_offset_(kDefaultMenuOffsetX, kDefaultMenuOffsetY),
menu_delegate_(menu_delegate),
diff --git a/views/controls/button/menu_button.h b/views/controls/button/menu_button.h
index ce84526..5f202cb 100644
--- a/views/controls/button/menu_button.h
+++ b/views/controls/button/menu_button.h
@@ -8,6 +8,7 @@
#include <string>
+#include "base/string16.h"
#include "base/time.h"
#include "ui/gfx/font.h"
#include "views/background.h"
@@ -28,12 +29,11 @@ class ViewMenuDelegate;
////////////////////////////////////////////////////////////////////////////////
class VIEWS_EXPORT MenuButton : public TextButton {
public:
- // The menu button's class name.
static const char kViewClassName[];
// Create a Button.
MenuButton(ButtonListener* listener,
- const std::wstring& text,
+ const string16& text,
ViewMenuDelegate* menu_delegate,
bool show_menu_marker);
virtual ~MenuButton();
diff --git a/views/examples/menu_example.cc b/views/examples/menu_example.cc
index 04e28b6..ea501eb 100644
--- a/views/examples/menu_example.cc
+++ b/views/examples/menu_example.cc
@@ -9,9 +9,9 @@
#include "base/utf_string_conversions.h"
#include "ui/base/models/simple_menu_model.h"
#include "views/controls/button/menu_button.h"
+#include "views/controls/button/text_button.h"
#include "views/controls/menu/menu_2.h"
#include "views/controls/menu/view_menu_delegate.h"
-#include "views/controls/button/text_button.h"
#include "views/layout/fill_layout.h"
#include "views/view.h"
@@ -59,7 +59,7 @@ class ExampleMenuModel : public ui::SimpleMenuModel,
class ExampleMenuButton : public views::MenuButton,
public views::ViewMenuDelegate {
public:
- ExampleMenuButton(const std::wstring& test, bool show_menu_marker);
+ ExampleMenuButton(const string16& test, bool show_menu_marker);
virtual ~ExampleMenuButton();
private:
@@ -176,7 +176,7 @@ void ExampleMenuModel::ExecuteCommand(int command_id) {
// ExampleMenuButton -----------------------------------------------------------
-ExampleMenuButton::ExampleMenuButton(const std::wstring& test,
+ExampleMenuButton::ExampleMenuButton(const string16& test,
bool show_menu_marker)
: ALLOW_THIS_IN_INITIALIZER_LIST(
views::MenuButton(NULL, test, this, show_menu_marker)) {
@@ -186,9 +186,9 @@ ExampleMenuButton::~ExampleMenuButton() {
}
void ExampleMenuButton::RunMenu(views::View* source, const gfx::Point& point) {
- if (menu_model_ == NULL) {
+ if (!menu_model_.get())
menu_model_.reset(new ExampleMenuModel);
- }
+
menu_model_->RunMenuAt(point);
}
@@ -207,8 +207,8 @@ void MenuExample::CreateExampleView(views::View* container) {
// views::Menu2 is not a sub class of View, hence we cannot directly
// add to the continer. Instead, we add a button to open a menu.
const bool show_menu_marker = true;
- ExampleMenuButton* menu_button = new ExampleMenuButton(L"Open a menu",
- show_menu_marker);
+ ExampleMenuButton* menu_button = new ExampleMenuButton(
+ ASCIIToUTF16("Open a menu"), show_menu_marker);
container->SetLayoutManager(new views::FillLayout);
container->AddChildView(menu_button);
}