summaryrefslogtreecommitdiffstats
path: root/ui/views
diff options
context:
space:
mode:
Diffstat (limited to 'ui/views')
-rw-r--r--ui/views/controls/button/button_dropdown.cc4
-rw-r--r--ui/views/controls/button/button_dropdown.h3
-rw-r--r--ui/views/view_unittest.cc3
3 files changed, 5 insertions, 5 deletions
diff --git a/ui/views/controls/button/button_dropdown.cc b/ui/views/controls/button/button_dropdown.cc
index 5ee98b3..236eca4 100644
--- a/ui/views/controls/button/button_dropdown.cc
+++ b/ui/views/controls/button/button_dropdown.cc
@@ -175,8 +175,8 @@ void ButtonDropDown::ShowDropDownMenu() {
menu_showing_ = true;
// Create and run menu. Display an empty menu if model is NULL.
- if (model_) {
- MenuModelAdapter menu_delegate(model_);
+ if (model_.get()) {
+ MenuModelAdapter menu_delegate(model_.get());
menu_delegate.set_triggerable_event_flags(triggerable_event_flags());
menu_runner_.reset(new MenuRunner(menu_delegate.CreateMenu()));
MenuRunner::RunResult result =
diff --git a/ui/views/controls/button/button_dropdown.h b/ui/views/controls/button/button_dropdown.h
index d58e640..8e57222 100644
--- a/ui/views/controls/button/button_dropdown.h
+++ b/ui/views/controls/button/button_dropdown.h
@@ -29,6 +29,7 @@ class VIEWS_EXPORT ButtonDropDown : public ImageButton {
// The button's class name.
static const char kViewClassName[];
+ // Takes ownership of the |model|.
ButtonDropDown(ButtonListener* listener, ui::MenuModel* model);
virtual ~ButtonDropDown();
@@ -67,7 +68,7 @@ class VIEWS_EXPORT ButtonDropDown : public ImageButton {
private:
// The model that populates the attached menu.
- ui::MenuModel* model_;
+ scoped_ptr<ui::MenuModel> model_;
// Indicates if menu is currently showing.
bool menu_showing_;
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc
index ef607be..3759915 100644
--- a/ui/views/view_unittest.cc
+++ b/ui/views/view_unittest.cc
@@ -1762,7 +1762,7 @@ class ButtonDropDownTest : public ViewTest {
virtual void SetUp() OVERRIDE {
ViewTest::SetUp();
- test_dialog_ = new TestDialog(&mock_menu_model_);
+ test_dialog_ = new TestDialog(new MockMenuModel());
Widget* window =
Widget::CreateWindowWithBounds(test_dialog_, gfx::Rect(0, 0, 100, 100));
test_dialog_->widget_ = window;
@@ -1779,7 +1779,6 @@ class ButtonDropDownTest : public ViewTest {
}
TestDialog* test_dialog_;
- MockMenuModel mock_menu_model_;
// This is owned by test_dialog_.
View* button_as_view_;