| 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 <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "chrome/test/automation/automation_proxy.h" | 7 #include "chrome/test/automation/automation_proxy.h" |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 if (!SendWithTimeout(new AutomationMsg_BrowserWindow(0, window_index, | 406 if (!SendWithTimeout(new AutomationMsg_BrowserWindow(0, window_index, |
| 407 &handle), | 407 &handle), |
| 408 command_execution_timeout_ms(), NULL)) { | 408 command_execution_timeout_ms(), NULL)) { |
| 409 DLOG(ERROR) << "GetBrowserWindow did not complete in a timely fashion"; | 409 DLOG(ERROR) << "GetBrowserWindow did not complete in a timely fashion"; |
| 410 return NULL; | 410 return NULL; |
| 411 } | 411 } |
| 412 | 412 |
| 413 return ProxyObjectFromHandle<BrowserProxy>(handle); | 413 return ProxyObjectFromHandle<BrowserProxy>(handle); |
| 414 } | 414 } |
| 415 | 415 |
| 416 bool AutomationProxy::GetBrowserLocale(string16* locale) { |
| 417 DCHECK(locale != NULL); |
| 418 if (!SendWithTimeout(new AutomationMsg_GetBrowserLocale(0, locale), |
| 419 command_execution_timeout_ms(), NULL)) { |
| 420 DLOG(ERROR) << "GetBrowserLocale did not complete in a timely fashion"; |
| 421 return false; |
| 422 } |
| 423 |
| 424 // An empty locale means that the browser has no UI language |
| 425 // which is impossible. |
| 426 DCHECK(!locale->empty()); |
| 427 return !locale->empty(); |
| 428 } |
| 429 |
| 416 scoped_refptr<BrowserProxy> AutomationProxy::FindNormalBrowserWindow() { | 430 scoped_refptr<BrowserProxy> AutomationProxy::FindNormalBrowserWindow() { |
| 417 int handle = 0; | 431 int handle = 0; |
| 418 | 432 |
| 419 if (!SendWithTimeout(new AutomationMsg_FindNormalBrowserWindow(0, &handle), | 433 if (!SendWithTimeout(new AutomationMsg_FindNormalBrowserWindow(0, &handle), |
| 420 command_execution_timeout_ms(), NULL)) { | 434 command_execution_timeout_ms(), NULL)) { |
| 421 return NULL; | 435 return NULL; |
| 422 } | 436 } |
| 423 | 437 |
| 424 return ProxyObjectFromHandle<BrowserProxy>(handle); | 438 return ProxyObjectFromHandle<BrowserProxy>(handle); |
| 425 } | 439 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 if (!p) { | 529 if (!p) { |
| 516 p = new T(this, tracker_.get(), handle); | 530 p = new T(this, tracker_.get(), handle); |
| 517 p->AddRef(); | 531 p->AddRef(); |
| 518 } | 532 } |
| 519 | 533 |
| 520 // Since there is no scoped_refptr::attach. | 534 // Since there is no scoped_refptr::attach. |
| 521 scoped_refptr<T> result; | 535 scoped_refptr<T> result; |
| 522 result.swap(&p); | 536 result.swap(&p); |
| 523 return result; | 537 return result; |
| 524 } | 538 } |
| OLD | NEW |