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. | |
| 
 
samarth
2013/04/17 00:39:13
nit: this comment isn't very useful.  How about so
 
dougw
2013/04/19 01:11:09
Done.
 
 | |
| 577 if (AutocompleteMatch::IsSearchType(match->type)) | |
| 576 result.search_query = match->contents; | 578 result.search_query = match->contents; | 
| 579 | |
| 577 result.transition = match->transition; | 580 result.transition = match->transition; | 
| 578 result.relevance = match->relevance; | 581 result.relevance = match->relevance; | 
| 579 DVLOG(1) << " " << result.relevance << " " << result.type << " " | 582 DVLOG(1) << " " << result.relevance << " " << result.type << " " | 
| 580 << result.provider << " " << result.destination_url << " '" | 583 << result.provider << " " << result.destination_url << " '" | 
| 581 << result.description << "' '" << result.search_query << "' " | 584 << result.description << "' '" << result.search_query << "' " | 
| 582 << result.transition; | 585 << result.transition; | 
| 583 results.push_back(result); | 586 results.push_back(result); | 
| 584 } | 587 } | 
| 585 } | 588 } | 
| 586 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( | 589 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( | 
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1631 return false; | 1634 return false; | 
| 1632 | 1635 | 
| 1633 // If this is not window startup, switch. | 1636 // If this is not window startup, switch. | 
| 1634 // TODO(shishir): This is not completely reliable. Find a better way to detect | 1637 // TODO(shishir): This is not completely reliable. Find a better way to detect | 
| 1635 // startup time. | 1638 // startup time. | 
| 1636 if (browser_->GetActiveWebContents()) | 1639 if (browser_->GetActiveWebContents()) | 
| 1637 return true; | 1640 return true; | 
| 1638 | 1641 | 
| 1639 return chrome::IsAggressiveLocalNTPFallbackEnabled(); | 1642 return chrome::IsAggressiveLocalNTPFallbackEnabled(); | 
| 1640 } | 1643 } | 
| OLD | NEW |