summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/extension_shelf_controller.h
blob: a533c7a2536170ec8f42139b340d5cf16cd875d1 (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
49
// 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"
#import "chrome/browser/cocoa/view_resizer.h"

class Browser;
class ExtensionShelfMac;

// A controller for the extension shelf. After creating on object of this class,
// insert its |view| into a superview and call |wasInsertedIntoWindow|. After
// that, the controller automatically registers itself in the extensions
// subsystem and manages displaying toolstrips in the extension shelf.
@interface ExtensionShelfController : NSViewController {
 @private
  CGFloat shelfHeight_;

  scoped_ptr<ExtensionShelfMac> bridge_;

  // Delegate that handles resizing our view.
  id<ViewResizer> resizeDelegate_;

  Browser* browser_;
}

// Initializes a new ExtensionShelfController.
- (id)initWithBrowser:(Browser*)browser
       resizeDelegate:(id<ViewResizer>)resizeDelegate;

// Makes the extension shelf view managed by this class visible.
- (IBAction)show:(id)sender;

// Makes the extension shelf view managed by this class invisible.
- (IBAction)hide:(id)sender;

// Returns the height this shelf has when it's visible (which is different from
// the frame's height if the shelf is hidden).
- (CGFloat)height;

// Call this once this shelf's view has been inserted into a superview. It will
// create the internal bridge object to chrome's extension system and call
// cacheDisplayInRect:toBitmapImageRep: on the |view|, which requires that it is
// in a superview.
- (void)wasInsertedIntoWindow;

@end