1 // Copyright (c) 2010 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/download/download_shelf_mac.h" 6 7 #include "chrome/browser/download/download_item_model.h" 8 #include "chrome/browser/ui/browser.h" 9 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" 10 #include "chrome/browser/ui/cocoa/download/download_item_mac.h" 11 12 DownloadShelfMac::DownloadShelfMac(Browser* browser, 13 DownloadShelfController* controller) 14 : browser_(browser), 15 shelf_controller_(controller) { 16 } 17 18 void DownloadShelfMac::AddDownload(BaseDownloadItemModel* download_model) { 19 [shelf_controller_ addDownloadItem:download_model]; 20 Show(); 21 } 22 23 bool DownloadShelfMac::IsShowing() const { 24 return [shelf_controller_ isVisible] == YES; 25 } 26 27 bool DownloadShelfMac::IsClosing() const { 28 // TODO(estade): This is never called. For now just return false. 29 return false; 30 } 31 32 void DownloadShelfMac::Show() { 33 [shelf_controller_ show:nil]; 34 browser_->UpdateDownloadShelfVisibility(true); 35 } 36 37 void DownloadShelfMac::Close() { 38 [shelf_controller_ hide:nil]; 39 browser_->UpdateDownloadShelfVisibility(false); 40 } 41 42 Browser* DownloadShelfMac::browser() const { 43 return browser_; 44 } 45