| OLD | NEW |
| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #import "base/mac/scoped_objc_class_swizzler.h" | 7 #import "base/mac/scoped_objc_class_swizzler.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "ui/events/event_processor.h" | 9 #include "ui/events/event_processor.h" |
| 10 #include "ui/events/event_target.h" | 10 #include "ui/events/event_target.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 } | 305 } |
| 306 | 306 |
| 307 EventGeneratorDelegateMac::~EventGeneratorDelegateMac() { | 307 EventGeneratorDelegateMac::~EventGeneratorDelegateMac() { |
| 308 DCHECK_EQ(this, ui::test::EventGenerator::default_delegate); | 308 DCHECK_EQ(this, ui::test::EventGenerator::default_delegate); |
| 309 ui::test::EventGenerator::default_delegate = NULL; | 309 ui::test::EventGenerator::default_delegate = NULL; |
| 310 } | 310 } |
| 311 | 311 |
| 312 scoped_ptr<ui::EventTargetIterator> | 312 scoped_ptr<ui::EventTargetIterator> |
| 313 EventGeneratorDelegateMac::GetChildIterator() const { | 313 EventGeneratorDelegateMac::GetChildIterator() const { |
| 314 // Return NULL to dispatch all events to the result of GetRootTarget(). | 314 // Return NULL to dispatch all events to the result of GetRootTarget(). |
| 315 return scoped_ptr<ui::EventTargetIterator>(); | 315 return nullptr; |
| 316 } | 316 } |
| 317 | 317 |
| 318 void EventGeneratorDelegateMac::OnMouseEvent(ui::MouseEvent* event) { | 318 void EventGeneratorDelegateMac::OnMouseEvent(ui::MouseEvent* event) { |
| 319 // For mouse drag events, ensure the swizzled methods return the right flags. | 319 // For mouse drag events, ensure the swizzled methods return the right flags. |
| 320 base::AutoReset<ui::test::EventGenerator*> reset(&g_active_generator, owner_); | 320 base::AutoReset<ui::test::EventGenerator*> reset(&g_active_generator, owner_); |
| 321 NSEvent* ns_event = CreateMouseEventInWindow(window_, | 321 NSEvent* ns_event = CreateMouseEventInWindow(window_, |
| 322 event->type(), | 322 event->type(), |
| 323 event->location(), | 323 event->location(), |
| 324 event->changed_button_flags()); | 324 event->changed_button_flags()); |
| 325 if (owner_->targeting_application()) | 325 if (owner_->targeting_application()) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 namespace views { | 359 namespace views { |
| 360 namespace test { | 360 namespace test { |
| 361 | 361 |
| 362 void InitializeMacEventGeneratorDelegate() { | 362 void InitializeMacEventGeneratorDelegate() { |
| 363 EventGeneratorDelegateMac::GetInstance(); | 363 EventGeneratorDelegateMac::GetInstance(); |
| 364 } | 364 } |
| 365 | 365 |
| 366 } // namespace test | 366 } // namespace test |
| 367 } // namespace views | 367 } // namespace views |
| OLD | NEW |