| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/common/json_value_serializer.h" | 12 #include "chrome/common/json_value_serializer.h" |
| 13 #include "chrome/test/automation/automation_constants.h" | 13 #include "chrome/test/automation/automation_constants.h" |
| 14 #include "chrome/test/automation/automation_messages.h" | 14 #include "chrome/test/automation/automation_messages.h" |
| 15 #include "chrome/test/automation/automation_proxy.h" | 15 #include "chrome/test/automation/automation_proxy.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 | 17 |
| 18 TabProxy::TabProxy(AutomationMessageSender* sender, |
| 19 AutomationHandleTracker* tracker, |
| 20 int handle) |
| 21 : AutomationResourceProxy(tracker, sender, handle) { |
| 22 } |
| 23 |
| 24 |
| 18 bool TabProxy::GetTabTitle(std::wstring* title) const { | 25 bool TabProxy::GetTabTitle(std::wstring* title) const { |
| 19 if (!is_valid()) | 26 if (!is_valid()) |
| 20 return false; | 27 return false; |
| 21 | 28 |
| 22 if (!title) { | 29 if (!title) { |
| 23 NOTREACHED(); | 30 NOTREACHED(); |
| 24 return false; | 31 return false; |
| 25 } | 32 } |
| 26 | 33 |
| 27 int tab_title_size_response = 0; | 34 int tab_title_size_response = 0; |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 AutoLock lock(list_lock_); | 799 AutoLock lock(list_lock_); |
| 793 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, | 800 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, |
| 794 OnMessageReceived(this, message)); | 801 OnMessageReceived(this, message)); |
| 795 } | 802 } |
| 796 | 803 |
| 797 void TabProxy::OnChannelError() { | 804 void TabProxy::OnChannelError() { |
| 798 AutoLock lock(list_lock_); | 805 AutoLock lock(list_lock_); |
| 799 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, OnChannelError(this)); | 806 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, OnChannelError(this)); |
| 800 } | 807 } |
| 801 | 808 |
| 809 TabProxy::~TabProxy() {} |
| 810 |
| 802 bool TabProxy::ExecuteJavaScriptAndGetJSON(const std::string& script, | 811 bool TabProxy::ExecuteJavaScriptAndGetJSON(const std::string& script, |
| 803 std::string* json) { | 812 std::string* json) { |
| 804 if (!is_valid()) | 813 if (!is_valid()) |
| 805 return false; | 814 return false; |
| 806 if (!json) { | 815 if (!json) { |
| 807 NOTREACHED(); | 816 NOTREACHED(); |
| 808 return false; | 817 return false; |
| 809 } | 818 } |
| 810 return sender_->Send(new AutomationMsg_DomOperation(0, handle_, L"", | 819 return sender_->Send(new AutomationMsg_DomOperation(0, handle_, L"", |
| 811 UTF8ToWide(script), | 820 UTF8ToWide(script), |
| 812 json)); | 821 json)); |
| 813 } | 822 } |
| 814 | 823 |
| 815 void TabProxy::FirstObjectAdded() { | 824 void TabProxy::FirstObjectAdded() { |
| 816 AddRef(); | 825 AddRef(); |
| 817 } | 826 } |
| 818 | 827 |
| 819 void TabProxy::LastObjectRemoved() { | 828 void TabProxy::LastObjectRemoved() { |
| 820 Release(); | 829 Release(); |
| 821 } | 830 } |
| OLD | NEW |