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/autocomplete/autocomplete_controller.h" | 5 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 if ((i->provider->type() == AutocompleteProvider::TYPE_KEYWORD && | 554 if ((i->provider->type() == AutocompleteProvider::TYPE_KEYWORD && |
555 !i->keyword.empty()) || | 555 !i->keyword.empty()) || |
556 (i->provider->type() == AutocompleteProvider::TYPE_SEARCH && | 556 (i->provider->type() == AutocompleteProvider::TYPE_SEARCH && |
557 AutocompleteMatch::IsSearchType(i->type))) { | 557 AutocompleteMatch::IsSearchType(i->type))) { |
558 i->description.clear(); | 558 i->description.clear(); |
559 i->description_class.clear(); | 559 i->description_class.clear(); |
560 DCHECK(!i->keyword.empty()); | 560 DCHECK(!i->keyword.empty()); |
561 if (i->keyword != last_keyword) { | 561 if (i->keyword != last_keyword) { |
562 const TemplateURL* template_url = i->GetTemplateURL(profile_, false); | 562 const TemplateURL* template_url = i->GetTemplateURL(profile_, false); |
563 if (template_url) { | 563 if (template_url) { |
564 i->description = l10n_util::GetStringFUTF16( | 564 // For extension keywords, just make the description the extension |
565 IDS_AUTOCOMPLETE_SEARCH_DESCRIPTION, | 565 // name -- don't assume that the normal search keyword description is |
566 template_url->AdjustedShortNameForLocaleDirection()); | 566 // applicable. |
| 567 i->description = template_url->AdjustedShortNameForLocaleDirection(); |
| 568 if (!template_url->IsExtensionKeyword()) { |
| 569 i->description = l10n_util::GetStringFUTF16( |
| 570 IDS_AUTOCOMPLETE_SEARCH_DESCRIPTION, i->description); |
| 571 } |
567 i->description_class.push_back( | 572 i->description_class.push_back( |
568 ACMatchClassification(0, ACMatchClassification::DIM)); | 573 ACMatchClassification(0, ACMatchClassification::DIM)); |
569 } | 574 } |
570 last_keyword = i->keyword; | 575 last_keyword = i->keyword; |
571 } | 576 } |
572 } else { | 577 } else { |
573 last_keyword.clear(); | 578 last_keyword.clear(); |
574 } | 579 } |
575 } | 580 } |
576 } | 581 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 // it to the edit model / dropdown display code. | 633 // it to the edit model / dropdown display code. |
629 if (!chrome::IsInstantExtendedAPIEnabled() && | 634 if (!chrome::IsInstantExtendedAPIEnabled() && |
630 !chrome::IsInstantEnabled(profile_)) { | 635 !chrome::IsInstantEnabled(profile_)) { |
631 stop_timer_.Start(FROM_HERE, | 636 stop_timer_.Start(FROM_HERE, |
632 base::TimeDelta::FromMilliseconds(kStopTimeMS), | 637 base::TimeDelta::FromMilliseconds(kStopTimeMS), |
633 base::Bind(&AutocompleteController::Stop, | 638 base::Bind(&AutocompleteController::Stop, |
634 base::Unretained(this), | 639 base::Unretained(this), |
635 false)); | 640 false)); |
636 } | 641 } |
637 } | 642 } |
OLD | NEW |