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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp

Issue 2845963002: [ServiceWorker] Add type attribute into Client object (Closed)
Patch Set: layout tests Created 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "modules/serviceworkers/ServiceWorkerClient.h" 5 #include "modules/serviceworkers/ServiceWorkerClient.h"
6 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" 6 #include "modules/serviceworkers/ServiceWorkerWindowClient.h"
7 7
8 #include <memory> 8 #include <memory>
9 #include "bindings/core/v8/CallbackPromiseAdapter.h" 9 #include "bindings/core/v8/CallbackPromiseAdapter.h"
10 #include "bindings/core/v8/ExceptionState.h" 10 #include "bindings/core/v8/ExceptionState.h"
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 ServiceWorkerClient* ServiceWorkerClient::Create( 40 ServiceWorkerClient* ServiceWorkerClient::Create(
41 const WebServiceWorkerClientInfo& info) { 41 const WebServiceWorkerClientInfo& info) {
42 return new ServiceWorkerClient(info); 42 return new ServiceWorkerClient(info);
43 } 43 }
44 44
45 ServiceWorkerClient::ServiceWorkerClient(const WebServiceWorkerClientInfo& info) 45 ServiceWorkerClient::ServiceWorkerClient(const WebServiceWorkerClientInfo& info)
46 : uuid_(info.uuid), 46 : uuid_(info.uuid),
47 url_(info.url.GetString()), 47 url_(info.url.GetString()),
48 type_(info.client_type),
48 frame_type_(info.frame_type) {} 49 frame_type_(info.frame_type) {}
49 50
50 ServiceWorkerClient::~ServiceWorkerClient() {} 51 ServiceWorkerClient::~ServiceWorkerClient() {}
51 52
53 String ServiceWorkerClient::type() const {
54 switch (type_) {
55 case kWebServiceWorkerClientTypeWindow:
56 return "window";
57 case kWebServiceWorkerClientTypeWorker:
58 return "worker";
59 case kWebServiceWorkerClientTypeSharedWorker:
60 return "sharedworker";
61 case kWebServiceWorkerClientTypeLast:
shimazu 2017/05/01 06:40:35 I prefer kWebServiceWorkerClientTypeAll to Last to
leonhsl(Using Gerrit) 2017/05/02 03:14:35 Done.
62 NOTREACHED();
63 return String();
64 }
65
66 NOTREACHED();
67 return String();
68 }
69
52 String ServiceWorkerClient::frameType() const { 70 String ServiceWorkerClient::frameType() const {
53 switch (frame_type_) { 71 switch (frame_type_) {
54 case WebURLRequest::kFrameTypeAuxiliary: 72 case WebURLRequest::kFrameTypeAuxiliary:
55 return "auxiliary"; 73 return "auxiliary";
56 case WebURLRequest::kFrameTypeNested: 74 case WebURLRequest::kFrameTypeNested:
57 return "nested"; 75 return "nested";
58 case WebURLRequest::kFrameTypeNone: 76 case WebURLRequest::kFrameTypeNone:
59 return "none"; 77 return "none";
60 case WebURLRequest::kFrameTypeTopLevel: 78 case WebURLRequest::kFrameTypeTopLevel:
61 return "top-level"; 79 return "top-level";
(...skipping 15 matching lines...) Expand all
77 return; 95 return;
78 96
79 WebString message_string = message->ToWireString(); 97 WebString message_string = message->ToWireString();
80 WebMessagePortChannelArray web_channels = 98 WebMessagePortChannelArray web_channels =
81 MessagePort::ToWebMessagePortChannelArray(std::move(channels)); 99 MessagePort::ToWebMessagePortChannelArray(std::move(channels));
82 ServiceWorkerGlobalScopeClient::From(context)->PostMessageToClient( 100 ServiceWorkerGlobalScopeClient::From(context)->PostMessageToClient(
83 uuid_, message_string, std::move(web_channels)); 101 uuid_, message_string, std::move(web_channels));
84 } 102 }
85 103
86 } // namespace blink 104 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698