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

Side by Side Diff: ui/base/models/simple_menu_model.cc

Issue 2049493004: Remove use of deprecated MessageLoop methods in ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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/base/ime/chromeos/ime_keyboard_x11.cc ('k') | ui/base/test/ui_controls_internal_win.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/base/models/simple_menu_model.h" 5 #include "ui/base/models/simple_menu_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/location.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread_task_runner_handle.h"
11 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/gfx/image/image.h" 14 #include "ui/gfx/image/image.h"
13 15
14 namespace ui { 16 namespace ui {
15 17
16 const int kSeparatorId = -1; 18 const int kSeparatorId = -1;
17 19
18 struct SimpleMenuModel::Item { 20 struct SimpleMenuModel::Item {
19 int command_id; 21 int command_id;
20 base::string16 label; 22 base::string16 label;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 388
387 void SimpleMenuModel::MenuWillShow() { 389 void SimpleMenuModel::MenuWillShow() {
388 if (delegate_) 390 if (delegate_)
389 delegate_->MenuWillShow(this); 391 delegate_->MenuWillShow(this);
390 } 392 }
391 393
392 void SimpleMenuModel::MenuClosed() { 394 void SimpleMenuModel::MenuClosed() {
393 // Due to how menus work on the different platforms, ActivatedAt will be 395 // Due to how menus work on the different platforms, ActivatedAt will be
394 // called after this. It's more convenient for the delegate to be called 396 // called after this. It's more convenient for the delegate to be called
395 // afterwards though, so post a task. 397 // afterwards though, so post a task.
396 base::MessageLoop::current()->PostTask( 398 base::ThreadTaskRunnerHandle::Get()->PostTask(
397 FROM_HERE, 399 FROM_HERE,
398 base::Bind(&SimpleMenuModel::OnMenuClosed, method_factory_.GetWeakPtr())); 400 base::Bind(&SimpleMenuModel::OnMenuClosed, method_factory_.GetWeakPtr()));
399 } 401 }
400 402
401 void SimpleMenuModel::SetMenuModelDelegate( 403 void SimpleMenuModel::SetMenuModelDelegate(
402 ui::MenuModelDelegate* menu_model_delegate) { 404 ui::MenuModelDelegate* menu_model_delegate) {
403 menu_model_delegate_ = menu_model_delegate; 405 menu_model_delegate_ = menu_model_delegate;
404 } 406 }
405 407
406 MenuModelDelegate* SimpleMenuModel::GetMenuModelDelegate() const { 408 MenuModelDelegate* SimpleMenuModel::GetMenuModelDelegate() const {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 #ifndef NDEBUG 445 #ifndef NDEBUG
444 if (item.type == TYPE_SEPARATOR) { 446 if (item.type == TYPE_SEPARATOR) {
445 DCHECK_EQ(item.command_id, kSeparatorId); 447 DCHECK_EQ(item.command_id, kSeparatorId);
446 } else { 448 } else {
447 DCHECK_GE(item.command_id, 0); 449 DCHECK_GE(item.command_id, 0);
448 } 450 }
449 #endif // NDEBUG 451 #endif // NDEBUG
450 } 452 }
451 453
452 } // namespace ui 454 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/chromeos/ime_keyboard_x11.cc ('k') | ui/base/test/ui_controls_internal_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698