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.
5 #include "chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.h"
7 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h"
8 #include "chrome/browser/ui/search/instant_overlay_model.h"
10 InstantOverlayControllerMac::InstantOverlayControllerMac(
12 OverlayableContentsController* overlay)
13 : InstantOverlayController(browser),
17 InstantOverlayControllerMac::~InstantOverlayControllerMac() {
20 void InstantOverlayControllerMac::OverlayStateChanged(
21 const InstantOverlayModel& model) {
22 if (model.mode().is_ntp() || model.mode().is_search_suggestions()) {
23 // Drop shadow is only needed if search mode is not |NTP| and overlay does
24 // not fill up the entire contents page.
25 BOOL drawDropShadow = !model.mode().is_ntp() &&
26 !(model.height() == 100 &&
27 model.height_units() == INSTANT_SIZE_PERCENT);
28 [overlay_ setOverlay:model.GetOverlayContents()
30 heightUnits:model.height_units()
31 drawDropShadow:drawDropShadow];
32 } else if ([overlay_ isShowingOverlay]) {
33 [overlay_ setOverlay:NULL
35 heightUnits:INSTANT_SIZE_PIXELS