| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/search_engines/template_url.h" | 5 #include "chrome/browser/search_engines/template_url.h" |
| 6 | 6 |
| 7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
| 8 #include "base/i18n/icu_string_conversions.h" | 8 #include "base/i18n/icu_string_conversions.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/stringprintf.h" |
| 11 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 12 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/search_engines/search_engine_type.h" | 14 #include "chrome/browser/search_engines/search_engine_type.h" |
| 14 #include "chrome/browser/search_engines/search_terms_data.h" | 15 #include "chrome/browser/search_engines/search_terms_data.h" |
| 15 #include "chrome/browser/search_engines/template_url_model.h" | 16 #include "chrome/browser/search_engines/template_url_model.h" |
| 16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 17 #include "chrome/installer/util/google_update_settings.h" | 18 #include "chrome/installer/util/google_update_settings.h" |
| 18 #include "content/browser/user_metrics.h" | 19 #include "content/browser/user_metrics.h" |
| 19 #include "net/base/escape.h" | 20 #include "net/base/escape.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 i != replacements_.rend(); ++i) { | 347 i != replacements_.rend(); ++i) { |
| 347 switch (i->type) { | 348 switch (i->type) { |
| 348 case ENCODING: | 349 case ENCODING: |
| 349 url.insert(i->index, input_encoding); | 350 url.insert(i->index, input_encoding); |
| 350 break; | 351 break; |
| 351 | 352 |
| 352 case GOOGLE_ACCEPTED_SUGGESTION: | 353 case GOOGLE_ACCEPTED_SUGGESTION: |
| 353 if (accepted_suggestion == NO_SUGGESTION_CHOSEN) | 354 if (accepted_suggestion == NO_SUGGESTION_CHOSEN) |
| 354 url.insert(i->index, "aq=f&"); | 355 url.insert(i->index, "aq=f&"); |
| 355 else if (accepted_suggestion != NO_SUGGESTIONS_AVAILABLE) | 356 else if (accepted_suggestion != NO_SUGGESTIONS_AVAILABLE) |
| 356 url.insert(i->index, StringPrintf("aq=%d&", accepted_suggestion)); | 357 url.insert(i->index, |
| 358 base::StringPrintf("aq=%d&", accepted_suggestion)); |
| 357 break; | 359 break; |
| 358 | 360 |
| 359 case GOOGLE_BASE_URL: | 361 case GOOGLE_BASE_URL: |
| 360 url.insert(i->index, search_terms_data.GoogleBaseURLValue()); | 362 url.insert(i->index, search_terms_data.GoogleBaseURLValue()); |
| 361 break; | 363 break; |
| 362 | 364 |
| 363 case GOOGLE_BASE_SUGGEST_URL: | 365 case GOOGLE_BASE_SUGGEST_URL: |
| 364 url.insert(i->index, search_terms_data.GoogleBaseSuggestURLValue()); | 366 url.insert(i->index, search_terms_data.GoogleBaseSuggestURLValue()); |
| 365 break; | 367 break; |
| 366 | 368 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 } | 694 } |
| 693 | 695 |
| 694 std::string TemplateURL::GetExtensionId() const { | 696 std::string TemplateURL::GetExtensionId() const { |
| 695 DCHECK(IsExtensionKeyword()); | 697 DCHECK(IsExtensionKeyword()); |
| 696 return GURL(url_.url()).host(); | 698 return GURL(url_.url()).host(); |
| 697 } | 699 } |
| 698 | 700 |
| 699 bool TemplateURL::IsExtensionKeyword() const { | 701 bool TemplateURL::IsExtensionKeyword() const { |
| 700 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme); | 702 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme); |
| 701 } | 703 } |
| OLD | NEW |