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/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 void BrowserInstantController::UpdateThemeInfoForPreview() { | 154 void BrowserInstantController::UpdateThemeInfoForPreview() { |
155 // Update theme background info and theme area height. | 155 // Update theme background info and theme area height. |
156 // Initialize |theme_info| if necessary. | 156 // Initialize |theme_info| if necessary. |
157 // |OnThemeChanged| also updates theme area height if necessary. | 157 // |OnThemeChanged| also updates theme area height if necessary. |
158 if (!initialized_theme_info_) | 158 if (!initialized_theme_info_) |
159 OnThemeChanged(ThemeServiceFactory::GetForProfile(browser_->profile())); | 159 OnThemeChanged(ThemeServiceFactory::GetForProfile(browser_->profile())); |
160 else | 160 else |
161 OnThemeChanged(NULL); | 161 OnThemeChanged(NULL); |
162 } | 162 } |
163 | 163 |
| 164 void BrowserInstantController::SetMarginSize(int start, int end) { |
| 165 instant_.SetMarginSize(start, end); |
| 166 } |
| 167 |
164 void BrowserInstantController::ResetInstant() { | 168 void BrowserInstantController::ResetInstant() { |
165 instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile())); | 169 instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile())); |
166 } | 170 } |
167 | 171 |
168 //////////////////////////////////////////////////////////////////////////////// | 172 //////////////////////////////////////////////////////////////////////////////// |
169 // BrowserInstantController, search::SearchModelObserver implementation: | 173 // BrowserInstantController, search::SearchModelObserver implementation: |
170 | 174 |
171 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, | 175 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, |
172 const search::Mode& new_mode) { | 176 const search::Mode& new_mode) { |
173 // If mode is now |NTP|, send theme-related information to instant. | 177 // If mode is now |NTP|, send theme-related information to instant. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // part of the image overlay should draw, 'cos the origin is top-left. | 282 // part of the image overlay should draw, 'cos the origin is top-left. |
279 if (!browser_->search_model()->mode().is_ntp() || | 283 if (!browser_->search_model()->mode().is_ntp() || |
280 theme_info_.theme_id.empty() || | 284 theme_info_.theme_id.empty() || |
281 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { | 285 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { |
282 return; | 286 return; |
283 } | 287 } |
284 instant_.ThemeAreaHeightChanged(theme_area_height_); | 288 instant_.ThemeAreaHeightChanged(theme_area_height_); |
285 } | 289 } |
286 | 290 |
287 } // namespace chrome | 291 } // namespace chrome |
OLD | NEW |