| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // NOTE: This is only invoked on aura. | 97 // NOTE: This is only invoked on aura. |
| 98 browser_->window()->WebContentsFocused( | 98 browser_->window()->WebContentsFocused( |
| 99 instant_->GetPreviewContents()->web_contents()); | 99 instant_->GetPreviewContents()->web_contents()); |
| 100 } | 100 } |
| 101 | 101 |
| 102 TabContents* BrowserInstantController::GetActiveTabContents() const { | 102 TabContents* BrowserInstantController::GetActiveTabContents() const { |
| 103 return chrome::GetActiveTabContents(browser_); | 103 return chrome::GetActiveTabContents(browser_); |
| 104 } | 104 } |
| 105 | 105 |
| 106 //////////////////////////////////////////////////////////////////////////////// | 106 //////////////////////////////////////////////////////////////////////////////// |
| 107 // BrowserInstantController, content::NotificationObserver implementation: | 107 // BrowserInstantController, PrefObserver implementation: |
| 108 | 108 |
| 109 void BrowserInstantController::Observe( | 109 void BrowserInstantController::OnPreferenceChanged( |
| 110 int type, | 110 PrefServiceBase* service, |
| 111 const content::NotificationSource& source, | 111 const std::string& pref_name) { |
| 112 const content::NotificationDetails& details) { | 112 DCHECK_EQ(std::string(prefs::kInstantEnabled), pref_name); |
| 113 DCHECK_EQ(chrome::NOTIFICATION_PREF_CHANGED, type); | |
| 114 DCHECK_EQ(std::string(prefs::kInstantEnabled), | |
| 115 *content::Details<std::string>(details).ptr()); | |
| 116 ResetInstant(); | 113 ResetInstant(); |
| 117 } | 114 } |
| 118 | 115 |
| 119 //////////////////////////////////////////////////////////////////////////////// | 116 //////////////////////////////////////////////////////////////////////////////// |
| 120 // BrowserInstantController, TabStripModelObserver implementation: | 117 // BrowserInstantController, TabStripModelObserver implementation: |
| 121 | 118 |
| 122 void BrowserInstantController::TabDeactivated(TabContents* contents) { | 119 void BrowserInstantController::TabDeactivated(TabContents* contents) { |
| 123 if (instant()) | 120 if (instant()) |
| 124 instant_->Hide(); | 121 instant_->Hide(); |
| 125 } | 122 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 143 InstantController::CreateInstant(browser_->profile(), this) : NULL); | 140 InstantController::CreateInstant(browser_->profile(), this) : NULL); |
| 144 | 141 |
| 145 // Notify any observers that they need to reset. | 142 // Notify any observers that they need to reset. |
| 146 content::NotificationService::current()->Notify( | 143 content::NotificationService::current()->Notify( |
| 147 chrome::NOTIFICATION_BROWSER_INSTANT_RESET, | 144 chrome::NOTIFICATION_BROWSER_INSTANT_RESET, |
| 148 content::Source<BrowserInstantController>(this), | 145 content::Source<BrowserInstantController>(this), |
| 149 content::NotificationService::NoDetails()); | 146 content::NotificationService::NoDetails()); |
| 150 } | 147 } |
| 151 | 148 |
| 152 } // namespace chrome | 149 } // namespace chrome |
| OLD | NEW |