Chromium Code Reviews| 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 "chrome/browser/autocomplete/bookmark_provider.h" | 5 #include "chrome/browser/autocomplete/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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 : AutocompleteProvider(AutocompleteProvider::TYPE_BOOKMARK), | 58 : AutocompleteProvider(AutocompleteProvider::TYPE_BOOKMARK), |
| 59 profile_(profile), | 59 profile_(profile), |
| 60 bookmark_model_(NULL) { | 60 bookmark_model_(NULL) { |
| 61 if (profile) { | 61 if (profile) { |
| 62 bookmark_model_ = BookmarkModelFactory::GetForProfile(profile); | 62 bookmark_model_ = BookmarkModelFactory::GetForProfile(profile); |
| 63 languages_ = profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); | 63 languages_ = profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
| 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 if (minimal_changes) | 69 bool on_focus) { |
| 70 if (minimal_changes || on_focus) | |
|
Peter Kasting
2015/01/07 20:16:36
This isn't equivalent to the previous behavior, wh
Maria
2015/01/08 07:52:38
Done.
| |
| 70 return; | 71 return; |
| 71 matches_.clear(); | 72 matches_.clear(); |
| 72 | 73 |
| 73 if (input.text().empty() || | 74 if (input.text().empty() || |
| 74 (input.type() == metrics::OmniboxInputType::FORCED_QUERY)) | 75 (input.type() == metrics::OmniboxInputType::FORCED_QUERY)) |
| 75 return; | 76 return; |
| 76 | 77 |
| 77 DoAutocomplete(input); | 78 DoAutocomplete(input); |
| 78 } | 79 } |
| 79 | 80 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 i != positions.end(); | 338 i != positions.end(); |
| 338 ++i) { | 339 ++i) { |
| 339 AutocompleteMatch::ACMatchClassifications new_class; | 340 AutocompleteMatch::ACMatchClassifications new_class; |
| 340 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, | 341 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, |
| 341 text_length, url_style, &new_class); | 342 text_length, url_style, &new_class); |
| 342 classifications = AutocompleteMatch::MergeClassifications( | 343 classifications = AutocompleteMatch::MergeClassifications( |
| 343 classifications, new_class); | 344 classifications, new_class); |
| 344 } | 345 } |
| 345 return classifications; | 346 return classifications; |
| 346 } | 347 } |
| OLD | NEW |