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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_web_ui.h" | 9 #include "chrome/browser/extensions/extension_web_ui.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (extension) { | 135 if (extension) { |
136 AppLauncherHandler::RecordAppLaunchType( | 136 AppLauncherHandler::RecordAppLaunchType( |
137 extension_misc::APP_LAUNCH_OMNIBOX_INSTANT, | 137 extension_misc::APP_LAUNCH_OMNIBOX_INSTANT, |
138 extension->GetType()); | 138 extension->GetType()); |
139 } | 139 } |
140 if (in_new_tab) { | 140 if (in_new_tab) { |
141 // TabStripModel takes ownership of |overlay|. | 141 // TabStripModel takes ownership of |overlay|. |
142 browser_->tab_strip_model()->AddWebContents(overlay.release(), -1, | 142 browser_->tab_strip_model()->AddWebContents(overlay.release(), -1, |
143 instant_.last_transition_type(), TabStripModel::ADD_ACTIVE); | 143 instant_.last_transition_type(), TabStripModel::ADD_ACTIVE); |
144 } else { | 144 } else { |
| 145 content::WebContents* contents = overlay.get(); |
145 ReplaceWebContentsAt( | 146 ReplaceWebContentsAt( |
146 browser_->tab_strip_model()->active_index(), | 147 browser_->tab_strip_model()->active_index(), |
147 overlay.Pass()); | 148 overlay.Pass()); |
| 149 browser_->window()->GetLocationBar()->SaveStateToContents(contents); |
148 } | 150 } |
149 } | 151 } |
150 | 152 |
151 void BrowserInstantController::ReplaceWebContentsAt( | 153 void BrowserInstantController::ReplaceWebContentsAt( |
152 int index, | 154 int index, |
153 scoped_ptr<content::WebContents> new_contents) { | 155 scoped_ptr<content::WebContents> new_contents) { |
154 DCHECK_NE(TabStripModel::kNoTab, index); | 156 DCHECK_NE(TabStripModel::kNoTab, index); |
155 scoped_ptr<content::WebContents> old_contents(browser_->tab_strip_model()-> | 157 scoped_ptr<content::WebContents> old_contents(browser_->tab_strip_model()-> |
156 ReplaceWebContentsAt(index, new_contents.release())); | 158 ReplaceWebContentsAt(index, new_contents.release())); |
157 instant_unload_handler_.RunUnloadListenersOrDestroy(old_contents.Pass(), | 159 instant_unload_handler_.RunUnloadListenersOrDestroy(old_contents.Pass(), |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 } | 346 } |
345 | 347 |
346 initialized_theme_info_ = true; | 348 initialized_theme_info_ = true; |
347 } | 349 } |
348 | 350 |
349 DCHECK(initialized_theme_info_); | 351 DCHECK(initialized_theme_info_); |
350 | 352 |
351 if (browser_->search_model()->mode().is_ntp()) | 353 if (browser_->search_model()->mode().is_ntp()) |
352 instant_.ThemeChanged(theme_info_); | 354 instant_.ThemeChanged(theme_info_); |
353 } | 355 } |
OLD | NEW |