CTTabContentsController.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Copyright (c) 2009 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-chromium file.
  4. #pragma once
  5. #import <Cocoa/Cocoa.h>
  6. @class CTTabContents;
  7. // A class that controls the contents of a tab. It manages displaying the native
  8. // view for a given CTTabContents in |contentsContainer_|.
  9. // Note that just creating the class does not display the view in
  10. // |contentsContainer_|. We defer inserting it until the box is the correct size
  11. // to avoid multiple resize messages to the renderer. You must call
  12. // |-ensureContentsVisible| to display the render widget host view.
  13. @interface CTTabContentsController : NSViewController
  14. // Create the contents of a tab represented by |contents| and loaded from the
  15. // nib given by |name|.
  16. - (id)initWithNibName:(NSString*)name
  17. bundle:(NSBundle*)bundle
  18. contents:(CTTabContents*)contents;
  19. // Create the contents of a tab represented by |contents| and loaded from a nib
  20. // called "TabContents".
  21. //
  22. // Will first try to find a nib named "TabContents" in the main bundle. If the
  23. // "TabContents" nib could not be found in the main bulde it is loaded from the
  24. // framework bundle.
  25. //
  26. // If you use a nib with another name you should override the implementation in
  27. // your subclass and delegate the internal initialization to
  28. // initWithNibName:bundle:contents
  29. - (id)initWithContents:(CTTabContents*)contents;
  30. // Returns YES if the tab represented by this controller is the front-most.
  31. - (BOOL)isCurrentTab;
  32. // Called when the tab contents is the currently active tab and is about to be
  33. // removed from the view hierarchy.
  34. - (void)willResignActiveTab;
  35. // Called when the tab contents is about to be put into the view hierarchy as
  36. // the active tab. Handles things such as ensuring the toolbar is correctly
  37. // enabled.
  38. - (void)willBecomeActiveTab;
  39. // Call when the tab view is properly sized and the render widget host view
  40. // should be put into the view hierarchy.
  41. - (void)ensureContentsVisible;
  42. // Called when the tab contents is updated in some non-descript way (the
  43. // notification from the model isn't specific). |updatedContents| could reflect
  44. // an entirely new tab contents object.
  45. - (void)tabDidChange:(CTTabContents*)updatedContents;
  46. // Shows |devToolsContents| in a split view, or removes the bottom view in the
  47. // split viewif |devToolsContents| is NULL.
  48. // TODO(thakis): Either move this to tab_window or move infobar handling to here
  49. // too -- http://crbug.com/31633 .
  50. //- (void)showDevToolsContents:(CTTabContents*)devToolsContents;
  51. // Returns the height required by devtools and divider, or 0 if no devtools are
  52. // docked to the tab.
  53. //- (CGFloat)devToolsHeight;
  54. @end