Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h

Issue 12386019: Instant: Use only one hidden WebContents per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2012 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
8 #import <Cocoa/Cocoa.h>
9
10 #include "base/memory/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/common/instant_types.h"
13
14 class Browser;
15 @class BrowserWindowController;
16 class InstantPreviewControllerMac;
17
18 namespace content {
19 class WebContents;
20 }
21
22 // PreviewableContentsController manages the display of up to two tab contents
23 // views. It is primarily for use with Instant results. This class supports
24 // the notion of an "active" view vs. a "preview" tab contents view.
25 //
26 // The "active" view is a container view that can be retrieved using
27 // |-activeContainer|. Its contents are meant to be managed by an external
28 // class.
29 //
30 // The "preview" can be set using |-showPreview:| and |-hidePreview|. When a
31 // preview is set, the active view is hidden (but stays in the view hierarchy).
32 // When the preview is removed, the active view is reshown.
33 @interface PreviewableContentsController : NSViewController {
34 @private
35 // Container view for the "active" contents.
36 scoped_nsobject<NSView> activeContainer_;
37
38 // The preview WebContents. Will be NULL if no preview is currently showing.
39 content::WebContents* previewContents_; // weak
40
41 // C++ bridge to the Instant model change interface.
42 scoped_ptr<InstantPreviewControllerMac> instantPreviewController_;
43
44 // The desired height of the preview and units.
45 CGFloat previewHeight_;
46 InstantSizeUnits previewHeightUnits_;
47
48 // If true then a shadow is drawn below the preview. This is used to make
49 // instant omnibox "float" over the tab's web contents.
50 BOOL drawDropShadow_;
51
52 // View responsible for drawing a drop shadow.
53 scoped_nsobject<NSView> dropShadowView_;
54
55 BrowserWindowController* windowController_;
56
57 // The vertical offset between the top of the view and the active container.
58 // This is used to push the active container below the bookmark bar. Normally
59 // this is set to the height of the bookmark bar so that the bookmark bar is
60 // not obscured.
61 CGFloat activeContainerOffset_;
62 }
63
64 @property(readonly, nonatomic) NSView* activeContainer;
65 @property(readonly, nonatomic) NSView* dropShadowView;
66 @property(readonly, nonatomic) BOOL drawDropShadow;
67 @property(assign, nonatomic) CGFloat activeContainerOffset;
68
69 // Initialization.
70 - (id)initWithBrowser:(Browser*)browser
71 windowController:(BrowserWindowController*)windowController;
72
73 // Sets the current preview and installs its WebContentsView into the view
74 // hierarchy. Hides the active view. If |preview| is NULL then closes the
75 // current preview and shows the active view.
76 - (void)setPreview:(content::WebContents*)preview
77 height:(CGFloat)height
78 heightUnits:(InstantSizeUnits)heightUnits
79 drawDropShadow:(BOOL)drawDropShadow;
80
81 // Called when a tab with |contents| is activated, so that we can check to see
82 // if it's the preview being activated (and adjust internal state accordingly).
83 - (void)onActivateTabWithContents:(content::WebContents*)contents;
84
85 // Returns YES if the preview contents is currently showing.
86 - (BOOL)isShowingPreview;
87
88 - (InstantPreviewControllerMac*)instantPreviewController;
89
90 @end
91
92 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_PREVIEWABLE_CONTENTS_CONTROLLER_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698