1 // Copyright (c) 2011 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_TABPOSE_WINDOW_H_
6 #define CHROME_BROWSER_UI_COCOA_TABPOSE_WINDOW_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/mac/scoped_cftyperef.h"
12 #include "base/mac/scoped_nsobject.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h"
31 } // namespace tabpose
34 class TabStripModelObserverBridge
;
36 // A TabposeWindow shows an overview of open tabs and lets the user select a new
37 // active tab. The window blocks clicks on the tab strip and the download
38 // shelf. Every open browser window has its own overlay, and they are
39 // independent of each other.
40 @interface TabposeWindow
: NSWindow
{
42 tabpose::WindowState state_
;
44 // The root layer added to the content view. Covers the whole window.
45 CALayer
* rootLayer_
; // weak
47 // The layer showing the background layer. Covers the whole visible area.
48 CALayer
* bgLayer_
; // weak
51 CALayer
* topGradient_
; // weak
53 // The layer drawn behind the currently selected tile.
54 CALayer
* selectionHighlight_
; // weak
56 // Colors used by the layers.
57 base::ScopedCFTypeRef
<CGColorRef
> gray_
;
58 base::ScopedCFTypeRef
<CGColorRef
> darkBlue_
;
60 TabStripModel
* tabStripModel_
; // weak
62 // Stores all preview layers. The order in here matches the order in
63 // the tabstrip model.
64 base::scoped_nsobject
<NSMutableArray
> allThumbnailLayers_
;
66 base::scoped_nsobject
<NSMutableArray
> allFaviconLayers_
;
67 base::scoped_nsobject
<NSMutableArray
> allTitleLayers_
;
69 // Manages the state of all layers.
70 scoped_ptr
<tabpose::TileSet
> tileSet_
;
72 // The rectangle of the window that contains all layers. This is the
73 // rectangle occupied by |bgLayer_|.
74 NSRect containingRect_
;
76 // Informs us of added/removed/updated tabs.
77 scoped_ptr
<TabStripModelObserverBridge
> tabStripModelObserverBridge_
;
79 // The icon used for the closebutton layers.
80 base::scoped_nsobject
<NSImage
> closeIcon_
;
82 // True if all close layers should be shown (as opposed to just the close
83 // layer of the currently selected thumbnail).
84 BOOL showAllCloseLayers_
;
87 // Shows a TabposeWindow on top of |parent|, with |rect| being the active area.
88 // If |slomo| is YES, then the appearance animation is shown in slow motion.
89 // The window blocks all keyboard and mouse events and releases itself when
91 + (id
)openTabposeFor
:(NSWindow
*)parent
94 tabStripModel
:(TabStripModel
*)tabStripModel
;
97 @interface
TabposeWindow (TestingAPI
)
98 - (void)selectTileAtIndexWithoutAnimation
:(int)newIndex
;
99 - (NSUInteger
)thumbnailLayerCount
;
100 - (int)selectedIndex
;
103 #endif // CHROME_BROWSER_UI_COCOA_TABPOSE_WINDOW_H_