| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 AppendChromeSyncGaiaHeader(request, resource_context); | 680 AppendChromeSyncGaiaHeader(request, resource_context); |
| 681 #endif | 681 #endif |
| 682 | 682 |
| 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 |
| 691 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 692 if (io_data->policy_header_helper()) |
| 693 io_data->policy_header_helper()->AddPolicyHeaders(request); |
| 694 #endif |
| 690 } | 695 } |
| 691 | 696 |
| 692 // Notification that a request has completed. | 697 // Notification that a request has completed. |
| 693 void ChromeResourceDispatcherHostDelegate::RequestComplete( | 698 void ChromeResourceDispatcherHostDelegate::RequestComplete( |
| 694 net::URLRequest* url_request) { | 699 net::URLRequest* url_request) { |
| 695 // 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. |
| 696 const ResourceRequestInfo* info = | 701 const ResourceRequestInfo* info = |
| 697 ResourceRequestInfo::ForRequest(url_request); | 702 ResourceRequestInfo::ForRequest(url_request); |
| 698 if (url_request && !url_request->was_cached()) { | 703 if (url_request && !url_request->was_cached()) { |
| 699 BrowserThread::PostTask(BrowserThread::UI, | 704 BrowserThread::PostTask(BrowserThread::UI, |
| 700 FROM_HERE, | 705 FROM_HERE, |
| 701 base::Bind(&UpdatePrerenderNetworkBytesCallback, | 706 base::Bind(&UpdatePrerenderNetworkBytesCallback, |
| 702 info->GetChildID(), | 707 info->GetChildID(), |
| 703 info->GetRouteID(), | 708 info->GetRouteID(), |
| 704 url_request->GetTotalReceivedBytes())); | 709 url_request->GetTotalReceivedBytes())); |
| 705 } | 710 } |
| 706 } | 711 } |
| 707 | 712 |
| 708 // static | 713 // static |
| 709 void ChromeResourceDispatcherHostDelegate:: | 714 void ChromeResourceDispatcherHostDelegate:: |
| 710 SetExternalProtocolHandlerDelegateForTesting( | 715 SetExternalProtocolHandlerDelegateForTesting( |
| 711 ExternalProtocolHandler::Delegate* delegate) { | 716 ExternalProtocolHandler::Delegate* delegate) { |
| 712 g_external_protocol_handler_delegate = delegate; | 717 g_external_protocol_handler_delegate = delegate; |
| 713 } | 718 } |
| OLD | NEW |