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

Side by Side Diff: ui/views/examples/menu_example.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 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/label_example.cc ('k') | ui/views/examples/multiline_example.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/examples/menu_example.h" 5 #include "ui/views/examples/menu_example.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 COMMAND_DO_SOMETHING, 44 COMMAND_DO_SOMETHING,
45 COMMAND_SELECT_ASCII, 45 COMMAND_SELECT_ASCII,
46 COMMAND_SELECT_UTF8, 46 COMMAND_SELECT_UTF8,
47 COMMAND_SELECT_UTF16, 47 COMMAND_SELECT_UTF16,
48 COMMAND_CHECK_APPLE, 48 COMMAND_CHECK_APPLE,
49 COMMAND_CHECK_ORANGE, 49 COMMAND_CHECK_ORANGE,
50 COMMAND_CHECK_KIWI, 50 COMMAND_CHECK_KIWI,
51 COMMAND_GO_HOME, 51 COMMAND_GO_HOME,
52 }; 52 };
53 53
54 scoped_ptr<ui::SimpleMenuModel> submenu_; 54 std::unique_ptr<ui::SimpleMenuModel> submenu_;
55 std::set<int> checked_fruits_; 55 std::set<int> checked_fruits_;
56 int current_encoding_command_id_; 56 int current_encoding_command_id_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(ExampleMenuModel); 58 DISALLOW_COPY_AND_ASSIGN(ExampleMenuModel);
59 }; 59 };
60 60
61 class ExampleMenuButton : public MenuButton, public MenuButtonListener { 61 class ExampleMenuButton : public MenuButton, public MenuButtonListener {
62 public: 62 public:
63 explicit ExampleMenuButton(const base::string16& test); 63 explicit ExampleMenuButton(const base::string16& test);
64 ~ExampleMenuButton() override; 64 ~ExampleMenuButton() override;
65 65
66 private: 66 private:
67 // MenuButtonListener: 67 // MenuButtonListener:
68 void OnMenuButtonClicked(MenuButton* source, 68 void OnMenuButtonClicked(MenuButton* source,
69 const gfx::Point& point, 69 const gfx::Point& point,
70 const ui::Event* event) override; 70 const ui::Event* event) override;
71 71
72 ui::SimpleMenuModel* GetMenuModel(); 72 ui::SimpleMenuModel* GetMenuModel();
73 73
74 scoped_ptr<ExampleMenuModel> menu_model_; 74 std::unique_ptr<ExampleMenuModel> menu_model_;
75 scoped_ptr<MenuRunner> menu_runner_; 75 std::unique_ptr<MenuRunner> menu_runner_;
76 76
77 DISALLOW_COPY_AND_ASSIGN(ExampleMenuButton); 77 DISALLOW_COPY_AND_ASSIGN(ExampleMenuButton);
78 }; 78 };
79 79
80 // ExampleMenuModel --------------------------------------------------------- 80 // ExampleMenuModel ---------------------------------------------------------
81 81
82 ExampleMenuModel::ExampleMenuModel() 82 ExampleMenuModel::ExampleMenuModel()
83 : ui::SimpleMenuModel(this), 83 : ui::SimpleMenuModel(this),
84 current_encoding_command_id_(COMMAND_SELECT_ASCII) { 84 current_encoding_command_id_(COMMAND_SELECT_ASCII) {
85 AddItem(COMMAND_DO_SOMETHING, ASCIIToUTF16("Do Something")); 85 AddItem(COMMAND_DO_SOMETHING, ASCIIToUTF16("Do Something"));
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 void MenuExample::CreateExampleView(View* container) { 217 void MenuExample::CreateExampleView(View* container) {
218 // We add a button to open a menu. 218 // We add a button to open a menu.
219 ExampleMenuButton* menu_button = new ExampleMenuButton( 219 ExampleMenuButton* menu_button = new ExampleMenuButton(
220 ASCIIToUTF16("Open a menu")); 220 ASCIIToUTF16("Open a menu"));
221 container->SetLayoutManager(new FillLayout); 221 container->SetLayoutManager(new FillLayout);
222 container->AddChildView(menu_button); 222 container->AddChildView(menu_button);
223 } 223 }
224 224
225 } // namespace examples 225 } // namespace examples
226 } // namespace views 226 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/label_example.cc ('k') | ui/views/examples/multiline_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698