Chromium Code Reviews| Index: chrome/browser/android/vr_shell/vr_shell.cc |
| diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc |
| index fd602959400e0e4e322236f8768677d7dcc4bc31..2c7b7049fcb10ce25d1f3226cfa77fd796ac0492 100644 |
| --- a/chrome/browser/android/vr_shell/vr_shell.cc |
| +++ b/chrome/browser/android/vr_shell/vr_shell.cc |
| @@ -45,12 +45,15 @@ |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/common/content_features.h" |
| #include "content/public/common/referrer.h" |
| +#include "content/public/common/service_manager_connection.h" |
| +#include "device/geolocation/public/interfaces/geolocation_config.mojom.h" |
| #include "device/vr/android/gvr/cardboard_gamepad_data_fetcher.h" |
| #include "device/vr/android/gvr/gvr_device.h" |
| #include "device/vr/android/gvr/gvr_device_provider.h" |
| #include "device/vr/android/gvr/gvr_gamepad_data_fetcher.h" |
| #include "gpu/command_buffer/common/mailbox.h" |
| #include "jni/VrShellImpl_jni.h" |
| +#include "services/service_manager/public/cpp/connector.h" |
| #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| #include "ui/android/view_android.h" |
| #include "ui/android/window_android.h" |
| @@ -72,7 +75,7 @@ namespace { |
| vr_shell::VrShell* g_instance; |
| constexpr base::TimeDelta poll_media_access_interval_ = |
| - base::TimeDelta::FromSecondsD(0.1); |
| + base::TimeDelta::FromSecondsD(0.2); |
| constexpr base::TimeDelta kExitVrDueToUnsupportedModeDelay = |
| base::TimeDelta::FromSeconds(5); |
| @@ -644,6 +647,12 @@ void VrShell::PollMediaAccessFlag() { |
| if (web_contents->IsConnectedToBluetoothDevice()) |
| num_tabs_bluetooth_connected++; |
| } |
| + auto* connector = |
| + content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
| + connector->BindInterface("content_browser", &geolocation_config_); |
| + |
| + geolocation_config_->IsHighAccuracyLocationBeingCaptured(base::Bind( |
| + &VrShell::SetHighAccuracyLocation, weak_ptr_factory_.GetWeakPtr())); |
|
blundell
2017/07/12 13:28:06
this can be base::Unretained because this object o
asimjour1
2017/07/12 18:03:58
Done.
|
| bool is_capturing_audio = num_tabs_capturing_audio > 0; |
| bool is_capturing_video = num_tabs_capturing_video > 0; |
| @@ -667,6 +676,12 @@ void VrShell::PollMediaAccessFlag() { |
| } |
| } |
| +void VrShell::SetHighAccuracyLocation(bool high_accuracy_location) { |
| + if (high_accuracy_location != high_accuracy_location_) |
|
blundell
2017/07/12 13:28:06
nit:
more clear as
if (high_accuracy_location ==
asimjour1
2017/07/12 18:03:58
Done.
|
| + ui_->SetLocationAccessIndicator(high_accuracy_location); |
| + high_accuracy_location_ = high_accuracy_location; |
| +} |
| + |
| void VrShell::SetContentCssSize(float width, float height, float dpr) { |
| JNIEnv* env = base::android::AttachCurrentThread(); |
| Java_VrShellImpl_setContentCssSize(env, j_vr_shell_.obj(), width, height, |