| 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/tab_proxy.h" | 5 #include "chrome/test/automation/tab_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 const std::string& target) { | 336 const std::string& target) { |
| 337 if (!is_valid()) | 337 if (!is_valid()) |
| 338 return; | 338 return; |
| 339 | 339 |
| 340 sender_->Send( | 340 sender_->Send( |
| 341 new AutomationMsg_HandleMessageFromExternalHost( | 341 new AutomationMsg_HandleMessageFromExternalHost( |
| 342 handle_, message, origin, target)); | 342 handle_, message, origin, target)); |
| 343 } | 343 } |
| 344 #endif // defined(OS_WIN) | 344 #endif // defined(OS_WIN) |
| 345 | 345 |
| 346 bool TabProxy::WaitForTabToBeRestored(uint32 timeout_ms) { | |
| 347 if (!is_valid()) | |
| 348 return false; | |
| 349 bool succeeded = false; | |
| 350 return sender_->Send( | |
| 351 new AutomationMsg_WaitForTabToBeRestored(handle_, &succeeded)) && | |
| 352 succeeded; | |
| 353 } | |
| 354 | |
| 355 bool TabProxy::GetSecurityState(content::SecurityStyle* security_style, | |
| 356 net::CertStatus* ssl_cert_status, | |
| 357 int* insecure_content_status) { | |
| 358 DCHECK(security_style && ssl_cert_status && insecure_content_status); | |
| 359 | |
| 360 if (!is_valid()) | |
| 361 return false; | |
| 362 | |
| 363 bool succeeded = false; | |
| 364 | |
| 365 sender_->Send(new AutomationMsg_GetSecurityState( | |
| 366 handle_, &succeeded, security_style, ssl_cert_status, | |
| 367 insecure_content_status)); | |
| 368 | |
| 369 return succeeded; | |
| 370 } | |
| 371 | |
| 372 bool TabProxy::GetPageType(content::PageType* type) { | |
| 373 DCHECK(type); | |
| 374 | |
| 375 if (!is_valid()) | |
| 376 return false; | |
| 377 | |
| 378 bool succeeded = false; | |
| 379 sender_->Send(new AutomationMsg_GetPageType(handle_, &succeeded, type)); | |
| 380 return succeeded; | |
| 381 } | |
| 382 | |
| 383 bool TabProxy::TakeActionOnSSLBlockingPage(bool proceed) { | |
| 384 if (!is_valid()) | |
| 385 return false; | |
| 386 | |
| 387 AutomationMsg_NavigationResponseValues result = | |
| 388 AUTOMATION_MSG_NAVIGATION_ERROR; | |
| 389 sender_->Send(new AutomationMsg_ActionOnSSLBlockingPage(handle_, proceed, | |
| 390 &result)); | |
| 391 return result == AUTOMATION_MSG_NAVIGATION_SUCCESS || | |
| 392 result == AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED; | |
| 393 } | |
| 394 | |
| 395 bool TabProxy::PrintAsync() { | 346 bool TabProxy::PrintAsync() { |
| 396 if (!is_valid()) | 347 if (!is_valid()) |
| 397 return false; | 348 return false; |
| 398 | 349 |
| 399 return sender_->Send(new AutomationMsg_PrintAsync(handle_)); | 350 return sender_->Send(new AutomationMsg_PrintAsync(handle_)); |
| 400 } | 351 } |
| 401 | 352 |
| 402 bool TabProxy::WaitForInfoBarCount(size_t target_count) { | 353 bool TabProxy::WaitForInfoBarCount(size_t target_count) { |
| 403 if (!is_valid()) | 354 if (!is_valid()) |
| 404 return false; | 355 return false; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 473 |
| 523 TabProxy::~TabProxy() {} | 474 TabProxy::~TabProxy() {} |
| 524 | 475 |
| 525 void TabProxy::FirstObjectAdded() { | 476 void TabProxy::FirstObjectAdded() { |
| 526 AddRef(); | 477 AddRef(); |
| 527 } | 478 } |
| 528 | 479 |
| 529 void TabProxy::LastObjectRemoved() { | 480 void TabProxy::LastObjectRemoved() { |
| 530 Release(); | 481 Release(); |
| 531 } | 482 } |
| OLD | NEW |