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

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

Issue 2641003002: Show scheme in black and content in gray for data: protocol urls (Closed)
Patch Set: Hoist deemphasis logic Created 3 years, 9 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 if (client) { 178 if (client) {
179 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); 179 model_.reset(new OmniboxEditModel(this, controller, std::move(client)));
180 } 180 }
181 } 181 }
182 182
183 void OmniboxView::TextChanged() { 183 void OmniboxView::TextChanged() {
184 EmphasizeURLComponents(); 184 EmphasizeURLComponents();
185 if (model_.get()) 185 if (model_.get())
186 model_->OnChanged(); 186 model_->OnChanged();
187 } 187 }
188
189 OmniboxView::DEEMPHASIZE_COMPONENTS OmniboxView::GetDeemphasis(
190 const base::string16& url_scheme,
191 const bool has_host) const {
192 OmniboxView::DEEMPHASIZE_COMPONENTS deemphasize = NOTHING;
Peter Kasting 2017/02/24 01:53:40 Nit: Can remove this variable, change assignments
193
194 // This constant is copied from extensions/common/constants.h to avoid
195 // complicated dependencies.
Peter Kasting 2017/02/24 01:53:40 Urgh. Can we not have extensions/common/ in compo
196 const char kExtensionScheme[] = "chrome-extension";
197
198 if (model_->CurrentTextIsURL()) {
199 // Extension IDs are not human-readable, so deemphasize everything to draw
200 // attention to the human-readable name in the location icon text.
201 if (url_scheme == base::UTF8ToUTF16(kExtensionScheme))
202 deemphasize = EVERYTHING;
203 // Data URLs are rarely human-readable and can be used for spoofing, so draw
204 // attention to the scheme to emphasize "this is just a bunch of data".
205 else if (url_scheme == base::UTF8ToUTF16(url::kDataScheme))
206 deemphasize = ALL_BUT_SCHEME;
207 // For normal URLs, the host is the best proxy for "identity".
208 else if (has_host)
209 deemphasize = ALL_BUT_HOST;
210 }
211
212 return deemphasize;
213 }
OLDNEW
« components/omnibox/browser/omnibox_view.h ('K') | « components/omnibox/browser/omnibox_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698