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

Unified Diff: chrome/browser/android/vr_shell/ui_scene_manager.cc

Issue 2878543002: Refactor VR Shell Input. Locks input to click/scroll targets. (Closed)
Patch Set: Address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | chrome/browser/android/vr_shell/vr_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/ui_scene_manager.cc
diff --git a/chrome/browser/android/vr_shell/ui_scene_manager.cc b/chrome/browser/android/vr_shell/ui_scene_manager.cc
index 857d4d2eb59e1b0d48aa790947a17793b7cbfcfe..23d81070f652fdef2496cbad296bee3540368533 100644
--- a/chrome/browser/android/vr_shell/ui_scene_manager.cc
+++ b/chrome/browser/android/vr_shell/ui_scene_manager.cc
@@ -4,8 +4,10 @@
#include "chrome/browser/android/vr_shell/ui_scene_manager.h"
+#include "base/callback.h"
#include "base/memory/ptr_util.h"
#include "chrome/browser/android/vr_shell/textures/ui_texture.h"
+#include "chrome/browser/android/vr_shell/ui_elements/close_button.h"
#include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning.h"
#include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning.h"
#include "chrome/browser/android/vr_shell/ui_elements/ui_element.h"
@@ -67,6 +69,9 @@ UiSceneManager::UiSceneManager(VrBrowserInterface* browser,
CreateContentQuad();
CreateSecurityWarnings();
CreateUrlBar();
+
+ if (in_cct_)
+ CreateCloseButton();
}
UiSceneManager::~UiSceneManager() {}
@@ -190,7 +195,7 @@ void UiSceneManager::CreateBackground() {
void UiSceneManager::CreateUrlBar() {
// TODO(cjgrant): Incorporate final size and position.
// TODO(cjgrant): Add the loading progress indicator element.
- auto element = base::MakeUnique<UrlBar>(512);
+ std::unique_ptr<UrlBar> element = base::MakeUnique<UrlBar>(512);
element->set_id(AllocateId());
element->set_translation({0, -0.9, -1.8});
element->set_size({0.9, 0, 1});
@@ -201,6 +206,20 @@ void UiSceneManager::CreateUrlBar() {
scene_->AddUiElement(std::move(element));
}
+void UiSceneManager::CreateCloseButton() {
+ std::unique_ptr<CloseButton> element =
+ base::MakeUnique<CloseButton>(base::Bind(
+ &UiSceneManager::OnCloseButtonClicked, base::Unretained(this)));
+ element->set_id(AllocateId());
+ element->set_fill(vr_shell::Fill::NONE);
+ element->set_translation(
+ gfx::Vector3dF(0, kContentVerticalOffset - (kContentHeight / 2) - 0.3,
+ -kContentDistance + 0.4));
+ element->set_size(gfx::Vector3dF(0.2, 0.2, 1));
+ browser_ui_elements_.push_back(element.get());
+ scene_->AddUiElement(std::move(element));
+}
+
base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
@@ -296,6 +315,8 @@ void UiSceneManager::SetLoadProgress(double progress) {}
void UiSceneManager::SetHistoryButtonsEnabled(bool can_go_back,
bool can_go_forward) {}
+void UiSceneManager::OnCloseButtonClicked() {}
+
int UiSceneManager::AllocateId() {
return next_available_id_++;
}
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | chrome/browser/android/vr_shell/vr_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698