| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_FRAME_CFPROXY_H_ | 5 #ifndef CHROME_FRAME_CFPROXY_H_ |
| 6 #define CHROME_FRAME_CFPROXY_H_ | 6 #define CHROME_FRAME_CFPROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #include <map> // for proxy factory | 10 #include <map> // for proxy factory |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 */ | 71 */ |
| 72 | 72 |
| 73 // ChromeProxy is an abstract class. Is forwards the commands to an | 73 // ChromeProxy is an abstract class. Is forwards the commands to an |
| 74 // instance of the running Chromium browser. | 74 // instance of the running Chromium browser. |
| 75 // A pointer to ChromeProxy instance is obtained through a | 75 // A pointer to ChromeProxy instance is obtained through a |
| 76 // ChromeProxyFactory object. | 76 // ChromeProxyFactory object. |
| 77 class ChromeProxy { | 77 class ChromeProxy { |
| 78 public: | 78 public: |
| 79 // General | 79 // General |
| 80 virtual void RemoveBrowsingData(int remove_mask) = 0; // async | 80 virtual void RemoveBrowsingData(int remove_mask) = 0; // async |
| 81 virtual void InstallExtension(ChromeProxyDelegate* delegate, | |
| 82 const FilePath& crx_path, | |
| 83 SyncMessageContext* ctx) = 0; | |
| 84 virtual void LoadExtension(ChromeProxyDelegate* delegate, | |
| 85 const FilePath& path, | |
| 86 SyncMessageContext* ctx) = 0; | |
| 87 virtual void GetEnabledExtensions(ChromeProxyDelegate* delegate, | |
| 88 SyncMessageContext* ctx) = 0; | |
| 89 virtual void SetProxyConfig(const std::string& json_encoded_settings) = 0; | 81 virtual void SetProxyConfig(const std::string& json_encoded_settings) = 0; |
| 90 | 82 |
| 91 // Tab management. | 83 // Tab management. |
| 92 virtual void CreateTab(ChromeProxyDelegate* delegate, | 84 virtual void CreateTab(ChromeProxyDelegate* delegate, |
| 93 const ExternalTabSettings& settings) = 0; | 85 const ExternalTabSettings& settings) = 0; |
| 94 virtual void ConnectTab(ChromeProxyDelegate* delegate, HWND hwnd, | 86 virtual void ConnectTab(ChromeProxyDelegate* delegate, HWND hwnd, |
| 95 uint64 cookie) = 0; | 87 uint64 cookie) = 0; |
| 96 virtual void BlockTab(uint64 cookie) = 0; | 88 virtual void BlockTab(uint64 cookie) = 0; |
| 97 | 89 |
| 98 // Tab related. | 90 // Tab related. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 117 virtual void Tab_FontSize(int tab, enum AutomationPageFontSize font_size) = 0; | 109 virtual void Tab_FontSize(int tab, enum AutomationPageFontSize font_size) = 0; |
| 118 virtual void Tab_SetInitialFocus(int tab, | 110 virtual void Tab_SetInitialFocus(int tab, |
| 119 bool reverse, bool restore_focus_to_view) = 0; | 111 bool reverse, bool restore_focus_to_view) = 0; |
| 120 virtual void Tab_SetParentWindow(int tab) = 0; | 112 virtual void Tab_SetParentWindow(int tab) = 0; |
| 121 virtual void Tab_Resize(int tab) = 0; | 113 virtual void Tab_Resize(int tab) = 0; |
| 122 virtual void Tab_ProcessAccelerator(int tab, const MSG& msg) = 0; | 114 virtual void Tab_ProcessAccelerator(int tab, const MSG& msg) = 0; |
| 123 | 115 |
| 124 // Misc. | 116 // Misc. |
| 125 virtual void Tab_OnHostMoved(int tab) = 0; | 117 virtual void Tab_OnHostMoved(int tab) = 0; |
| 126 virtual void Tab_RunUnloadHandlers(int tab) = 0; | 118 virtual void Tab_RunUnloadHandlers(int tab) = 0; |
| 127 virtual void Tab_SetEnableExtensionAutomation(int tab, | |
| 128 const std::vector<std::string>& functions_enabled) = 0; | |
| 129 virtual void Tab_Navigate(int tab, const GURL& url, const GURL& referrer) = 0; | 119 virtual void Tab_Navigate(int tab, const GURL& url, const GURL& referrer) = 0; |
| 130 virtual void Tab_OverrideEncoding(int tab, const char* encoding) = 0; | 120 virtual void Tab_OverrideEncoding(int tab, const char* encoding) = 0; |
| 131 | 121 |
| 132 protected: | 122 protected: |
| 133 // Accessible by ChromeProxyFactory | 123 // Accessible by ChromeProxyFactory |
| 134 friend class ChromeProxyFactory; | 124 friend class ChromeProxyFactory; |
| 135 virtual ~ChromeProxy() {} | 125 virtual ~ChromeProxy() {} |
| 136 virtual void Init(const ProxyParams& params) = 0; | 126 virtual void Init(const ProxyParams& params) = 0; |
| 137 virtual int AddDelegate(ChromeProxyDelegate* delegate) = 0; | 127 virtual int AddDelegate(ChromeProxyDelegate* delegate) = 0; |
| 138 virtual int RemoveDelegate(ChromeProxyDelegate* delegate) = 0; | 128 virtual int RemoveDelegate(ChromeProxyDelegate* delegate) = 0; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 156 virtual void PeerLost(ChromeProxy* proxy, DisconnectReason reason) = 0; | 146 virtual void PeerLost(ChromeProxy* proxy, DisconnectReason reason) = 0; |
| 157 virtual int tab_handle() = 0; // to avoid reverse lookup :) | 147 virtual int tab_handle() = 0; // to avoid reverse lookup :) |
| 158 | 148 |
| 159 // Sync message responses. | 149 // Sync message responses. |
| 160 virtual void Completed_CreateTab(bool success, HWND chrome_wnd, | 150 virtual void Completed_CreateTab(bool success, HWND chrome_wnd, |
| 161 HWND tab_window, int tab_handle, int session_id) = 0; | 151 HWND tab_window, int tab_handle, int session_id) = 0; |
| 162 virtual void Completed_ConnectToTab(bool success, HWND chrome_window, | 152 virtual void Completed_ConnectToTab(bool success, HWND chrome_window, |
| 163 HWND tab_window, int tab_handle, int session_id) = 0; | 153 HWND tab_window, int tab_handle, int session_id) = 0; |
| 164 virtual void Completed_Navigate(bool success, | 154 virtual void Completed_Navigate(bool success, |
| 165 enum AutomationMsg_NavigationResponseValues res) = 0; | 155 enum AutomationMsg_NavigationResponseValues res) = 0; |
| 166 virtual void Completed_InstallExtension(bool success, | |
| 167 AutomationMsg_ExtensionResponseValues res, SyncMessageContext* ctx) = 0; | |
| 168 virtual void Completed_LoadExpandedExtension(bool success, | |
| 169 AutomationMsg_ExtensionResponseValues res, SyncMessageContext* ctx) = 0; | |
| 170 virtual void Completed_GetEnabledExtensions(bool success, | |
| 171 const std::vector<FilePath>* extensions) = 0; | |
| 172 | 156 |
| 173 protected: | 157 protected: |
| 174 ~ChromeProxyDelegate() {} | 158 ~ChromeProxyDelegate() {} |
| 175 }; | 159 }; |
| 176 | 160 |
| 177 // a way to obtain a ChromeProxy implementation | 161 // a way to obtain a ChromeProxy implementation |
| 178 struct ProxyParams { | 162 struct ProxyParams { |
| 179 std::string profile; | 163 std::string profile; |
| 180 std::wstring extra_params; | 164 std::wstring extra_params; |
| 181 FilePath profile_path; | 165 FilePath profile_path; |
| 182 base::TimeDelta timeout; | 166 base::TimeDelta timeout; |
| 183 }; | 167 }; |
| 184 | 168 |
| 185 class ChromeProxyFactory { | 169 class ChromeProxyFactory { |
| 186 public: | 170 public: |
| 187 ChromeProxyFactory(); | 171 ChromeProxyFactory(); |
| 188 ~ChromeProxyFactory(); | 172 ~ChromeProxyFactory(); |
| 189 void GetProxy(ChromeProxyDelegate* delegate, const ProxyParams& params); | 173 void GetProxy(ChromeProxyDelegate* delegate, const ProxyParams& params); |
| 190 bool ReleaseProxy(ChromeProxyDelegate* delegate, const std::string& profile); | 174 bool ReleaseProxy(ChromeProxyDelegate* delegate, const std::string& profile); |
| 191 protected: | 175 protected: |
| 192 virtual ChromeProxy* CreateProxy(); | 176 virtual ChromeProxy* CreateProxy(); |
| 193 typedef std::map<std::string, ChromeProxy*> ProxyMap; | 177 typedef std::map<std::string, ChromeProxy*> ProxyMap; |
| 194 ProxyMap proxies_; | 178 ProxyMap proxies_; |
| 195 base::Lock lock_; | 179 base::Lock lock_; |
| 196 }; | 180 }; |
| 197 | 181 |
| 198 #endif // CHROME_FRAME_CFPROXY_H_ | 182 #endif // CHROME_FRAME_CFPROXY_H_ |
| OLD | NEW |