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 : page_visibility_state(blink::WebPageVisibilityStateLast), | 13 : ServiceWorkerClientInfo(std::string(), |
14 is_focused(false), | 14 blink::WebPageVisibilityStateLast, |
15 frame_type(REQUEST_CONTEXT_FRAME_TYPE_LAST), | 15 false, |
16 client_type(blink::WebServiceWorkerClientTypeLast), | 16 GURL(), |
17 last_focus_time(base::TimeTicks()) {} | 17 REQUEST_CONTEXT_FRAME_TYPE_LAST, |
| 18 base::TimeTicks(), |
| 19 blink::WebServiceWorkerClientTypeLast) {} |
18 | 20 |
19 ServiceWorkerClientInfo::ServiceWorkerClientInfo( | 21 ServiceWorkerClientInfo::ServiceWorkerClientInfo( |
| 22 const std::string& client_uuid, |
20 blink::WebPageVisibilityState page_visibility_state, | 23 blink::WebPageVisibilityState page_visibility_state, |
21 bool is_focused, | 24 bool is_focused, |
22 const GURL& url, | 25 const GURL& url, |
23 RequestContextFrameType frame_type, | 26 RequestContextFrameType frame_type, |
24 base::TimeTicks last_focus_time, | 27 base::TimeTicks last_focus_time, |
25 blink::WebServiceWorkerClientType client_type) | 28 blink::WebServiceWorkerClientType client_type) |
26 : page_visibility_state(page_visibility_state), | 29 : client_uuid(client_uuid), |
| 30 page_visibility_state(page_visibility_state), |
27 is_focused(is_focused), | 31 is_focused(is_focused), |
28 url(url), | 32 url(url), |
29 frame_type(frame_type), | 33 frame_type(frame_type), |
30 client_type(client_type), | 34 last_focus_time(last_focus_time), |
31 last_focus_time(last_focus_time) {} | 35 client_type(client_type) {} |
32 | 36 |
33 bool ServiceWorkerClientInfo::IsEmpty() const { | 37 bool ServiceWorkerClientInfo::IsEmpty() const { |
34 return page_visibility_state == blink::WebPageVisibilityStateLast && | 38 return page_visibility_state == blink::WebPageVisibilityStateLast && |
35 is_focused == false && | 39 is_focused == false && |
36 url.is_empty() && | 40 url.is_empty() && |
37 frame_type == REQUEST_CONTEXT_FRAME_TYPE_LAST && | 41 frame_type == REQUEST_CONTEXT_FRAME_TYPE_LAST && |
38 client_type == blink::WebServiceWorkerClientTypeLast; | 42 client_type == blink::WebServiceWorkerClientTypeLast; |
39 } | 43 } |
40 | 44 |
41 bool ServiceWorkerClientInfo::IsValid() const { | 45 bool ServiceWorkerClientInfo::IsValid() const { |
42 return !IsEmpty() && !client_uuid.empty(); | 46 return !IsEmpty() && !client_uuid.empty(); |
43 } | 47 } |
44 | 48 |
45 } // namespace content | 49 } // namespace content |
OLD | NEW |