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

Side by Side Diff: components/omnibox/browser/omnibox_view.cc

Issue 1935663002: New origin security indicator icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SVGOMG -> Skiafier for as many as possible. Created 4 years, 7 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // This file defines helper functions shared by the various implementations 5 // This file defines helper functions shared by the various implementations
6 // of OmniboxView. 6 // of OmniboxView.
7 7
8 #include "components/omnibox/browser/omnibox_view.h" 8 #include "components/omnibox/browser/omnibox_view.h"
9 9
10 #include <utility> 10 #include <utility>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 int OmniboxView::GetIcon() const { 81 int OmniboxView::GetIcon() const {
82 if (!IsEditingOrEmpty()) 82 if (!IsEditingOrEmpty())
83 return controller_->GetToolbarModel()->GetIcon(); 83 return controller_->GetToolbarModel()->GetIcon();
84 int id = AutocompleteMatch::TypeToIcon(model_.get() ? 84 int id = AutocompleteMatch::TypeToIcon(model_.get() ?
85 model_->CurrentTextType() : AutocompleteMatchType::URL_WHAT_YOU_TYPED); 85 model_->CurrentTextType() : AutocompleteMatchType::URL_WHAT_YOU_TYPED);
86 return (id == IDR_OMNIBOX_HTTP) ? IDR_LOCATION_BAR_HTTP : id; 86 return (id == IDR_OMNIBOX_HTTP) ? IDR_LOCATION_BAR_HTTP : id;
87 } 87 }
88 88
89 gfx::VectorIconId OmniboxView::GetVectorIcon(bool invert) const { 89 gfx::VectorIconId OmniboxView::GetVectorIcon() const {
90 #if !defined(OS_ANDROID) && !defined(OS_IOS) 90 #if !defined(OS_ANDROID) && !defined(OS_IOS)
91 if (!IsEditingOrEmpty()) { 91 if (!IsEditingOrEmpty()) {
92 gfx::VectorIconId id = controller_->GetToolbarModel()->GetVectorIcon(); 92 gfx::VectorIconId id = controller_->GetToolbarModel()->GetVectorIcon();
Evan Stade 2016/05/18 21:40:42 nit: don't need this local var any more
palmer 2016/05/19 17:49:23 Done.
93 if (invert) {
94 if (id == gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID)
95 return gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_INVERT;
96 if (id == gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID)
97 return gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID_INVERT;
98 }
99 return id; 93 return id;
100 } 94 }
101 // Reuse the dropdown icons... 95 // Reuse the dropdown icons...
102 gfx::VectorIconId id = AutocompleteMatch::TypeToVectorIcon( 96 gfx::VectorIconId id = AutocompleteMatch::TypeToVectorIcon(
103 model_ ? model_->CurrentTextType() 97 model_ ? model_->CurrentTextType()
104 : AutocompleteMatchType::URL_WHAT_YOU_TYPED); 98 : AutocompleteMatchType::URL_WHAT_YOU_TYPED);
105 // but use a tweaked version for the HTTP icon. 99 // but use a different version for the HTTP icon.
106 return (id == gfx::VectorIconId::OMNIBOX_HTTP) 100 return (id == gfx::VectorIconId::OMNIBOX_HTTP)
107 ? gfx::VectorIconId::LOCATION_BAR_HTTP 101 ? gfx::VectorIconId::LOCATION_BAR_HTTP
108 : id; 102 : id;
109 #else 103 #else
110 NOTIMPLEMENTED(); 104 NOTIMPLEMENTED();
111 return gfx::VectorIconId::VECTOR_ICON_NONE; 105 return gfx::VectorIconId::VECTOR_ICON_NONE;
112 #endif 106 #endif
113 } 107 }
114 108
115 void OmniboxView::SetUserText(const base::string16& text) { 109 void OmniboxView::SetUserText(const base::string16& text) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 if (client) { 176 if (client) {
183 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); 177 model_.reset(new OmniboxEditModel(this, controller, std::move(client)));
184 } 178 }
185 } 179 }
186 180
187 void OmniboxView::TextChanged() { 181 void OmniboxView::TextChanged() {
188 EmphasizeURLComponents(); 182 EmphasizeURLComponents();
189 if (model_.get()) 183 if (model_.get())
190 model_->OnChanged(); 184 model_->OnChanged();
191 } 185 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698