| 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/themes/theme_service.h" | 11 #include "chrome/browser/themes/theme_service.h" |
| 12 #include "chrome/browser/themes/theme_service_factory.h" | 12 #include "chrome/browser/themes/theme_service_factory.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_tabstrip.h" | 14 #include "chrome/browser/ui/browser_tabstrip.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/omnibox/location_bar.h" | 16 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 17 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 17 #include "chrome/browser/ui/search/search.h" | 18 #include "chrome/browser/ui/search/search.h" |
| 18 #include "chrome/browser/ui/search/search_model.h" | 19 #include "chrome/browser/ui/search/search_model.h" |
| 19 #include "chrome/browser/ui/search/search_tab_helper.h" | 20 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 20 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 21 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 22 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 23 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 23 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
| 24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 25 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
| 26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 DCHECK(browser_->profile()->GetExtensionService()); | 109 DCHECK(browser_->profile()->GetExtensionService()); |
| 109 if (browser_->profile()->GetExtensionService()->IsInstalledApp(url)) { | 110 if (browser_->profile()->GetExtensionService()->IsInstalledApp(url)) { |
| 110 AppLauncherHandler::RecordAppLaunchType( | 111 AppLauncherHandler::RecordAppLaunchType( |
| 111 extension_misc::APP_LAUNCH_OMNIBOX_INSTANT); | 112 extension_misc::APP_LAUNCH_OMNIBOX_INSTANT); |
| 112 } | 113 } |
| 113 } | 114 } |
| 114 } | 115 } |
| 115 | 116 |
| 116 void BrowserInstantController::SetInstantSuggestion( | 117 void BrowserInstantController::SetInstantSuggestion( |
| 117 const InstantSuggestion& suggestion) { | 118 const InstantSuggestion& suggestion) { |
| 118 if (browser_->window()->GetLocationBar()) | 119 browser_->window()->GetLocationBar()->SetInstantSuggestion(suggestion); |
| 119 browser_->window()->GetLocationBar()->SetInstantSuggestion(suggestion); | |
| 120 } | 120 } |
| 121 | 121 |
| 122 gfx::Rect BrowserInstantController::GetInstantBounds() { | 122 gfx::Rect BrowserInstantController::GetInstantBounds() { |
| 123 return browser_->window()->GetInstantBounds(); | 123 return browser_->window()->GetInstantBounds(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void BrowserInstantController::InstantPreviewFocused() { | 126 void BrowserInstantController::InstantPreviewFocused() { |
| 127 // NOTE: This is only invoked on aura. | 127 // NOTE: This is only invoked on aura. |
| 128 browser_->window()->WebContentsFocused( | 128 browser_->window()->WebContentsFocused( |
| 129 instant_.GetPreviewContents()->web_contents()); | 129 instant_.GetPreviewContents()->web_contents()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void BrowserInstantController::SetInvisibleFocus() { |
| 133 OmniboxView* omnibox_view = browser_->window()->GetLocationBar()-> |
| 134 GetLocationEntry(); |
| 135 omnibox_view->SetFocus(); |
| 136 omnibox_view->model()->SetFocusVisibility(false); |
| 137 } |
| 138 |
| 132 TabContents* BrowserInstantController::GetActiveTabContents() const { | 139 TabContents* BrowserInstantController::GetActiveTabContents() const { |
| 133 return browser_->tab_strip_model()->GetActiveTabContents(); | 140 return browser_->tab_strip_model()->GetActiveTabContents(); |
| 134 } | 141 } |
| 135 | 142 |
| 136 void BrowserInstantController::ActiveTabChanged() { | 143 void BrowserInstantController::ActiveTabChanged() { |
| 137 instant_.ActiveTabChanged(); | 144 instant_.ActiveTabChanged(); |
| 138 } | 145 } |
| 139 | 146 |
| 140 void BrowserInstantController::SetContentHeight(int height) { | 147 void BrowserInstantController::SetContentHeight(int height) { |
| 141 OnThemeAreaHeightChanged(height); | 148 OnThemeAreaHeightChanged(height); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // part of the image overlay should draw, 'cos the origin is top-left. | 275 // part of the image overlay should draw, 'cos the origin is top-left. |
| 269 if (!browser_->search_model()->mode().is_ntp() || | 276 if (!browser_->search_model()->mode().is_ntp() || |
| 270 theme_info_.theme_id.empty() || | 277 theme_info_.theme_id.empty() || |
| 271 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { | 278 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { |
| 272 return; | 279 return; |
| 273 } | 280 } |
| 274 instant_.ThemeAreaHeightChanged(theme_area_height_); | 281 instant_.ThemeAreaHeightChanged(theme_area_height_); |
| 275 } | 282 } |
| 276 | 283 |
| 277 } // namespace chrome | 284 } // namespace chrome |
| OLD | NEW |