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 "app/app_switches.h" | 7 #include "app/app_switches.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 | 950 |
951 void ChromeFrameAutomationClient::CreateExternalTab() { | 951 void ChromeFrameAutomationClient::CreateExternalTab() { |
952 AutomationLaunchResult launch_result = AUTOMATION_SUCCESS; | 952 AutomationLaunchResult launch_result = AUTOMATION_SUCCESS; |
953 DCHECK(IsWindow()); | 953 DCHECK(IsWindow()); |
954 DCHECK(automation_server_ != NULL); | 954 DCHECK(automation_server_ != NULL); |
955 | 955 |
956 if (chrome_launch_params_->url().is_valid()) { | 956 if (chrome_launch_params_->url().is_valid()) { |
957 navigate_after_initialization_ = false; | 957 navigate_after_initialization_ = false; |
958 } | 958 } |
959 | 959 |
960 const IPC::ExternalTabSettings settings = { | 960 const IPC::ExternalTabSettings settings( |
961 m_hWnd, | 961 m_hWnd, |
962 gfx::Rect(), | 962 gfx::Rect(), |
963 WS_CHILD, | 963 WS_CHILD, |
964 chrome_launch_params_->incognito(), | 964 chrome_launch_params_->incognito(), |
965 !use_chrome_network_, | 965 !use_chrome_network_, |
966 handle_top_level_requests_, | 966 handle_top_level_requests_, |
967 chrome_launch_params_->url(), | 967 chrome_launch_params_->url(), |
968 chrome_launch_params_->referrer(), | 968 chrome_launch_params_->referrer(), |
969 // Infobars disabled in widget mode. | 969 // Infobars disabled in widget mode. |
970 !chrome_launch_params_->widget_mode(), | 970 !chrome_launch_params_->widget_mode(), |
971 chrome_launch_params_->route_all_top_level_navigations(), | 971 chrome_launch_params_->route_all_top_level_navigations()); |
972 }; | |
973 | 972 |
974 THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( | 973 THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( |
975 "ChromeFrame.HostNetworking", !use_chrome_network_, 0, 1, 2); | 974 "ChromeFrame.HostNetworking", !use_chrome_network_, 0, 1, 2); |
976 | 975 |
977 THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( | 976 THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( |
978 "ChromeFrame.HandleTopLevelRequests", handle_top_level_requests_, 0, 1, | 977 "ChromeFrame.HandleTopLevelRequests", handle_top_level_requests_, 0, 1, |
979 2); | 978 2); |
980 | 979 |
981 IPC::SyncMessage* message = | 980 IPC::SyncMessage* message = |
982 new AutomationMsg_CreateExternalTab(0, settings, NULL, NULL, 0, 0); | 981 new AutomationMsg_CreateExternalTab(0, settings, NULL, NULL, 0, 0); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 } | 1438 } |
1440 | 1439 |
1441 ////////////////////////////////////////////////////////////////////////// | 1440 ////////////////////////////////////////////////////////////////////////// |
1442 // PluginUrlRequestDelegate implementation. | 1441 // PluginUrlRequestDelegate implementation. |
1443 // Forward network related responses to Chrome. | 1442 // Forward network related responses to Chrome. |
1444 | 1443 |
1445 void ChromeFrameAutomationClient::OnResponseStarted(int request_id, | 1444 void ChromeFrameAutomationClient::OnResponseStarted(int request_id, |
1446 const char* mime_type, const char* headers, int size, | 1445 const char* mime_type, const char* headers, int size, |
1447 base::Time last_modified, const std::string& redirect_url, | 1446 base::Time last_modified, const std::string& redirect_url, |
1448 int redirect_status) { | 1447 int redirect_status) { |
1449 const IPC::AutomationURLResponse response = { | 1448 const IPC::AutomationURLResponse response( |
1450 mime_type, | 1449 mime_type, |
1451 headers ? headers : "", | 1450 headers ? headers : "", |
1452 size, | 1451 size, |
1453 last_modified, | 1452 last_modified, |
1454 redirect_url, | 1453 redirect_url, |
1455 redirect_status | 1454 redirect_status); |
1456 }; | |
1457 | 1455 |
1458 automation_server_->Send(new AutomationMsg_RequestStarted(0, | 1456 automation_server_->Send(new AutomationMsg_RequestStarted(0, |
1459 tab_->handle(), request_id, response)); | 1457 tab_->handle(), request_id, response)); |
1460 } | 1458 } |
1461 | 1459 |
1462 void ChromeFrameAutomationClient::OnReadComplete(int request_id, | 1460 void ChromeFrameAutomationClient::OnReadComplete(int request_id, |
1463 const std::string& data) { | 1461 const std::string& data) { |
1464 automation_server_->Send(new AutomationMsg_RequestData(0, tab_->handle(), | 1462 automation_server_->Send(new AutomationMsg_RequestData(0, tab_->handle(), |
1465 request_id, data)); | 1463 request_id, data)); |
1466 } | 1464 } |
1467 | 1465 |
1468 void ChromeFrameAutomationClient::OnResponseEnd(int request_id, | 1466 void ChromeFrameAutomationClient::OnResponseEnd(int request_id, |
1469 const URLRequestStatus& status) { | 1467 const URLRequestStatus& status) { |
1470 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), | 1468 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), |
1471 request_id, status)); | 1469 request_id, status)); |
1472 } | 1470 } |
1473 | 1471 |
1474 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, | 1472 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, |
1475 const GURL& url, const std::string& cookie_string, int cookie_id) { | 1473 const GURL& url, const std::string& cookie_string, int cookie_id) { |
1476 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, | 1474 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, |
1477 tab_->handle(), success, url, cookie_string, cookie_id)); | 1475 tab_->handle(), success, url, cookie_string, cookie_id)); |
1478 } | 1476 } |
OLD | NEW |