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

Side by Side Diff: content/common/service_worker/service_worker_client_info.h

Issue 871013003: Gather the ServiceWorker client information in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rfh_getvisibilitystate
Patch Set: Created 5 years, 11 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_INFO_CLIENT_H_
6 #define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_INFO_CLIENT_H_
7
8 #include "base/macros.h"
9 #include "content/public/common/request_context_frame_type.h"
10 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
11 #include "third_party/WebKit/public/platform/WebServiceWorkerClientsInfo.h"
12 #include "url/gurl.h"
13
14 namespace content {
15
16 // This class holds the information related to a service worker window client.
17 // It is the content/ equivalent of WebServiceWorkerClientInfo.
18 // An instance can be created empty or can be filed with the expected
19 // properties. After its creation, it is not possible to change the properties
20 // of the object, except set the client id once.
21 class ServiceWorkerClientInfo {
22 public:
23 ServiceWorkerClientInfo();
24 ServiceWorkerClientInfo(blink::WebPageVisibilityState page_visibility_state,
25 bool is_focused,
26 const GURL& url,
27 RequestContextFrameType frame_type);
28
29 int client_id() const;
30 blink::WebPageVisibilityState page_visibility_state() const;
31 bool is_focused() const;
32 const GURL& url() const;
33 RequestContextFrameType frame_type() const;
34
35 // Set the client id and finishes the initialization of the object.
36 void SetClientID(int client_id);
37
38 // Returns whether the instance was created empty. An empty instance can't
39 // have properties set to it later.
40 bool IsEmpty() const;
41
42 // Returns whether the instance is valid. A valid instance is not empty and
43 // has a client id.
44 bool IsValid() const;
45
46 operator blink::WebServiceWorkerClientInfo() const;
47
48 private:
49 bool empty_;
50 bool has_client_id_;
51
52 int client_id_;
53 blink::WebPageVisibilityState page_visibility_state_;
54 bool is_focused_;
55 GURL url_;
56 RequestContextFrameType frame_type_;
57 };
58
59 } // namespace content
60
61 #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_INFO_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698