| 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 "chrome/test/automation/automation_proxy.h" | 5 #include "chrome/test/automation/automation_proxy.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 tracker_->InvalidateHandle(handle); | 369 tracker_->InvalidateHandle(handle); |
| 370 } | 370 } |
| 371 } | 371 } |
| 372 | 372 |
| 373 bool AutomationProxy::OpenNewBrowserWindow(Browser::Type type, bool show) { | 373 bool AutomationProxy::OpenNewBrowserWindow(Browser::Type type, bool show) { |
| 374 return Send( | 374 return Send( |
| 375 new AutomationMsg_OpenNewBrowserWindowOfType(static_cast<int>(type), | 375 new AutomationMsg_OpenNewBrowserWindowOfType(static_cast<int>(type), |
| 376 show)); | 376 show)); |
| 377 } | 377 } |
| 378 | 378 |
| 379 scoped_refptr<TabProxy> AutomationProxy::CreateExternalTab( | |
| 380 const ExternalTabSettings& settings, | |
| 381 gfx::NativeWindow* external_tab_container, | |
| 382 gfx::NativeWindow* tab) { | |
| 383 int handle = 0; | |
| 384 int session_id = 0; | |
| 385 bool succeeded = | |
| 386 Send(new AutomationMsg_CreateExternalTab(settings, | |
| 387 external_tab_container, | |
| 388 tab, | |
| 389 &handle, | |
| 390 &session_id)); | |
| 391 if (!succeeded) { | |
| 392 return NULL; | |
| 393 } | |
| 394 | |
| 395 #if defined(OS_WIN) && !defined(USE_AURA) | |
| 396 DCHECK(IsWindow(*external_tab_container)); | |
| 397 #else // defined(OS_WIN) | |
| 398 DCHECK(*external_tab_container); | |
| 399 #endif // defined(OS_WIN) | |
| 400 DCHECK(tracker_->GetResource(handle) == NULL); | |
| 401 return new TabProxy(this, tracker_.get(), handle); | |
| 402 } | |
| 403 | |
| 404 template <class T> scoped_refptr<T> AutomationProxy::ProxyObjectFromHandle( | 379 template <class T> scoped_refptr<T> AutomationProxy::ProxyObjectFromHandle( |
| 405 int handle) { | 380 int handle) { |
| 406 if (!handle) | 381 if (!handle) |
| 407 return NULL; | 382 return NULL; |
| 408 | 383 |
| 409 // Get AddRef-ed pointer to the object if handle is already seen. | 384 // Get AddRef-ed pointer to the object if handle is already seen. |
| 410 T* p = static_cast<T*>(tracker_->GetResource(handle)); | 385 T* p = static_cast<T*>(tracker_->GetResource(handle)); |
| 411 if (!p) { | 386 if (!p) { |
| 412 p = new T(this, tracker_.get(), handle); | 387 p = new T(this, tracker_.get(), handle); |
| 413 p->AddRef(); | 388 p->AddRef(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 442 } |
| 468 | 443 |
| 469 bool AutomationProxy::SendJSONRequest(const std::string& request, | 444 bool AutomationProxy::SendJSONRequest(const std::string& request, |
| 470 int timeout_ms, | 445 int timeout_ms, |
| 471 std::string* response) { | 446 std::string* response) { |
| 472 bool result = false; | 447 bool result = false; |
| 473 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) | 448 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) |
| 474 return false; | 449 return false; |
| 475 return result; | 450 return result; |
| 476 } | 451 } |
| OLD | NEW |