Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / tabpose_window.h
blobeb6ea9c48b91ff6b1038b1d733dfe414d2d7d8f8
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"
16 namespace tabpose {
18 class Tile;
19 class TileSet;
23 namespace tabpose {
25 enum WindowState {
26 kFadingIn,
27 kFadedIn,
28 kFadingOut,
31 } // namespace tabpose
33 class TabStripModel;
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 {
41 @private
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
50 // Top gradient.
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
90 // closed.
91 + (id)openTabposeFor:(NSWindow*)parent
92 rect:(NSRect)rect
93 slomo:(BOOL)slomo
94 tabStripModel:(TabStripModel*)tabStripModel;
95 @end
97 @interface TabposeWindow (TestingAPI)
98 - (void)selectTileAtIndexWithoutAnimation:(int)newIndex;
99 - (NSUInteger)thumbnailLayerCount;
100 - (int)selectedIndex;
101 @end
103 #endif // CHROME_BROWSER_UI_COCOA_TABPOSE_WINDOW_H_