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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 gfx::Rect BrowserInstantController::GetInstantBounds() { | 123 gfx::Rect BrowserInstantController::GetInstantBounds() { |
123 return browser_->window()->GetInstantBounds(); | 124 return browser_->window()->GetInstantBounds(); |
124 } | 125 } |
125 | 126 |
126 void BrowserInstantController::InstantPreviewFocused() { | 127 void BrowserInstantController::InstantPreviewFocused() { |
127 // NOTE: This is only invoked on aura. | 128 // NOTE: This is only invoked on aura. |
128 browser_->window()->WebContentsFocused( | 129 browser_->window()->WebContentsFocused( |
129 instant_.GetPreviewContents()->web_contents()); | 130 instant_.GetPreviewContents()->web_contents()); |
130 } | 131 } |
131 | 132 |
133 void BrowserInstantController::SetInvisibleFocus() { | |
134 if (browser_->window()->GetLocationBar()) { | |
Peter Kasting
2012/12/01 03:49:58
When will the window not have a location bar? We
samarth
2012/12/03 06:46:15
I was just following the pattern in SetSuggestion
| |
135 browser_->window()->GetLocationBar()->GetLocationEntry()-> | |
136 SetInvisibleFocus(); | |
137 } | |
138 } | |
139 | |
132 TabContents* BrowserInstantController::GetActiveTabContents() const { | 140 TabContents* BrowserInstantController::GetActiveTabContents() const { |
133 return browser_->tab_strip_model()->GetActiveTabContents(); | 141 return browser_->tab_strip_model()->GetActiveTabContents(); |
134 } | 142 } |
135 | 143 |
136 void BrowserInstantController::ActiveTabChanged() { | 144 void BrowserInstantController::ActiveTabChanged() { |
137 instant_.ActiveTabChanged(); | 145 instant_.ActiveTabChanged(); |
138 } | 146 } |
139 | 147 |
140 void BrowserInstantController::SetContentHeight(int height) { | 148 void BrowserInstantController::SetContentHeight(int height) { |
141 OnThemeAreaHeightChanged(height); | 149 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. | 276 // part of the image overlay should draw, 'cos the origin is top-left. |
269 if (!browser_->search_model()->mode().is_ntp() || | 277 if (!browser_->search_model()->mode().is_ntp() || |
270 theme_info_.theme_id.empty() || | 278 theme_info_.theme_id.empty() || |
271 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { | 279 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { |
272 return; | 280 return; |
273 } | 281 } |
274 instant_.ThemeAreaHeightChanged(theme_area_height_); | 282 instant_.ThemeAreaHeightChanged(theme_area_height_); |
275 } | 283 } |
276 | 284 |
277 } // namespace chrome | 285 } // namespace chrome |
OLD | NEW |