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_FRAME_CHROME_FRAME_AUTOMATION_H_ | 5 #ifndef CHROME_FRAME_CHROME_FRAME_AUTOMATION_H_ |
6 #define CHROME_FRAME_CHROME_FRAME_AUTOMATION_H_ | 6 #define CHROME_FRAME_CHROME_FRAME_AUTOMATION_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlwin.h> | 9 #include <atlwin.h> |
10 #include <map> | 10 #include <map> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 // This class contains information used for launching chrome. | 105 // This class contains information used for launching chrome. |
106 class ChromeFrameLaunchParams : // NOLINT | 106 class ChromeFrameLaunchParams : // NOLINT |
107 public base::RefCountedThreadSafe<ChromeFrameLaunchParams> { | 107 public base::RefCountedThreadSafe<ChromeFrameLaunchParams> { |
108 public: | 108 public: |
109 ChromeFrameLaunchParams(const GURL& url, const GURL& referrer, | 109 ChromeFrameLaunchParams(const GURL& url, const GURL& referrer, |
110 const base::FilePath& profile_path, | 110 const base::FilePath& profile_path, |
111 const std::wstring& profile_name, | 111 const std::wstring& profile_name, |
112 const std::wstring& language, | 112 const std::wstring& language, |
113 bool incognito, bool widget_mode, | 113 bool incognito, bool widget_mode, |
114 bool route_all_top_level_navigations, | 114 bool route_all_top_level_navigations) |
115 bool send_shutdown_delay_switch) | |
116 : launch_timeout_(kCommandExecutionTimeout), url_(url), | 115 : launch_timeout_(kCommandExecutionTimeout), url_(url), |
117 referrer_(referrer), profile_path_(profile_path), | 116 referrer_(referrer), profile_path_(profile_path), |
118 profile_name_(profile_name), language_(language), | 117 profile_name_(profile_name), language_(language), |
119 version_check_(true), incognito_mode_(incognito), | 118 version_check_(true), incognito_mode_(incognito), |
120 is_widget_mode_(widget_mode), | 119 is_widget_mode_(widget_mode), |
121 route_all_top_level_navigations_(route_all_top_level_navigations), | 120 route_all_top_level_navigations_(route_all_top_level_navigations) { |
122 send_shutdown_delay_switch_(send_shutdown_delay_switch) { | |
123 } | 121 } |
124 | 122 |
125 ~ChromeFrameLaunchParams() { | 123 ~ChromeFrameLaunchParams() { |
126 } | 124 } |
127 | 125 |
128 void set_launch_timeout(int timeout) { | 126 void set_launch_timeout(int timeout) { |
129 launch_timeout_ = timeout; | 127 launch_timeout_ = timeout; |
130 } | 128 } |
131 | 129 |
132 int launch_timeout() const { | 130 int launch_timeout() const { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 177 |
180 void set_route_all_top_level_navigations( | 178 void set_route_all_top_level_navigations( |
181 bool route_all_top_level_navigations) { | 179 bool route_all_top_level_navigations) { |
182 route_all_top_level_navigations_ = route_all_top_level_navigations; | 180 route_all_top_level_navigations_ = route_all_top_level_navigations; |
183 } | 181 } |
184 | 182 |
185 bool route_all_top_level_navigations() const { | 183 bool route_all_top_level_navigations() const { |
186 return route_all_top_level_navigations_; | 184 return route_all_top_level_navigations_; |
187 } | 185 } |
188 | 186 |
189 bool send_shutdown_delay_switch() const { | |
190 return send_shutdown_delay_switch_; | |
191 } | |
192 | |
193 protected: | 187 protected: |
194 int launch_timeout_; | 188 int launch_timeout_; |
195 GURL url_; | 189 GURL url_; |
196 GURL referrer_; | 190 GURL referrer_; |
197 base::FilePath profile_path_; | 191 base::FilePath profile_path_; |
198 std::wstring profile_name_; | 192 std::wstring profile_name_; |
199 std::wstring language_; | 193 std::wstring language_; |
200 bool version_check_; | 194 bool version_check_; |
201 bool incognito_mode_; | 195 bool incognito_mode_; |
202 bool is_widget_mode_; | 196 bool is_widget_mode_; |
203 bool route_all_top_level_navigations_; | 197 bool route_all_top_level_navigations_; |
204 bool send_shutdown_delay_switch_; | |
205 | 198 |
206 private: | 199 private: |
207 DISALLOW_COPY_AND_ASSIGN(ChromeFrameLaunchParams); | 200 DISALLOW_COPY_AND_ASSIGN(ChromeFrameLaunchParams); |
208 }; | 201 }; |
209 | 202 |
210 // Callback when chrome process launch is complete and automation handshake | 203 // Callback when chrome process launch is complete and automation handshake |
211 // (Hello message) is established. All methods are invoked on the automation | 204 // (Hello message) is established. All methods are invoked on the automation |
212 // proxy's worker thread. | 205 // proxy's worker thread. |
213 struct DECLSPEC_NOVTABLE LaunchDelegate { // NOLINT | 206 struct DECLSPEC_NOVTABLE LaunchDelegate { // NOLINT |
214 virtual void LaunchComplete(ChromeFrameAutomationProxy* proxy, | 207 virtual void LaunchComplete(ChromeFrameAutomationProxy* proxy, |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 void PrintTab(); | 364 void PrintTab(); |
372 | 365 |
373 void set_use_chrome_network(bool use_chrome_network) { | 366 void set_use_chrome_network(bool use_chrome_network) { |
374 use_chrome_network_ = use_chrome_network; | 367 use_chrome_network_ = use_chrome_network; |
375 } | 368 } |
376 | 369 |
377 bool use_chrome_network() const { | 370 bool use_chrome_network() const { |
378 return use_chrome_network_; | 371 return use_chrome_network_; |
379 } | 372 } |
380 | 373 |
381 bool send_shutdown_delay_switch() const { | |
382 return send_shutdown_delay_switch_; | |
383 } | |
384 | |
385 #ifdef UNIT_TEST | 374 #ifdef UNIT_TEST |
386 void set_proxy_factory(ProxyFactory* factory) { | 375 void set_proxy_factory(ProxyFactory* factory) { |
387 proxy_factory_ = factory; | 376 proxy_factory_ = factory; |
388 } | 377 } |
389 #endif | 378 #endif |
390 | 379 |
391 void set_handle_top_level_requests(bool handle_top_level_requests) { | 380 void set_handle_top_level_requests(bool handle_top_level_requests) { |
392 handle_top_level_requests_ = handle_top_level_requests; | 381 handle_top_level_requests_ = handle_top_level_requests; |
393 } | 382 } |
394 | 383 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 421 |
433 virtual void OnFinalMessage(HWND wnd) { | 422 virtual void OnFinalMessage(HWND wnd) { |
434 Release(); | 423 Release(); |
435 } | 424 } |
436 | 425 |
437 scoped_refptr<ChromeFrameLaunchParams> launch_params() { | 426 scoped_refptr<ChromeFrameLaunchParams> launch_params() { |
438 return chrome_launch_params_; | 427 return chrome_launch_params_; |
439 } | 428 } |
440 | 429 |
441 private: | 430 private: |
442 void InitializeFieldTrials(); | |
443 | |
444 void OnMessageReceivedUIThread(const IPC::Message& msg); | 431 void OnMessageReceivedUIThread(const IPC::Message& msg); |
445 void OnChannelErrorUIThread(); | 432 void OnChannelErrorUIThread(); |
446 | 433 |
447 HWND chrome_window() const { return chrome_window_; } | 434 HWND chrome_window() const { return chrome_window_; } |
448 void BeginNavigate(); | 435 void BeginNavigate(); |
449 void BeginNavigateCompleted(AutomationMsg_NavigationResponseValues result); | 436 void BeginNavigateCompleted(AutomationMsg_NavigationResponseValues result); |
450 | 437 |
451 // Helpers | 438 // Helpers |
452 void ReportNavigationError(AutomationMsg_NavigationResponseValues error_code, | 439 void ReportNavigationError(AutomationMsg_NavigationResponseValues error_code, |
453 const std::string& url); | 440 const std::string& url); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 // When host network stack is used, this object is in charge of | 505 // When host network stack is used, this object is in charge of |
519 // handling network requests. | 506 // handling network requests. |
520 PluginUrlRequestManager* url_fetcher_; | 507 PluginUrlRequestManager* url_fetcher_; |
521 PluginUrlRequestManager::ThreadSafeFlags url_fetcher_flags_; | 508 PluginUrlRequestManager::ThreadSafeFlags url_fetcher_flags_; |
522 | 509 |
523 // set to true if the host needs to get notified of all top level navigations | 510 // set to true if the host needs to get notified of all top level navigations |
524 // in this page. This typically applies to hosts which would render the new | 511 // in this page. This typically applies to hosts which would render the new |
525 // page without chrome frame. Defaults to false. | 512 // page without chrome frame. Defaults to false. |
526 bool route_all_top_level_navigations_; | 513 bool route_all_top_level_navigations_; |
527 | 514 |
528 // Set to true if Chrome Frame should tell Chrome to delay shutdown after | |
529 // we break a connection. Currently used only as part of a field trial. | |
530 bool send_shutdown_delay_switch_; | |
531 | |
532 friend class BeginNavigateContext; | 515 friend class BeginNavigateContext; |
533 friend class CreateExternalTabContext; | 516 friend class CreateExternalTabContext; |
534 }; | 517 }; |
535 | 518 |
536 #endif // CHROME_FRAME_CHROME_FRAME_AUTOMATION_H_ | 519 #endif // CHROME_FRAME_CHROME_FRAME_AUTOMATION_H_ |
OLD | NEW |