| OLD | NEW |
| 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 Loading... |
| 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 gfx::VectorIconId OmniboxView::GetVectorIcon() const { | 82 const gfx::VectorIcon& OmniboxView::GetVectorIcon() const { |
| 83 if (!IsEditingOrEmpty()) | 83 if (!IsEditingOrEmpty()) |
| 84 return controller_->GetToolbarModel()->GetVectorIcon(); | 84 return controller_->GetToolbarModel()->GetVectorIcon(); |
| 85 | 85 |
| 86 return AutocompleteMatch::TypeToVectorIcon( | 86 return AutocompleteMatch::TypeToVectorIcon( |
| 87 model_ ? model_->CurrentTextType() | 87 model_ ? model_->CurrentTextType() |
| 88 : AutocompleteMatchType::URL_WHAT_YOU_TYPED); | 88 : AutocompleteMatchType::URL_WHAT_YOU_TYPED); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void OmniboxView::SetUserText(const base::string16& text) { | 91 void OmniboxView::SetUserText(const base::string16& text) { |
| 92 SetUserText(text, true); | 92 SetUserText(text, true); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |