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

Side by Side Diff: ui/views/event_monitor_aura.cc

Issue 809903005: ui/views: Cleanup usage of scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no need of Pass() Created 5 years, 11 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/controls/button/label_button.cc ('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 "ui/aura/env.h" 8 #include "ui/aura/env.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/events/event_target.h" 10 #include "ui/events/event_target.h"
11 11
12 namespace views { 12 namespace views {
13 13
14 // static 14 // static
15 scoped_ptr<EventMonitor> EventMonitor::CreateApplicationMonitor( 15 scoped_ptr<EventMonitor> EventMonitor::CreateApplicationMonitor(
16 ui::EventHandler* event_handler) { 16 ui::EventHandler* event_handler) {
17 return scoped_ptr<EventMonitor>( 17 return make_scoped_ptr(
18 new EventMonitorAura(event_handler, aura::Env::GetInstance())); 18 new EventMonitorAura(event_handler, aura::Env::GetInstance()));
19 } 19 }
20 20
21 // static 21 // static
22 scoped_ptr<EventMonitor> EventMonitor::CreateWindowMonitor( 22 scoped_ptr<EventMonitor> EventMonitor::CreateWindowMonitor(
23 ui::EventHandler* event_handler, 23 ui::EventHandler* event_handler,
24 gfx::NativeWindow target_window) { 24 gfx::NativeWindow target_window) {
25 return scoped_ptr<EventMonitor>( 25 return make_scoped_ptr(new EventMonitorAura(event_handler, target_window));
26 new EventMonitorAura(event_handler, target_window));
27 } 26 }
28 27
29 // static 28 // static
30 gfx::Point EventMonitor::GetLastMouseLocation() { 29 gfx::Point EventMonitor::GetLastMouseLocation() {
31 return aura::Env::GetInstance()->last_mouse_location(); 30 return aura::Env::GetInstance()->last_mouse_location();
32 } 31 }
33 32
34 EventMonitorAura::EventMonitorAura(ui::EventHandler* event_handler, 33 EventMonitorAura::EventMonitorAura(ui::EventHandler* event_handler,
35 ui::EventTarget* event_target) 34 ui::EventTarget* event_target)
36 : event_handler_(event_handler), event_target_(event_target) { 35 : event_handler_(event_handler), event_target_(event_target) {
37 DCHECK(event_handler_); 36 DCHECK(event_handler_);
38 DCHECK(event_target_); 37 DCHECK(event_target_);
39 event_target_->AddPreTargetHandler(event_handler_); 38 event_target_->AddPreTargetHandler(event_handler_);
40 } 39 }
41 40
42 EventMonitorAura::~EventMonitorAura() { 41 EventMonitorAura::~EventMonitorAura() {
43 event_target_->RemovePreTargetHandler(event_handler_); 42 event_target_->RemovePreTargetHandler(event_handler_);
44 } 43 }
45 44
46 } // namespace views 45 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/event_monitor_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698