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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 const std::wstring& jscript, | 170 const std::wstring& jscript, |
171 std::wstring* string_value) { | 171 std::wstring* string_value) { |
172 scoped_ptr<Value> root(ExecuteAndExtractValue(frame_xpath, jscript)); | 172 scoped_ptr<Value> root(ExecuteAndExtractValue(frame_xpath, jscript)); |
173 if (root == NULL) | 173 if (root == NULL) |
174 return false; | 174 return false; |
175 | 175 |
176 DCHECK(root->IsType(Value::TYPE_LIST)); | 176 DCHECK(root->IsType(Value::TYPE_LIST)); |
177 Value* value = NULL; | 177 Value* value = NULL; |
178 bool succeeded = static_cast<ListValue*>(root.get())->Get(0, &value); | 178 bool succeeded = static_cast<ListValue*>(root.get())->Get(0, &value); |
179 if (succeeded) { | 179 if (succeeded) { |
180 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 = 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, |
(...skipping 173 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 |