Chromium Code Reviews| 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 "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/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_tabstrip.h" | 12 #include "chrome/browser/ui/browser_tabstrip.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/omnibox/location_bar.h" | 14 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 15 #include "chrome/browser/ui/omnibox/omnibox_view.h" | |
| 15 #include "chrome/browser/ui/search/search.h" | 16 #include "chrome/browser/ui/search/search.h" |
| 16 #include "chrome/browser/ui/search/search_model.h" | 17 #include "chrome/browser/ui/search/search_model.h" |
| 17 #include "chrome/browser/ui/search/search_tab_helper.h" | 18 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 18 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 21 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 21 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
| 22 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 23 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 gfx::Rect BrowserInstantController::GetInstantBounds() { | 105 gfx::Rect BrowserInstantController::GetInstantBounds() { |
| 105 return browser_->window()->GetInstantBounds(); | 106 return browser_->window()->GetInstantBounds(); |
| 106 } | 107 } |
| 107 | 108 |
| 108 void BrowserInstantController::InstantPreviewFocused() { | 109 void BrowserInstantController::InstantPreviewFocused() { |
| 109 // NOTE: This is only invoked on aura. | 110 // NOTE: This is only invoked on aura. |
| 110 browser_->window()->WebContentsFocused( | 111 browser_->window()->WebContentsFocused( |
| 111 instant_.GetPreviewContents()->web_contents()); | 112 instant_.GetPreviewContents()->web_contents()); |
| 112 } | 113 } |
| 113 | 114 |
| 115 void BrowserInstantController::SetInvisibleFocus() { | |
| 116 if (browser_->window()->GetLocationBar()) | |
|
dhollowa
2012/11/20 23:50:17
nit: need {} on if-body.
samarth
2012/11/21 00:40:15
Done.
| |
| 117 browser_->window()->GetLocationBar()->GetLocationEntry()-> | |
| 118 SetInvisibleFocus(); | |
| 119 } | |
| 120 | |
| 114 TabContents* BrowserInstantController::GetActiveTabContents() const { | 121 TabContents* BrowserInstantController::GetActiveTabContents() const { |
| 115 return browser_->tab_strip_model()->GetActiveTabContents(); | 122 return browser_->tab_strip_model()->GetActiveTabContents(); |
| 116 } | 123 } |
| 117 | 124 |
| 118 void BrowserInstantController::ActiveTabChanged() { | 125 void BrowserInstantController::ActiveTabChanged() { |
| 119 instant_.ActiveTabChanged(); | 126 instant_.ActiveTabChanged(); |
| 120 } | 127 } |
| 121 | 128 |
| 122 //////////////////////////////////////////////////////////////////////////////// | 129 //////////////////////////////////////////////////////////////////////////////// |
| 123 // BrowserInstantController, PrefObserver implementation: | 130 // BrowserInstantController, PrefObserver implementation: |
| 124 | 131 |
| 125 void BrowserInstantController::OnPreferenceChanged( | 132 void BrowserInstantController::OnPreferenceChanged( |
| 126 PrefServiceBase* service, | 133 PrefServiceBase* service, |
| 127 const std::string& pref_name) { | 134 const std::string& pref_name) { |
| 128 instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile())); | 135 instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile())); |
| 129 } | 136 } |
| 130 | 137 |
| 131 //////////////////////////////////////////////////////////////////////////////// | 138 //////////////////////////////////////////////////////////////////////////////// |
| 132 // BrowserInstantController, search::SearchModelObserver implementation: | 139 // BrowserInstantController, search::SearchModelObserver implementation: |
| 133 | 140 |
| 134 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, | 141 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, |
| 135 const search::Mode& new_mode) { | 142 const search::Mode& new_mode) { |
| 136 instant_.SearchModeChanged(old_mode, new_mode); | 143 instant_.SearchModeChanged(old_mode, new_mode); |
| 137 } | 144 } |
| 138 | 145 |
| 139 } // namespace chrome | 146 } // namespace chrome |
| OLD | NEW |