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

Side by Side Diff: chrome/browser/search_engines/template_url.cc

Issue 6322001: Remove wstring from TemplateURL and friends.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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 "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/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 } 256 }
257 257
258 // static 258 // static
259 void TemplateURLRef::SetGoogleBaseURL(std::string* google_base_url) { 259 void TemplateURLRef::SetGoogleBaseURL(std::string* google_base_url) {
260 UIThreadSearchTermsData::SetGoogleBaseURL(google_base_url); 260 UIThreadSearchTermsData::SetGoogleBaseURL(google_base_url);
261 } 261 }
262 262
263 std::string TemplateURLRef::ReplaceSearchTerms( 263 std::string TemplateURLRef::ReplaceSearchTerms(
264 const TemplateURL& host, 264 const TemplateURL& host,
265 const std::wstring& terms, 265 const string16& terms,
266 int accepted_suggestion, 266 int accepted_suggestion,
267 const std::wstring& original_query_for_suggestion) const { 267 const string16& original_query_for_suggestion) const {
268 UIThreadSearchTermsData search_terms_data; 268 UIThreadSearchTermsData search_terms_data;
269 return ReplaceSearchTermsUsingTermsData(host, 269 return ReplaceSearchTermsUsingTermsData(host,
270 terms, 270 terms,
271 accepted_suggestion, 271 accepted_suggestion,
272 original_query_for_suggestion, 272 original_query_for_suggestion,
273 search_terms_data); 273 search_terms_data);
274 } 274 }
275 275
276 std::string TemplateURLRef::ReplaceSearchTermsUsingTermsData( 276 std::string TemplateURLRef::ReplaceSearchTermsUsingTermsData(
277 const TemplateURL& host, 277 const TemplateURL& host,
278 const std::wstring& terms, 278 const string16& terms,
279 int accepted_suggestion, 279 int accepted_suggestion,
280 const std::wstring& original_query_for_suggestion, 280 const string16& original_query_for_suggestion,
281 const SearchTermsData& search_terms_data) const { 281 const SearchTermsData& search_terms_data) const {
282 ParseIfNecessaryUsingTermsData(search_terms_data); 282 ParseIfNecessaryUsingTermsData(search_terms_data);
283 if (!valid_) 283 if (!valid_)
284 return std::string(); 284 return std::string();
285 285
286 if (replacements_.empty()) 286 if (replacements_.empty())
287 return parsed_url_; 287 return parsed_url_;
288 288
289 // Determine if the search terms are in the query or before. We're escaping 289 // Determine if the search terms are in the query or before. We're escaping
290 // space as '+' in the former case and as '%20' in the latter case. 290 // space as '+' in the former case and as '%20' in the latter case.
291 bool is_in_query = true; 291 bool is_in_query = true;
292 for (Replacements::iterator i = replacements_.begin(); 292 for (Replacements::iterator i = replacements_.begin();
293 i != replacements_.end(); ++i) { 293 i != replacements_.end(); ++i) {
294 if (i->type == SEARCH_TERMS) { 294 if (i->type == SEARCH_TERMS) {
295 std::wstring::size_type query_start = parsed_url_.find('?'); 295 string16::size_type query_start = parsed_url_.find('?');
296 is_in_query = query_start != std::wstring::npos && 296 is_in_query = query_start != string16::npos &&
297 (static_cast<std::wstring::size_type>(i->index) > query_start); 297 (static_cast<string16::size_type>(i->index) > query_start);
298 break; 298 break;
299 } 299 }
300 } 300 }
301 301
302 string16 encoded_terms; 302 string16 encoded_terms;
303 string16 encoded_original_query; 303 string16 encoded_original_query;
304 std::string input_encoding; 304 std::string input_encoding;
305 // If the search terms are in query - escape them respecting the encoding. 305 // If the search terms are in query - escape them respecting the encoding.
306 if (is_in_query) { 306 if (is_in_query) {
307 // Encode the search terms so that we know the encoding. 307 // Encode the search terms so that we know the encoding.
308 const std::vector<std::string>& encodings = host.input_encodings(); 308 const std::vector<std::string>& encodings = host.input_encodings();
309 for (size_t i = 0; i < encodings.size(); ++i) { 309 for (size_t i = 0; i < encodings.size(); ++i) {
310 if (EscapeQueryParamValue(WideToUTF16Hack(terms), 310 if (EscapeQueryParamValue(terms,
311 encodings[i].c_str(), true, 311 encodings[i].c_str(), true,
312 &encoded_terms)) { 312 &encoded_terms)) {
313 if (!original_query_for_suggestion.empty()) { 313 if (!original_query_for_suggestion.empty()) {
314 EscapeQueryParamValue(WideToUTF16Hack(original_query_for_suggestion), 314 EscapeQueryParamValue(original_query_for_suggestion,
315 encodings[i].c_str(), 315 encodings[i].c_str(),
316 true, 316 true,
317 &encoded_original_query); 317 &encoded_original_query);
318 } 318 }
319 input_encoding = encodings[i]; 319 input_encoding = encodings[i];
320 break; 320 break;
321 } 321 }
322 } 322 }
323 if (input_encoding.empty()) { 323 if (input_encoding.empty()) {
324 encoded_terms = WideToUTF16Hack( 324 encoded_terms = EscapeQueryParamValueUTF8(terms, true);
325 EscapeQueryParamValueUTF8(terms, true));
326 if (!original_query_for_suggestion.empty()) { 325 if (!original_query_for_suggestion.empty()) {
327 encoded_original_query = 326 encoded_original_query =
328 WideToUTF16Hack(EscapeQueryParamValueUTF8( 327 EscapeQueryParamValueUTF8(original_query_for_suggestion, true);
329 original_query_for_suggestion, true));
330 } 328 }
331 input_encoding = "UTF-8"; 329 input_encoding = "UTF-8";
332 } 330 }
333 } else { 331 } else {
334 encoded_terms = WideToUTF16Hack(UTF8ToWide(EscapePath(WideToUTF8(terms)))); 332 encoded_terms = UTF8ToUTF16(EscapePath(UTF16ToUTF8(terms)));
335 input_encoding = "UTF-8"; 333 input_encoding = "UTF-8";
336 } 334 }
337 335
338 std::string url = parsed_url_; 336 std::string url = parsed_url_;
339 337
340 // replacements_ is ordered in ascending order, as such we need to iterate 338 // replacements_ is ordered in ascending order, as such we need to iterate
341 // from the back. 339 // from the back.
342 for (Replacements::reverse_iterator i = replacements_.rbegin(); 340 for (Replacements::reverse_iterator i = replacements_.rbegin();
343 i != replacements_.rend(); ++i) { 341 i != replacements_.rend(); ++i) {
344 switch (i->type) { 342 switch (i->type) {
(...skipping 21 matching lines...) Expand all
366 url.insert(i->index, "oq=" + UTF16ToUTF8(encoded_original_query) + 364 url.insert(i->index, "oq=" + UTF16ToUTF8(encoded_original_query) +
367 "&"); 365 "&");
368 break; 366 break;
369 367
370 case GOOGLE_RLZ: { 368 case GOOGLE_RLZ: {
371 // On platforms that don't have RLZ, we still want this branch 369 // On platforms that don't have RLZ, we still want this branch
372 // to happen so that we replace the RLZ template with the 370 // to happen so that we replace the RLZ template with the
373 // empty string. (If we don't handle this case, we hit a 371 // empty string. (If we don't handle this case, we hit a
374 // NOTREACHED below.) 372 // NOTREACHED below.)
375 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) 373 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
376 std::wstring rlz_string = search_terms_data.GetRlzParameterValue(); 374 string16 rlz_string = search_terms_data.GetRlzParameterValue();
377 if (!rlz_string.empty()) { 375 if (!rlz_string.empty()) {
378 rlz_string = L"rlz=" + rlz_string + L"&"; 376 rlz_string = L"rlz=" + rlz_string + L"&";
379 url.insert(i->index, WideToUTF8(rlz_string)); 377 url.insert(i->index, UTF16ToUTF8(rlz_string));
380 } 378 }
381 #endif 379 #endif
382 break; 380 break;
383 } 381 }
384 382
385 case GOOGLE_UNESCAPED_SEARCH_TERMS: { 383 case GOOGLE_UNESCAPED_SEARCH_TERMS: {
386 std::string unescaped_terms; 384 std::string unescaped_terms;
387 base::WideToCodepage(terms, input_encoding.c_str(), 385 base::UTF16ToCodepage(terms, input_encoding.c_str(),
388 base::OnStringConversionError::SKIP, 386 base::OnStringConversionError::SKIP,
389 &unescaped_terms); 387 &unescaped_terms);
390 url.insert(i->index, std::string(unescaped_terms.begin(), 388 url.insert(i->index, std::string(unescaped_terms.begin(),
391 unescaped_terms.end())); 389 unescaped_terms.end()));
392 break; 390 break;
393 } 391 }
394 392
395 case LANGUAGE: 393 case LANGUAGE:
396 url.insert(i->index, search_terms_data.GetApplicationLocale()); 394 url.insert(i->index, search_terms_data.GetApplicationLocale());
397 break; 395 break;
398 396
399 case SEARCH_TERMS: 397 case SEARCH_TERMS:
(...skipping 24 matching lines...) Expand all
424 UIThreadSearchTermsData search_terms_data; 422 UIThreadSearchTermsData search_terms_data;
425 return IsValidUsingTermsData(search_terms_data); 423 return IsValidUsingTermsData(search_terms_data);
426 } 424 }
427 425
428 bool TemplateURLRef::IsValidUsingTermsData( 426 bool TemplateURLRef::IsValidUsingTermsData(
429 const SearchTermsData& search_terms_data) const { 427 const SearchTermsData& search_terms_data) const {
430 ParseIfNecessaryUsingTermsData(search_terms_data); 428 ParseIfNecessaryUsingTermsData(search_terms_data);
431 return valid_; 429 return valid_;
432 } 430 }
433 431
434 std::wstring TemplateURLRef::DisplayURL() const { 432 string16 TemplateURLRef::DisplayURL() const {
435 ParseIfNecessary(); 433 ParseIfNecessary();
436 if (!valid_ || replacements_.empty()) 434 if (!valid_ || replacements_.empty())
437 return UTF8ToWide(url_); 435 return UTF8ToUTF16(url_);
438 436
439 string16 result = UTF8ToUTF16(url_); 437 string16 result = UTF8ToUTF16(url_);
440 ReplaceSubstringsAfterOffset(&result, 0, 438 ReplaceSubstringsAfterOffset(&result, 0,
441 ASCIIToUTF16(kSearchTermsParameterFull), 439 ASCIIToUTF16(kSearchTermsParameterFull),
442 ASCIIToUTF16(kDisplaySearchTerms)); 440 ASCIIToUTF16(kDisplaySearchTerms));
443 441
444 ReplaceSubstringsAfterOffset( 442 ReplaceSubstringsAfterOffset(
445 &result, 0, 443 &result, 0,
446 ASCIIToUTF16(kGoogleUnescapedSearchTermsParameterFull), 444 ASCIIToUTF16(kGoogleUnescapedSearchTermsParameterFull),
447 ASCIIToUTF16(kDisplayUnescapedSearchTerms)); 445 ASCIIToUTF16(kDisplayUnescapedSearchTerms));
448 446
449 return UTF16ToWideHack(result); 447 return result;
450 } 448 }
451 449
452 // static 450 // static
453 std::string TemplateURLRef::DisplayURLToURLRef( 451 std::string TemplateURLRef::DisplayURLToURLRef(
454 const std::wstring& display_url) { 452 const string16& display_url) {
455 string16 result = WideToUTF16Hack(display_url); 453 string16 result = display_url;
456 ReplaceSubstringsAfterOffset(&result, 0, ASCIIToUTF16(kDisplaySearchTerms), 454 ReplaceSubstringsAfterOffset(&result, 0, ASCIIToUTF16(kDisplaySearchTerms),
457 ASCIIToUTF16(kSearchTermsParameterFull)); 455 ASCIIToUTF16(kSearchTermsParameterFull));
458 ReplaceSubstringsAfterOffset( 456 ReplaceSubstringsAfterOffset(
459 &result, 0, 457 &result, 0,
460 ASCIIToUTF16(kDisplayUnescapedSearchTerms), 458 ASCIIToUTF16(kDisplayUnescapedSearchTerms),
461 ASCIIToUTF16(kGoogleUnescapedSearchTermsParameterFull)); 459 ASCIIToUTF16(kGoogleUnescapedSearchTermsParameterFull));
462 return UTF16ToUTF8(result); 460 return UTF16ToUTF8(result);
463 } 461 }
464 462
465 const std::string& TemplateURLRef::GetHost() const { 463 const std::string& TemplateURLRef::GetHost() const {
466 ParseIfNecessary(); 464 ParseIfNecessary();
467 return host_; 465 return host_;
468 } 466 }
469 467
470 const std::string& TemplateURLRef::GetPath() const { 468 const std::string& TemplateURLRef::GetPath() const {
471 ParseIfNecessary(); 469 ParseIfNecessary();
472 return path_; 470 return path_;
473 } 471 }
474 472
475 const std::string& TemplateURLRef::GetSearchTermKey() const { 473 const std::string& TemplateURLRef::GetSearchTermKey() const {
476 ParseIfNecessary(); 474 ParseIfNecessary();
477 return search_term_key_; 475 return search_term_key_;
478 } 476 }
479 477
480 std::wstring TemplateURLRef::SearchTermToWide(const TemplateURL& host, 478 string16 TemplateURLRef::SearchTermToString16(const TemplateURL& host,
481 const std::string& term) const { 479 const std::string& term) const {
482 const std::vector<std::string>& encodings = host.input_encodings(); 480 const std::vector<std::string>& encodings = host.input_encodings();
483 std::wstring result; 481 string16 result;
484 482
485 std::string unescaped = 483 std::string unescaped =
486 UnescapeURLComponent(term, UnescapeRule::REPLACE_PLUS_WITH_SPACE | 484 UnescapeURLComponent(term, UnescapeRule::REPLACE_PLUS_WITH_SPACE |
487 UnescapeRule::URL_SPECIAL_CHARS); 485 UnescapeRule::URL_SPECIAL_CHARS);
488 for (size_t i = 0; i < encodings.size(); ++i) { 486 for (size_t i = 0; i < encodings.size(); ++i) {
489 if (base::CodepageToWide(unescaped, encodings[i].c_str(), 487 if (base::CodepageToUTF16(unescaped, encodings[i].c_str(),
490 base::OnStringConversionError::FAIL, &result)) 488 base::OnStringConversionError::FAIL, &result))
491 return result; 489 return result;
492 } 490 }
493 491
494 // Always fall back on UTF-8 if it works. 492 // Always fall back on UTF-8 if it works.
495 if (base::CodepageToWide(unescaped, base::kCodepageUTF8, 493 if (base::CodepageToUTF16(unescaped, base::kCodepageUTF8,
496 base::OnStringConversionError::FAIL, &result)) 494 base::OnStringConversionError::FAIL, &result))
497 return result; 495 return result;
498 496
499 // When nothing worked, just use the escaped text. We have no idea what the 497 // When nothing worked, just use the escaped text. We have no idea what the
500 // encoding is. We need to substitute spaces for pluses ourselves since we're 498 // encoding is. We need to substitute spaces for pluses ourselves since we're
501 // not sending it through an unescaper. 499 // not sending it through an unescaper.
502 result = UTF8ToWide(term); 500 result = UTF8ToUTF16(term);
503 std::replace(result.begin(), result.end(), '+', ' '); 501 std::replace(result.begin(), result.end(), '+', ' ');
504 return result; 502 return result;
505 } 503 }
506 504
507 bool TemplateURLRef::HasGoogleBaseURLs() const { 505 bool TemplateURLRef::HasGoogleBaseURLs() const {
508 ParseIfNecessary(); 506 ParseIfNecessary();
509 for (size_t i = 0; i < replacements_.size(); ++i) { 507 for (size_t i = 0; i < replacements_.size(); ++i) {
510 if ((replacements_[i].type == GOOGLE_BASE_URL) || 508 if ((replacements_[i].type == GOOGLE_BASE_URL) ||
511 (replacements_[i].type == GOOGLE_BASE_SUGGEST_URL)) 509 (replacements_[i].type == GOOGLE_BASE_SUGGEST_URL))
512 return true; 510 return true;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 created_by_policy_(false), 568 created_by_policy_(false),
571 usage_count_(0), 569 usage_count_(0),
572 search_engine_type_(SEARCH_ENGINE_OTHER), 570 search_engine_type_(SEARCH_ENGINE_OTHER),
573 logo_id_(kNoSearchEngineLogo), 571 logo_id_(kNoSearchEngineLogo),
574 prepopulate_id_(0) { 572 prepopulate_id_(0) {
575 } 573 }
576 574
577 TemplateURL::~TemplateURL() { 575 TemplateURL::~TemplateURL() {
578 } 576 }
579 577
580 std::wstring TemplateURL::AdjustedShortNameForLocaleDirection() const { 578 string16 TemplateURL::AdjustedShortNameForLocaleDirection() const {
581 std::wstring bidi_safe_short_name = short_name_; 579 string16 bidi_safe_short_name = short_name_;
582 base::i18n::AdjustStringForLocaleDirection(&bidi_safe_short_name); 580 base::i18n::AdjustStringForLocaleDirection(&bidi_safe_short_name);
583 return bidi_safe_short_name; 581 return bidi_safe_short_name;
584 } 582 }
585 583
586 void TemplateURL::SetSuggestionsURL(const std::string& suggestions_url, 584 void TemplateURL::SetSuggestionsURL(const std::string& suggestions_url,
587 int index_offset, 585 int index_offset,
588 int page_offset) { 586 int page_offset) {
589 suggestions_url_.Set(suggestions_url, index_offset, page_offset); 587 suggestions_url_.Set(suggestions_url, index_offset, page_offset);
590 } 588 }
591 589
592 void TemplateURL::SetURL(const std::string& url, 590 void TemplateURL::SetURL(const std::string& url,
593 int index_offset, 591 int index_offset,
594 int page_offset) { 592 int page_offset) {
595 url_.Set(url, index_offset, page_offset); 593 url_.Set(url, index_offset, page_offset);
596 } 594 }
597 595
598 void TemplateURL::SetInstantURL(const std::string& url, 596 void TemplateURL::SetInstantURL(const std::string& url,
599 int index_offset, 597 int index_offset,
600 int page_offset) { 598 int page_offset) {
601 instant_url_.Set(url, index_offset, page_offset); 599 instant_url_.Set(url, index_offset, page_offset);
602 } 600 }
603 601
604 void TemplateURL::set_keyword(const std::wstring& keyword) { 602 void TemplateURL::set_keyword(const string16& keyword) {
605 // Case sensitive keyword matching is confusing. As such, we force all 603 // Case sensitive keyword matching is confusing. As such, we force all
606 // keywords to be lower case. 604 // keywords to be lower case.
607 keyword_ = UTF16ToWide(l10n_util::ToLower(WideToUTF16(keyword))); 605 keyword_ = l10n_util::ToLower(keyword);
608 autogenerate_keyword_ = false; 606 autogenerate_keyword_ = false;
609 } 607 }
610 608
611 const std::wstring& TemplateURL::keyword() const { 609 string16 TemplateURL::keyword() const {
612 EnsureKeyword(); 610 EnsureKeyword();
613 return keyword_; 611 return keyword_;
614 } 612 }
615 613
616 void TemplateURL::EnsureKeyword() const { 614 void TemplateURL::EnsureKeyword() const {
617 if (autogenerate_keyword_ && !keyword_generated_) { 615 if (autogenerate_keyword_ && !keyword_generated_) {
618 // Generate a keyword and cache it. 616 // Generate a keyword and cache it.
619 keyword_ = TemplateURLModel::GenerateKeyword( 617 keyword_ = TemplateURLModel::GenerateKeyword(
620 TemplateURLModel::GenerateSearchURL(this).GetWithEmptyPath(), true); 618 TemplateURLModel::GenerateSearchURL(this).GetWithEmptyPath(), true);
621 keyword_generated_ = true; 619 keyword_generated_ = true;
622 } 620 }
623 } 621 }
624 622
625 bool TemplateURL::ShowInDefaultList() const { 623 bool TemplateURL::ShowInDefaultList() const {
626 return show_in_default_list() && url() && url()->SupportsReplacement(); 624 return show_in_default_list() && url() && url()->SupportsReplacement();
627 } 625 }
628 626
629 void TemplateURL::SetFavIconURL(const GURL& url) { 627 void TemplateURL::SetFavIconURL(const GURL& url) {
630 for (std::vector<ImageRef>::iterator i = image_refs_.begin(); 628 for (std::vector<ImageRef>::iterator i = image_refs_.begin();
631 i != image_refs_.end(); ++i) { 629 i != image_refs_.end(); ++i) {
632 if (i->type == L"image/x-icon" && 630 if (i->type == "image/x-icon" &&
633 i->width == kFavIconSize && i->height == kFavIconSize) { 631 i->width == kFavIconSize && i->height == kFavIconSize) {
634 if (!url.is_valid()) 632 if (!url.is_valid())
635 image_refs_.erase(i); 633 image_refs_.erase(i);
636 else 634 else
637 i->url = url; 635 i->url = url;
638 return; 636 return;
639 } 637 }
640 } 638 }
641 // Don't have one yet, add it. 639 // Don't have one yet, add it.
642 if (url.is_valid()) { 640 if (url.is_valid()) {
643 add_image_ref( 641 add_image_ref(
644 TemplateURL::ImageRef(L"image/x-icon", kFavIconSize, kFavIconSize, 642 TemplateURL::ImageRef("image/x-icon", kFavIconSize,
645 url)); 643 kFavIconSize, url));
646 } 644 }
647 } 645 }
648 646
649 GURL TemplateURL::GetFavIconURL() const { 647 GURL TemplateURL::GetFavIconURL() const {
650 for (std::vector<ImageRef>::const_iterator i = image_refs_.begin(); 648 for (std::vector<ImageRef>::const_iterator i = image_refs_.begin();
651 i != image_refs_.end(); ++i) { 649 i != image_refs_.end(); ++i) {
652 if ((i->type == L"image/x-icon" || i->type == L"image/vnd.microsoft.icon") 650 if ((i->type == "image/x-icon" || i->type == "image/vnd.microsoft.icon")
653 && i->width == kFavIconSize && i->height == kFavIconSize) { 651 && i->width == kFavIconSize && i->height == kFavIconSize) {
654 return i->url; 652 return i->url;
655 } 653 }
656 } 654 }
657 return GURL(); 655 return GURL();
658 } 656 }
659 657
660 void TemplateURL::InvalidateCachedValues() const { 658 void TemplateURL::InvalidateCachedValues() const {
661 url_.InvalidateCachedValues(); 659 url_.InvalidateCachedValues();
662 suggestions_url_.InvalidateCachedValues(); 660 suggestions_url_.InvalidateCachedValues();
663 if (autogenerate_keyword_) { 661 if (autogenerate_keyword_) {
664 keyword_.clear(); 662 keyword_.clear();
665 keyword_generated_ = false; 663 keyword_generated_ = false;
666 } 664 }
667 } 665 }
668 666
669 std::string TemplateURL::GetExtensionId() const { 667 std::string TemplateURL::GetExtensionId() const {
670 DCHECK(IsExtensionKeyword()); 668 DCHECK(IsExtensionKeyword());
671 return GURL(url_.url()).host(); 669 return GURL(url_.url()).host();
672 } 670 }
673 671
674 bool TemplateURL::IsExtensionKeyword() const { 672 bool TemplateURL::IsExtensionKeyword() const {
675 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme); 673 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme);
676 } 674 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url.h ('k') | chrome/browser/search_engines/template_url_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698