blob: 2212ff9d099b782eec92aba7afc96e615bc821d9 [file] [log] [blame]
// 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/vr/toolbar_helper.h"
#include "base/memory/ptr_util.h"
#include "components/toolbar/toolbar_model_impl.h"
class ToolbarModelDelegate;
namespace vr {
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(BrowserUiInterface* ui,
ToolbarModelDelegate* delegate)
: ui_(ui),
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(), toolbar_model_->IsOfflinePage());
if (current_state_ == state)
current_state_ = state;
} // namespace vr