Chromium Code Reviews| 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..8513bc3a089688fca2540d07fc69944d1c5f5cbe |
| --- /dev/null |
| +++ b/chrome/browser/android/vr_shell/toolbar_helper.cc |
| @@ -0,0 +1,39 @@ |
| +// 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 { |
| +constexpr int kMaxURLDisplayChars = 1024; |
|
mthiesse
2017/06/28 00:27:08
Why 1024? Do we intend for the URL to never get tr
cjgrant
2017/06/28 15:14:34
ToolbarModelImpl can truncate, that's fine. The c
mthiesse
2017/06/28 15:46:41
1K just seems strange. I was wondering if we were
cjgrant
2017/06/28 19:41:51
Is it less strange than 32K that desktop uses? :)
mthiesse
2017/06/28 19:50:13
I'm just asking for a comment saying "This is arbi
cjgrant
2017/06/28 20:21:02
SGTM. Done.
|
| +} |
| + |
| +ToolbarHelper::ToolbarHelper(UiInterface* ui, ToolbarModelDelegate* delegate) |
| + : ui_(ui), |
| + toolbar_model_( |
| + base::MakeUnique<ToolbarModelImpl>(delegate, kMaxURLDisplayChars)) {} |
| + |
| +ToolbarHelper::~ToolbarHelper() {} |
| + |
| +void ToolbarHelper::Update() { |
| + ToolbarState state; |
| + state.gurl = toolbar_model_->GetURL(); |
| + state.security_level = toolbar_model_->GetSecurityLevel(true); |
| + state.vector_icon = &(toolbar_model_->GetVectorIcon()); |
|
mthiesse
2017/06/28 00:27:08
nit: unnecessary parens
cjgrant
2017/06/28 15:14:33
Done.
|
| + state.secure_verbose_text = toolbar_model_->GetSecureVerboseText(); |
| + state.should_display_url = toolbar_model_->ShouldDisplayURL(); |
| + |
| + if (current_state_ == state) |
| + return; |
| + current_state_ = state; |
| + ui_->SetToolbarState(state); |
| +} |
| + |
| +} // namespace vr_shell |