| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 133 } |
| 134 | 134 |
| 135 content::WebContents* BrowserInstantController::GetActiveWebContents() const { | 135 content::WebContents* BrowserInstantController::GetActiveWebContents() const { |
| 136 return browser_->tab_strip_model()->GetActiveWebContents(); | 136 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void BrowserInstantController::ActiveTabChanged() { | 139 void BrowserInstantController::ActiveTabChanged() { |
| 140 instant_.ActiveTabChanged(); | 140 instant_.ActiveTabChanged(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void BrowserInstantController::AboutToOpenURL( |
| 144 content::WebContents* web_contents, |
| 145 const GURL& url) { |
| 146 if (instant_.GetPreviewContents() == web_contents) |
| 147 instant_.InstantLoaderAboutToNavigateMainFrame(url); |
| 148 } |
| 149 |
| 143 void BrowserInstantController::SetContentHeight(int height) { | 150 void BrowserInstantController::SetContentHeight(int height) { |
| 144 OnThemeAreaHeightChanged(height); | 151 OnThemeAreaHeightChanged(height); |
| 145 } | 152 } |
| 146 | 153 |
| 147 void BrowserInstantController::UpdateThemeInfoForPreview() { | 154 void BrowserInstantController::UpdateThemeInfoForPreview() { |
| 148 // Update theme background info and theme area height. | 155 // Update theme background info and theme area height. |
| 149 // Initialize |theme_info| if necessary. | 156 // Initialize |theme_info| if necessary. |
| 150 // |OnThemeChanged| also updates theme area height if necessary. | 157 // |OnThemeChanged| also updates theme area height if necessary. |
| 151 if (!initialized_theme_info_) | 158 if (!initialized_theme_info_) |
| 152 OnThemeChanged(ThemeServiceFactory::GetForProfile(browser_->profile())); | 159 OnThemeChanged(ThemeServiceFactory::GetForProfile(browser_->profile())); |
| (...skipping 118 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. | 278 // part of the image overlay should draw, 'cos the origin is top-left. |
| 272 if (!browser_->search_model()->mode().is_ntp() || | 279 if (!browser_->search_model()->mode().is_ntp() || |
| 273 theme_info_.theme_id.empty() || | 280 theme_info_.theme_id.empty() || |
| 274 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { | 281 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { |
| 275 return; | 282 return; |
| 276 } | 283 } |
| 277 instant_.ThemeAreaHeightChanged(theme_area_height_); | 284 instant_.ThemeAreaHeightChanged(theme_area_height_); |
| 278 } | 285 } |
| 279 | 286 |
| 280 } // namespace chrome | 287 } // namespace chrome |
| OLD | NEW |