| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 bool TabProxy::NeedsAuth() const { | 153 bool TabProxy::NeedsAuth() const { |
| 154 if (!is_valid()) | 154 if (!is_valid()) |
| 155 return false; | 155 return false; |
| 156 | 156 |
| 157 bool needs_auth = false; | 157 bool needs_auth = false; |
| 158 sender_->Send(new AutomationMsg_NeedsAuth(0, handle_, &needs_auth)); | 158 sender_->Send(new AutomationMsg_NeedsAuth(0, handle_, &needs_auth)); |
| 159 return needs_auth; | 159 return needs_auth; |
| 160 } | 160 } |
| 161 | 161 |
| 162 AutomationMsg_NavigationResponseValues TabProxy::GoBack() { | 162 AutomationMsg_NavigationResponseValues TabProxy::GoBack() { |
| 163 return GoBackBlockUntilNavigationsComplete(1); |
| 164 } |
| 165 |
| 166 AutomationMsg_NavigationResponseValues |
| 167 TabProxy::GoBackBlockUntilNavigationsComplete(int number_of_navigations) { |
| 163 if (!is_valid()) | 168 if (!is_valid()) |
| 164 return AUTOMATION_MSG_NAVIGATION_ERROR; | 169 return AUTOMATION_MSG_NAVIGATION_ERROR; |
| 165 | 170 |
| 166 AutomationMsg_NavigationResponseValues navigate_response = | 171 AutomationMsg_NavigationResponseValues navigate_response = |
| 167 AUTOMATION_MSG_NAVIGATION_ERROR; | 172 AUTOMATION_MSG_NAVIGATION_ERROR; |
| 168 sender_->Send(new AutomationMsg_GoBack(0, handle_, &navigate_response)); | 173 sender_->Send(new AutomationMsg_GoBackBlockUntilNavigationsComplete( |
| 174 0, handle_, number_of_navigations, &navigate_response)); |
| 169 return navigate_response; | 175 return navigate_response; |
| 170 } | 176 } |
| 171 | 177 |
| 172 AutomationMsg_NavigationResponseValues TabProxy::GoForward() { | 178 AutomationMsg_NavigationResponseValues TabProxy::GoForward() { |
| 179 return GoForwardBlockUntilNavigationsComplete(1); |
| 180 } |
| 181 |
| 182 AutomationMsg_NavigationResponseValues |
| 183 TabProxy::GoForwardBlockUntilNavigationsComplete( |
| 184 int number_of_navigations) { |
| 173 if (!is_valid()) | 185 if (!is_valid()) |
| 174 return AUTOMATION_MSG_NAVIGATION_ERROR; | 186 return AUTOMATION_MSG_NAVIGATION_ERROR; |
| 175 | 187 |
| 176 AutomationMsg_NavigationResponseValues navigate_response = | 188 AutomationMsg_NavigationResponseValues navigate_response = |
| 177 AUTOMATION_MSG_NAVIGATION_ERROR; | 189 AUTOMATION_MSG_NAVIGATION_ERROR; |
| 178 sender_->Send(new AutomationMsg_GoForward(0, handle_, &navigate_response)); | 190 sender_->Send(new AutomationMsg_GoForwardBlockUntilNavigationsComplete( |
| 191 0, handle_, number_of_navigations, &navigate_response)); |
| 179 return navigate_response; | 192 return navigate_response; |
| 180 } | 193 } |
| 181 | 194 |
| 182 AutomationMsg_NavigationResponseValues TabProxy::Reload() { | 195 AutomationMsg_NavigationResponseValues TabProxy::Reload() { |
| 183 if (!is_valid()) | 196 if (!is_valid()) |
| 184 return AUTOMATION_MSG_NAVIGATION_ERROR; | 197 return AUTOMATION_MSG_NAVIGATION_ERROR; |
| 185 | 198 |
| 186 AutomationMsg_NavigationResponseValues navigate_response = | 199 AutomationMsg_NavigationResponseValues navigate_response = |
| 187 AUTOMATION_MSG_NAVIGATION_ERROR; | 200 AUTOMATION_MSG_NAVIGATION_ERROR; |
| 188 sender_->Send(new AutomationMsg_Reload(0, handle_, &navigate_response)); | 201 sender_->Send(new AutomationMsg_Reload(0, handle_, &navigate_response)); |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 AutoLock lock(list_lock_); | 722 AutoLock lock(list_lock_); |
| 710 observers_list_.RemoveObserver(observer); | 723 observers_list_.RemoveObserver(observer); |
| 711 } | 724 } |
| 712 | 725 |
| 713 // Called on Channel background thread, if TabMessages filter is installed. | 726 // Called on Channel background thread, if TabMessages filter is installed. |
| 714 void TabProxy::OnMessageReceived(const IPC::Message& message) { | 727 void TabProxy::OnMessageReceived(const IPC::Message& message) { |
| 715 AutoLock lock(list_lock_); | 728 AutoLock lock(list_lock_); |
| 716 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, | 729 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, |
| 717 OnMessageReceived(this, message)); | 730 OnMessageReceived(this, message)); |
| 718 } | 731 } |
| OLD | NEW |