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

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

Issue 2031813002: alternative to https://codereview.chromium.org/2028933002/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/omnibox/browser/omnibox_view.h ('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 (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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Invalid URLs such as chrome://history can end up here. 66 // Invalid URLs such as chrome://history can end up here.
67 if (!match.destination_url.is_valid() || !model_) 67 if (!match.destination_url.is_valid() || !model_)
68 return; 68 return;
69 const AutocompleteMatch::Type match_type = match.type; 69 const AutocompleteMatch::Type match_type = match.type;
70 model_->OpenMatch( 70 model_->OpenMatch(
71 match, disposition, alternate_nav_url, pasted_text, selected_line); 71 match, disposition, alternate_nav_url, pasted_text, selected_line);
72 // WARNING: |match| may refer to a deleted object at this point! 72 // WARNING: |match| may refer to a deleted object at this point!
73 OnMatchOpened(match_type); 73 OnMatchOpened(match_type);
74 } 74 }
75 75
76 security_state::SecurityStateModel::SecurityLevel
77 OmniboxView::GetSecurityLevelForDisplay() const {
78 return IsEditingOrEmpty()
79 ? security_state::SecurityStateModel::NONE
80 : controller_->GetToolbarModel()->GetSecurityLevel(false);
81 }
82
76 bool OmniboxView::IsEditingOrEmpty() const { 83 bool OmniboxView::IsEditingOrEmpty() const {
77 return (model_.get() && model_->user_input_in_progress()) || 84 return (model_.get() && model_->user_input_in_progress()) ||
78 (GetOmniboxTextLength() == 0); 85 (GetOmniboxTextLength() == 0);
79 } 86 }
80 87
81 int OmniboxView::GetIcon() const { 88 int OmniboxView::GetIcon() const {
82 if (!IsEditingOrEmpty()) 89 if (!IsEditingOrEmpty())
83 return controller_->GetToolbarModel()->GetIcon(); 90 return controller_->GetToolbarModel()->GetIcon();
84 int id = AutocompleteMatch::TypeToIcon(model_.get() ? 91 int id = AutocompleteMatch::TypeToIcon(model_.get() ?
85 model_->CurrentTextType() : AutocompleteMatchType::URL_WHAT_YOU_TYPED); 92 model_->CurrentTextType() : AutocompleteMatchType::URL_WHAT_YOU_TYPED);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if (client) { 180 if (client) {
174 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); 181 model_.reset(new OmniboxEditModel(this, controller, std::move(client)));
175 } 182 }
176 } 183 }
177 184
178 void OmniboxView::TextChanged() { 185 void OmniboxView::TextChanged() {
179 EmphasizeURLComponents(); 186 EmphasizeURLComponents();
180 if (model_.get()) 187 if (model_.get())
181 model_->OnChanged(); 188 model_->OnChanged();
182 } 189 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/omnibox_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698