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/extensions/api/omnibox/omnibox_api.h" | 5 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 } | 363 } |
364 | 364 |
365 return match_classifications; | 365 return match_classifications; |
366 } | 366 } |
367 | 367 |
368 void ApplyDefaultSuggestionForExtensionKeyword( | 368 void ApplyDefaultSuggestionForExtensionKeyword( |
369 Profile* profile, | 369 Profile* profile, |
370 const TemplateURL* keyword, | 370 const TemplateURL* keyword, |
371 const base::string16& remaining_input, | 371 const base::string16& remaining_input, |
372 AutocompleteMatch* match) { | 372 AutocompleteMatch* match) { |
373 DCHECK(keyword->GetType() == TemplateURL::OMNIBOX_API_EXTENSION); | 373 DCHECK(keyword->type() == TemplateURL::OMNIBOX_API_EXTENSION); |
374 | 374 |
375 std::unique_ptr<omnibox::SuggestResult> suggestion( | 375 std::unique_ptr<omnibox::SuggestResult> suggestion( |
376 GetOmniboxDefaultSuggestion(profile, keyword->GetExtensionId())); | 376 GetOmniboxDefaultSuggestion(profile, keyword->GetExtensionId())); |
377 if (!suggestion || suggestion->description.empty()) | 377 if (!suggestion || suggestion->description.empty()) |
378 return; // fall back to the universal default | 378 return; // fall back to the universal default |
379 | 379 |
380 const base::string16 kPlaceholderText(base::ASCIIToUTF16("%s")); | 380 const base::string16 kPlaceholderText(base::ASCIIToUTF16("%s")); |
381 const base::string16 kReplacementText(base::ASCIIToUTF16("<input>")); | 381 const base::string16 kReplacementText(base::ASCIIToUTF16("<input>")); |
382 | 382 |
383 base::string16 description = base::UTF8ToUTF16(suggestion->description); | 383 base::string16 description = base::UTF8ToUTF16(suggestion->description); |
(...skipping 11 matching lines...) Expand all Loading... |
395 for (size_t i = 0; i < description_styles.size(); ++i) { | 395 for (size_t i = 0; i < description_styles.size(); ++i) { |
396 if (description_styles[i].offset > placeholder) | 396 if (description_styles[i].offset > placeholder) |
397 description_styles[i].offset += replacement.length() - 2; | 397 description_styles[i].offset += replacement.length() - 2; |
398 } | 398 } |
399 } | 399 } |
400 | 400 |
401 match->contents.assign(description); | 401 match->contents.assign(description); |
402 } | 402 } |
403 | 403 |
404 } // namespace extensions | 404 } // namespace extensions |
OLD | NEW |