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

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

Issue 2960903002: VR: Use ToolbarModel to drive VR URL bar state. (Closed)
Patch Set: Update toolbar build file to include vector icons for Android. Created 3 years, 6 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/toolbar_helper.h ('k') | chrome/browser/android/vr_shell/toolbar_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/toolbar_helper.cc
diff --git a/chrome/browser/android/vr_shell/toolbar_helper.cc b/chrome/browser/android/vr_shell/toolbar_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3e1bbd7457ede0f2ef1aa6839dbd4e46165f3785
--- /dev/null
+++ b/chrome/browser/android/vr_shell/toolbar_helper.cc
@@ -0,0 +1,41 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/vr_shell/toolbar_helper.h"
+
+#include "base/memory/ptr_util.h"
+#include "components/toolbar/toolbar_model_impl.h"
+
+class ToolbarModelDelegate;
+
+namespace vr_shell {
+
+namespace {
+
+// This number is arbitrary. For VR, use a number smaller than desktop's 32K, as
+// the URL indicator does not show long URLs.
+constexpr int kMaxURLDisplayChars = 1024;
+
+} // namespace
+
+ToolbarHelper::ToolbarHelper(UiInterface* ui, ToolbarModelDelegate* delegate)
+ : ui_(ui),
+ toolbar_model_(
+ base::MakeUnique<ToolbarModelImpl>(delegate, kMaxURLDisplayChars)) {}
+
+ToolbarHelper::~ToolbarHelper() {}
+
+void ToolbarHelper::Update() {
+ ToolbarState state(
+ toolbar_model_->GetURL(), toolbar_model_->GetSecurityLevel(true),
+ &toolbar_model_->GetVectorIcon(), toolbar_model_->GetSecureVerboseText(),
+ toolbar_model_->ShouldDisplayURL());
+
+ if (current_state_ == state)
+ return;
+ current_state_ = state;
+ ui_->SetToolbarState(state);
+}
+
+} // namespace vr_shell
« no previous file with comments | « chrome/browser/android/vr_shell/toolbar_helper.h ('k') | chrome/browser/android/vr_shell/toolbar_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698