Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/search/instant_controller.h" | 5 #include "chrome/browser/ui/search/instant_controller.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 DVLOG(1) << "Waiting for " << (*provider)->GetName(); | 565 DVLOG(1) << "Waiting for " << (*provider)->GetName(); |
| 566 return; | 566 return; |
| 567 } | 567 } |
| 568 for (ACMatches::const_iterator match = (*provider)->matches().begin(); | 568 for (ACMatches::const_iterator match = (*provider)->matches().begin(); |
| 569 match != (*provider)->matches().end(); ++match) { | 569 match != (*provider)->matches().end(); ++match) { |
| 570 InstantAutocompleteResult result; | 570 InstantAutocompleteResult result; |
| 571 result.provider = UTF8ToUTF16((*provider)->GetName()); | 571 result.provider = UTF8ToUTF16((*provider)->GetName()); |
| 572 result.type = UTF8ToUTF16(AutocompleteMatch::TypeToString(match->type)); | 572 result.type = UTF8ToUTF16(AutocompleteMatch::TypeToString(match->type)); |
| 573 result.description = match->description; | 573 result.description = match->description; |
| 574 result.destination_url = UTF8ToUTF16(match->destination_url.spec()); | 574 result.destination_url = UTF8ToUTF16(match->destination_url.spec()); |
| 575 if (from_search_provider) | 575 |
| 576 // If the search query should be displayed. | |
| 577 if (from_search_provider && | |
| 578 (match->type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || | |
| 579 match->type == AutocompleteMatch::SEARCH_HISTORY || | |
| 580 match->type == AutocompleteMatch::SEARCH_SUGGEST || | |
| 581 match->type == AutocompleteMatch::SEARCH_OTHER_ENGINE)) | |
|
sreeram
2013/04/16 17:28:27
Why not just AutocompleteMatch::IsSearchType()? I
samarth
2013/04/17 00:39:13
Sreeram: do you have any ideas for how to write a
sreeram
2013/04/17 01:29:14
How about something like this:
SetOmniboxText(
dougw
2013/04/19 01:11:09
Done.
dougw
2013/04/19 01:11:09
Done.
dougw
2013/04/22 16:08:53
Done.
| |
| 576 result.search_query = match->contents; | 582 result.search_query = match->contents; |
| 583 | |
| 577 result.transition = match->transition; | 584 result.transition = match->transition; |
| 578 result.relevance = match->relevance; | 585 result.relevance = match->relevance; |
| 579 DVLOG(1) << " " << result.relevance << " " << result.type << " " | 586 DVLOG(1) << " " << result.relevance << " " << result.type << " " |
| 580 << result.provider << " " << result.destination_url << " '" | 587 << result.provider << " " << result.destination_url << " '" |
| 581 << result.description << "' '" << result.search_query << "' " | 588 << result.description << "' '" << result.search_query << "' " |
| 582 << result.transition; | 589 << result.transition; |
| 583 results.push_back(result); | 590 results.push_back(result); |
| 584 } | 591 } |
| 585 } | 592 } |
| 586 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( | 593 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1631 return false; | 1638 return false; |
| 1632 | 1639 |
| 1633 // If this is not window startup, switch. | 1640 // If this is not window startup, switch. |
| 1634 // TODO(shishir): This is not completely reliable. Find a better way to detect | 1641 // TODO(shishir): This is not completely reliable. Find a better way to detect |
| 1635 // startup time. | 1642 // startup time. |
| 1636 if (browser_->GetActiveWebContents()) | 1643 if (browser_->GetActiveWebContents()) |
| 1637 return true; | 1644 return true; |
| 1638 | 1645 |
| 1639 return chrome::IsAggressiveLocalNTPFallbackEnabled(); | 1646 return chrome::IsAggressiveLocalNTPFallbackEnabled(); |
| 1640 } | 1647 } |
| OLD | NEW |