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