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