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

Side by Side Diff: device/vr/vr_service_impl.cc

Issue 2783993002: Send vrdisplayactivate to the most recently focused navigator listening for displayactivate. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « device/vr/vr_display_impl.cc ('k') | third_party/WebKit/Source/modules/vr/VRDisplay.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 "device/vr/vr_service_impl.h" 5 #include "device/vr/vr_service_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 DCHECK(displays_.count(device) == 0); 47 DCHECK(displays_.count(device) == 0);
48 base::Callback<void(mojom::VRDisplayInfoPtr)> on_created = 48 base::Callback<void(mojom::VRDisplayInfoPtr)> on_created =
49 base::Bind(&VRServiceImpl::OnVRDisplayInfoCreated, 49 base::Bind(&VRServiceImpl::OnVRDisplayInfoCreated,
50 weak_ptr_factory_.GetWeakPtr(), device); 50 weak_ptr_factory_.GetWeakPtr(), device);
51 device->CreateVRDisplayInfo(on_created); 51 device->CreateVRDisplayInfo(on_created);
52 } 52 }
53 53
54 void VRServiceImpl::SetListeningForActivate(bool listening) { 54 void VRServiceImpl::SetListeningForActivate(bool listening) {
55 listening_for_activate_ = listening; 55 listening_for_activate_ = listening;
56 VRDeviceManager* device_manager = VRDeviceManager::GetInstance(); 56 VRDeviceManager* device_manager = VRDeviceManager::GetInstance();
57 device_manager->ListeningForActivateChanged(listening); 57 device_manager->ListeningForActivateChanged(listening, this);
58 } 58 }
59 59
60 // Creates a VRDisplayPtr unique to this service so that the associated page can 60 // Creates a VRDisplayPtr unique to this service so that the associated page can
61 // communicate with the VRDevice. 61 // communicate with the VRDevice.
62 void VRServiceImpl::OnVRDisplayInfoCreated( 62 void VRServiceImpl::OnVRDisplayInfoCreated(
63 VRDevice* device, 63 VRDevice* device,
64 mojom::VRDisplayInfoPtr display_info) { 64 mojom::VRDisplayInfoPtr display_info) {
65 // TODO(crbug/701027): make sure that client_ is never null by initializing it 65 // TODO(crbug/701027): make sure that client_ is never null by initializing it
66 // in the constructor. 66 // in the constructor.
67 if (!client_) { 67 if (!client_) {
68 DLOG(ERROR) << "Cannot create VR display because connection to render " 68 DLOG(ERROR) << "Cannot create VR display because connection to render "
69 "process is not established"; 69 "process is not established";
70 return; 70 return;
71 } 71 }
72 displays_[device] = base::MakeUnique<VRDisplayImpl>( 72 displays_[device] = base::MakeUnique<VRDisplayImpl>(
73 device, this, client_.get(), std::move(display_info)); 73 device, this, client_.get(), std::move(display_info));
74 } 74 }
75 75
76 VRDisplayImpl* VRServiceImpl::GetVRDisplayImplForTesting(VRDevice* device) { 76 VRDisplayImpl* VRServiceImpl::GetVRDisplayImplForTesting(VRDevice* device) {
77 auto it = displays_.find(device); 77 auto it = displays_.find(device);
78 return (it == displays_.end()) ? nullptr : it->second.get(); 78 return (it == displays_.end()) ? nullptr : it->second.get();
79 } 79 }
80 80
81 } // namespace device 81 } // namespace device
OLDNEW
« no previous file with comments | « device/vr/vr_display_impl.cc ('k') | third_party/WebKit/Source/modules/vr/VRDisplay.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698