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

Side by Side Diff: third_party/WebKit/Source/web/WebMediaDeviceChangeObserver.cpp

Issue 2883793003: Move detached files from web/ to (core/modules)/exported. (Closed)
Patch Set: Created 3 years, 7 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 2016 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 "public/web/WebMediaDeviceChangeObserver.h"
6
7 #include "core/dom/Document.h"
8 #include "modules/mediastream/MediaDevices.h"
9 #include "platform/weborigin/SecurityOrigin.h"
10 #include "public/platform/WebSecurityOrigin.h"
11
12 namespace blink {
13
14 WebMediaDeviceChangeObserver::WebMediaDeviceChangeObserver()
15 : private_(nullptr) {}
16
17 WebMediaDeviceChangeObserver::WebMediaDeviceChangeObserver(bool unused)
18 : private_(MediaDevices::Create(Document::Create())) {}
19
20 WebMediaDeviceChangeObserver::WebMediaDeviceChangeObserver(
21 const WebMediaDeviceChangeObserver& other) {
22 Assign(other);
23 }
24
25 WebMediaDeviceChangeObserver& WebMediaDeviceChangeObserver::operator=(
26 const WebMediaDeviceChangeObserver& other) {
27 Assign(other);
28 return *this;
29 }
30
31 WebMediaDeviceChangeObserver::WebMediaDeviceChangeObserver(
32 MediaDevices* observer)
33 : private_(observer) {}
34
35 WebMediaDeviceChangeObserver::~WebMediaDeviceChangeObserver() {
36 Reset();
37 }
38
39 bool WebMediaDeviceChangeObserver::IsNull() const {
40 return private_.IsNull();
41 }
42
43 void WebMediaDeviceChangeObserver::DidChangeMediaDevices() {
44 if (private_.IsNull())
45 return;
46
47 private_->DidChangeMediaDevices();
48 }
49
50 WebSecurityOrigin WebMediaDeviceChangeObserver::GetSecurityOrigin() const {
51 if (private_.IsNull())
52 return WebSecurityOrigin();
53
54 return WebSecurityOrigin(
55 private_->GetExecutionContext()->GetSecurityOrigin());
56 }
57
58 void WebMediaDeviceChangeObserver::Assign(
59 const WebMediaDeviceChangeObserver& other) {
60 private_ = other.private_;
61 }
62
63 void WebMediaDeviceChangeObserver::Reset() {
64 private_.Reset();
65 }
66
67 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698