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

Side by Side Diff: Source/modules/netinfo/NetworkInformation.h

Issue 291203002: Adds NetInfo v3 Web API to Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@netinfo1
Patch Set: Comment typo Created 6 years, 6 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 2014 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 NetworkInformation_h
6 #define NetworkInformation_h
7
8 #include "bindings/v8/ScriptWrappable.h"
9 #include "core/dom/ActiveDOMObject.h"
10 #include "core/events/EventTarget.h"
11 #include "core/page/NetworkStateNotifier.h"
12 #include "public/platform/WebConnectionType.h"
13
14 namespace WebCore {
15
16 class ExecutionContext;
17
18 class NetworkInformation FINAL
19 : public RefCountedWillBeRefCountedGarbageCollected<NetworkInformation>
20 , public ScriptWrappable
21 , public ActiveDOMObject
22 , public EventTargetWithInlineData
23 , public NetworkStateNotifier::NetworkStateObserver {
24 REFCOUNTED_EVENT_TARGET(NetworkInformation);
25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NetworkInformation);
26
27 public:
28 static PassRefPtrWillBeRawPtr<NetworkInformation> create(ExecutionContext*);
29 virtual ~NetworkInformation();
30
31 String type() const;
32
33 virtual void connectionTypeChange(blink::WebConnectionType) OVERRIDE;
34
35 // EventTarget overrides.
36 virtual const AtomicString& interfaceName() const OVERRIDE;
37 virtual ExecutionContext* executionContext() const OVERRIDE;
38 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) OVERRIDE;
39 virtual bool removeEventListener(const AtomicString& eventType, EventListene r*, bool useCapture = false) OVERRIDE;
40 virtual void removeAllEventListeners() OVERRIDE;
41
42 // ActiveDOMObject overrides.
43 virtual bool hasPendingActivity() const OVERRIDE;
44 virtual void stop() OVERRIDE;
45
46 DEFINE_ATTRIBUTE_EVENT_LISTENER(typechange);
47
48 private:
49 explicit NetworkInformation(ExecutionContext*);
50 void startObserving();
51 void stopObserving();
52
53 // Touched only on context thread.
54 blink::WebConnectionType m_type;
55
56 // Whether this object is listening for events from NetworkStateNotifier.
57 bool m_observing;
58
59 // Whether ActiveDOMObject::stop has been called.
60 bool m_contextStopped;
61 };
62
63 } // namespace WebCore
64
65 #endif // NetworkInformation_h
OLDNEW
« no previous file with comments | « Source/modules/netinfo/NavigatorNetworkInformation.idl ('k') | Source/modules/netinfo/NetworkInformation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698