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

Side by Side Diff: chrome/browser/instant/instant_controller.cc

Issue 11466007: Add new IPC for searchbox to pipe SearchBox NavigateContentWindow calls to the browser. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Minor build fix for some platforms. Created 8 years 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
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/instant/instant_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 std::vector<InstantAutocompleteResult> results; 380 std::vector<InstantAutocompleteResult> results;
381 for (ACProviders::const_iterator provider = providers.begin(); 381 for (ACProviders::const_iterator provider = providers.begin();
382 provider != providers.end(); ++provider) { 382 provider != providers.end(); ++provider) {
383 for (ACMatches::const_iterator match = (*provider)->matches().begin(); 383 for (ACMatches::const_iterator match = (*provider)->matches().begin();
384 match != (*provider)->matches().end(); ++match) { 384 match != (*provider)->matches().end(); ++match) {
385 InstantAutocompleteResult result; 385 InstantAutocompleteResult result;
386 result.provider = UTF8ToUTF16((*provider)->GetName()); 386 result.provider = UTF8ToUTF16((*provider)->GetName());
387 result.type = UTF8ToUTF16(AutocompleteMatch::TypeToString(match->type)); 387 result.type = UTF8ToUTF16(AutocompleteMatch::TypeToString(match->type));
388 result.description = match->description; 388 result.description = match->description;
389 result.destination_url = UTF8ToUTF16(match->destination_url.spec()); 389 result.destination_url = UTF8ToUTF16(match->destination_url.spec());
390 result.transition = match->transition;
390 result.relevance = match->relevance; 391 result.relevance = match->relevance;
391 DVLOG(1) << " " << result.relevance << " " << result.type << " " 392 DVLOG(1) << " " << result.relevance << " " << result.type << " "
392 << result.provider << " " << result.destination_url << " '" 393 << result.provider << " " << result.destination_url << " '"
393 << result.description << "'"; 394 << result.description << "'";
394 results.push_back(result); 395 results.push_back(result);
395 } 396 }
396 } 397 }
397 398
398 if (instant_tab_) 399 if (instant_tab_)
399 instant_tab_->SendAutocompleteResults(results); 400 instant_tab_->SendAutocompleteResults(results);
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 HideLoader(); 829 HideLoader();
829 #else 830 #else
830 if (IsViewInContents(GetViewGainingFocus(view_gaining_focus), 831 if (IsViewInContents(GetViewGainingFocus(view_gaining_focus),
831 loader_->contents())) 832 loader_->contents()))
832 CommitIfPossible(INSTANT_COMMIT_FOCUS_LOST); 833 CommitIfPossible(INSTANT_COMMIT_FOCUS_LOST);
833 else 834 else
834 HideLoader(); 835 HideLoader();
835 #endif 836 #endif
836 } 837 }
837 838
839 void InstantController::NavigateToURL(const GURL& url,
840 content::PageTransition transition) {
841 if (!extended_enabled_)
842 return;
843 HideLoader();
844 browser_->OpenURLInCurrentTab(url, transition);
845 }
846
838 bool InstantController::ResetLoader(const TemplateURL* template_url, 847 bool InstantController::ResetLoader(const TemplateURL* template_url,
839 const content::WebContents* active_tab) { 848 const content::WebContents* active_tab) {
840 std::string instant_url; 849 std::string instant_url;
841 if (!GetInstantURL(template_url, &instant_url)) 850 if (!GetInstantURL(template_url, &instant_url))
842 return false; 851 return false;
843 852
844 if (loader_ && loader_->instant_url() == instant_url) 853 if (loader_ && loader_->instant_url() == instant_url)
845 return true; 854 return true;
846 855
847 HideInternal(); 856 HideInternal();
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 } 1084 }
1076 1085
1077 std::map<std::string, int>::const_iterator iter = 1086 std::map<std::string, int>::const_iterator iter =
1078 blacklisted_urls_.find(*instant_url); 1087 blacklisted_urls_.find(*instant_url);
1079 if (iter != blacklisted_urls_.end() && 1088 if (iter != blacklisted_urls_.end() &&
1080 iter->second > kMaxInstantSupportFailures) 1089 iter->second > kMaxInstantSupportFailures)
1081 return false; 1090 return false;
1082 1091
1083 return true; 1092 return true;
1084 } 1093 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698