OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/common/service_worker/service_worker_client_info.h" | 5 #include "content/common/service_worker/service_worker_client_info.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/common/service_worker/service_worker_types.h" | 8 #include "content/common/service_worker/service_worker_types.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 ServiceWorkerClientInfo::ServiceWorkerClientInfo() | 12 ServiceWorkerClientInfo::ServiceWorkerClientInfo() |
13 : client_id(kInvalidServiceWorkerClientId), | 13 : page_visibility_state(blink::WebPageVisibilityStateLast), |
14 page_visibility_state(blink::WebPageVisibilityStateLast), | |
15 is_focused(false), | 14 is_focused(false), |
16 frame_type(REQUEST_CONTEXT_FRAME_TYPE_LAST), | 15 frame_type(REQUEST_CONTEXT_FRAME_TYPE_LAST), |
17 client_type(blink::WebServiceWorkerClientTypeLast) { | 16 client_type(blink::WebServiceWorkerClientTypeLast) { |
18 } | 17 } |
19 | 18 |
20 ServiceWorkerClientInfo::ServiceWorkerClientInfo( | 19 ServiceWorkerClientInfo::ServiceWorkerClientInfo( |
21 blink::WebPageVisibilityState page_visibility_state, | 20 blink::WebPageVisibilityState page_visibility_state, |
22 bool is_focused, | 21 bool is_focused, |
23 const GURL& url, | 22 const GURL& url, |
24 RequestContextFrameType frame_type, | 23 RequestContextFrameType frame_type, |
25 blink::WebServiceWorkerClientType client_type) | 24 blink::WebServiceWorkerClientType client_type) |
26 : client_id(kInvalidServiceWorkerClientId), | 25 : page_visibility_state(page_visibility_state), |
27 page_visibility_state(page_visibility_state), | |
28 is_focused(is_focused), | 26 is_focused(is_focused), |
29 url(url), | 27 url(url), |
30 frame_type(frame_type), | 28 frame_type(frame_type), |
31 client_type(client_type) { | 29 client_type(client_type) { |
32 } | 30 } |
33 | 31 |
34 bool ServiceWorkerClientInfo::IsEmpty() const { | 32 bool ServiceWorkerClientInfo::IsEmpty() const { |
35 return page_visibility_state == blink::WebPageVisibilityStateLast && | 33 return page_visibility_state == blink::WebPageVisibilityStateLast && |
36 is_focused == false && | 34 is_focused == false && |
37 url.is_empty() && | 35 url.is_empty() && |
38 frame_type == REQUEST_CONTEXT_FRAME_TYPE_LAST && | 36 frame_type == REQUEST_CONTEXT_FRAME_TYPE_LAST && |
39 client_type == blink::WebServiceWorkerClientTypeLast; | 37 client_type == blink::WebServiceWorkerClientTypeLast; |
40 } | 38 } |
41 | 39 |
42 bool ServiceWorkerClientInfo::IsValid() const { | 40 bool ServiceWorkerClientInfo::IsValid() const { |
43 return !IsEmpty() && client_id != kInvalidServiceWorkerClientId; | 41 return !IsEmpty() && !client_uuid.empty(); |
44 } | 42 } |
45 | 43 |
46 } // namespace content | 44 } // namespace content |
OLD | NEW |