OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHROMEDRIVER_CHROME_CHROME_IMPL_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_CHROME_IMPL_H_ |
6 #define CHROME_TEST_CHROMEDRIVER_CHROME_CHROME_IMPL_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_CHROME_CHROME_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... | |
24 | 24 |
25 class ChromeImpl : public Chrome, public WebViewDelegate { | 25 class ChromeImpl : public Chrome, public WebViewDelegate { |
26 public: | 26 public: |
27 ChromeImpl(URLRequestContextGetter* context_getter, | 27 ChromeImpl(URLRequestContextGetter* context_getter, |
28 int port, | 28 int port, |
29 const SyncWebSocketFactory& socket_factory); | 29 const SyncWebSocketFactory& socket_factory); |
30 virtual ~ChromeImpl(); | 30 virtual ~ChromeImpl(); |
31 | 31 |
32 // Overridden from Chrome: | 32 // Overridden from Chrome: |
33 virtual std::string GetVersion() OVERRIDE; | 33 virtual std::string GetVersion() OVERRIDE; |
34 virtual Status GetWebViews(std::list<WebView*>* web_views) OVERRIDE; | 34 virtual Status GetWebViewIds(std::list<std::string>* web_view_ids) OVERRIDE; |
35 virtual Status GetWebViewById(const std::string& id, | |
36 WebView** web_view) OVERRIDE; | |
35 virtual Status IsJavaScriptDialogOpen(bool* is_open) OVERRIDE; | 37 virtual Status IsJavaScriptDialogOpen(bool* is_open) OVERRIDE; |
36 virtual Status GetJavaScriptDialogMessage(std::string* message) OVERRIDE; | 38 virtual Status GetJavaScriptDialogMessage(std::string* message) OVERRIDE; |
37 virtual Status HandleJavaScriptDialog( | 39 virtual Status HandleJavaScriptDialog( |
38 bool accept, | 40 bool accept, |
39 const std::string& prompt_text) OVERRIDE; | 41 const std::string& prompt_text) OVERRIDE; |
40 | 42 |
41 // Overridden from WebViewDelegate: | 43 // Overridden from WebViewDelegate: |
42 virtual void OnWebViewClose(WebView* web_view) OVERRIDE; | 44 virtual void OnWebViewClose(WebView* web_view) OVERRIDE; |
43 | 45 |
44 protected: | 46 protected: |
45 Status Init(); | 47 Status Init(); |
46 int GetPort() const; | 48 int GetPort() const; |
47 | 49 |
48 private: | 50 private: |
49 typedef std::map<std::string, linked_ptr<WebViewImpl> > WebViewMap; | 51 typedef std::map<std::string, linked_ptr<WebViewImpl> > WebViewMap; |
50 | 52 |
51 Status GetDialogManagerForOpenDialog(JavaScriptDialogManager** manager); | 53 Status GetDialogManagerForOpenDialog(JavaScriptDialogManager** manager); |
52 Status ParseAndCheckVersion(const std::string& version); | 54 Status ParseAndCheckVersion(const std::string& version); |
53 | 55 |
54 scoped_refptr<URLRequestContextGetter> context_getter_; | 56 scoped_refptr<URLRequestContextGetter> context_getter_; |
55 int port_; | 57 int port_; |
56 SyncWebSocketFactory socket_factory_; | 58 SyncWebSocketFactory socket_factory_; |
57 std::string version_; | 59 std::string version_; |
58 int build_no_; | 60 int build_no_; |
59 WebViewMap web_view_map_; | 61 WebViewMap web_view_map_; |
62 // Ids in this list are in the same order as the window opened. | |
chrisgao (Use stgao instead)
2013/03/22 23:29:46
window->web view
| |
63 std::list<std::string> web_view_ids_; | |
60 }; | 64 }; |
61 | 65 |
62 namespace internal { | 66 namespace internal { |
63 | 67 |
64 struct WebViewInfo { | 68 struct WebViewInfo { |
65 enum Type { | 69 enum Type { |
66 kPage, | 70 kPage, |
67 kOther | 71 kOther |
68 }; | 72 }; |
69 | 73 |
(...skipping 12 matching lines...) Expand all Loading... | |
82 | 86 |
83 Status ParsePagesInfo(const std::string& data, | 87 Status ParsePagesInfo(const std::string& data, |
84 std::list<WebViewInfo>* info_list); | 88 std::list<WebViewInfo>* info_list); |
85 | 89 |
86 Status ParseVersionInfo(const std::string& data, | 90 Status ParseVersionInfo(const std::string& data, |
87 std::string* version); | 91 std::string* version); |
88 | 92 |
89 } // namespace internal | 93 } // namespace internal |
90 | 94 |
91 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_CHROME_IMPL_H_ | 95 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_CHROME_IMPL_H_ |
OLD | NEW |