| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/android/vr_shell/toolbar_helper.h" |
| 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 #include "components/toolbar/toolbar_model_impl.h" |
| 9 |
| 10 class ToolbarModelDelegate; |
| 11 |
| 12 namespace vr_shell { |
| 13 |
| 14 namespace { |
| 15 |
| 16 // This number is arbitrary. For VR, use a number smaller than desktop's 32K, as |
| 17 // the URL indicator does not show long URLs. |
| 18 constexpr int kMaxURLDisplayChars = 1024; |
| 19 |
| 20 } // namespace |
| 21 |
| 22 ToolbarHelper::ToolbarHelper(UiInterface* ui, ToolbarModelDelegate* delegate) |
| 23 : ui_(ui), |
| 24 toolbar_model_( |
| 25 base::MakeUnique<ToolbarModelImpl>(delegate, kMaxURLDisplayChars)) {} |
| 26 |
| 27 ToolbarHelper::~ToolbarHelper() {} |
| 28 |
| 29 void ToolbarHelper::Update() { |
| 30 ToolbarState state( |
| 31 toolbar_model_->GetURL(), toolbar_model_->GetSecurityLevel(true), |
| 32 &toolbar_model_->GetVectorIcon(), toolbar_model_->GetSecureVerboseText(), |
| 33 toolbar_model_->ShouldDisplayURL()); |
| 34 |
| 35 if (current_state_ == state) |
| 36 return; |
| 37 current_state_ = state; |
| 38 ui_->SetToolbarState(state); |
| 39 } |
| 40 |
| 41 } // namespace vr_shell |
| OLD | NEW |