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" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "base/threading/platform_thread.h" | 12 #include "base/threading/platform_thread.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/common/automation_constants.h" | 14 #include "chrome/common/automation_constants.h" |
15 #include "chrome/common/automation_messages.h" | 15 #include "chrome/common/automation_messages.h" |
16 #include "chrome/test/automation/automation_json_requests.h" | |
17 #include "chrome/test/automation/automation_proxy.h" | 16 #include "chrome/test/automation/automation_proxy.h" |
18 #include "chrome/test/automation/browser_proxy.h" | 17 #include "chrome/test/automation/browser_proxy.h" |
19 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
20 | 19 |
21 TabProxy::TabProxy(AutomationMessageSender* sender, | 20 TabProxy::TabProxy(AutomationMessageSender* sender, |
22 AutomationHandleTracker* tracker, | 21 AutomationHandleTracker* tracker, |
23 int handle) | 22 int handle) |
24 : AutomationResourceProxy(tracker, sender, handle) { | 23 : AutomationResourceProxy(tracker, sender, handle) { |
25 } | 24 } |
26 | 25 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 bool TabProxy::OverrideEncoding(const std::string& encoding) { | 361 bool TabProxy::OverrideEncoding(const std::string& encoding) { |
363 if (!is_valid()) | 362 if (!is_valid()) |
364 return false; | 363 return false; |
365 | 364 |
366 bool succeeded = false; | 365 bool succeeded = false; |
367 sender_->Send(new AutomationMsg_OverrideEncoding(handle_, encoding, | 366 sender_->Send(new AutomationMsg_OverrideEncoding(handle_, encoding, |
368 &succeeded)); | 367 &succeeded)); |
369 return succeeded; | 368 return succeeded; |
370 } | 369 } |
371 | 370 |
372 bool TabProxy::CaptureEntirePageAsPNG(const base::FilePath& path) { | |
373 if (!is_valid()) | |
374 return false; | |
375 | |
376 int browser_index, tab_index; | |
377 automation::Error error; | |
378 if (!SendGetIndicesFromTabHandleJSONRequest( | |
379 sender_, handle_, &browser_index, &tab_index, &error)) { | |
380 return false; | |
381 } | |
382 | |
383 return SendCaptureEntirePageJSONRequest( | |
384 sender_, WebViewLocator::ForIndexPair(browser_index, tab_index), | |
385 path, &error); | |
386 } | |
387 | |
388 #if defined(OS_WIN) | 371 #if defined(OS_WIN) |
389 void TabProxy::Reposition(HWND window, HWND window_insert_after, int left, | 372 void TabProxy::Reposition(HWND window, HWND window_insert_after, int left, |
390 int top, int width, int height, int flags, | 373 int top, int width, int height, int flags, |
391 HWND parent_window) { | 374 HWND parent_window) { |
392 Reposition_Params params; | 375 Reposition_Params params; |
393 params.window = window; | 376 params.window = window; |
394 params.window_insert_after = window_insert_after; | 377 params.window_insert_after = window_insert_after; |
395 params.left = left; | 378 params.left = left; |
396 params.top = top; | 379 params.top = top; |
397 params.width = width; | 380 params.width = width; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 | 460 |
478 TabProxy::~TabProxy() {} | 461 TabProxy::~TabProxy() {} |
479 | 462 |
480 void TabProxy::FirstObjectAdded() { | 463 void TabProxy::FirstObjectAdded() { |
481 AddRef(); | 464 AddRef(); |
482 } | 465 } |
483 | 466 |
484 void TabProxy::LastObjectRemoved() { | 467 void TabProxy::LastObjectRemoved() { |
485 Release(); | 468 Release(); |
486 } | 469 } |
OLD | NEW |