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/cocoa/tab_contents/instant_overlay_controller_mac.h" | 5 #include "chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.h" |
6 #include "chrome/browser/instant/instant_overlay_model.h" | 6 #include "chrome/browser/instant/instant_overlay_model.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
9 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" | 9 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" |
10 | 10 |
11 InstantOverlayControllerMac::InstantOverlayControllerMac( | 11 InstantOverlayControllerMac::InstantOverlayControllerMac( |
12 Browser* browser, | 12 Browser* browser, |
13 BrowserWindowController* window, | 13 BrowserWindowController* window, |
14 OverlayableContentsController* overlay) | 14 OverlayableContentsController* overlay) |
15 : InstantOverlayController(browser), | 15 : InstantOverlayController(browser), |
16 window_(window), | 16 window_(window), |
17 overlay_(overlay) { | 17 overlay_(overlay) { |
18 } | 18 } |
19 | 19 |
20 InstantOverlayControllerMac::~InstantOverlayControllerMac() { | 20 InstantOverlayControllerMac::~InstantOverlayControllerMac() { |
21 } | 21 } |
22 | 22 |
23 void InstantOverlayControllerMac::OverlayStateChanged( | 23 void InstantOverlayControllerMac::OverlayStateChanged( |
24 const InstantOverlayModel& model) { | 24 const InstantOverlayModel& model) { |
25 if (model.mode().is_ntp() || model.mode().is_search_suggestions()) { | 25 if (model.contents()) { |
26 // Drop shadow is only needed if search mode is not |NTP| and overlay does | 26 // Drop shadow is only needed if the overlay does not fill up the entire |
27 // not fill up the entire contents page. | 27 // contents page. TODO(sail): Compute the actual height, a la Views code. |
28 BOOL drawDropShadow = !model.mode().is_ntp() && | 28 BOOL drawDropShadow = |
29 !(model.height() == 100 && | 29 model.height() != 100 || model.height_units() != INSTANT_SIZE_PERCENT; |
30 model.height_units() == INSTANT_SIZE_PERCENT); | 30 [overlay_ setOverlay:model.contents() |
31 [overlay_ setOverlay:model.GetOverlayContents() | |
32 height:model.height() | 31 height:model.height() |
33 heightUnits:model.height_units() | 32 heightUnits:model.height_units() |
34 drawDropShadow:drawDropShadow]; | 33 drawDropShadow:drawDropShadow]; |
| 34 browser_->MaybeUpdateBookmarkBarStateForInstantOverlay(); |
35 } else { | 35 } else { |
36 [overlay_ setOverlay:NULL | 36 [overlay_ setOverlay:NULL |
37 height:0 | 37 height:0 |
38 heightUnits:INSTANT_SIZE_PIXELS | 38 heightUnits:INSTANT_SIZE_PIXELS |
39 drawDropShadow:NO]; | 39 drawDropShadow:NO]; |
40 } | 40 } |
41 browser_->MaybeUpdateBookmarkBarStateForInstantOverlay(model.mode()); | |
42 [window_ updateBookmarkBarStateForInstantOverlay]; | 41 [window_ updateBookmarkBarStateForInstantOverlay]; |
43 } | 42 } |
OLD | NEW |