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

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

Issue 2399333002: Revert of Delete pre-MD code from OmniboxResultView (Closed)
Patch Set: Created 4 years, 2 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 match, disposition, alternate_nav_url, pasted_text, selected_line); 72 match, disposition, alternate_nav_url, pasted_text, selected_line);
73 // WARNING: |match| may refer to a deleted object at this point! 73 // WARNING: |match| may refer to a deleted object at this point!
74 OnMatchOpened(match_type); 74 OnMatchOpened(match_type);
75 } 75 }
76 76
77 bool OmniboxView::IsEditingOrEmpty() const { 77 bool OmniboxView::IsEditingOrEmpty() const {
78 return (model_.get() && model_->user_input_in_progress()) || 78 return (model_.get() && model_->user_input_in_progress()) ||
79 (GetOmniboxTextLength() == 0); 79 (GetOmniboxTextLength() == 0);
80 } 80 }
81 81
82 int OmniboxView::GetIcon() const {
83 if (!IsEditingOrEmpty())
84 return controller_->GetToolbarModel()->GetIcon();
85 int id = AutocompleteMatch::TypeToIcon(model_.get() ?
86 model_->CurrentTextType() : AutocompleteMatchType::URL_WHAT_YOU_TYPED);
87 return (id == IDR_OMNIBOX_HTTP) ? IDR_LOCATION_BAR_HTTP : id;
88 }
89
82 gfx::VectorIconId OmniboxView::GetVectorIcon() const { 90 gfx::VectorIconId OmniboxView::GetVectorIcon() const {
91 #if !defined(OS_ANDROID) && !defined(OS_IOS)
83 if (!IsEditingOrEmpty()) 92 if (!IsEditingOrEmpty())
84 return controller_->GetToolbarModel()->GetVectorIcon(); 93 return controller_->GetToolbarModel()->GetVectorIcon();
85 94
86 return AutocompleteMatch::TypeToVectorIcon( 95 return AutocompleteMatch::TypeToVectorIcon(
87 model_ ? model_->CurrentTextType() 96 model_ ? model_->CurrentTextType()
88 : AutocompleteMatchType::URL_WHAT_YOU_TYPED); 97 : AutocompleteMatchType::URL_WHAT_YOU_TYPED);
98 #else
99 NOTIMPLEMENTED();
100 return gfx::VectorIconId::VECTOR_ICON_NONE;
101 #endif
89 } 102 }
90 103
91 void OmniboxView::SetUserText(const base::string16& text) { 104 void OmniboxView::SetUserText(const base::string16& text) {
92 SetUserText(text, true); 105 SetUserText(text, true);
93 } 106 }
94 107
95 void OmniboxView::SetUserText(const base::string16& text, 108 void OmniboxView::SetUserText(const base::string16& text,
96 bool update_popup) { 109 bool update_popup) {
97 if (model_.get()) 110 if (model_.get())
98 model_->SetUserText(text); 111 model_->SetUserText(text);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 if (client) { 191 if (client) {
179 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); 192 model_.reset(new OmniboxEditModel(this, controller, std::move(client)));
180 } 193 }
181 } 194 }
182 195
183 void OmniboxView::TextChanged() { 196 void OmniboxView::TextChanged() {
184 EmphasizeURLComponents(); 197 EmphasizeURLComponents();
185 if (model_.get()) 198 if (model_.get())
186 model_->OnChanged(); 199 model_->OnChanged();
187 } 200 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/omnibox_view.h ('k') | components/resources/components_scaled_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698