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

Side by Side Diff: components/toolbar/toolbar_model_impl.cc

Issue 2964513002: Toolbar: Do not include vector icons if on Android with no VR. (Closed)
Patch Set: Demonstrate distributivity of negation for readability (ie. address Peter's comment) 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
« no previous file with comments | « components/toolbar/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/toolbar/toolbar_model_impl.h" 5 #include "components/toolbar/toolbar_model_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "components/prefs/pref_service.h" 11 #include "components/prefs/pref_service.h"
12 #include "components/security_state/core/security_state.h" 12 #include "components/security_state/core/security_state.h"
13 #include "components/strings/grit/components_strings.h" 13 #include "components/strings/grit/components_strings.h"
14 #include "components/toolbar/features.h"
14 #include "components/toolbar/toolbar_model_delegate.h" 15 #include "components/toolbar/toolbar_model_delegate.h"
15 #include "components/url_formatter/elide_url.h" 16 #include "components/url_formatter/elide_url.h"
16 #include "components/url_formatter/url_formatter.h" 17 #include "components/url_formatter/url_formatter.h"
17 #include "net/cert/cert_status_flags.h" 18 #include "net/cert/cert_status_flags.h"
18 #include "net/cert/x509_certificate.h" 19 #include "net/cert/x509_certificate.h"
19 #include "net/ssl/ssl_connection_status_flags.h" 20 #include "net/ssl/ssl_connection_status_flags.h"
20 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/gfx/text_elider.h" 22 #include "ui/gfx/text_elider.h"
22 #include "ui/gfx/vector_icon_types.h" 23 #include "ui/gfx/vector_icon_types.h"
23 24
24 #if !defined(OS_IOS) 25 #if (!defined(OS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !defined(OS_IOS)
25 #include "components/toolbar/vector_icons.h" // nogncheck 26 #include "components/toolbar/vector_icons.h" // nogncheck
26 #include "ui/vector_icons/vector_icons.h" // nogncheck 27 #include "ui/vector_icons/vector_icons.h" // nogncheck
27 #endif 28 #endif
28 29
29 ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate, 30 ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate,
30 size_t max_url_display_chars) 31 size_t max_url_display_chars)
31 : delegate_(delegate), max_url_display_chars_(max_url_display_chars) { 32 : delegate_(delegate), max_url_display_chars_(max_url_display_chars) {
32 DCHECK(delegate_); 33 DCHECK(delegate_);
33 } 34 }
34 35
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 67
67 security_state::SecurityLevel ToolbarModelImpl::GetSecurityLevel( 68 security_state::SecurityLevel ToolbarModelImpl::GetSecurityLevel(
68 bool ignore_editing) const { 69 bool ignore_editing) const {
69 // When editing or empty, assume no security style. 70 // When editing or empty, assume no security style.
70 return ((input_in_progress() && !ignore_editing) || !ShouldDisplayURL()) 71 return ((input_in_progress() && !ignore_editing) || !ShouldDisplayURL())
71 ? security_state::NONE 72 ? security_state::NONE
72 : delegate_->GetSecurityLevel(); 73 : delegate_->GetSecurityLevel();
73 } 74 }
74 75
75 const gfx::VectorIcon& ToolbarModelImpl::GetVectorIcon() const { 76 const gfx::VectorIcon& ToolbarModelImpl::GetVectorIcon() const {
76 #if !defined(OS_IOS) 77 #if (!defined(OS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !defined(OS_IOS)
77 auto* const icon_override = delegate_->GetVectorIconOverride(); 78 auto* const icon_override = delegate_->GetVectorIconOverride();
78 if (icon_override) 79 if (icon_override)
79 return *icon_override; 80 return *icon_override;
80 81
81 switch (GetSecurityLevel(false)) { 82 switch (GetSecurityLevel(false)) {
82 case security_state::NONE: 83 case security_state::NONE:
83 case security_state::HTTP_SHOW_WARNING: 84 case security_state::HTTP_SHOW_WARNING:
84 return toolbar::kHttpIcon; 85 return toolbar::kHttpIcon;
85 case security_state::EV_SECURE: 86 case security_state::EV_SECURE:
86 case security_state::SECURE: 87 case security_state::SECURE:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ? IDS_DANGEROUS_VERBOSE_STATE 131 ? IDS_DANGEROUS_VERBOSE_STATE
131 : IDS_NOT_SECURE_VERBOSE_STATE); 132 : IDS_NOT_SECURE_VERBOSE_STATE);
132 default: 133 default:
133 return base::string16(); 134 return base::string16();
134 } 135 }
135 } 136 }
136 137
137 bool ToolbarModelImpl::ShouldDisplayURL() const { 138 bool ToolbarModelImpl::ShouldDisplayURL() const {
138 return delegate_->ShouldDisplayURL(); 139 return delegate_->ShouldDisplayURL();
139 } 140 }
OLDNEW
« no previous file with comments | « components/toolbar/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698