| 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 "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/search/instant_service.h" | 10 #include "chrome/browser/search/instant_service.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 browser_->search_model()->RemoveObserver(this); | 99 browser_->search_model()->RemoveObserver(this); |
| 100 | 100 |
| 101 InstantService* instant_service = | 101 InstantService* instant_service = |
| 102 InstantServiceFactory::GetForProfile(profile()); | 102 InstantServiceFactory::GetForProfile(profile()); |
| 103 instant_service->RemoveObserver(this); | 103 instant_service->RemoveObserver(this); |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition, | 106 bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition, |
| 107 const GURL& url) { | 107 const GURL& url) { |
| 108 // Unsupported dispositions. | 108 // Unsupported dispositions. |
| 109 if (disposition == NEW_BACKGROUND_TAB || disposition == NEW_WINDOW || | 109 if (disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB || |
| 110 disposition == NEW_FOREGROUND_TAB) | 110 disposition == WindowOpenDisposition::NEW_WINDOW || |
| 111 disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB) |
| 111 return false; | 112 return false; |
| 112 | 113 |
| 113 // The omnibox currently doesn't use other dispositions, so we don't attempt | 114 // The omnibox currently doesn't use other dispositions, so we don't attempt |
| 114 // to handle them. If you hit this DCHECK file a bug and I'll (sky) add | 115 // to handle them. If you hit this DCHECK file a bug and I'll (sky) add |
| 115 // support for the new disposition. | 116 // support for the new disposition. |
| 116 DCHECK(disposition == CURRENT_TAB) << disposition; | 117 DCHECK(disposition == WindowOpenDisposition::CURRENT_TAB) |
| 118 << static_cast<int>(disposition); |
| 117 | 119 |
| 118 const base::string16& search_terms = | 120 const base::string16& search_terms = |
| 119 search::ExtractSearchTermsFromURL(profile(), url); | 121 search::ExtractSearchTermsFromURL(profile(), url); |
| 120 EmbeddedSearchRequestParams request_params(url); | 122 EmbeddedSearchRequestParams request_params(url); |
| 121 if (search_terms.empty()) | 123 if (search_terms.empty()) |
| 122 return false; | 124 return false; |
| 123 | 125 |
| 124 InstantSearchPrerenderer* prerenderer = | 126 InstantSearchPrerenderer* prerenderer = |
| 125 GetInstantSearchPrerenderer(profile()); | 127 GetInstantSearchPrerenderer(profile()); |
| 126 if (prerenderer) { | 128 if (prerenderer) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 params.referrer = content::Referrer(); | 213 params.referrer = content::Referrer(); |
| 212 params.transition_type = ui::PAGE_TRANSITION_RELOAD; | 214 params.transition_type = ui::PAGE_TRANSITION_RELOAD; |
| 213 contents->GetController().LoadURLWithParams(params); | 215 contents->GetController().LoadURLWithParams(params); |
| 214 } else { | 216 } else { |
| 215 // Reload the contents to ensure that it gets assigned to a | 217 // Reload the contents to ensure that it gets assigned to a |
| 216 // non-privileged renderer. | 218 // non-privileged renderer. |
| 217 TabReloader::Reload(contents); | 219 TabReloader::Reload(contents); |
| 218 } | 220 } |
| 219 } | 221 } |
| 220 } | 222 } |
| OLD | NEW |