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 "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 "chrome/common/json_value_serializer.h" | 10 #include "chrome/common/json_value_serializer.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 void* iter = NULL; | 114 void* iter = NULL; |
115 response->ReadInt(&iter, x); | 115 response->ReadInt(&iter, x); |
116 response->ReadInt(&iter, y); | 116 response->ReadInt(&iter, y); |
117 delete response; | 117 delete response; |
118 return true; | 118 return true; |
119 } | 119 } |
120 | 120 |
121 int TabProxy::FindInPage(const std::wstring& search_string, | 121 int TabProxy::FindInPage(const std::wstring& search_string, |
122 FindInPageDirection forward, | 122 FindInPageDirection forward, |
123 FindInPageCase match_case, | 123 FindInPageCase match_case, |
124 bool find_next) { | 124 bool find_next, |
| 125 int* active_ordinal) { |
125 if (!is_valid()) | 126 if (!is_valid()) |
126 return -1; | 127 return -1; |
127 | 128 |
128 FindInPageRequest request = {0}; | 129 FindInPageRequest request = {0}; |
129 request.search_string = search_string; | 130 request.search_string = search_string; |
130 request.find_next = find_next; | 131 request.find_next = find_next; |
131 // The explicit comparison to TRUE avoids a warning (C4800). | 132 // The explicit comparison to TRUE avoids a warning (C4800). |
132 request.match_case = match_case == TRUE; | 133 request.match_case = match_case == TRUE; |
133 request.forward = forward == TRUE; | 134 request.forward = forward == TRUE; |
134 | 135 |
135 IPC::Message* response = NULL; | 136 IPC::Message* response = NULL; |
136 bool succeeded = sender_->SendAndWaitForResponse( | 137 bool succeeded = sender_->SendAndWaitForResponse( |
137 new AutomationMsg_FindRequest(0, handle_, request), | 138 new AutomationMsg_FindRequest(0, handle_, request), |
138 &response, | 139 &response, |
139 AutomationMsg_FindInPageResponse::ID); | 140 AutomationMsg_FindInPageResponse2::ID); |
140 if (!succeeded) | 141 if (!succeeded) |
141 return -1; | 142 return -1; |
142 | 143 |
143 void* iter = NULL; | 144 void* iter = NULL; |
| 145 int ordinal; |
144 int matches_found; | 146 int matches_found; |
145 AutomationMsg_FindInPageResponse::Read(response, &matches_found); | 147 response->ReadInt(&iter, &ordinal); |
146 | 148 response->ReadInt(&iter, &matches_found); |
| 149 if (active_ordinal) |
| 150 *active_ordinal = ordinal; |
| 151 delete response; |
147 return matches_found; | 152 return matches_found; |
148 } | 153 } |
149 | 154 |
150 int TabProxy::NavigateToURL(const GURL& url) { | 155 int TabProxy::NavigateToURL(const GURL& url) { |
151 return NavigateToURLWithTimeout(url, INFINITE, NULL); | 156 return NavigateToURLWithTimeout(url, INFINITE, NULL); |
152 } | 157 } |
153 | 158 |
154 int TabProxy::NavigateToURLWithTimeout(const GURL& url, | 159 int TabProxy::NavigateToURLWithTimeout(const GURL& url, |
155 uint32 timeout_ms, | 160 uint32 timeout_ms, |
156 bool* is_timeout) { | 161 bool* is_timeout) { |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 &response, | 1040 &response, |
1036 AutomationMsg_WaitForNavigationResponse::ID); | 1041 AutomationMsg_WaitForNavigationResponse::ID); |
1037 scoped_ptr<IPC::Message> auto_deleter(response); | 1042 scoped_ptr<IPC::Message> auto_deleter(response); |
1038 if (!success) | 1043 if (!success) |
1039 return false; | 1044 return false; |
1040 | 1045 |
1041 void* iter = NULL; | 1046 void* iter = NULL; |
1042 response->ReadBool(&iter, &success); | 1047 response->ReadBool(&iter, &success); |
1043 return success; | 1048 return success; |
1044 } | 1049 } |
OLD | NEW |