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 #include "content/shell/renderer/test_runner/event_sender.h" | 5 #include "content/shell/renderer/test_runner/event_sender.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "content/public/common/page_zoom.h" | 10 #include "content/public/common/page_zoom.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 return GetKeyModifiers(modifier_names); | 118 return GetKeyModifiers(modifier_names); |
119 } | 119 } |
120 | 120 |
121 // Maximum distance (in space and time) for a mouse click to register as a | 121 // Maximum distance (in space and time) for a mouse click to register as a |
122 // double or triple click. | 122 // double or triple click. |
123 const double kMultipleClickTimeSec = 1; | 123 const double kMultipleClickTimeSec = 1; |
124 const int kMultipleClickRadiusPixels = 5; | 124 const int kMultipleClickRadiusPixels = 5; |
125 const char kSubMenuDepthIdentifier[] = "_"; | 125 const char kSubMenuDepthIdentifier[] = "_"; |
126 const char kSubMenuIdentifier[] = " >"; | 126 const char kSubMenuIdentifier[] = " >"; |
| 127 const char kSeparatorIdentifier[] = "---------"; |
127 | 128 |
128 bool OutsideMultiClickRadius(const WebPoint& a, const WebPoint& b) { | 129 bool OutsideMultiClickRadius(const WebPoint& a, const WebPoint& b) { |
129 return ((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)) > | 130 return ((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)) > |
130 kMultipleClickRadiusPixels * kMultipleClickRadiusPixels; | 131 kMultipleClickRadiusPixels * kMultipleClickRadiusPixels; |
131 } | 132 } |
132 | 133 |
133 void PopulateCustomItems(const WebVector<WebMenuItemInfo>& customItems, | 134 void PopulateCustomItems(const WebVector<WebMenuItemInfo>& customItems, |
134 const std::string& prefix, std::vector<std::string>* strings) { | 135 const std::string& prefix, std::vector<std::string>* strings) { |
135 for (size_t i = 0; i < customItems.size(); ++i) { | 136 for (size_t i = 0; i < customItems.size(); ++i) { |
136 if (customItems[i].type == blink::WebMenuItemInfo::SubMenu) { | 137 if (customItems[i].type == blink::WebMenuItemInfo::Separator) { |
| 138 strings->push_back(prefix + kSeparatorIdentifier); |
| 139 } else if (customItems[i].type == blink::WebMenuItemInfo::SubMenu) { |
137 strings->push_back(prefix + customItems[i].label.utf8() + | 140 strings->push_back(prefix + customItems[i].label.utf8() + |
138 kSubMenuIdentifier); | 141 kSubMenuIdentifier); |
139 PopulateCustomItems(customItems[i].subMenuItems, prefix + | 142 PopulateCustomItems(customItems[i].subMenuItems, prefix + |
140 kSubMenuDepthIdentifier, strings); | 143 kSubMenuDepthIdentifier, strings); |
141 } else { | 144 } else { |
142 strings->push_back(prefix + customItems[i].label.utf8()); | 145 strings->push_back(prefix + customItems[i].label.utf8()); |
143 } | 146 } |
144 } | 147 } |
145 } | 148 } |
146 | 149 |
(...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2288 } | 2291 } |
2289 default: | 2292 default: |
2290 NOTREACHED(); | 2293 NOTREACHED(); |
2291 } | 2294 } |
2292 } | 2295 } |
2293 | 2296 |
2294 replaying_saved_events_ = false; | 2297 replaying_saved_events_ = false; |
2295 } | 2298 } |
2296 | 2299 |
2297 } // namespace content | 2300 } // namespace content |
OLD | NEW |