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

Side by Side Diff: ui/aura/test/event_generator.cc

Issue 8755003: Maximize windows when double clicking their title bar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/test/event_generator.h ('k') | ui/aura_shell/aura_shell.gyp » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/aura/test/event_generator.h" 5 #include "ui/aura/test/event_generator.h"
6 6
7 #include "ui/aura/desktop.h" 7 #include "ui/aura/desktop.h"
8 #include "ui/aura/event.h" 8 #include "ui/aura/event.h"
9 9
10 namespace { 10 namespace {
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 EventGenerator::EventGenerator(Window* window) 32 EventGenerator::EventGenerator(Window* window)
33 : flags_(0), 33 : flags_(0),
34 current_location_(CenterOfWindowInDesktopCoordinate(window)) { 34 current_location_(CenterOfWindowInDesktopCoordinate(window)) {
35 } 35 }
36 36
37 EventGenerator::~EventGenerator() { 37 EventGenerator::~EventGenerator() {
38 } 38 }
39 39
40 void EventGenerator::ClickLeftButton() {
41 PressLeftButton();
42 ReleaseLeftButton();
43 }
44
45 void EventGenerator::PressLeftButton() { 40 void EventGenerator::PressLeftButton() {
46 if ((flags_ & ui::EF_LEFT_BUTTON_DOWN) == 0) { 41 if ((flags_ & ui::EF_LEFT_BUTTON_DOWN) == 0) {
47 flags_ |= ui::EF_LEFT_BUTTON_DOWN; 42 flags_ |= ui::EF_LEFT_BUTTON_DOWN;
48 MouseEvent mouseev(ui::ET_MOUSE_PRESSED, current_location_, flags_); 43 MouseEvent mouseev(ui::ET_MOUSE_PRESSED, current_location_, flags_);
49 Dispatch(mouseev); 44 Dispatch(mouseev);
50 } 45 }
51 } 46 }
52 47
53 void EventGenerator::ReleaseLeftButton() { 48 void EventGenerator::ReleaseLeftButton() {
54 if (flags_ & ui::EF_LEFT_BUTTON_DOWN) { 49 if (flags_ & ui::EF_LEFT_BUTTON_DOWN) {
55 flags_ ^= ui::EF_LEFT_BUTTON_DOWN; 50 flags_ ^= ui::EF_LEFT_BUTTON_DOWN;
56 MouseEvent mouseev(ui::ET_MOUSE_RELEASED, current_location_, 0); 51 MouseEvent mouseev(ui::ET_MOUSE_RELEASED, current_location_, 0);
57 Dispatch(mouseev); 52 Dispatch(mouseev);
58 } 53 }
59 } 54 }
60 55
56 void EventGenerator::ClickLeftButton() {
57 PressLeftButton();
58 ReleaseLeftButton();
59 }
60
61 void EventGenerator::DoubleClickLeftButton() {
62 flags_ |= ui::EF_LEFT_BUTTON_DOWN | ui::EF_IS_DOUBLE_CLICK;
63 MouseEvent event(ui::ET_MOUSE_PRESSED, current_location_, flags_);
64 Dispatch(event);
oshima 2011/11/30 22:31:08 I think we need to to generate release event as we
65 }
66
61 void EventGenerator::MoveMouseTo(const gfx::Point& point) { 67 void EventGenerator::MoveMouseTo(const gfx::Point& point) {
62 if (flags_ & ui::EF_LEFT_BUTTON_DOWN ) { 68 if (flags_ & ui::EF_LEFT_BUTTON_DOWN ) {
63 MouseEvent middle( 69 MouseEvent middle(
64 ui::ET_MOUSE_DRAGGED, current_location_.Middle(point), flags_); 70 ui::ET_MOUSE_DRAGGED, current_location_.Middle(point), flags_);
65 Dispatch(middle); 71 Dispatch(middle);
66 72
67 MouseEvent mouseev(ui::ET_MOUSE_DRAGGED, point, flags_); 73 MouseEvent mouseev(ui::ET_MOUSE_DRAGGED, point, flags_);
68 Dispatch(mouseev); 74 Dispatch(mouseev);
69 } else { 75 } else {
70 MouseEvent middle( 76 MouseEvent middle(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 break; 111 break;
106 } 112 }
107 } 113 }
108 114
109 void EventGenerator::MoveMouseToCenterOf(Window* window) { 115 void EventGenerator::MoveMouseToCenterOf(Window* window) {
110 MoveMouseTo(CenterOfWindowInDesktopCoordinate(window)); 116 MoveMouseTo(CenterOfWindowInDesktopCoordinate(window));
111 } 117 }
112 118
113 } // namespace test 119 } // namespace test
114 } // namespace aura 120 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/event_generator.h ('k') | ui/aura_shell/aura_shell.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698