| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 instant_.ActiveTabChanged(); | 143 instant_.ActiveTabChanged(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void BrowserInstantController::TabDeactivated(content::WebContents* contents) { | 146 void BrowserInstantController::TabDeactivated(content::WebContents* contents) { |
| 147 InstantSearchPrerenderer* prerenderer = | 147 InstantSearchPrerenderer* prerenderer = |
| 148 InstantSearchPrerenderer::GetForProfile(profile()); | 148 InstantSearchPrerenderer::GetForProfile(profile()); |
| 149 if (prerenderer) | 149 if (prerenderer) |
| 150 prerenderer->Cancel(); | 150 prerenderer->Cancel(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void BrowserInstantController::ModelChanged( | 153 void BrowserInstantController::ModelChanged(const SearchMode& old_mode, |
| 154 const SearchModel::State& old_state, | 154 const SearchMode& new_mode) { |
| 155 const SearchModel::State& new_state) { | 155 // Record some actions corresponding to the mode change. Note that to get |
| 156 if (old_state.mode != new_state.mode) { | 156 // the full story, it's necessary to look at other UMA actions as well, |
| 157 const SearchMode& new_mode = new_state.mode; | 157 // such as tab switches. |
| 158 if (new_mode.is_ntp()) |
| 159 base::RecordAction(base::UserMetricsAction("InstantExtended.ShowNTP")); |
| 158 | 160 |
| 159 // Record some actions corresponding to the mode change. Note that to get | 161 instant_.SearchModeChanged(old_mode, new_mode); |
| 160 // the full story, it's necessary to look at other UMA actions as well, | |
| 161 // such as tab switches. | |
| 162 if (new_mode.is_ntp()) | |
| 163 base::RecordAction(base::UserMetricsAction("InstantExtended.ShowNTP")); | |
| 164 | |
| 165 instant_.SearchModeChanged(old_state.mode, new_mode); | |
| 166 } | |
| 167 } | 162 } |
| 168 | 163 |
| 169 void BrowserInstantController::DefaultSearchProviderChanged( | 164 void BrowserInstantController::DefaultSearchProviderChanged( |
| 170 bool google_base_url_domain_changed) { | 165 bool google_base_url_domain_changed) { |
| 171 InstantService* instant_service = | 166 InstantService* instant_service = |
| 172 InstantServiceFactory::GetForProfile(profile()); | 167 InstantServiceFactory::GetForProfile(profile()); |
| 173 if (!instant_service) | 168 if (!instant_service) |
| 174 return; | 169 return; |
| 175 | 170 |
| 176 TabStripModel* tab_model = browser_->tab_strip_model(); | 171 TabStripModel* tab_model = browser_->tab_strip_model(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 196 params.referrer = content::Referrer(); | 191 params.referrer = content::Referrer(); |
| 197 params.transition_type = ui::PAGE_TRANSITION_RELOAD; | 192 params.transition_type = ui::PAGE_TRANSITION_RELOAD; |
| 198 contents->GetController().LoadURLWithParams(params); | 193 contents->GetController().LoadURLWithParams(params); |
| 199 } else { | 194 } else { |
| 200 // Reload the contents to ensure that it gets assigned to a | 195 // Reload the contents to ensure that it gets assigned to a |
| 201 // non-privileged renderer. | 196 // non-privileged renderer. |
| 202 TabReloader::Reload(contents); | 197 TabReloader::Reload(contents); |
| 203 } | 198 } |
| 204 } | 199 } |
| 205 } | 200 } |
| OLD | NEW |