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

Side by Side Diff: chrome/browser/ui/search/instant_controller.cc

Issue 13963014: Local omnibox treats navsuggest suggestions as queries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 DVLOG(1) << "Waiting for " << (*provider)->GetName(); 585 DVLOG(1) << "Waiting for " << (*provider)->GetName();
586 return; 586 return;
587 } 587 }
588 for (ACMatches::const_iterator match = (*provider)->matches().begin(); 588 for (ACMatches::const_iterator match = (*provider)->matches().begin();
589 match != (*provider)->matches().end(); ++match) { 589 match != (*provider)->matches().end(); ++match) {
590 InstantAutocompleteResult result; 590 InstantAutocompleteResult result;
591 result.provider = UTF8ToUTF16((*provider)->GetName()); 591 result.provider = UTF8ToUTF16((*provider)->GetName());
592 result.type = UTF8ToUTF16(AutocompleteMatch::TypeToString(match->type)); 592 result.type = UTF8ToUTF16(AutocompleteMatch::TypeToString(match->type));
593 result.description = match->description; 593 result.description = match->description;
594 result.destination_url = UTF8ToUTF16(match->destination_url.spec()); 594 result.destination_url = UTF8ToUTF16(match->destination_url.spec());
595 if (from_search_provider) 595
596 // Setting the search_query field tells the Instant page to treat the
597 // suggestion as a query.
598 if (AutocompleteMatch::IsSearchType(match->type))
596 result.search_query = match->contents; 599 result.search_query = match->contents;
600
597 result.transition = match->transition; 601 result.transition = match->transition;
598 result.relevance = match->relevance; 602 result.relevance = match->relevance;
599 DVLOG(1) << " " << result.relevance << " " << result.type << " " 603 DVLOG(1) << " " << result.relevance << " " << result.type << " "
600 << result.provider << " " << result.destination_url << " '" 604 << result.provider << " " << result.destination_url << " '"
601 << result.description << "' '" << result.search_query << "' " 605 << result.description << "' '" << result.search_query << "' "
602 << result.transition; 606 << result.transition;
603 results.push_back(result); 607 results.push_back(result);
604 } 608 }
605 } 609 }
606 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( 610 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf(
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 return false; 1666 return false;
1663 1667
1664 // If this is not window startup, switch. 1668 // If this is not window startup, switch.
1665 // TODO(shishir): This is not completely reliable. Find a better way to detect 1669 // TODO(shishir): This is not completely reliable. Find a better way to detect
1666 // startup time. 1670 // startup time.
1667 if (browser_->GetActiveWebContents()) 1671 if (browser_->GetActiveWebContents())
1668 return true; 1672 return true;
1669 1673
1670 return chrome::IsAggressiveLocalNTPFallbackEnabled(); 1674 return chrome::IsAggressiveLocalNTPFallbackEnabled();
1671 } 1675 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698