| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 int TabProxy::FindInPage(const std::wstring& search_string, | 54 int TabProxy::FindInPage(const std::wstring& search_string, |
| 55 FindInPageDirection forward, | 55 FindInPageDirection forward, |
| 56 FindInPageCase match_case, | 56 FindInPageCase match_case, |
| 57 bool find_next, | 57 bool find_next, |
| 58 int* ordinal) { | 58 int* ordinal) { |
| 59 if (!is_valid()) | 59 if (!is_valid()) |
| 60 return -1; | 60 return -1; |
| 61 | 61 |
| 62 AutomationMsg_Find_Params params; | 62 AutomationMsg_Find_Params params; |
| 63 params.search_string = WideToUTF16Hack(search_string); | 63 params.search_string = base::WideToUTF16Hack(search_string); |
| 64 params.find_next = find_next; | 64 params.find_next = find_next; |
| 65 params.match_case = (match_case == CASE_SENSITIVE); | 65 params.match_case = (match_case == CASE_SENSITIVE); |
| 66 params.forward = (forward == FWD); | 66 params.forward = (forward == FWD); |
| 67 | 67 |
| 68 int matches = 0; | 68 int matches = 0; |
| 69 int ordinal2 = 0; | 69 int ordinal2 = 0; |
| 70 bool succeeded = sender_->Send(new AutomationMsg_Find(handle_, | 70 bool succeeded = sender_->Send(new AutomationMsg_Find(handle_, |
| 71 params, | 71 params, |
| 72 &ordinal2, | 72 &ordinal2, |
| 73 &matches)); | 73 &matches)); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return false; | 174 return false; |
| 175 | 175 |
| 176 DCHECK(root->IsType(base::Value::TYPE_LIST)); | 176 DCHECK(root->IsType(base::Value::TYPE_LIST)); |
| 177 base::Value* value = NULL; | 177 base::Value* value = NULL; |
| 178 bool succeeded = static_cast<base::ListValue*>(root.get())->Get(0, &value); | 178 bool succeeded = static_cast<base::ListValue*>(root.get())->Get(0, &value); |
| 179 if (succeeded) { | 179 if (succeeded) { |
| 180 base::string16 read_value; | 180 base::string16 read_value; |
| 181 succeeded = value->GetAsString(&read_value); | 181 succeeded = value->GetAsString(&read_value); |
| 182 if (succeeded) { | 182 if (succeeded) { |
| 183 // TODO(viettrungluu): remove conversion. (But should |jscript| be UTF-8?) | 183 // TODO(viettrungluu): remove conversion. (But should |jscript| be UTF-8?) |
| 184 *string_value = UTF16ToWideHack(read_value); | 184 *string_value = base::UTF16ToWideHack(read_value); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 return succeeded; | 187 return succeeded; |
| 188 } | 188 } |
| 189 | 189 |
| 190 bool TabProxy::ExecuteAndExtractBool(const std::wstring& frame_xpath, | 190 bool TabProxy::ExecuteAndExtractBool(const std::wstring& frame_xpath, |
| 191 const std::wstring& jscript, | 191 const std::wstring& jscript, |
| 192 bool* bool_value) { | 192 bool* bool_value) { |
| 193 scoped_ptr<base::Value> root(ExecuteAndExtractValue(frame_xpath, jscript)); | 193 scoped_ptr<base::Value> root(ExecuteAndExtractValue(frame_xpath, jscript)); |
| 194 if (root == NULL) | 194 if (root == NULL) |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 TabProxy::~TabProxy() {} | 365 TabProxy::~TabProxy() {} |
| 366 | 366 |
| 367 void TabProxy::FirstObjectAdded() { | 367 void TabProxy::FirstObjectAdded() { |
| 368 AddRef(); | 368 AddRef(); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void TabProxy::LastObjectRemoved() { | 371 void TabProxy::LastObjectRemoved() { |
| 372 Release(); | 372 Release(); |
| 373 } | 373 } |
| OLD | NEW |