Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: ui/views/test/combobox_test_api.cc

Issue 2790773002: Cleanup MenuRunner API (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/examples/tree_view_example.cc ('k') | ui/views/test/menu_test_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/views/test/combobox_test_api.h" 5 #include "ui/views/test/combobox_test_api.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "ui/base/models/menu_model.h" 11 #include "ui/base/models/menu_model.h"
12 #include "ui/views/controls/combobox/combobox.h" 12 #include "ui/views/controls/combobox/combobox.h"
13 #include "ui/views/controls/menu/menu_runner.h" 13 #include "ui/views/controls/menu/menu_runner.h"
14 #include "ui/views/controls/menu/menu_runner_handler.h" 14 #include "ui/views/controls/menu/menu_runner_handler.h"
15 #include "ui/views/test/menu_runner_test_api.h" 15 #include "ui/views/test/menu_runner_test_api.h"
16 16
17 namespace views { 17 namespace views {
18 namespace test { 18 namespace test {
19 namespace { 19 namespace {
20 20
21 // An dummy implementation of MenuRunnerHandler to check if the dropdown menu is 21 // An dummy implementation of MenuRunnerHandler to check if the dropdown menu is
22 // shown or not. 22 // shown or not.
23 class TestMenuRunnerHandler : public MenuRunnerHandler { 23 class TestMenuRunnerHandler : public MenuRunnerHandler {
24 public: 24 public:
25 explicit TestMenuRunnerHandler(int* show_counter) 25 explicit TestMenuRunnerHandler(int* show_counter)
26 : show_counter_(show_counter) {} 26 : show_counter_(show_counter) {}
27 MenuRunner::RunResult RunMenuAt(Widget* parent, 27 void RunMenuAt(Widget* parent,
28 MenuButton* button, 28 MenuButton* button,
29 const gfx::Rect& bounds, 29 const gfx::Rect& bounds,
30 MenuAnchorPosition anchor, 30 MenuAnchorPosition anchor,
31 ui::MenuSourceType source_type, 31 ui::MenuSourceType source_type,
32 int32_t types) override { 32 int32_t types) override {
33 *show_counter_ += 1; 33 *show_counter_ += 1;
34 return MenuRunner::NORMAL_EXIT;
35 } 34 }
36 35
37 private: 36 private:
38 int* show_counter_; 37 int* show_counter_;
39 38
40 DISALLOW_COPY_AND_ASSIGN(TestMenuRunnerHandler); 39 DISALLOW_COPY_AND_ASSIGN(TestMenuRunnerHandler);
41 }; 40 };
42 41
43 } // namespace 42 } // namespace
44 43
(...skipping 12 matching lines...) Expand all
57 gfx::Size ComboboxTestApi::content_size() { 56 gfx::Size ComboboxTestApi::content_size() {
58 return combobox_->content_size_; 57 return combobox_->content_size_;
59 } 58 }
60 59
61 ui::MenuModel* ComboboxTestApi::menu_model() { 60 ui::MenuModel* ComboboxTestApi::menu_model() {
62 return combobox_->menu_model_.get(); 61 return combobox_->menu_model_.get();
63 } 62 }
64 63
65 } // test 64 } // test
66 } // views 65 } // views
OLDNEW
« no previous file with comments | « ui/views/examples/tree_view_example.cc ('k') | ui/views/test/menu_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698