| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome_frame/chrome_frame_automation.h" | 5 #include "chrome_frame/chrome_frame_automation.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/trace_event.h" | 10 #include "base/trace_event.h" |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 automation_server_id_(NULL), | 558 automation_server_id_(NULL), |
| 559 ui_thread_id_(NULL), | 559 ui_thread_id_(NULL), |
| 560 init_state_(UNINITIALIZED), | 560 init_state_(UNINITIALIZED), |
| 561 use_chrome_network_(false), | 561 use_chrome_network_(false), |
| 562 proxy_factory_(g_proxy_factory.get()), | 562 proxy_factory_(g_proxy_factory.get()), |
| 563 handle_top_level_requests_(false), | 563 handle_top_level_requests_(false), |
| 564 tab_handle_(-1), | 564 tab_handle_(-1), |
| 565 external_tab_cookie_(0), | 565 external_tab_cookie_(0), |
| 566 url_fetcher_(NULL), | 566 url_fetcher_(NULL), |
| 567 url_fetcher_flags_(PluginUrlRequestManager::NOT_THREADSAFE), | 567 url_fetcher_flags_(PluginUrlRequestManager::NOT_THREADSAFE), |
| 568 navigate_after_initialization_(false) { | 568 navigate_after_initialization_(false), |
| 569 route_all_top_level_navigations_(false) { |
| 569 } | 570 } |
| 570 | 571 |
| 571 ChromeFrameAutomationClient::~ChromeFrameAutomationClient() { | 572 ChromeFrameAutomationClient::~ChromeFrameAutomationClient() { |
| 572 // Uninitialize must be called prior to the destructor | 573 // Uninitialize must be called prior to the destructor |
| 573 DCHECK(automation_server_ == NULL); | 574 DCHECK(automation_server_ == NULL); |
| 574 } | 575 } |
| 575 | 576 |
| 576 bool ChromeFrameAutomationClient::Initialize( | 577 bool ChromeFrameAutomationClient::Initialize( |
| 577 ChromeFrameDelegate* chrome_frame_delegate, | 578 ChromeFrameDelegate* chrome_frame_delegate, |
| 578 ChromeFrameLaunchParams* chrome_launch_params) { | 579 ChromeFrameLaunchParams* chrome_launch_params) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 parsed_url != chrome_launch_params_->url()) { | 713 parsed_url != chrome_launch_params_->url()) { |
| 713 // Important: Since we will be using the referrer_ variable from a | 714 // Important: Since we will be using the referrer_ variable from a |
| 714 // different thread, we need to force a new std::string buffer instance for | 715 // different thread, we need to force a new std::string buffer instance for |
| 715 // the referrer_ GURL variable. Otherwise we can run into strangeness when | 716 // the referrer_ GURL variable. Otherwise we can run into strangeness when |
| 716 // the GURL is accessed and it could result in a bad URL that can cause the | 717 // the GURL is accessed and it could result in a bad URL that can cause the |
| 717 // referrer to be dropped or something worse. | 718 // referrer to be dropped or something worse. |
| 718 GURL referrer_gurl(referrer.c_str()); | 719 GURL referrer_gurl(referrer.c_str()); |
| 719 if (!chrome_launch_params_) { | 720 if (!chrome_launch_params_) { |
| 720 FilePath profile_path; | 721 FilePath profile_path; |
| 721 chrome_launch_params_ = new ChromeFrameLaunchParams(parsed_url, | 722 chrome_launch_params_ = new ChromeFrameLaunchParams(parsed_url, |
| 722 referrer_gurl, profile_path, L"", L"", false, false); | 723 referrer_gurl, profile_path, L"", L"", false, false, |
| 724 route_all_top_level_navigations_); |
| 723 } else { | 725 } else { |
| 724 chrome_launch_params_->set_referrer(referrer_gurl); | 726 chrome_launch_params_->set_referrer(referrer_gurl); |
| 725 chrome_launch_params_->set_url(parsed_url); | 727 chrome_launch_params_->set_url(parsed_url); |
| 726 } | 728 } |
| 727 | 729 |
| 728 navigate_after_initialization_ = false; | 730 navigate_after_initialization_ = false; |
| 729 | 731 |
| 730 if (is_initialized()) { | 732 if (is_initialized()) { |
| 731 BeginNavigate(); | 733 BeginNavigate(); |
| 732 } else { | 734 } else { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 | 932 |
| 931 const IPC::ExternalTabSettings settings = { | 933 const IPC::ExternalTabSettings settings = { |
| 932 m_hWnd, | 934 m_hWnd, |
| 933 gfx::Rect(), | 935 gfx::Rect(), |
| 934 WS_CHILD, | 936 WS_CHILD, |
| 935 chrome_launch_params_->incognito(), | 937 chrome_launch_params_->incognito(), |
| 936 !use_chrome_network_, | 938 !use_chrome_network_, |
| 937 handle_top_level_requests_, | 939 handle_top_level_requests_, |
| 938 chrome_launch_params_->url(), | 940 chrome_launch_params_->url(), |
| 939 chrome_launch_params_->referrer(), | 941 chrome_launch_params_->referrer(), |
| 940 !chrome_launch_params_->widget_mode() // Infobars disabled in widget mode. | 942 // Infobars disabled in widget mode. |
| 943 !chrome_launch_params_->widget_mode(), |
| 944 chrome_launch_params_->route_all_top_level_navigations(), |
| 941 }; | 945 }; |
| 942 | 946 |
| 943 THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( | 947 THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 944 "ChromeFrame.HostNetworking", !use_chrome_network_, 0, 1, 2); | 948 "ChromeFrame.HostNetworking", !use_chrome_network_, 0, 1, 2); |
| 945 | 949 |
| 946 THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( | 950 THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 947 "ChromeFrame.HandleTopLevelRequests", handle_top_level_requests_, 0, 1, | 951 "ChromeFrame.HandleTopLevelRequests", handle_top_level_requests_, 0, 1, |
| 948 2); | 952 2); |
| 949 | 953 |
| 950 IPC::SyncMessage* message = | 954 IPC::SyncMessage* message = |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 const URLRequestStatus& status) { | 1441 const URLRequestStatus& status) { |
| 1438 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), | 1442 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), |
| 1439 request_id, status)); | 1443 request_id, status)); |
| 1440 } | 1444 } |
| 1441 | 1445 |
| 1442 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, | 1446 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, |
| 1443 const GURL& url, const std::string& cookie_string, int cookie_id) { | 1447 const GURL& url, const std::string& cookie_string, int cookie_id) { |
| 1444 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, | 1448 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, |
| 1445 tab_->handle(), success, url, cookie_string, cookie_id)); | 1449 tab_->handle(), success, url, cookie_string, cookie_id)); |
| 1446 } | 1450 } |
| OLD | NEW |