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

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: Update toolbar build file to include vector icons for Android. 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
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
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/toolbar_helper.h ('k') | chrome/browser/android/vr_shell/toolbar_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698