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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 client_(client), | 59 client_(client), |
60 bookmark_model_(client ? client_->GetBookmarkModel() : nullptr) {} | 60 bookmark_model_(client ? client_->GetBookmarkModel() : nullptr) {} |
61 | 61 |
62 void BookmarkProvider::Start(const AutocompleteInput& input, | 62 void BookmarkProvider::Start(const AutocompleteInput& input, |
63 bool minimal_changes) { | 63 bool minimal_changes) { |
64 TRACE_EVENT0("omnibox", "BookmarkProvider::Start"); | 64 TRACE_EVENT0("omnibox", "BookmarkProvider::Start"); |
65 if (minimal_changes) | 65 if (minimal_changes) |
66 return; | 66 return; |
67 matches_.clear(); | 67 matches_.clear(); |
68 | 68 |
69 if (input.from_omnibox_focus() || input.text().empty() || | 69 if (input.from_omnibox_focus() || input.text().empty()) |
70 (input.type() == metrics::OmniboxInputType::FORCED_QUERY)) | |
71 return; | 70 return; |
72 | 71 |
73 DoAutocomplete(input); | 72 DoAutocomplete(input); |
74 } | 73 } |
75 | 74 |
76 BookmarkProvider::~BookmarkProvider() {} | 75 BookmarkProvider::~BookmarkProvider() {} |
77 | 76 |
78 void BookmarkProvider::DoAutocomplete(const AutocompleteInput& input) { | 77 void BookmarkProvider::DoAutocomplete(const AutocompleteInput& input) { |
79 // We may not have a bookmark model for some unit tests. | 78 // We may not have a bookmark model for some unit tests. |
80 if (!bookmark_model_) | 79 if (!bookmark_model_) |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 i != positions.end(); | 333 i != positions.end(); |
335 ++i) { | 334 ++i) { |
336 AutocompleteMatch::ACMatchClassifications new_class; | 335 AutocompleteMatch::ACMatchClassifications new_class; |
337 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, | 336 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, |
338 text_length, url_style, &new_class); | 337 text_length, url_style, &new_class); |
339 classifications = AutocompleteMatch::MergeClassifications( | 338 classifications = AutocompleteMatch::MergeClassifications( |
340 classifications, new_class); | 339 classifications, new_class); |
341 } | 340 } |
342 return classifications; | 341 return classifications; |
343 } | 342 } |
OLD | NEW |