OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/common/automation_messages.h" | 13 #include "chrome/common/automation_messages.h" |
14 #include "chrome/common/json_value_serializer.h" | 14 #include "chrome/common/json_value_serializer.h" |
| 15 #include "chrome/test/automation/automation_json_requests.h" |
15 #include "chrome/test/automation/automation_proxy.h" | 16 #include "chrome/test/automation/automation_proxy.h" |
16 #include "chrome/test/automation/browser_proxy.h" | 17 #include "chrome/test/automation/browser_proxy.h" |
17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
18 | 19 |
19 TabProxy::TabProxy(AutomationMessageSender* sender, | 20 TabProxy::TabProxy(AutomationMessageSender* sender, |
20 AutomationHandleTracker* tracker, | 21 AutomationHandleTracker* tracker, |
21 int handle) | 22 int handle) |
22 : AutomationResourceProxy(tracker, sender, handle) { | 23 : AutomationResourceProxy(tracker, sender, handle) { |
23 } | 24 } |
24 | 25 |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 | 740 |
740 bool succeeded = false; | 741 bool succeeded = false; |
741 sender_->Send(new AutomationMsg_LoadBlockedPlugins(handle_, &succeeded)); | 742 sender_->Send(new AutomationMsg_LoadBlockedPlugins(handle_, &succeeded)); |
742 return succeeded; | 743 return succeeded; |
743 } | 744 } |
744 | 745 |
745 bool TabProxy::CaptureEntirePageAsPNG(const FilePath& path) { | 746 bool TabProxy::CaptureEntirePageAsPNG(const FilePath& path) { |
746 if (!is_valid()) | 747 if (!is_valid()) |
747 return false; | 748 return false; |
748 | 749 |
749 bool succeeded = false; | 750 int browser_index, tab_index; |
750 sender_->Send(new AutomationMsg_CaptureEntirePageAsPNG(handle_, path, | 751 if (!SendGetIndicesFromTabHandleJSONRequest( |
751 &succeeded)); | 752 sender_, handle_, &browser_index, &tab_index)) { |
752 return succeeded; | 753 return false; |
| 754 } |
| 755 |
| 756 return SendCaptureEntirePageJSONRequest(sender_, browser_index, |
| 757 tab_index, path); |
753 } | 758 } |
754 | 759 |
755 #if defined(OS_WIN) | 760 #if defined(OS_WIN) |
756 void TabProxy::Reposition(HWND window, HWND window_insert_after, int left, | 761 void TabProxy::Reposition(HWND window, HWND window_insert_after, int left, |
757 int top, int width, int height, int flags, | 762 int top, int width, int height, int flags, |
758 HWND parent_window) { | 763 HWND parent_window) { |
759 Reposition_Params params = {0}; | 764 Reposition_Params params = {0}; |
760 params.window = window; | 765 params.window = window; |
761 params.window_insert_after = window_insert_after; | 766 params.window_insert_after = window_insert_after; |
762 params.left = left; | 767 params.left = left; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 json)); | 858 json)); |
854 } | 859 } |
855 | 860 |
856 void TabProxy::FirstObjectAdded() { | 861 void TabProxy::FirstObjectAdded() { |
857 AddRef(); | 862 AddRef(); |
858 } | 863 } |
859 | 864 |
860 void TabProxy::LastObjectRemoved() { | 865 void TabProxy::LastObjectRemoved() { |
861 Release(); | 866 Release(); |
862 } | 867 } |
OLD | NEW |