Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2359)

Unified Diff: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc

Issue 2362033002: Showing previews UI for Offline Previews (Closed)
Patch Set: megjablon comments rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
diff --git a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
index 97cb50e63cb009c469b17f04e21d99a5de1ca62e..2d02ccee5a51171e2df5eaba65289b6b90fef414 100644
--- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
@@ -40,20 +40,21 @@
#include "chrome/browser/signin/chrome_signin_helper.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/login/login_handler.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/features.h"
#include "chrome/common/url_constants.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h"
#include "components/google/core/browser/google_util.h"
+#include "components/offline_pages/loaded_offline_page_info.h"
#include "components/policy/core/common/cloud/policy_header_io_helper.h"
#include "components/rappor/rappor_utils.h"
#include "components/search_engines/template_url_service.h"
#include "components/variations/net/variations_http_headers.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_data.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/browser/plugin_service_filter.h"
#include "content/public/browser/render_frame_host.h"
@@ -820,33 +821,37 @@ bool ChromeResourceDispatcherHostDelegate::ShouldEnableLoFiMode(
// static
void ChromeResourceDispatcherHostDelegate::
SetExternalProtocolHandlerDelegateForTesting(
ExternalProtocolHandler::Delegate* delegate) {
g_external_protocol_handler_delegate = delegate;
}
content::NavigationData*
ChromeResourceDispatcherHostDelegate::GetNavigationData(
net::URLRequest* request) const {
+ if (!request)
+ return nullptr;
ChromeNavigationData* data =
ChromeNavigationData::GetDataAndCreateIfNecessary(request);
- if (!request)
- return data;
+ // DeepCopy DataReductionProxyData and LoadedOfflinePageInfo from |request| to
+ // prevent. This copy will be shortlived as it will be deep copied again
+ // when content makes a clone of NavigationData for the UI thread.
data_reduction_proxy::DataReductionProxyData* data_reduction_proxy_data =
data_reduction_proxy::DataReductionProxyData::GetData(*request);
- // DeepCopy the DataReductionProxyData from the URLRequest to prevent the
- // URLRequest and DataReductionProxyData from both having ownership of the
- // same object. This copy will be shortlived as it will be deep copied again
- // when content makes a clone of NavigationData for the UI thread.
if (data_reduction_proxy_data)
data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy());
+ offline_pages::LoadedOfflinePageInfo* loaded_offline_page_info =
+ offline_pages::LoadedOfflinePageInfo::GetInfo(*request);
+ if (loaded_offline_page_info)
+ data->SetLoadedOfflinePageInfo(loaded_offline_page_info->DeepCopy());
+
return data;
}
std::unique_ptr<net::ClientCertStore>
ChromeResourceDispatcherHostDelegate::CreateClientCertStore(
content::ResourceContext* resource_context) {
return ProfileIOData::FromResourceContext(resource_context)->
CreateClientCertStore();
}

Powered by Google App Engine
This is Rietveld 408576698