OLD | NEW |
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 "base/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/timer.h" | 8 #include "base/timer.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 double_click_ = false; | 366 double_click_ = false; |
367 } | 367 } |
368 | 368 |
369 bool mouse_enter() const { return mouse_enter_; } | 369 bool mouse_enter() const { return mouse_enter_; } |
370 bool mouse_exit() const { return mouse_exit_; } | 370 bool mouse_exit() const { return mouse_exit_; } |
371 bool mouse_press() const { return mouse_press_; } | 371 bool mouse_press() const { return mouse_press_; } |
372 bool mouse_move() const { return mouse_move_; } | 372 bool mouse_move() const { return mouse_move_; } |
373 bool mouse_release() const { return mouse_release_; } | 373 bool mouse_release() const { return mouse_release_; } |
374 bool double_click() const { return double_click_; } | 374 bool double_click() const { return double_click_; } |
375 | 375 |
376 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 376 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
377 switch (event->type()) { | 377 switch (event->type()) { |
378 case ui::ET_MOUSE_PRESSED: | 378 case ui::ET_MOUSE_PRESSED: |
379 double_click_ = event->flags() & ui::EF_IS_DOUBLE_CLICK; | 379 double_click_ = event->flags() & ui::EF_IS_DOUBLE_CLICK; |
380 mouse_press_ = true; | 380 mouse_press_ = true; |
381 break; | 381 break; |
382 case ui::ET_MOUSE_RELEASED: | 382 case ui::ET_MOUSE_RELEASED: |
383 mouse_release_ = true; | 383 mouse_release_ = true; |
384 break; | 384 break; |
385 case ui::ET_MOUSE_MOVED: | 385 case ui::ET_MOUSE_MOVED: |
386 mouse_move_ = true; | 386 mouse_move_ = true; |
387 break; | 387 break; |
388 case ui::ET_MOUSE_ENTERED: | 388 case ui::ET_MOUSE_ENTERED: |
389 mouse_enter_ = true; | 389 mouse_enter_ = true; |
390 break; | 390 break; |
391 case ui::ET_MOUSE_EXITED: | 391 case ui::ET_MOUSE_EXITED: |
392 mouse_exit_ = true; | 392 mouse_exit_ = true; |
393 break; | 393 break; |
394 default: | 394 default: |
395 NOTREACHED(); | 395 NOTREACHED(); |
396 } | 396 } |
397 return ui::ER_HANDLED; | 397 event->SetHandled(); |
398 } | 398 } |
399 | 399 |
400 private: | 400 private: |
401 bool mouse_enter_; | 401 bool mouse_enter_; |
402 bool mouse_exit_; | 402 bool mouse_exit_; |
403 bool mouse_press_; | 403 bool mouse_press_; |
404 bool mouse_release_; | 404 bool mouse_release_; |
405 bool mouse_move_; | 405 bool mouse_move_; |
406 bool double_click_; | 406 bool double_click_; |
407 | 407 |
(...skipping 2638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 tes.LeapForward(40)); | 3046 tes.LeapForward(40)); |
3047 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4); | 3047 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4); |
3048 EXPECT_TRUE(delegate->scroll_update()); | 3048 EXPECT_TRUE(delegate->scroll_update()); |
3049 EXPECT_EQ(-1, delegate->scroll_y()); | 3049 EXPECT_EQ(-1, delegate->scroll_y()); |
3050 | 3050 |
3051 delegate->Reset(); | 3051 delegate->Reset(); |
3052 } | 3052 } |
3053 | 3053 |
3054 } // namespace test | 3054 } // namespace test |
3055 } // namespace aura | 3055 } // namespace aura |
OLD | NEW |