OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_COCOA_TABPOSE_WINDOW_H_ | |
6 #define CHROME_BROWSER_UI_COCOA_TABPOSE_WINDOW_H_ | |
7 | |
8 #import <Cocoa/Cocoa.h> | |
9 | |
10 #include "base/mac/scoped_cftyperef.h" | |
11 | |
12 #include "base/mac/scoped_nsobject.h" | |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/memory/scoped_vector.h" | |
15 | |
16 namespace tabpose { | |
17 | |
18 class Tile; | |
19 class TileSet; | |
20 | |
21 } | |
22 | |
23 namespace tabpose { | |
24 | |
25 enum WindowState { | |
26 kFadingIn, | |
27 kFadedIn, | |
28 kFadingOut, | |
29 }; | |
30 | |
31 } // namespace tabpose | |
32 | |
33 class TabStripModel; | |
34 class TabStripModelObserverBridge; | |
35 | |
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 { | |
41 @private | |
42 tabpose::WindowState state_; | |
43 | |
44 // The root layer added to the content view. Covers the whole window. | |
45 CALayer* rootLayer_; // weak | |
46 | |
47 // The layer showing the background layer. Covers the whole visible area. | |
48 CALayer* bgLayer_; // weak | |
49 | |
50 // Top gradient. | |
51 CALayer* topGradient_; // weak | |
52 | |
53 // The layer drawn behind the currently selected tile. | |
54 CALayer* selectionHighlight_; // weak | |
55 | |
56 // Colors used by the layers. | |
57 base::ScopedCFTypeRef<CGColorRef> gray_; | |
58 base::ScopedCFTypeRef<CGColorRef> darkBlue_; | |
59 | |
60 TabStripModel* tabStripModel_; // weak | |
61 | |
62 // Stores all preview layers. The order in here matches the order in | |
63 // the tabstrip model. | |
64 base::scoped_nsobject<NSMutableArray> allThumbnailLayers_; | |
65 | |
66 base::scoped_nsobject<NSMutableArray> allFaviconLayers_; | |
67 base::scoped_nsobject<NSMutableArray> allTitleLayers_; | |
68 | |
69 // Manages the state of all layers. | |
70 scoped_ptr<tabpose::TileSet> tileSet_; | |
71 | |
72 // The rectangle of the window that contains all layers. This is the | |
73 // rectangle occupied by |bgLayer_|. | |
74 NSRect containingRect_; | |
75 | |
76 // Informs us of added/removed/updated tabs. | |
77 scoped_ptr<TabStripModelObserverBridge> tabStripModelObserverBridge_; | |
78 | |
79 // The icon used for the closebutton layers. | |
80 base::scoped_nsobject<NSImage> closeIcon_; | |
81 | |
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_; | |
85 } | |
86 | |
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 | |
90 // closed. | |
91 + (id)openTabposeFor:(NSWindow*)parent | |
92 rect:(NSRect)rect | |
93 slomo:(BOOL)slomo | |
94 tabStripModel:(TabStripModel*)tabStripModel; | |
95 @end | |
96 | |
97 @interface TabposeWindow (TestingAPI) | |
98 - (void)selectTileAtIndexWithoutAnimation:(int)newIndex; | |
99 - (NSUInteger)thumbnailLayerCount; | |
100 - (int)selectedIndex; | |
101 @end | |
102 | |
103 #endif // CHROME_BROWSER_UI_COCOA_TABPOSE_WINDOW_H_ | |
OLD | NEW |