| 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 #include "components/omnibox/browser/bookmark_provider.h" | 5 #include "components/omnibox/browser/bookmark_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 void BookmarkProvider::Start(const AutocompleteInput& input, | 67 void BookmarkProvider::Start(const AutocompleteInput& input, |
| 68 bool minimal_changes) { | 68 bool minimal_changes) { |
| 69 TRACE_EVENT0("omnibox", "BookmarkProvider::Start"); | 69 TRACE_EVENT0("omnibox", "BookmarkProvider::Start"); |
| 70 if (minimal_changes) | 70 if (minimal_changes) |
| 71 return; | 71 return; |
| 72 matches_.clear(); | 72 matches_.clear(); |
| 73 | 73 |
| 74 if (input.from_omnibox_focus() || input.text().empty() || | 74 if (input.from_omnibox_focus() || input.text().empty()) |
| 75 (input.type() == metrics::OmniboxInputType::FORCED_QUERY)) | |
| 76 return; | 75 return; |
| 77 | 76 |
| 78 DoAutocomplete(input); | 77 DoAutocomplete(input); |
| 79 } | 78 } |
| 80 | 79 |
| 81 BookmarkProvider::~BookmarkProvider() {} | 80 BookmarkProvider::~BookmarkProvider() {} |
| 82 | 81 |
| 83 void BookmarkProvider::DoAutocomplete(const AutocompleteInput& input) { | 82 void BookmarkProvider::DoAutocomplete(const AutocompleteInput& input) { |
| 84 // We may not have a bookmark model for some unit tests. | 83 // We may not have a bookmark model for some unit tests. |
| 85 if (!bookmark_model_) | 84 if (!bookmark_model_) |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 i != positions.end(); | 338 i != positions.end(); |
| 340 ++i) { | 339 ++i) { |
| 341 AutocompleteMatch::ACMatchClassifications new_class; | 340 AutocompleteMatch::ACMatchClassifications new_class; |
| 342 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, | 341 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, |
| 343 text_length, url_style, &new_class); | 342 text_length, url_style, &new_class); |
| 344 classifications = AutocompleteMatch::MergeClassifications( | 343 classifications = AutocompleteMatch::MergeClassifications( |
| 345 classifications, new_class); | 344 classifications, new_class); |
| 346 } | 345 } |
| 347 return classifications; | 346 return classifications; |
| 348 } | 347 } |
| OLD | NEW |