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

Side by Side Diff: Source/modules/presentation/PresentationAvailability.cpp

Issue 1290693003: Presentation API: add UMA. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 4 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 "config.h" 5 #include "config.h"
6 #include "modules/presentation/PresentationAvailability.h" 6 #include "modules/presentation/PresentationAvailability.h"
7 7
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/events/Event.h" 10 #include "core/events/Event.h"
11 #include "core/frame/UseCounter.h"
11 #include "modules/EventTargetModulesNames.h" 12 #include "modules/EventTargetModulesNames.h"
12 #include "modules/presentation/PresentationController.h" 13 #include "modules/presentation/PresentationController.h"
13 #include "public/platform/Platform.h" 14 #include "public/platform/Platform.h"
14 #include "public/platform/modules/presentation/WebPresentationClient.h" 15 #include "public/platform/modules/presentation/WebPresentationClient.h"
15 16
16 namespace blink { 17 namespace blink {
17 18
18 namespace { 19 namespace {
19 20
20 WebPresentationClient* presentationClient(ExecutionContext* executionContext) 21 WebPresentationClient* presentationClient(ExecutionContext* executionContext)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 const AtomicString& PresentationAvailability::interfaceName() const 57 const AtomicString& PresentationAvailability::interfaceName() const
57 { 58 {
58 return EventTargetNames::PresentationAvailability; 59 return EventTargetNames::PresentationAvailability;
59 } 60 }
60 61
61 ExecutionContext* PresentationAvailability::executionContext() const 62 ExecutionContext* PresentationAvailability::executionContext() const
62 { 63 {
63 return ActiveDOMObject::executionContext(); 64 return ActiveDOMObject::executionContext();
64 } 65 }
65 66
67 bool PresentationAvailability::addEventListener(const AtomicString& eventType, P assRefPtrWillBeRawPtr<EventListener> listener, bool capture)
68 {
69 if (eventType == EventTypeNames::change)
70 UseCounter::count(executionContext(), UseCounter::PresentationAvailabili tyChangeEventListener);
71
72 return EventTarget::addEventListener(eventType, listener, capture);
73 }
74
66 void PresentationAvailability::availabilityChanged(bool value) 75 void PresentationAvailability::availabilityChanged(bool value)
67 { 76 {
68 if (m_value == value) 77 if (m_value == value)
69 return; 78 return;
70 79
71 m_value = value; 80 m_value = value;
72 dispatchEvent(Event::create(EventTypeNames::change)); 81 dispatchEvent(Event::create(EventTypeNames::change));
73 } 82 }
74 83
75 bool PresentationAvailability::hasPendingActivity() const 84 bool PresentationAvailability::hasPendingActivity() const
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 135 }
127 136
128 DEFINE_TRACE(PresentationAvailability) 137 DEFINE_TRACE(PresentationAvailability)
129 { 138 {
130 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationAvailability >::trace(visitor); 139 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationAvailability >::trace(visitor);
131 PageLifecycleObserver::trace(visitor); 140 PageLifecycleObserver::trace(visitor);
132 ActiveDOMObject::trace(visitor); 141 ActiveDOMObject::trace(visitor);
133 } 142 }
134 143
135 } // namespace 144 } // namespace
OLDNEW
« no previous file with comments | « Source/modules/presentation/PresentationAvailability.h ('k') | Source/modules/presentation/PresentationRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698