| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.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/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/google_url_tracker.h" | 13 #include "chrome/browser/google_url_tracker.h" |
| 14 #include "chrome/browser/search_engines/template_url_model.h" | 14 #include "chrome/browser/search_engines/template_url_model.h" |
| 15 #include "chrome/common/url_constants.h" |
| 15 #include "gfx/favicon_size.h" | 16 #include "gfx/favicon_size.h" |
| 16 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
| 17 | 18 |
| 18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 19 #include "chrome/browser/rlz/rlz.h" | 20 #include "chrome/browser/rlz/rlz.h" |
| 20 #endif | 21 #endif |
| 21 | 22 |
| 22 // The TemplateURLRef has any number of terms that need to be replaced. Each of | 23 // The TemplateURLRef has any number of terms that need to be replaced. Each of |
| 23 // the terms is enclosed in braces. If the character preceeding the final | 24 // the terms is enclosed in braces. If the character preceeding the final |
| 24 // brace is a ?, it indicates the term is optional and can be replaced with | 25 // brace is a ?, it indicates the term is optional and can be replaced with |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 } | 615 } |
| 615 | 616 |
| 616 void TemplateURL::InvalidateCachedValues() const { | 617 void TemplateURL::InvalidateCachedValues() const { |
| 617 url_.InvalidateCachedValues(); | 618 url_.InvalidateCachedValues(); |
| 618 suggestions_url_.InvalidateCachedValues(); | 619 suggestions_url_.InvalidateCachedValues(); |
| 619 if (autogenerate_keyword_) { | 620 if (autogenerate_keyword_) { |
| 620 keyword_.clear(); | 621 keyword_.clear(); |
| 621 keyword_generated_ = false; | 622 keyword_generated_ = false; |
| 622 } | 623 } |
| 623 } | 624 } |
| 625 |
| 626 std::string TemplateURL::GetExtensionId() const { |
| 627 DCHECK(IsExtensionKeyword()); |
| 628 return GURL(WideToUTF8(url_.url())).host(); |
| 629 } |
| 630 |
| 631 bool TemplateURL::IsExtensionKeyword() const { |
| 632 return GURL(WideToUTF8(url_.url())).SchemeIs(chrome::kExtensionScheme); |
| 633 } |
| OLD | NEW |