blob: 0c778b7aa722d66f95fd46dcc777706b8bd432dd [file] [log] [blame]
[email protected]add184df2012-03-10 10:08:571// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]f7817822009-09-24 05:11:582// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_FRAME_CHROME_FRAME_AUTOMATION_H_
6#define CHROME_FRAME_CHROME_FRAME_AUTOMATION_H_
7
8#include <atlbase.h>
9#include <atlwin.h>
[email protected]f7817822009-09-24 05:11:5810#include <map>
[email protected]8ee65ba2011-04-12 20:53:2311#include <string>
[email protected]efd4dfc22010-03-26 20:14:4012#include <vector>
[email protected]f7817822009-09-24 05:11:5813
[email protected]3b63f8f42011-03-28 01:54:1514#include "base/memory/ref_counted.h"
15#include "base/memory/scoped_handle.h"
[email protected]f7817822009-09-24 05:11:5816#include "base/stack_container.h"
[email protected]20305ec2011-01-21 04:55:5217#include "base/synchronization/lock.h"
[email protected]34b99632011-01-01 01:01:0618#include "base/threading/thread.h"
[email protected]ce072a72010-12-31 20:02:1619#include "base/timer.h"
[email protected]f7817822009-09-24 05:11:5820#include "chrome/test/automation/automation_proxy.h"
21#include "chrome/test/automation/tab_proxy.h"
22#include "chrome_frame/chrome_frame_delegate.h"
[email protected]f7817822009-09-24 05:11:5823#include "chrome_frame/plugin_url_request.h"
[email protected]d0b8e5f2010-05-18 04:26:0224#include "chrome_frame/sync_msg_reply_dispatcher.h"
[email protected]54087fe2011-10-28 22:02:4825#include "content/public/common/page_zoom.h"
[email protected]f7817822009-09-24 05:11:5826
[email protected]b0b85fe92009-10-21 00:11:2327// By a convoluated route, this timeout also winds up being the sync automation
28// message timeout. See the ChromeFrameAutomationProxyImpl ctor and the
29// AutomationProxy ctor for details.
30const unsigned long kCommandExecutionTimeout = 60000; // NOLINT, 60 seconds
[email protected]f7817822009-09-24 05:11:5831
32class ProxyFactory;
[email protected]354bcba2010-12-14 04:34:4333class NavigationConstraints;
[email protected]1bb5f892009-10-06 01:44:5734enum AutomationPageFontSize;
[email protected]f7817822009-09-24 05:11:5835
[email protected]efd4dfc22010-03-26 20:14:4036struct DECLSPEC_NOVTABLE ChromeFrameAutomationProxy { // NOLINT
[email protected]f7817822009-09-24 05:11:5837 virtual bool Send(IPC::Message* msg) = 0;
38
[email protected]d0b8e5f2010-05-18 04:26:0239 virtual void SendAsAsync(
40 IPC::SyncMessage* msg,
41 SyncMessageReplyDispatcher::SyncMessageCallContext* context,
42 void* key) = 0;
[email protected]f7817822009-09-24 05:11:5843 virtual void CancelAsync(void* key) = 0;
44 virtual scoped_refptr<TabProxy> CreateTabProxy(int handle) = 0;
[email protected]efd4dfc22010-03-26 20:14:4045 virtual void ReleaseTabProxy(AutomationHandle handle) = 0;
[email protected]f7817822009-09-24 05:11:5846 virtual std::string server_version() = 0;
47
48 virtual void SendProxyConfig(const std::string&) = 0;
[email protected]f7817822009-09-24 05:11:5849 protected:
[email protected]efd4dfc22010-03-26 20:14:4050 virtual ~ChromeFrameAutomationProxy() {}
[email protected]f7817822009-09-24 05:11:5851};
52
[email protected]bbfa9a12010-08-10 14:09:3753// Forward declarations.
54class ProxyFactory;
55
[email protected]f7817822009-09-24 05:11:5856// We extend the AutomationProxy class to handle our custom
57// IPC messages
[email protected]bbfa9a12010-08-10 14:09:3758class ChromeFrameAutomationProxyImpl
59 : public ChromeFrameAutomationProxy,
60 // We have to derive from automationproxy since we want access to some
61 // members (tracker_ & channel_) - simple aggregation wont work;
62 // .. and non-public inheritance is verboten.
63 public AutomationProxy {
[email protected]f7817822009-09-24 05:11:5864 public:
[email protected]bbfa9a12010-08-10 14:09:3765 ~ChromeFrameAutomationProxyImpl();
[email protected]d0b8e5f2010-05-18 04:26:0266 virtual void SendAsAsync(
67 IPC::SyncMessage* msg,
68 SyncMessageReplyDispatcher::SyncMessageCallContext* context,
69 void* key);
[email protected]f7817822009-09-24 05:11:5870
[email protected]bbfa9a12010-08-10 14:09:3771 // Called on the worker thread.
72 virtual void OnChannelError();
73
[email protected]f7817822009-09-24 05:11:5874 virtual void CancelAsync(void* key);
75
76 virtual scoped_refptr<TabProxy> CreateTabProxy(int handle);
[email protected]efd4dfc22010-03-26 20:14:4077 virtual void ReleaseTabProxy(AutomationHandle handle);
[email protected]e67a73f42010-08-31 15:05:0278
[email protected]f7817822009-09-24 05:11:5879 virtual std::string server_version() {
80 return AutomationProxy::server_version();
81 }
82
[email protected]f7817822009-09-24 05:11:5883 virtual bool Send(IPC::Message* msg) {
84 return AutomationProxy::Send(msg);
85 }
86
87 virtual void SendProxyConfig(const std::string& p) {
88 AutomationProxy::SendProxyConfig(p);
89 }
90
[email protected]f7817822009-09-24 05:11:5891 protected:
[email protected]bbfa9a12010-08-10 14:09:3792 friend class AutomationProxyCacheEntry;
93 ChromeFrameAutomationProxyImpl(AutomationProxyCacheEntry* entry,
[email protected]dfe0deb2010-12-23 20:40:1694 std::string channel_id,
[email protected]a0b900b2012-07-20 19:41:5695 base::TimeDelta launch_timeout);
[email protected]bbfa9a12010-08-10 14:09:3796
[email protected]f7817822009-09-24 05:11:5897 class CFMsgDispatcher;
[email protected]efd4dfc22010-03-26 20:14:4098 class TabProxyNotificationMessageFilter;
[email protected]bbfa9a12010-08-10 14:09:3799
100 scoped_refptr<CFMsgDispatcher> sync_;
[email protected]efd4dfc22010-03-26 20:14:40101 scoped_refptr<TabProxyNotificationMessageFilter> message_filter_;
[email protected]bbfa9a12010-08-10 14:09:37102 AutomationProxyCacheEntry* proxy_entry_;
[email protected]f7817822009-09-24 05:11:58103};
104
[email protected]bbfa9a12010-08-10 14:09:37105// This class contains information used for launching chrome.
106class ChromeFrameLaunchParams : // NOLINT
[email protected]e67a73f42010-08-31 15:05:02107 public base::RefCountedThreadSafe<ChromeFrameLaunchParams> {
[email protected]bbfa9a12010-08-10 14:09:37108 public:
109 ChromeFrameLaunchParams(const GURL& url, const GURL& referrer,
110 const FilePath& profile_path,
111 const std::wstring& profile_name,
[email protected]6ae3d492010-10-20 14:01:21112 const std::wstring& language,
[email protected]9eeb35e2010-09-30 21:38:50113 bool incognito, bool widget_mode,
[email protected]add184df2012-03-10 10:08:57114 bool route_all_top_level_navigations,
115 bool send_shutdown_delay_switch)
[email protected]bbfa9a12010-08-10 14:09:37116 : launch_timeout_(kCommandExecutionTimeout), url_(url),
117 referrer_(referrer), profile_path_(profile_path),
[email protected]6ae3d492010-10-20 14:01:21118 profile_name_(profile_name), language_(language),
[email protected]c70e5582011-12-20 21:22:45119 version_check_(true), incognito_mode_(incognito),
120 is_widget_mode_(widget_mode),
[email protected]add184df2012-03-10 10:08:57121 route_all_top_level_navigations_(route_all_top_level_navigations),
122 send_shutdown_delay_switch_(send_shutdown_delay_switch) {
[email protected]bbfa9a12010-08-10 14:09:37123 }
124
125 ~ChromeFrameLaunchParams() {
126 }
127
128 void set_launch_timeout(int timeout) {
129 launch_timeout_ = timeout;
130 }
131
132 int launch_timeout() const {
133 return launch_timeout_;
134 }
135
136 const GURL& url() const {
137 return url_;
138 }
139
140 void set_url(const GURL& url) {
141 url_ = url;
142 }
143
144 const GURL& referrer() const {
145 return referrer_;
146 }
147
148 void set_referrer(const GURL& referrer) {
149 referrer_ = referrer;
150 }
151
152 const FilePath& profile_path() const {
153 return profile_path_;
154 }
155
156 const std::wstring& profile_name() const {
157 return profile_name_;
158 }
159
[email protected]6ae3d492010-10-20 14:01:21160 const std::wstring& language() const {
161 return language_;
162 }
163
[email protected]bbfa9a12010-08-10 14:09:37164 bool version_check() const {
165 return version_check_;
166 }
167
168 void set_version_check(bool check) {
169 version_check_ = check;
170 }
171
172 bool incognito() const {
173 return incognito_mode_;
174 }
175
176 bool widget_mode() const {
177 return is_widget_mode_;
178 }
179
[email protected]9eeb35e2010-09-30 21:38:50180 void set_route_all_top_level_navigations(
181 bool route_all_top_level_navigations) {
182 route_all_top_level_navigations_ = route_all_top_level_navigations;
183 }
184
185 bool route_all_top_level_navigations() const {
186 return route_all_top_level_navigations_;
187 }
188
[email protected]add184df2012-03-10 10:08:57189 bool send_shutdown_delay_switch() const {
190 return send_shutdown_delay_switch_;
191 }
192
[email protected]bbfa9a12010-08-10 14:09:37193 protected:
194 int launch_timeout_;
195 GURL url_;
196 GURL referrer_;
197 FilePath profile_path_;
198 std::wstring profile_name_;
[email protected]6ae3d492010-10-20 14:01:21199 std::wstring language_;
[email protected]bbfa9a12010-08-10 14:09:37200 bool version_check_;
201 bool incognito_mode_;
202 bool is_widget_mode_;
[email protected]9eeb35e2010-09-30 21:38:50203 bool route_all_top_level_navigations_;
[email protected]add184df2012-03-10 10:08:57204 bool send_shutdown_delay_switch_;
[email protected]bbfa9a12010-08-10 14:09:37205
206 private:
207 DISALLOW_COPY_AND_ASSIGN(ChromeFrameLaunchParams);
208};
209
210// Callback when chrome process launch is complete and automation handshake
[email protected]5548186f2011-12-17 03:37:55211// (Hello message) is established. All methods are invoked on the automation
212// proxy's worker thread.
[email protected]bbfa9a12010-08-10 14:09:37213struct DECLSPEC_NOVTABLE LaunchDelegate { // NOLINT
214 virtual void LaunchComplete(ChromeFrameAutomationProxy* proxy,
215 AutomationLaunchResult result) = 0;
216 virtual void AutomationServerDied() = 0;
217}; // NOLINT
218
219// Manages a cached ChromeFrameAutomationProxyImpl entry and holds
220// reference-less pointers to LaunchDelegate(s) to be notified in case
221// of automation server process changes.
222class AutomationProxyCacheEntry
223 : public base::RefCounted<AutomationProxyCacheEntry> {
224 public:
225 AutomationProxyCacheEntry(ChromeFrameLaunchParams* params,
226 LaunchDelegate* delegate);
227
228 ~AutomationProxyCacheEntry();
229
230 void AddDelegate(LaunchDelegate* delegate);
231 void RemoveDelegate(LaunchDelegate* delegate, base::WaitableEvent* done,
232 bool* was_last_delegate);
233
[email protected]bbfa9a12010-08-10 14:09:37234 DWORD WaitForThread(DWORD timeout) { // NOLINT
235 DCHECK(thread_.get());
236 return ::WaitForSingleObject(thread_->thread_handle(), timeout);
237 }
238
239 bool IsSameProfile(const std::wstring& name) const {
240 return lstrcmpiW(name.c_str(), profile_name.c_str()) == 0;
241 }
242
243 base::Thread* thread() const {
244 return thread_.get();
245 }
246
247 MessageLoop* message_loop() const {
248 return thread_->message_loop();
249 }
250
[email protected]ce072a72010-12-31 20:02:16251 bool IsSameThread(base::PlatformThreadId id) const {
[email protected]bbfa9a12010-08-10 14:09:37252 return thread_->thread_id() == id;
253 }
254
255 ChromeFrameAutomationProxyImpl* proxy() const {
[email protected]ce072a72010-12-31 20:02:16256 DCHECK(IsSameThread(base::PlatformThread::CurrentId()));
[email protected]bbfa9a12010-08-10 14:09:37257 return proxy_.get();
258 }
259
260 // Called by the proxy when the automation server has unexpectedly gone away.
261 void OnChannelError();
262
263 protected:
264 void CreateProxy(ChromeFrameLaunchParams* params,
265 LaunchDelegate* delegate);
[email protected]bbfa9a12010-08-10 14:09:37266
267 protected:
[email protected]7de487c2009-12-18 21:07:53268 std::wstring profile_name;
[email protected]bbfa9a12010-08-10 14:09:37269 scoped_ptr<base::Thread> thread_;
270 scoped_ptr<ChromeFrameAutomationProxyImpl> proxy_;
271 AutomationLaunchResult launch_result_;
272 typedef std::vector<LaunchDelegate*> LaunchDelegates;
273 LaunchDelegates launch_delegates_;
274 // Used for UMA histogram logging to measure the time for the chrome
275 // automation server to start;
276 base::TimeTicks automation_server_launch_start_time_;
[email protected]7de487c2009-12-18 21:07:53277};
278
[email protected]f7817822009-09-24 05:11:58279// We must create and destroy automation proxy in a thread with a message loop.
280// Hence thread cannot be a member of the proxy.
281class ProxyFactory {
282 public:
[email protected]f7817822009-09-24 05:11:58283 ProxyFactory();
[email protected]efd4dfc22010-03-26 20:14:40284 virtual ~ProxyFactory();
[email protected]7de487c2009-12-18 21:07:53285
[email protected]bbfa9a12010-08-10 14:09:37286 // Fetches or creates a new automation server instance.
287 // delegate may be NULL. If non-null, a pointer to the delegate will
288 // be stored for the lifetime of the automation process or until
289 // ReleaseAutomationServer is called.
[email protected]7de487c2009-12-18 21:07:53290 virtual void GetAutomationServer(LaunchDelegate* delegate,
[email protected]bbfa9a12010-08-10 14:09:37291 ChromeFrameLaunchParams* params,
[email protected]7de487c2009-12-18 21:07:53292 void** automation_server_id);
[email protected]bbfa9a12010-08-10 14:09:37293 virtual bool ReleaseAutomationServer(void* server_id,
294 LaunchDelegate* delegate);
[email protected]f7817822009-09-24 05:11:58295
296 private:
[email protected]bbfa9a12010-08-10 14:09:37297 typedef StackVector<scoped_refptr<AutomationProxyCacheEntry>, 4> Vector;
[email protected]f7817822009-09-24 05:11:58298 Vector proxies_;
299 // Lock if we are going to call GetAutomationServer from more than one thread.
[email protected]20305ec2011-01-21 04:55:52300 base::Lock lock_;
[email protected]f7817822009-09-24 05:11:58301};
302
[email protected]f7817822009-09-24 05:11:58303// Handles all automation requests initiated from the chrome frame objects.
[email protected]99d81e52011-06-29 02:29:53304// These include the chrome tab/chrome frame activex plugin objects.
[email protected]f7817822009-09-24 05:11:58305class ChromeFrameAutomationClient
306 : public CWindowImpl<ChromeFrameAutomationClient>,
307 public TaskMarshallerThroughWindowsMessages<ChromeFrameAutomationClient>,
[email protected]3eb07da2010-02-01 19:48:36308 public base::RefCountedThreadSafe<ChromeFrameAutomationClient>,
309 public PluginUrlRequestDelegate,
[email protected]f7817822009-09-24 05:11:58310 public TabProxy::TabProxyDelegate,
[email protected]bbfa9a12010-08-10 14:09:37311 public LaunchDelegate {
[email protected]f7817822009-09-24 05:11:58312 public:
313 ChromeFrameAutomationClient();
314 ~ChromeFrameAutomationClient();
315
316 // Called from UI thread.
317 virtual bool Initialize(ChromeFrameDelegate* chrome_frame_delegate,
[email protected]bbfa9a12010-08-10 14:09:37318 ChromeFrameLaunchParams* chrome_launch_params);
[email protected]f7817822009-09-24 05:11:58319 void Uninitialize();
[email protected]bbfa9a12010-08-10 14:09:37320 void NotifyAndUninitialize();
[email protected]f7817822009-09-24 05:11:58321
[email protected]354bcba2010-12-14 04:34:43322 virtual bool InitiateNavigation(
323 const std::string& url,
324 const std::string& referrer,
325 NavigationConstraints* navigation_constraints);
326
[email protected]f7817822009-09-24 05:11:58327 virtual bool NavigateToIndex(int index);
328 bool ForwardMessageFromExternalHost(const std::string& message,
329 const std::string& origin,
330 const std::string& target);
331 bool SetProxySettings(const std::string& json_encoded_proxy_settings);
332
[email protected]f7817822009-09-24 05:11:58333 void FindInPage(const std::wstring& search_string,
334 FindInPageDirection forward,
335 FindInPageCase match_case,
336 bool find_next);
337
[email protected]2b19e2fe2010-02-16 02:24:18338 virtual void OnChromeFrameHostMoved();
339
[email protected]f7817822009-09-24 05:11:58340 TabProxy* tab() const { return tab_.get(); }
341
342 BEGIN_MSG_MAP(ChromeFrameAutomationClient)
343 CHAIN_MSG_MAP(
344 TaskMarshallerThroughWindowsMessages<ChromeFrameAutomationClient>)
345 END_MSG_MAP()
346
[email protected]f7817822009-09-24 05:11:58347 // Resizes the hosted chrome window. This is brokered to the chrome
348 // automation instance as the host browser could be running under low IL,
349 // which would cause the SetWindowPos call to fail.
350 void Resize(int width, int height, int flags);
351
352 // Sets the passed in window as the parent of the external tab.
353 void SetParentWindow(HWND parent_window);
354
355 void SendContextMenuCommandToChromeFrame(int selected_command);
356
357 HWND tab_window() const {
358 return tab_window_;
359 }
360
361 void ReleaseAutomationServer();
362
363 // Returns the version number of plugin dll.
364 std::wstring GetVersion() const;
365
366 // BitBlts the contents of the chrome window to the print dc.
367 void Print(HDC print_dc, const RECT& print_bounds);
368
369 // Called in full tab mode and indicates a request to chrome to print
370 // the whole tab.
371 void PrintTab();
372
[email protected]f7817822009-09-24 05:11:58373 void set_use_chrome_network(bool use_chrome_network) {
374 use_chrome_network_ = use_chrome_network;
375 }
[email protected]add184df2012-03-10 10:08:57376
[email protected]f7817822009-09-24 05:11:58377 bool use_chrome_network() const {
378 return use_chrome_network_;
379 }
380
[email protected]add184df2012-03-10 10:08:57381 bool send_shutdown_delay_switch() const {
382 return send_shutdown_delay_switch_;
383 }
384
[email protected]f7817822009-09-24 05:11:58385#ifdef UNIT_TEST
386 void set_proxy_factory(ProxyFactory* factory) {
387 proxy_factory_ = factory;
388 }
389#endif
390
391 void set_handle_top_level_requests(bool handle_top_level_requests) {
392 handle_top_level_requests_ = handle_top_level_requests;
393 }
394
[email protected]d266ce82010-08-13 21:33:40395 // Url request manager set up.
396 void SetUrlFetcher(PluginUrlRequestManager* url_fetcher);
397
[email protected]f7817822009-09-24 05:11:58398 // Attaches an existing external tab to this automation client instance.
[email protected]b1c55638612010-03-08 16:26:11399 void AttachExternalTab(uint64 external_tab_cookie);
400 void BlockExternalTab(uint64 cookie);
[email protected]f7817822009-09-24 05:11:58401
[email protected]1bb5f892009-10-06 01:44:57402 void SetPageFontSize(enum AutomationPageFontSize);
403
[email protected]bc73b4e52010-03-26 04:16:20404 // For IDeleteBrowsingHistorySupport
405 void RemoveBrowsingData(int remove_mask);
406
[email protected]7f860dd82010-08-09 23:18:05407 // Sets the current zoom level on the tab.
[email protected]54087fe2011-10-28 22:02:48408 void SetZoomLevel(content::PageZoom zoom_level);
[email protected]7f860dd82010-08-09 23:18:05409
[email protected]d9d8f0c2010-09-17 21:47:16410 // Fires before unload and unload handlers on the page if any. Allows the
411 // the website to put up a confirmation dialog on unload.
412 void OnUnload(bool* should_unload);
413
[email protected]f7817822009-09-24 05:11:58414 protected:
415 // ChromeFrameAutomationProxy::LaunchDelegate implementation.
416 virtual void LaunchComplete(ChromeFrameAutomationProxy* proxy,
[email protected]bbfa9a12010-08-10 14:09:37417 AutomationLaunchResult result);
418 virtual void AutomationServerDied();
419
[email protected]f7817822009-09-24 05:11:58420 // TabProxyDelegate implementation
[email protected]6db8d9902010-12-24 08:36:25421 virtual bool OnMessageReceived(TabProxy* tab, const IPC::Message& msg);
[email protected]efd4dfc22010-03-26 20:14:40422 virtual void OnChannelError(TabProxy* tab);
[email protected]f7817822009-09-24 05:11:58423
424 void CreateExternalTab();
[email protected]ef8561d2010-05-19 02:49:18425 AutomationLaunchResult CreateExternalTabComplete(HWND chrome_window,
426 HWND tab_window,
[email protected]751bf4b2010-11-05 22:06:31427 int tab_handle,
428 int session_id);
[email protected]f7817822009-09-24 05:11:58429 // Called in UI thread. Here we fire event to the client notifying for
430 // the result of Initialize() method call.
431 void InitializeComplete(AutomationLaunchResult result);
432
[email protected]3148c0ae2010-03-11 18:06:00433 virtual void OnFinalMessage(HWND wnd) {
434 Release();
435 }
436
[email protected]bbfa9a12010-08-10 14:09:37437 scoped_refptr<ChromeFrameLaunchParams> launch_params() {
438 return chrome_launch_params_;
439 }
440
[email protected]f7817822009-09-24 05:11:58441 private:
[email protected]add184df2012-03-10 10:08:57442 void InitializeFieldTrials();
443
[email protected]2c9847a12010-12-24 08:16:46444 void OnMessageReceivedUIThread(const IPC::Message& msg);
[email protected]efd4dfc22010-03-26 20:14:40445 void OnChannelErrorUIThread();
[email protected]f7817822009-09-24 05:11:58446
447 HWND chrome_window() const { return chrome_window_; }
[email protected]bbfa9a12010-08-10 14:09:37448 void BeginNavigate();
[email protected]f7817822009-09-24 05:11:58449 void BeginNavigateCompleted(AutomationMsg_NavigationResponseValues result);
450
451 // Helpers
452 void ReportNavigationError(AutomationMsg_NavigationResponseValues error_code,
453 const std::string& url);
[email protected]d266ce82010-08-13 21:33:40454
455 bool ProcessUrlRequestMessage(TabProxy* tab, const IPC::Message& msg,
456 bool ui_thread);
457
458 // PluginUrlRequestDelegate implementation. Simply adds tab's handle
459 // as parameter and forwards to Chrome via IPC.
460 virtual void OnResponseStarted(int request_id, const char* mime_type,
461 const char* headers, int size, base::Time last_modified,
[email protected]0d282c2e2011-02-24 20:42:51462 const std::string& redirect_url, int redirect_status,
463 const net::HostPortPair& socket_address);
[email protected]d266ce82010-08-13 21:33:40464 virtual void OnReadComplete(int request_id, const std::string& data);
[email protected]27a112c2011-01-06 04:19:30465 virtual void OnResponseEnd(int request_id,
466 const net::URLRequestStatus& status);
[email protected]d266ce82010-08-13 21:33:40467 virtual void OnCookiesRetrieved(bool success, const GURL& url,
468 const std::string& cookie_string, int cookie_id);
469
[email protected]f7817822009-09-24 05:11:58470 bool is_initialized() const {
471 return init_state_ == INITIALIZED;
472 }
473
[email protected]f7817822009-09-24 05:11:58474 HWND parent_window_;
[email protected]ce072a72010-12-31 20:02:16475 base::PlatformThreadId ui_thread_id_;
[email protected]f7817822009-09-24 05:11:58476
477 void* automation_server_id_;
478 ChromeFrameAutomationProxy* automation_server_;
[email protected]a5205b62010-05-19 01:31:31479
[email protected]f7817822009-09-24 05:11:58480 HWND chrome_window_;
481 scoped_refptr<TabProxy> tab_;
482 ChromeFrameDelegate* chrome_frame_delegate_;
[email protected]f7817822009-09-24 05:11:58483
484 // Handle to the underlying chrome window. This is a child of the external
485 // tab window.
486 HWND tab_window_;
487
488 // Keeps track of the version of Chrome we're talking to.
489 std::string automation_server_version_;
490
[email protected]f7817822009-09-24 05:11:58491 typedef enum InitializationState {
492 UNINITIALIZED = 0,
493 INITIALIZING,
494 INITIALIZED,
495 UNINITIALIZING,
496 };
497
498 InitializationState init_state_;
499 bool use_chrome_network_;
500 bool handle_top_level_requests_;
501 ProxyFactory* proxy_factory_;
502 int tab_handle_;
[email protected]751bf4b2010-11-05 22:06:31503 // The SessionId used by Chrome as the id in the Javascript Tab object.
504 int session_id_;
[email protected]f7817822009-09-24 05:11:58505 // Only used if we attach to an existing tab.
[email protected]b1c55638612010-03-08 16:26:11506 uint64 external_tab_cookie_;
[email protected]7de487c2009-12-18 21:07:53507
508 // Set to true if we received a navigation request prior to the automation
509 // server being initialized.
510 bool navigate_after_initialization_;
511
[email protected]bbfa9a12010-08-10 14:09:37512 scoped_refptr<ChromeFrameLaunchParams> chrome_launch_params_;
[email protected]3eb07da2010-02-01 19:48:36513
[email protected]d266ce82010-08-13 21:33:40514 // Cache security manager for URL zone checking
[email protected]8ee65ba2011-04-12 20:53:23515 base::win::ScopedComPtr<IInternetSecurityManager> security_manager_;
[email protected]d266ce82010-08-13 21:33:40516
[email protected]3eb07da2010-02-01 19:48:36517 // When host network stack is used, this object is in charge of
518 // handling network requests.
519 PluginUrlRequestManager* url_fetcher_;
[email protected]27ad98352010-04-13 17:10:51520 PluginUrlRequestManager::ThreadSafeFlags url_fetcher_flags_;
[email protected]3eb07da2010-02-01 19:48:36521
[email protected]9eeb35e2010-09-30 21:38:50522 // set to true if the host needs to get notified of all top level navigations
523 // in this page. This typically applies to hosts which would render the new
524 // page without chrome frame. Defaults to false.
525 bool route_all_top_level_navigations_;
526
[email protected]add184df2012-03-10 10:08:57527 // Set to true if Chrome Frame should tell Chrome to delay shutdown after
528 // we break a connection. Currently used only as part of a field trial.
529 bool send_shutdown_delay_switch_;
530
[email protected]d0b8e5f2010-05-18 04:26:02531 friend class BeginNavigateContext;
532 friend class CreateExternalTabContext;
[email protected]f7817822009-09-24 05:11:58533};
534
535#endif // CHROME_FRAME_CHROME_FRAME_AUTOMATION_H_