OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/test/automation/browser_proxy.h" | 5 #include "chrome/test/automation/browser_proxy.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/gfx/point.h" | 9 #include "base/gfx/point.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 if (tab_count_response >= 0) { | 169 if (tab_count_response >= 0) { |
170 *num_tabs = tab_count_response; | 170 *num_tabs = tab_count_response; |
171 } else { | 171 } else { |
172 succeeded = false; | 172 succeeded = false; |
173 } | 173 } |
174 | 174 |
175 return succeeded; | 175 return succeeded; |
176 } | 176 } |
177 | 177 |
178 bool BrowserProxy::GetType(Type* type) const { | 178 bool BrowserProxy::GetType(Browser::Type* type) const { |
179 if (!is_valid()) | 179 if (!is_valid()) |
180 return false; | 180 return false; |
181 | 181 |
182 if (!type) { | 182 if (!type) { |
183 NOTREACHED(); | 183 NOTREACHED(); |
184 return false; | 184 return false; |
185 } | 185 } |
186 | 186 |
187 int type_as_int; | 187 int type_as_int; |
188 bool succeeded = sender_->SendWithTimeout(new AutomationMsg_Type( | 188 bool succeeded = sender_->SendWithTimeout(new AutomationMsg_Type( |
189 0, handle_, &type_as_int), base::kNoTimeout, NULL); | 189 0, handle_, &type_as_int), base::kNoTimeout, NULL); |
190 | 190 |
191 switch (type_as_int) { | 191 *type = static_cast<Browser::Type>(type_as_int); |
192 case 0: | |
193 *type = TYPE_NORMAL; | |
194 break; | |
195 case 1: | |
196 *type = TYPE_POPUP; | |
197 break; | |
198 case 2: | |
199 *type = TYPE_APP; | |
200 break; | |
201 case 3: | |
202 *type = TYPE_APP_POPUP; | |
203 break; | |
204 default: | |
205 return false; | |
206 } | |
207 | |
208 return succeeded; | 192 return succeeded; |
209 } | 193 } |
210 | 194 |
211 bool BrowserProxy::ApplyAccelerator(int id) { | 195 bool BrowserProxy::ApplyAccelerator(int id) { |
212 return RunCommandAsync(id); | 196 return RunCommandAsync(id); |
213 } | 197 } |
214 | 198 |
215 bool BrowserProxy::SimulateDrag(const gfx::Point& start, | 199 bool BrowserProxy::SimulateDrag(const gfx::Point& start, |
216 const gfx::Point& end, | 200 const gfx::Point& end, |
217 int flags, | 201 int flags, |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 if (!p) { | 450 if (!p) { |
467 p = new AutocompleteEditProxy(sender_, tracker_, autocomplete_edit_handle); | 451 p = new AutocompleteEditProxy(sender_, tracker_, autocomplete_edit_handle); |
468 p->AddRef(); | 452 p->AddRef(); |
469 } | 453 } |
470 | 454 |
471 // Since there is no scoped_refptr::attach. | 455 // Since there is no scoped_refptr::attach. |
472 scoped_refptr<AutocompleteEditProxy> result; | 456 scoped_refptr<AutocompleteEditProxy> result; |
473 result.swap(&p); | 457 result.swap(&p); |
474 return result; | 458 return result; |
475 } | 459 } |
OLD | NEW |