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::OpenURLInCurrentTab( |
| 165 const GURL& url, |
| 166 content::PageTransition transition) { |
| 167 browser_->OpenURL(content::OpenURLParams(url, |
| 168 content::Referrer(), |
| 169 CURRENT_TAB, |
| 170 transition, |
| 171 false)); |
| 172 } |
| 173 |
164 void BrowserInstantController::ResetInstant() { | 174 void BrowserInstantController::ResetInstant() { |
165 instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile())); | 175 instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile())); |
166 } | 176 } |
167 | 177 |
168 //////////////////////////////////////////////////////////////////////////////// | 178 //////////////////////////////////////////////////////////////////////////////// |
169 // BrowserInstantController, search::SearchModelObserver implementation: | 179 // BrowserInstantController, search::SearchModelObserver implementation: |
170 | 180 |
171 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, | 181 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, |
172 const search::Mode& new_mode) { | 182 const search::Mode& new_mode) { |
173 // If mode is now |NTP|, send theme-related information to instant. | 183 // 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. | 288 // part of the image overlay should draw, 'cos the origin is top-left. |
279 if (!browser_->search_model()->mode().is_ntp() || | 289 if (!browser_->search_model()->mode().is_ntp() || |
280 theme_info_.theme_id.empty() || | 290 theme_info_.theme_id.empty() || |
281 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { | 291 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { |
282 return; | 292 return; |
283 } | 293 } |
284 instant_.ThemeAreaHeightChanged(theme_area_height_); | 294 instant_.ThemeAreaHeightChanged(theme_area_height_); |
285 } | 295 } |
286 | 296 |
287 } // namespace chrome | 297 } // namespace chrome |
OLD | NEW |