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 #ifndef CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_MAC_H_
6 #define CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_MAC_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/task/cancelable_task_tracker.h"
11 #include "chrome/browser/download/download_item_model.h"
12 #include "chrome/browser/icon_manager.h"
13 #include "content/public/browser/download_item.h"
14 #include "content/public/browser/download_manager.h"
16 @
class DownloadItemController
;
22 // A class that bridges the visible mac download items to chromium's download
23 // model. The owning object (DownloadItemController) must explicitly call
24 // |LoadIcon| if it wants to display the icon associated with this download.
26 class DownloadItemMac
: content::DownloadItem::Observer
{
28 DownloadItemMac(content::DownloadItem
* download
,
29 DownloadItemController
* controller
);
32 virtual ~DownloadItemMac();
34 // content::DownloadItem::Observer implementation
35 virtual void OnDownloadUpdated(content::DownloadItem
* download
) OVERRIDE
;
36 virtual void OnDownloadOpened(content::DownloadItem
* download
) OVERRIDE
;
37 virtual void OnDownloadDestroyed(content::DownloadItem
* download
) OVERRIDE
;
39 DownloadItemModel
* download_model() { return &download_model_
; }
41 // Asynchronous icon loading support.
45 // Callback for asynchronous icon loading.
46 void OnExtractIconComplete(gfx::Image
* icon_bitmap
);
48 // The download item model we represent.
49 DownloadItemModel download_model_
;
51 // The objective-c controller object.
52 DownloadItemController
* item_controller_
; // weak, owns us.
54 // For canceling an in progress icon request.
55 base::CancelableTaskTracker cancelable_task_tracker_
;
57 // Stores the last known path where the file will be saved.
58 base::FilePath lastFilePath_
;
60 DISALLOW_COPY_AND_ASSIGN(DownloadItemMac
);
63 #endif // CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_MAC_H_