Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_OVERLAYABLE_CONTENTS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_OVERLAYABLE_CONTENTS_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_OVERLAYABLE_CONTENTS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_OVERLAYABLE_CONTENTS_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/common/instant_types.h" | |
| 13 | 12 |
| 14 class Browser; | 13 class Browser; |
| 15 class InstantOverlayControllerMac; | |
| 16 | 14 |
| 17 namespace content { | 15 namespace content { |
| 18 class WebContents; | 16 class WebContents; |
| 19 } | 17 } |
| 20 | 18 |
| 21 // OverlayableContentsController manages the display of up to two tab contents | 19 // OverlayableContentsController is an obsolete wrapper holding the view where a |
| 22 // views. It is primarily for use with Instant results. This class supports the | 20 // tab's WebContents is displayed. In the old Chrome Instant implementation it |
| 23 // notion of an "active" view vs. an "overlay" tab contents view. | 21 // multiplexed between the tab's contents and an overlay's contents. Now there |
| 22 // is no overlay, but ripping this class out entirely is hard. | |
| 24 // | 23 // |
| 25 // The "active" view is a container view that can be retrieved using | 24 // TODO(sail): Remove this class and replace it with something saner. |
|
samarth
2013/08/12 20:34:20
FYI sail is back so you can get his view on this :
| |
| 26 // |-activeContainer|. Its contents are meant to be managed by an external | |
| 27 // class. | |
| 28 // | |
| 29 // The "overlay" can be set using |-showOverlay:| and |-hideOverlay|. When an | |
| 30 // overlay is set, the active view is hidden (but stays in the view hierarchy). | |
| 31 // When the overlay is removed, the active view is reshown. | |
| 32 @interface OverlayableContentsController : NSViewController { | 25 @interface OverlayableContentsController : NSViewController { |
| 33 @private | 26 @private |
| 34 // Container view for the "active" contents. | 27 // Container view for the "active" contents. |
| 35 base::scoped_nsobject<NSView> activeContainer_; | 28 base::scoped_nsobject<NSView> activeContainer_; |
| 36 | |
| 37 // The overlay WebContents. Will be NULL if no overlay is currently showing. | |
| 38 content::WebContents* overlayContents_; // weak | |
| 39 | |
| 40 // C++ bridge to the Instant model change interface. | |
| 41 scoped_ptr<InstantOverlayControllerMac> instantOverlayController_; | |
| 42 | |
| 43 // The desired height of the overlay and units. | |
| 44 CGFloat overlayHeight_; | |
| 45 InstantSizeUnits overlayHeightUnits_; | |
| 46 } | 29 } |
| 47 | 30 |
| 48 @property(readonly, nonatomic) NSView* activeContainer; | 31 @property(readonly, nonatomic) NSView* activeContainer; |
| 49 | 32 |
| 50 // Initialization. | 33 // Initialization. |
| 51 - (id)initWithBrowser:(Browser*)browser; | 34 - (id)initWithBrowser:(Browser*)browser; |
| 52 | 35 |
| 53 // Sets the current overlay and installs its WebContentsView into the view | |
| 54 // hierarchy. Hides the active view. If |overlay| is NULL then closes the | |
| 55 // current overlay and shows the active view. | |
| 56 - (void)setOverlay:(content::WebContents*)overlay | |
| 57 height:(CGFloat)height | |
| 58 heightUnits:(InstantSizeUnits)heightUnits | |
| 59 drawDropShadow:(BOOL)drawDropShadow; | |
| 60 | |
| 61 // Called when a tab with |contents| is activated, so that we can check to see | |
| 62 // if it's the overlay being activated (and adjust internal state accordingly). | |
| 63 - (void)onActivateTabWithContents:(content::WebContents*)contents; | |
| 64 | |
| 65 - (InstantOverlayControllerMac*)instantOverlayController; | |
| 66 | |
| 67 - (BOOL)isShowingOverlay; | |
| 68 | |
| 69 @end | 36 @end |
| 70 | 37 |
| 71 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_OVERLAYABLE_CONTENTS_CONTROLLER_ H_ | 38 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_OVERLAYABLE_CONTENTS_CONTROLLER_ H_ |
| OLD | NEW |