OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/i18n/case_conversion.h" | 8 #include "base/i18n/case_conversion.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 return false; | 194 return false; |
195 } | 195 } |
196 | 196 |
197 std::string instant_url; | 197 std::string instant_url; |
198 Profile* profile = active_tab->profile(); | 198 Profile* profile = active_tab->profile(); |
199 | 199 |
200 // If the match's TemplateURL is valid, it's a search query; use it. If it's | 200 // If the match's TemplateURL is valid, it's a search query; use it. If it's |
201 // not valid, it's likely a URL; in EXTENDED mode, try using the default | 201 // not valid, it's likely a URL; in EXTENDED mode, try using the default |
202 // search engine's TemplateURL instead. | 202 // search engine's TemplateURL instead. |
203 const GURL& tab_url = active_tab->web_contents()->GetURL(); | 203 const GURL& tab_url = active_tab->web_contents()->GetURL(); |
204 if (GetInstantURL(match.GetTemplateURL(profile), tab_url, &instant_url)) { | 204 if (GetInstantURL(match.GetTemplateURL(profile, false), tab_url, |
| 205 &instant_url)) { |
205 ResetLoader(instant_url, active_tab); | 206 ResetLoader(instant_url, active_tab); |
206 } else if (mode_ != EXTENDED || !CreateDefaultLoader()) { | 207 } else if (mode_ != EXTENDED || !CreateDefaultLoader()) { |
207 Hide(); | 208 Hide(); |
208 return false; | 209 return false; |
209 } | 210 } |
210 | 211 |
211 if (full_text.empty()) { | 212 if (full_text.empty()) { |
212 Hide(); | 213 Hide(); |
213 return false; | 214 return false; |
214 } | 215 } |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 iter->second > kMaxInstantSupportFailures) | 816 iter->second > kMaxInstantSupportFailures) |
816 return false; | 817 return false; |
817 | 818 |
818 return true; | 819 return true; |
819 } | 820 } |
820 | 821 |
821 bool InstantController::IsOutOfDate() const { | 822 bool InstantController::IsOutOfDate() const { |
822 return !last_active_tab_ || | 823 return !last_active_tab_ || |
823 last_active_tab_ != browser_->GetActiveTabContents(); | 824 last_active_tab_ != browser_->GetActiveTabContents(); |
824 } | 825 } |
OLD | NEW |