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

Unified Diff: content/renderer/cache_storage/cache_storage_dispatcher.cc

Issue 1108273002: Add Client Attribute to FetchEvent- Chromium Side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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: content/renderer/cache_storage/cache_storage_dispatcher.cc
diff --git a/content/renderer/cache_storage/cache_storage_dispatcher.cc b/content/renderer/cache_storage/cache_storage_dispatcher.cc
index da40cbf1ff861132a7c25a95eca5955eed1311c2..2de6603a47537c191dfeb54ae46bcdb9860c2502 100644
--- a/content/renderer/cache_storage/cache_storage_dispatcher.cc
+++ b/content/renderer/cache_storage/cache_storage_dispatcher.cc
@@ -15,10 +15,13 @@
#include "base/threading/thread_local.h"
#include "content/child/thread_safe_sender.h"
#include "content/common/cache_storage/cache_storage_messages.h"
+#include "content/common/service_worker/service_worker_client_info.h"
#include "content/public/common/referrer.h"
+#include "content/public/common/request_context_frame_type.h"
#include "content/public/renderer/render_thread.h"
#include "content/renderer/service_worker/service_worker_type_util.h"
#include "third_party/WebKit/public/platform/WebServiceWorkerCache.h"
+#include "third_party/WebKit/public/platform/WebServiceWorkerClientsInfo.h"
#include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h"
#include "third_party/WebKit/public/platform/WebServiceWorkerResponse.h"
@@ -38,6 +41,21 @@ namespace {
CacheStorageDispatcher* const kHasBeenDeleted =
reinterpret_cast<CacheStorageDispatcher*>(0x1);
+ServiceWorkerClientInfo ClientInfoFromWebClientInfo(
+ const blink::WebServiceWorkerClientInfo& web_client_info) {
+ ServiceWorkerClientInfo client_info;
+
+ client_info.client_uuid = base::UTF16ToUTF8(web_client_info.uuid);
+ client_info.page_visibility_state = web_client_info.pageVisibilityState;
+ client_info.is_focused = web_client_info.isFocused;
+ client_info.url = web_client_info.url;
+ client_info.frame_type =
+ static_cast<RequestContextFrameType>(web_client_info.frameType);
+ client_info.client_type = web_client_info.clientType;
+
+ return client_info;
+}
+
ServiceWorkerFetchRequest FetchRequestFromWebRequest(
const blink::WebServiceWorkerRequest& web_request) {
ServiceWorkerHeaderMap headers;
@@ -46,7 +64,8 @@ ServiceWorkerFetchRequest FetchRequestFromWebRequest(
return ServiceWorkerFetchRequest(
web_request.url(), base::UTF16ToASCII(web_request.method()), headers,
Referrer(web_request.referrerUrl(), web_request.referrerPolicy()),
- web_request.isReload());
+ web_request.isReload(),
+ ClientInfoFromWebClientInfo(web_request.client()));
}
void PopulateWebRequestFromFetchRequest(

Powered by Google App Engine
This is Rietveld 408576698