| 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
|
|
|