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" |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 AutoLock lock(list_lock_); | 783 AutoLock lock(list_lock_); |
784 observers_list_.AddObserver(observer); | 784 observers_list_.AddObserver(observer); |
785 } | 785 } |
786 | 786 |
787 void TabProxy::RemoveObserver(TabProxyDelegate* observer) { | 787 void TabProxy::RemoveObserver(TabProxyDelegate* observer) { |
788 AutoLock lock(list_lock_); | 788 AutoLock lock(list_lock_); |
789 observers_list_.RemoveObserver(observer); | 789 observers_list_.RemoveObserver(observer); |
790 } | 790 } |
791 | 791 |
792 // Called on Channel background thread, if TabMessages filter is installed. | 792 // Called on Channel background thread, if TabMessages filter is installed. |
793 void TabProxy::OnMessageReceived(const IPC::Message& message) { | 793 bool TabProxy::OnMessageReceived(const IPC::Message& message) { |
794 AutoLock lock(list_lock_); | 794 AutoLock lock(list_lock_); |
795 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, | 795 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, |
796 OnMessageReceived(this, message)); | 796 OnMessageReceived(this, message)); |
| 797 return true; |
797 } | 798 } |
798 | 799 |
799 void TabProxy::OnChannelError() { | 800 void TabProxy::OnChannelError() { |
800 AutoLock lock(list_lock_); | 801 AutoLock lock(list_lock_); |
801 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, OnChannelError(this)); | 802 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, OnChannelError(this)); |
802 } | 803 } |
803 | 804 |
804 TabProxy::~TabProxy() {} | 805 TabProxy::~TabProxy() {} |
805 | 806 |
806 bool TabProxy::ExecuteJavaScriptAndGetJSON(const std::string& script, | 807 bool TabProxy::ExecuteJavaScriptAndGetJSON(const std::string& script, |
807 std::string* json) { | 808 std::string* json) { |
808 if (!is_valid()) | 809 if (!is_valid()) |
809 return false; | 810 return false; |
810 if (!json) { | 811 if (!json) { |
811 NOTREACHED(); | 812 NOTREACHED(); |
812 return false; | 813 return false; |
813 } | 814 } |
814 return sender_->Send(new AutomationMsg_DomOperation(handle_, L"", | 815 return sender_->Send(new AutomationMsg_DomOperation(handle_, L"", |
815 UTF8ToWide(script), | 816 UTF8ToWide(script), |
816 json)); | 817 json)); |
817 } | 818 } |
818 | 819 |
819 void TabProxy::FirstObjectAdded() { | 820 void TabProxy::FirstObjectAdded() { |
820 AddRef(); | 821 AddRef(); |
821 } | 822 } |
822 | 823 |
823 void TabProxy::LastObjectRemoved() { | 824 void TabProxy::LastObjectRemoved() { |
824 Release(); | 825 Release(); |
825 } | 826 } |
OLD | NEW |