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

Side by Side Diff: third_party/WebKit/Source/modules/mediacapabilities/NavigatorMediaCapabilities.cpp

Issue 2685863004: Media Capabilities: stub implementation of mediaCapabilities.query(). (Closed)
Patch Set: rebase Created 3 years, 10 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 2017 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 #include "modules/mediacapabilities/NavigatorMediaCapabilities.h"
6
7 #include "modules/mediacapabilities/MediaCapabilities.h"
8 #include "platform/Supplementable.h"
9
10 namespace blink {
11
12 MediaCapabilities* NavigatorMediaCapabilities::mediaCapabilities(
13 Navigator& navigator) {
14 NavigatorMediaCapabilities& self =
15 NavigatorMediaCapabilities::from(navigator);
16 if (!self.m_capabilities)
17 self.m_capabilities = new MediaCapabilities();
18 return self.m_capabilities.get();
19 }
20
21 DEFINE_TRACE(NavigatorMediaCapabilities) {
22 visitor->trace(m_capabilities);
23 Supplement<Navigator>::trace(visitor);
24 }
25
26 NavigatorMediaCapabilities::NavigatorMediaCapabilities(Navigator& navigator)
27 : Supplement<Navigator>(navigator) {}
28
29 NavigatorMediaCapabilities& NavigatorMediaCapabilities::from(
30 Navigator& navigator) {
31 NavigatorMediaCapabilities* supplement =
32 static_cast<NavigatorMediaCapabilities*>(
33 Supplement<Navigator>::from(navigator, supplementName()));
34 if (!supplement) {
35 supplement = new NavigatorMediaCapabilities(navigator);
36 provideTo(navigator, supplementName(), supplement);
37 }
38 return *supplement;
39 }
40
41 const char* NavigatorMediaCapabilities::supplementName() {
42 return "NavigatorMediaCapabilities";
43 }
44
45 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698