Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / download / download_shelf_mac.mm
blobcf14be75ecc54bfa5be085e97b5d463db7ef8b0f
1 // Copyright (c) 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/download/download_shelf_mac.h"
7 #include "chrome/browser/download/download_item_model.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/cocoa/download/download_item_mac.h"
10 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h"
12 DownloadShelfMac::DownloadShelfMac(Browser* browser,
13                                    DownloadShelfController* controller)
14     : browser_(browser),
15       shelf_controller_(controller) {
18 void DownloadShelfMac::DoAddDownload(content::DownloadItem* download) {
19   [shelf_controller_ addDownloadItem:download];
22 bool DownloadShelfMac::IsShowing() const {
23   return [shelf_controller_ isVisible] == YES;
26 bool DownloadShelfMac::IsClosing() const {
27   // TODO(estade): This is never called. For now just return false.
28   return false;
31 void DownloadShelfMac::DoShow() {
32   [shelf_controller_ showDownloadShelf:YES
33                           isUserAction:NO];
34   browser_->UpdateDownloadShelfVisibility(true);
37 void DownloadShelfMac::DoClose(CloseReason reason) {
38   [shelf_controller_ showDownloadShelf:NO
39                           isUserAction:reason == USER_ACTION];
40   browser_->UpdateDownloadShelfVisibility(false);
43 Browser* DownloadShelfMac::browser() const {
44   return browser_;