Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: chrome/browser/extensions/api/omnibox/omnibox_api.cc

Issue 2347973002: Enable Chrome to tweak search engines for some locales (Closed)
Patch Set: final nits Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698