| 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 DVLOG(1) << "Waiting for " << (*provider)->GetName(); | 610 DVLOG(1) << "Waiting for " << (*provider)->GetName(); |
| 611 return; | 611 return; |
| 612 } | 612 } |
| 613 for (ACMatches::const_iterator match = (*provider)->matches().begin(); | 613 for (ACMatches::const_iterator match = (*provider)->matches().begin(); |
| 614 match != (*provider)->matches().end(); ++match) { | 614 match != (*provider)->matches().end(); ++match) { |
| 615 InstantAutocompleteResult result; | 615 InstantAutocompleteResult result; |
| 616 result.provider = UTF8ToUTF16((*provider)->GetName()); | 616 result.provider = UTF8ToUTF16((*provider)->GetName()); |
| 617 result.type = UTF8ToUTF16(AutocompleteMatch::TypeToString(match->type)); | 617 result.type = UTF8ToUTF16(AutocompleteMatch::TypeToString(match->type)); |
| 618 result.description = match->description; | 618 result.description = match->description; |
| 619 result.destination_url = UTF8ToUTF16(match->destination_url.spec()); | 619 result.destination_url = UTF8ToUTF16(match->destination_url.spec()); |
| 620 if (from_search_provider) | 620 |
| 621 // Setting the search_query field tells the Instant page to treat the |
| 622 // suggestion as a query. |
| 623 if (AutocompleteMatch::IsSearchType(match->type)) |
| 621 result.search_query = match->contents; | 624 result.search_query = match->contents; |
| 625 |
| 622 result.transition = match->transition; | 626 result.transition = match->transition; |
| 623 result.relevance = match->relevance; | 627 result.relevance = match->relevance; |
| 624 DVLOG(1) << " " << result.relevance << " " << result.type << " " | 628 DVLOG(1) << " " << result.relevance << " " << result.type << " " |
| 625 << result.provider << " " << result.destination_url << " '" | 629 << result.provider << " " << result.destination_url << " '" |
| 626 << result.description << "' '" << result.search_query << "' " | 630 << result.description << "' '" << result.search_query << "' " |
| 627 << result.transition; | 631 << result.transition; |
| 628 results.push_back(result); | 632 results.push_back(result); |
| 629 } | 633 } |
| 630 } | 634 } |
| 631 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( | 635 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1712 if (browser_->GetActiveWebContents()) | 1716 if (browser_->GetActiveWebContents()) |
| 1713 return true; | 1717 return true; |
| 1714 | 1718 |
| 1715 return chrome::IsAggressiveLocalNTPFallbackEnabled(); | 1719 return chrome::IsAggressiveLocalNTPFallbackEnabled(); |
| 1716 } | 1720 } |
| 1717 | 1721 |
| 1718 bool InstantController::UsingLocalPage() const { | 1722 bool InstantController::UsingLocalPage() const { |
| 1719 return (instant_tab_ && instant_tab_->IsLocal()) || | 1723 return (instant_tab_ && instant_tab_->IsLocal()) || |
| 1720 (!instant_tab_ && overlay_ && overlay_->IsLocal()); | 1724 (!instant_tab_ && overlay_ && overlay_->IsLocal()); |
| 1721 } | 1725 } |
| OLD | NEW |