| 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_SIDEBAR_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_UI_COCOA_SIDEBAR_CONTROLLER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #import <Foundation/Foundation.h> | |
| 10 | |
| 11 #import "base/mac/cocoa_protocols.h" | |
| 12 #include "base/memory/scoped_nsobject.h" | |
| 13 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" | |
| 14 | |
| 15 @class NSSplitView; | |
| 16 @class NSView; | |
| 17 | |
| 18 class TabContents; | |
| 19 | |
| 20 // A class that handles updates of the sidebar view within a browser window. | |
| 21 // It swaps in the relevant sidebar contents for a given TabContents or removes | |
| 22 // the vew, if there's no sidebar contents to show. | |
| 23 @interface SidebarController : NSObject<NSSplitViewDelegate> { | |
| 24 @private | |
| 25 // A view hosting sidebar contents. | |
| 26 scoped_nsobject<NSSplitView> splitView_; | |
| 27 | |
| 28 // Manages currently displayed sidebar contents. | |
| 29 scoped_nsobject<TabContentsController> contentsController_; | |
| 30 } | |
| 31 | |
| 32 - (id)initWithDelegate:(id<TabContentsControllerDelegate>)delegate; | |
| 33 | |
| 34 // This controller's view. | |
| 35 - (NSSplitView*)view; | |
| 36 | |
| 37 // The compiler seems to have trouble handling a function named "view" that | |
| 38 // returns an NSSplitView, so provide a differently-named method. | |
| 39 - (NSSplitView*)splitView; | |
| 40 | |
| 41 // Depending on |contents|'s state, decides whether the sidebar | |
| 42 // should be shown or hidden and adjusts its width (|delegate_| handles | |
| 43 // the actual resize). | |
| 44 - (void)updateSidebarForTabContents:(TabContents*)contents; | |
| 45 | |
| 46 // Call when the sidebar view is properly sized and the render widget host view | |
| 47 // should be put into the view hierarchy. | |
| 48 - (void)ensureContentsVisible; | |
| 49 | |
| 50 @end | |
| 51 | |
| 52 #endif // CHROME_BROWSER_UI_COCOA_SIDEBAR_CONTROLLER_H_ | |
| OLD | NEW |