| 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/browser_instant_controller.h" | 5 #include "chrome/browser/ui/browser_instant_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 InstantSearchPrerenderer* prerenderer = | 120 InstantSearchPrerenderer* prerenderer = |
| 121 InstantSearchPrerenderer::GetForProfile(profile()); | 121 InstantSearchPrerenderer::GetForProfile(profile()); |
| 122 if (!prerenderer) | 122 if (!prerenderer) |
| 123 return; | 123 return; |
| 124 | 124 |
| 125 if (prerenderer->CanCommitQuery(GetActiveWebContents(), search_terms)) { | 125 if (prerenderer->CanCommitQuery(GetActiveWebContents(), search_terms)) { |
| 126 // Submit query to render the prefetched results. Browser will swap the | 126 // Submit query to render the prefetched results. Browser will swap the |
| 127 // prerendered contents with the active tab contents. | 127 // prerendered contents with the active tab contents. |
| 128 prerenderer->Commit(search_terms, EmbeddedSearchRequestParams(url)); | 128 prerenderer->Commit(EmbeddedSearchRequestParams(url)); |
| 129 } else { | 129 } else { |
| 130 prerenderer->Cancel(); | 130 prerenderer->Cancel(); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 Profile* BrowserInstantController::profile() const { | 134 Profile* BrowserInstantController::profile() const { |
| 135 return browser_->profile(); | 135 return browser_->profile(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 content::WebContents* BrowserInstantController::GetActiveWebContents() const { | 138 content::WebContents* BrowserInstantController::GetActiveWebContents() const { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 params.referrer = content::Referrer(); | 196 params.referrer = content::Referrer(); |
| 197 params.transition_type = ui::PAGE_TRANSITION_RELOAD; | 197 params.transition_type = ui::PAGE_TRANSITION_RELOAD; |
| 198 contents->GetController().LoadURLWithParams(params); | 198 contents->GetController().LoadURLWithParams(params); |
| 199 } else { | 199 } else { |
| 200 // Reload the contents to ensure that it gets assigned to a | 200 // Reload the contents to ensure that it gets assigned to a |
| 201 // non-privileged renderer. | 201 // non-privileged renderer. |
| 202 TabReloader::Reload(contents); | 202 TabReloader::Reload(contents); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 } | 205 } |
| OLD | NEW |