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

Side by Side Diff: ui/views/event_monitor_aura.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/event_monitor.h ('k') | ui/views/event_monitor_mac.mm » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/event_monitor_aura.h" 5 #include "ui/views/event_monitor_aura.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h"
8 #include "ui/aura/env.h" 9 #include "ui/aura/env.h"
9 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
10 #include "ui/events/event_target.h" 11 #include "ui/events/event_target.h"
11 12
12 namespace views { 13 namespace views {
13 14
14 // static 15 // static
15 scoped_ptr<EventMonitor> EventMonitor::CreateApplicationMonitor( 16 std::unique_ptr<EventMonitor> EventMonitor::CreateApplicationMonitor(
16 ui::EventHandler* event_handler) { 17 ui::EventHandler* event_handler) {
17 return make_scoped_ptr( 18 return base::WrapUnique(
18 new EventMonitorAura(event_handler, aura::Env::GetInstance())); 19 new EventMonitorAura(event_handler, aura::Env::GetInstance()));
19 } 20 }
20 21
21 // static 22 // static
22 scoped_ptr<EventMonitor> EventMonitor::CreateWindowMonitor( 23 std::unique_ptr<EventMonitor> EventMonitor::CreateWindowMonitor(
23 ui::EventHandler* event_handler, 24 ui::EventHandler* event_handler,
24 gfx::NativeWindow target_window) { 25 gfx::NativeWindow target_window) {
25 return make_scoped_ptr(new EventMonitorAura(event_handler, target_window)); 26 return base::WrapUnique(new EventMonitorAura(event_handler, target_window));
26 } 27 }
27 28
28 // static 29 // static
29 gfx::Point EventMonitor::GetLastMouseLocation() { 30 gfx::Point EventMonitor::GetLastMouseLocation() {
30 return aura::Env::GetInstance()->last_mouse_location(); 31 return aura::Env::GetInstance()->last_mouse_location();
31 } 32 }
32 33
33 EventMonitorAura::EventMonitorAura(ui::EventHandler* event_handler, 34 EventMonitorAura::EventMonitorAura(ui::EventHandler* event_handler,
34 ui::EventTarget* event_target) 35 ui::EventTarget* event_target)
35 : event_handler_(event_handler), event_target_(event_target) { 36 : event_handler_(event_handler), event_target_(event_target) {
36 DCHECK(event_handler_); 37 DCHECK(event_handler_);
37 DCHECK(event_target_); 38 DCHECK(event_target_);
38 event_target_->AddPreTargetHandler(event_handler_); 39 event_target_->AddPreTargetHandler(event_handler_);
39 } 40 }
40 41
41 EventMonitorAura::~EventMonitorAura() { 42 EventMonitorAura::~EventMonitorAura() {
42 event_target_->RemovePreTargetHandler(event_handler_); 43 event_target_->RemovePreTargetHandler(event_handler_);
43 } 44 }
44 45
45 } // namespace views 46 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/event_monitor.h ('k') | ui/views/event_monitor_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698