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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 void BrowserInstantController::UpdateThemeInfoForPreview() { | 147 void BrowserInstantController::UpdateThemeInfoForPreview() { |
148 // Update theme background info and theme area height. | 148 // Update theme background info and theme area height. |
149 // Initialize |theme_info| if necessary. | 149 // Initialize |theme_info| if necessary. |
150 // |OnThemeChanged| also updates theme area height if necessary. | 150 // |OnThemeChanged| also updates theme area height if necessary. |
151 if (!initialized_theme_info_) | 151 if (!initialized_theme_info_) |
152 OnThemeChanged(ThemeServiceFactory::GetForProfile(browser_->profile())); | 152 OnThemeChanged(ThemeServiceFactory::GetForProfile(browser_->profile())); |
153 else | 153 else |
154 OnThemeChanged(NULL); | 154 OnThemeChanged(NULL); |
155 } | 155 } |
156 | 156 |
| 157 void BrowserInstantController::SetMarginSize(int start, int end) { |
| 158 instant_.SetMarginSize(start, end); |
| 159 } |
| 160 |
157 void BrowserInstantController::ResetInstant() { | 161 void BrowserInstantController::ResetInstant() { |
158 instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile())); | 162 instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile())); |
159 } | 163 } |
160 | 164 |
161 //////////////////////////////////////////////////////////////////////////////// | 165 //////////////////////////////////////////////////////////////////////////////// |
162 // BrowserInstantController, search::SearchModelObserver implementation: | 166 // BrowserInstantController, search::SearchModelObserver implementation: |
163 | 167 |
164 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, | 168 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, |
165 const search::Mode& new_mode) { | 169 const search::Mode& new_mode) { |
166 // If mode is now |NTP|, send theme-related information to instant. | 170 // If mode is now |NTP|, send theme-related information to instant. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // 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. |
272 if (!browser_->search_model()->mode().is_ntp() || | 276 if (!browser_->search_model()->mode().is_ntp() || |
273 theme_info_.theme_id.empty() || | 277 theme_info_.theme_id.empty() || |
274 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { | 278 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { |
275 return; | 279 return; |
276 } | 280 } |
277 instant_.ThemeAreaHeightChanged(theme_area_height_); | 281 instant_.ThemeAreaHeightChanged(theme_area_height_); |
278 } | 282 } |
279 | 283 |
280 } // namespace chrome | 284 } // namespace chrome |
OLD | NEW |