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

Side by Side Diff: chrome/browser/android/vr_shell/toolbar_helper.cc

Issue 2960903002: VR: Use ToolbarModel to drive VR URL bar state. (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
OLDNEW
(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 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.
16 }
17
18 ToolbarHelper::ToolbarHelper(UiInterface* ui, ToolbarModelDelegate* delegate)
19 : ui_(ui),
20 toolbar_model_(
21 base::MakeUnique<ToolbarModelImpl>(delegate, kMaxURLDisplayChars)) {}
22
23 ToolbarHelper::~ToolbarHelper() {}
24
25 void ToolbarHelper::Update() {
26 ToolbarState state;
27 state.gurl = toolbar_model_->GetURL();
28 state.security_level = toolbar_model_->GetSecurityLevel(true);
29 state.vector_icon = &(toolbar_model_->GetVectorIcon());
mthiesse 2017/06/28 00:27:08 nit: unnecessary parens
cjgrant 2017/06/28 15:14:33 Done.
30 state.secure_verbose_text = toolbar_model_->GetSecureVerboseText();
31 state.should_display_url = toolbar_model_->ShouldDisplayURL();
32
33 if (current_state_ == state)
34 return;
35 current_state_ = state;
36 ui_->SetToolbarState(state);
37 }
38
39 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698