| 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 #ifndef CHROME_TEST_AUTOMATION_TAB_PROXY_H_ | 5 #ifndef CHROME_TEST_AUTOMATION_TAB_PROXY_H_ |
| 6 #define CHROME_TEST_AUTOMATION_TAB_PROXY_H_ | 6 #define CHROME_TEST_AUTOMATION_TAB_PROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" // NOLINT | 9 #include "build/build_config.h" // NOLINT |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 public: | 50 public: |
| 51 virtual void OnMessageReceived(TabProxy* tab, const IPC::Message& msg) {} | 51 virtual void OnMessageReceived(TabProxy* tab, const IPC::Message& msg) {} |
| 52 virtual void OnChannelError(TabProxy* tab) {} | 52 virtual void OnChannelError(TabProxy* tab) {} |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 virtual ~TabProxyDelegate() {} | 55 virtual ~TabProxyDelegate() {} |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 TabProxy(AutomationMessageSender* sender, | 58 TabProxy(AutomationMessageSender* sender, |
| 59 AutomationHandleTracker* tracker, | 59 AutomationHandleTracker* tracker, |
| 60 int handle) | 60 int handle); |
| 61 : AutomationResourceProxy(tracker, sender, handle) {} | |
| 62 | 61 |
| 63 // Gets the current url of the tab. | 62 // Gets the current url of the tab. |
| 64 bool GetCurrentURL(GURL* url) const WARN_UNUSED_RESULT; | 63 bool GetCurrentURL(GURL* url) const WARN_UNUSED_RESULT; |
| 65 | 64 |
| 66 // Gets the title of the tab. | 65 // Gets the title of the tab. |
| 67 bool GetTabTitle(std::wstring* title) const WARN_UNUSED_RESULT; | 66 bool GetTabTitle(std::wstring* title) const WARN_UNUSED_RESULT; |
| 68 | 67 |
| 69 // Gets the tabstrip index of the tab. | 68 // Gets the tabstrip index of the tab. |
| 70 bool GetTabIndex(int* index) const WARN_UNUSED_RESULT; | 69 bool GetTabIndex(int* index) const WARN_UNUSED_RESULT; |
| 71 | 70 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 void ReloadAsync(); | 402 void ReloadAsync(); |
| 404 void StopAsync(); | 403 void StopAsync(); |
| 405 void SaveAsAsync(); | 404 void SaveAsAsync(); |
| 406 | 405 |
| 407 // Calls delegates | 406 // Calls delegates |
| 408 void AddObserver(TabProxyDelegate* observer); | 407 void AddObserver(TabProxyDelegate* observer); |
| 409 void RemoveObserver(TabProxyDelegate* observer); | 408 void RemoveObserver(TabProxyDelegate* observer); |
| 410 void OnMessageReceived(const IPC::Message& message); | 409 void OnMessageReceived(const IPC::Message& message); |
| 411 void OnChannelError(); | 410 void OnChannelError(); |
| 412 protected: | 411 protected: |
| 413 virtual ~TabProxy() {} | 412 virtual ~TabProxy(); |
| 414 | 413 |
| 415 // Override JavaScriptExecutionController methods. | 414 // Override JavaScriptExecutionController methods. |
| 416 // Executes |script| and gets the response JSON. Returns true on success. | 415 // Executes |script| and gets the response JSON. Returns true on success. |
| 417 bool ExecuteJavaScriptAndGetJSON(const std::string& script, | 416 bool ExecuteJavaScriptAndGetJSON(const std::string& script, |
| 418 std::string* json) WARN_UNUSED_RESULT; | 417 std::string* json) WARN_UNUSED_RESULT; |
| 419 | 418 |
| 420 // Called when tracking the first object. Used for reference counting | 419 // Called when tracking the first object. Used for reference counting |
| 421 // purposes. | 420 // purposes. |
| 422 void FirstObjectAdded(); | 421 void FirstObjectAdded(); |
| 423 | 422 |
| 424 // Called when no longer tracking any objects. Used for reference counting | 423 // Called when no longer tracking any objects. Used for reference counting |
| 425 // purposes. | 424 // purposes. |
| 426 void LastObjectRemoved(); | 425 void LastObjectRemoved(); |
| 427 | 426 |
| 428 private: | 427 private: |
| 429 Lock list_lock_; // Protects the observers_list_. | 428 Lock list_lock_; // Protects the observers_list_. |
| 430 ObserverList<TabProxyDelegate> observers_list_; | 429 ObserverList<TabProxyDelegate> observers_list_; |
| 431 DISALLOW_COPY_AND_ASSIGN(TabProxy); | 430 DISALLOW_COPY_AND_ASSIGN(TabProxy); |
| 432 }; | 431 }; |
| 433 | 432 |
| 434 #endif // CHROME_TEST_AUTOMATION_TAB_PROXY_H_ | 433 #endif // CHROME_TEST_AUTOMATION_TAB_PROXY_H_ |
| OLD | NEW |