summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/download_item_controller.h
blob: dec9f7c4a94b9ad8eea5b1e7940bbf53ae07c00c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import <Cocoa/Cocoa.h>

#include "base/scoped_ptr.h"

class BaseDownloadItemModel;
class DownloadItemMac;
class DownloadShelfContextMenuMac;
@class DownloadShelfController;

// A controller class that manages one download item.

@interface DownloadItemController : NSViewController {
 @private
  IBOutlet NSPopUpButton* popupButton_;

  IBOutlet NSMenu* activeDownloadMenu_;
  IBOutlet NSMenu* completeDownloadMenu_;

  scoped_ptr<DownloadItemMac> bridge_;
  scoped_ptr<DownloadShelfContextMenuMac> menuBridge_;

  // Weak pointer to the shelf that owns us.
  DownloadShelfController* shelf_;
};

// Takes ownership of |downloadModel|.
- (id)initWithFrame:(NSRect)frameRect
              model:(BaseDownloadItemModel*)downloadModel
              shelf:(DownloadShelfController*)shelf;

// Updates the UI and menu state from |downloadModel|.
- (void)setStateFromDownload:(BaseDownloadItemModel*)downloadModel;

// Remove ourself from the download UI.
- (void)remove;

// Context menu handlers.
- (IBAction)handleOpen:(id)sender;
- (IBAction)handleAlwaysOpen:(id)sender;
- (IBAction)handleReveal:(id)sender;
- (IBAction)handleCancel:(id)sender;

@end