Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: chrome/test/automation/tab_proxy.h

Issue 113722: Make automation proxy objects to ref_counted. That allows to process async no... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/automation/browser_proxy.cc ('k') | chrome/test/automation/tab_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #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 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
11 #include <wtypes.h> 11 #include <wtypes.h>
12 #endif 12 #endif
13 13
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/observer_list.h"
17 #include "chrome/browser/download/save_package.h" 18 #include "chrome/browser/download/save_package.h"
18 #include "chrome/browser/tab_contents/navigation_entry.h" 19 #include "chrome/browser/tab_contents/navigation_entry.h"
19 #include "chrome/browser/tab_contents/security_style.h" 20 #include "chrome/browser/tab_contents/security_style.h"
20 #include "chrome/test/automation/automation_constants.h" 21 #include "chrome/test/automation/automation_constants.h"
21 #include "chrome/test/automation/automation_handle_tracker.h" 22 #include "chrome/test/automation/automation_handle_tracker.h"
22 23
23 class ConstrainedWindowProxy; 24 class ConstrainedWindowProxy;
24 class GURL; 25 class GURL;
25 class Value; 26 class Value;
27 class IPC::Message;
26 28
27 enum FindInPageDirection { BACK = 0, FWD = 1 }; 29 enum FindInPageDirection { BACK = 0, FWD = 1 };
28 enum FindInPageCase { IGNORE_CASE = 0, CASE_SENSITIVE = 1 }; 30 enum FindInPageCase { IGNORE_CASE = 0, CASE_SENSITIVE = 1 };
29 31
30 class TabProxy : public AutomationResourceProxy { 32 class TabProxy : public AutomationResourceProxy {
31 public: 33 public:
34 class TabProxyDelegate {
35 public:
36 virtual void OnMessageReceived(TabProxy* tab, const IPC::Message& msg) {}
37 };
38
32 TabProxy(AutomationMessageSender* sender, 39 TabProxy(AutomationMessageSender* sender,
33 AutomationHandleTracker* tracker, 40 AutomationHandleTracker* tracker,
34 int handle) 41 int handle)
35 : AutomationResourceProxy(tracker, sender, handle) {} 42 : AutomationResourceProxy(tracker, sender, handle) {}
36 43
37 virtual ~TabProxy() {}
38
39 // Gets the current url of the tab. 44 // Gets the current url of the tab.
40 bool GetCurrentURL(GURL* url) const; 45 bool GetCurrentURL(GURL* url) const;
41 46
42 // Gets the title of the tab. 47 // Gets the title of the tab.
43 bool GetTabTitle(std::wstring* title) const; 48 bool GetTabTitle(std::wstring* title) const;
44 49
45 // Gets the tabstrip index of the tab. 50 // Gets the tabstrip index of the tab.
46 bool GetTabIndex(int* index) const; 51 bool GetTabIndex(int* index) const;
47 52
48 // Gets the number of constrained window for this tab. 53 // Gets the number of constrained window for this tab.
49 bool GetConstrainedWindowCount(int* count) const; 54 bool GetConstrainedWindowCount(int* count) const;
50 55
51 // Gets the proxy object for constrained window within this tab. Ownership 56 // Gets the proxy object for constrained window within this tab. Ownership
52 // for the returned object is transfered to the caller. Returns NULL on 57 // for the returned object is transfered to the caller. Returns NULL on
53 // failure. 58 // failure.
54 ConstrainedWindowProxy* GetConstrainedWindow(int window_index) const; 59 scoped_refptr<ConstrainedWindowProxy> GetConstrainedWindow(
60 int window_index) const;
55 61
56 // Executes a javascript in a frame's context whose xpath is provided as the 62 // Executes a javascript in a frame's context whose xpath is provided as the
57 // first parameter and extract the values from the resulting json string. 63 // first parameter and extract the values from the resulting json string.
58 // Examples: 64 // Examples:
59 // jscript = "window.domAutomationController.send('string');" 65 // jscript = "window.domAutomationController.send('string');"
60 // will result in value = "string" 66 // will result in value = "string"
61 // jscript = "window.domAutomationController.send(24);" 67 // jscript = "window.domAutomationController.send(24);"
62 // will result in value = 24 68 // will result in value = 24
63 bool ExecuteAndExtractString(const std::wstring& frame_xpath, 69 bool ExecuteAndExtractString(const std::wstring& frame_xpath,
64 const std::wstring& jscript, 70 const std::wstring& jscript,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 bool OverrideEncoding(const std::wstring& encoding); 294 bool OverrideEncoding(const std::wstring& encoding);
289 295
290 #if defined(OS_WIN) 296 #if defined(OS_WIN)
291 // Resizes the tab window. 297 // Resizes the tab window.
292 // The parent_window parameter allows a parent to be specified for the window 298 // The parent_window parameter allows a parent to be specified for the window
293 // passed in. 299 // passed in.
294 void Reposition(HWND window, HWND window_insert_after, int left, int top, 300 void Reposition(HWND window, HWND window_insert_after, int left, int top,
295 int width, int height, int flags, HWND parent_window); 301 int width, int height, int flags, HWND parent_window);
296 #endif // defined(OS_WIN) 302 #endif // defined(OS_WIN)
297 303
304 // Calls delegates
305 void AddObserver(TabProxyDelegate* observer);
306 void RemoveObserver(TabProxyDelegate* observer);
307 void OnMessageReceived(const IPC::Message& message);
308 protected:
309 virtual ~TabProxy() {}
298 private: 310 private:
311 Lock list_lock_; // Protects the observers_list_.
312 ObserverList<TabProxyDelegate> observers_list_;
299 DISALLOW_COPY_AND_ASSIGN(TabProxy); 313 DISALLOW_COPY_AND_ASSIGN(TabProxy);
300 }; 314 };
301 315
302 #endif // CHROME_TEST_AUTOMATION_TAB_PROXY_H_ 316 #endif // CHROME_TEST_AUTOMATION_TAB_PROXY_H_
OLDNEW
« no previous file with comments | « chrome/test/automation/browser_proxy.cc ('k') | chrome/test/automation/tab_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698