| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/cocoa/tab_contents/instant_preview_controller_mac.h" | |
| 6 | |
| 7 #include "chrome/browser/instant/instant_model.h" | |
| 8 #include "chrome/browser/ui/browser.h" | |
| 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | |
| 10 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" | |
| 11 | |
| 12 InstantPreviewControllerMac::InstantPreviewControllerMac( | |
| 13 Browser* browser, | |
| 14 BrowserWindowController* window, | |
| 15 PreviewableContentsController* preview) | |
| 16 : InstantPreviewController(browser), | |
| 17 window_(window), | |
| 18 preview_(preview) { | |
| 19 } | |
| 20 | |
| 21 InstantPreviewControllerMac::~InstantPreviewControllerMac() { | |
| 22 } | |
| 23 | |
| 24 void InstantPreviewControllerMac::PreviewStateChanged( | |
| 25 const InstantModel& model) { | |
| 26 if (model.mode().is_ntp() || model.mode().is_search_suggestions()) { | |
| 27 // Drop shadow is only needed if search mode is not |NTP| and preview does | |
| 28 // not fill up the entire contents page. | |
| 29 BOOL drawDropShadow = !model.mode().is_ntp() && | |
| 30 !(model.height() == 100 && | |
| 31 model.height_units() == INSTANT_SIZE_PERCENT); | |
| 32 [preview_ setPreview:model.GetPreviewContents() | |
| 33 height:model.height() | |
| 34 heightUnits:model.height_units() | |
| 35 drawDropShadow:drawDropShadow]; | |
| 36 } else { | |
| 37 [preview_ setPreview:NULL | |
| 38 height:0 | |
| 39 heightUnits:INSTANT_SIZE_PIXELS | |
| 40 drawDropShadow:NO]; | |
| 41 } | |
| 42 browser_->MaybeUpdateBookmarkBarStateForInstantPreview(model.mode()); | |
| 43 [window_ updateBookmarkBarStateForInstantPreview]; | |
| 44 } | |
| OLD | NEW |