| 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 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" | 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 &headers); | 380 &headers); |
| 381 request->SetExtraRequestHeaders(headers); | 381 request->SetExtraRequestHeaders(headers); |
| 382 } | 382 } |
| 383 | 383 |
| 384 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 384 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 385 AppendChromeSyncGaiaHeader(request, resource_context); | 385 AppendChromeSyncGaiaHeader(request, resource_context); |
| 386 #endif | 386 #endif |
| 387 | 387 |
| 388 #if defined(ENABLE_CONFIGURATION_POLICY) | 388 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 389 if (io_data->policy_header_helper()) | 389 if (io_data->policy_header_helper()) |
| 390 io_data->policy_header_helper()->AddPolicyHeaders(request); | 390 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request); |
| 391 #endif | 391 #endif |
| 392 | 392 |
| 393 signin::AppendMirrorRequestHeaderIfPossible( | 393 signin::AppendMirrorRequestHeaderIfPossible( |
| 394 request, GURL() /* redirect_url */, | 394 request, GURL() /* redirect_url */, |
| 395 io_data, info->GetChildID(), info->GetRouteID()); | 395 io_data, info->GetChildID(), info->GetRouteID()); |
| 396 | 396 |
| 397 AppendStandardResourceThrottles(request, | 397 AppendStandardResourceThrottles(request, |
| 398 resource_context, | 398 resource_context, |
| 399 resource_type, | 399 resource_type, |
| 400 throttles); | 400 throttles); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 // In the Mirror world, Chrome should append a X-Chrome-Connected header to | 683 // In the Mirror world, Chrome should append a X-Chrome-Connected header to |
| 684 // all Gaia requests from a connected profile so Gaia could return a 204 | 684 // all Gaia requests from a connected profile so Gaia could return a 204 |
| 685 // response and let Chrome handle the action with native UI. The only | 685 // response and let Chrome handle the action with native UI. The only |
| 686 // exception is requests from gaia webview, since the native profile | 686 // exception is requests from gaia webview, since the native profile |
| 687 // management UI is built on top of it. | 687 // management UI is built on top of it. |
| 688 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, | 688 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, |
| 689 info->GetChildID(), info->GetRouteID()); | 689 info->GetChildID(), info->GetRouteID()); |
| 690 | 690 |
| 691 #if defined(ENABLE_CONFIGURATION_POLICY) | 691 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 692 if (io_data->policy_header_helper()) | 692 if (io_data->policy_header_helper()) |
| 693 io_data->policy_header_helper()->AddPolicyHeaders(request); | 693 io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request); |
| 694 #endif | 694 #endif |
| 695 } | 695 } |
| 696 | 696 |
| 697 // Notification that a request has completed. | 697 // Notification that a request has completed. |
| 698 void ChromeResourceDispatcherHostDelegate::RequestComplete( | 698 void ChromeResourceDispatcherHostDelegate::RequestComplete( |
| 699 net::URLRequest* url_request) { | 699 net::URLRequest* url_request) { |
| 700 // Jump on the UI thread and inform the prerender about the bytes. | 700 // Jump on the UI thread and inform the prerender about the bytes. |
| 701 const ResourceRequestInfo* info = | 701 const ResourceRequestInfo* info = |
| 702 ResourceRequestInfo::ForRequest(url_request); | 702 ResourceRequestInfo::ForRequest(url_request); |
| 703 if (url_request && !url_request->was_cached()) { | 703 if (url_request && !url_request->was_cached()) { |
| 704 BrowserThread::PostTask(BrowserThread::UI, | 704 BrowserThread::PostTask(BrowserThread::UI, |
| 705 FROM_HERE, | 705 FROM_HERE, |
| 706 base::Bind(&UpdatePrerenderNetworkBytesCallback, | 706 base::Bind(&UpdatePrerenderNetworkBytesCallback, |
| 707 info->GetChildID(), | 707 info->GetChildID(), |
| 708 info->GetRouteID(), | 708 info->GetRouteID(), |
| 709 url_request->GetTotalReceivedBytes())); | 709 url_request->GetTotalReceivedBytes())); |
| 710 } | 710 } |
| 711 } | 711 } |
| 712 | 712 |
| 713 // static | 713 // static |
| 714 void ChromeResourceDispatcherHostDelegate:: | 714 void ChromeResourceDispatcherHostDelegate:: |
| 715 SetExternalProtocolHandlerDelegateForTesting( | 715 SetExternalProtocolHandlerDelegateForTesting( |
| 716 ExternalProtocolHandler::Delegate* delegate) { | 716 ExternalProtocolHandler::Delegate* delegate) { |
| 717 g_external_protocol_handler_delegate = delegate; | 717 g_external_protocol_handler_delegate = delegate; |
| 718 } | 718 } |
| OLD | NEW |