1 // Copyright (c) 2010 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_TAB_CONTENTS_PREVIEWABLE_CONTENTS_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_PREVIEWABLE_CONTENTS_CONTROLLER_H_ 7 #pragma once 8 9 #import <Cocoa/Cocoa.h> 10 11 class TabContents; 12 13 // PreviewableContentsController manages the display of up to two tab contents 14 // views. It is primarily for use with Instant results. This class supports 15 // the notion of an "active" view vs. a "preview" tab contents view. 16 // 17 // The "active" view is a container view that can be retrieved using 18 // |-activeContainer|. Its contents are meant to be managed by an external 19 // class. 20 // 21 // The "preview" can be set using |-showPreview:| and |-hidePreview|. When a 22 // preview is set, the active view is hidden (but stays in the view hierarchy). 23 // When the preview is removed, the active view is reshown. 24 @interface PreviewableContentsController : NSViewController { 25 @private 26 // Container view for the "active" contents. 27 IBOutlet NSView* activeContainer_; 28 29 // The preview TabContents. Will be NULL if no preview is currently showing. 30 TabContents* previewContents_; // weak 31 } 32 33 @property(readonly, nonatomic) NSView* activeContainer; 34 35 // Sets the current preview and installs its TabContentsView into the view 36 // hierarchy. Hides the active view. |preview| must not be NULL. 37 - (void)showPreview:(TabContents*)preview; 38 39 // Closes the current preview and shows the active view. 40 - (void)hidePreview; 41 42 // Returns YES if the preview contents is currently showing. 43 - (BOOL)isShowingPreview; 44 45 @end 46 47 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_PREVIEWABLE_CONTENTS_CONTROLLER_H_ 48