| 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/ui/browser_instant_controller.h" | 5 #include "chrome/browser/ui/browser_instant_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_shutdown.h" | 7 #include "chrome/browser/browser_shutdown.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/instant/instant_controller.h" | 9 #include "chrome/browser/instant/instant_controller.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // to handle them. If you hit this DCHECK file a bug and I'll (sky) add | 52 // to handle them. If you hit this DCHECK file a bug and I'll (sky) add |
| 53 // support for the new disposition. | 53 // support for the new disposition. |
| 54 DCHECK(disposition == CURRENT_TAB || | 54 DCHECK(disposition == CURRENT_TAB || |
| 55 disposition == NEW_FOREGROUND_TAB) << disposition; | 55 disposition == NEW_FOREGROUND_TAB) << disposition; |
| 56 | 56 |
| 57 instant_->CommitCurrentPreview(disposition == CURRENT_TAB ? | 57 instant_->CommitCurrentPreview(disposition == CURRENT_TAB ? |
| 58 INSTANT_COMMIT_PRESSED_ENTER : INSTANT_COMMIT_PRESSED_ALT_ENTER); | 58 INSTANT_COMMIT_PRESSED_ENTER : INSTANT_COMMIT_PRESSED_ALT_ENTER); |
| 59 return true; | 59 return true; |
| 60 } | 60 } |
| 61 | 61 |
| 62 //////////////////////////////////////////////////////////////////////////////// | |
| 63 // BrowserInstantController, InstantControllerDelegate implementation: | |
| 64 | |
| 65 void BrowserInstantController::CommitInstant(TabContents* preview, | 62 void BrowserInstantController::CommitInstant(TabContents* preview, |
| 66 bool in_new_tab) { | 63 bool in_new_tab) { |
| 67 if (in_new_tab) { | 64 if (in_new_tab) { |
| 68 // TabStripModel takes ownership of |preview|. | 65 // TabStripModel takes ownership of |preview|. |
| 69 browser_->tab_strip_model()->AddTabContents(preview, -1, | 66 browser_->tab_strip_model()->AddTabContents(preview, -1, |
| 70 instant_->last_transition_type(), TabStripModel::ADD_ACTIVE); | 67 instant_->last_transition_type(), TabStripModel::ADD_ACTIVE); |
| 71 } else { | 68 } else { |
| 72 TabContents* active_tab = chrome::GetActiveTabContents(browser_); | 69 TabContents* active_tab = chrome::GetActiveTabContents(browser_); |
| 73 int index = browser_->tab_strip_model()->GetIndexOfTabContents(active_tab); | 70 int index = browser_->tab_strip_model()->GetIndexOfTabContents(active_tab); |
| 74 DCHECK_NE(TabStripModel::kNoTab, index); | 71 DCHECK_NE(TabStripModel::kNoTab, index); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 InstantController::CreateInstant(browser_->profile(), this) : NULL); | 143 InstantController::CreateInstant(browser_->profile(), this) : NULL); |
| 147 | 144 |
| 148 // Notify any observers that they need to reset. | 145 // Notify any observers that they need to reset. |
| 149 content::NotificationService::current()->Notify( | 146 content::NotificationService::current()->Notify( |
| 150 chrome::NOTIFICATION_BROWSER_INSTANT_RESET, | 147 chrome::NOTIFICATION_BROWSER_INSTANT_RESET, |
| 151 content::Source<BrowserInstantController>(this), | 148 content::Source<BrowserInstantController>(this), |
| 152 content::NotificationService::NoDetails()); | 149 content::NotificationService::NoDetails()); |
| 153 } | 150 } |
| 154 | 151 |
| 155 } // namespace chrome | 152 } // namespace chrome |
| OLD | NEW |