summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/tab_contents_controller.h
blob: 548007ae07a506021b8f5ade8d92603da751f8dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_
#define CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_
#pragma once

#include <Cocoa/Cocoa.h>

class TabContents;
class TabContentsCommandObserver;
class TabStripModel;

// A class that controls the web contents of a tab. It manages displaying the
// native view for a given TabContents and optionally its docked devtools in
// |contentsContainer_|.
// Note that just creating the class does not display the view in
// |contentsContainer_|. We defer inserting it until the box is the correct size
// to avoid multiple resize messages to the renderer. You must call
// |-ensureContentsVisible| to display the render widget host view.

@interface TabContentsController : NSViewController {
 @private
  TabContentsCommandObserver* observer_;  // nil if |commands_| is nil
  TabContents* contents_;  // weak

  IBOutlet NSSplitView* contentsContainer_;
}

// Create the contents of a tab represented by |contents| and loaded from the
// nib given by |name|.
- (id)initWithNibName:(NSString*)name
             contents:(TabContents*)contents;

// Called when the tab contents is the currently selected tab and is about to be
// removed from the view hierarchy.
- (void)willBecomeUnselectedTab;

// Called when the tab contents is about to be put into the view hierarchy as
// the selected tab. Handles things such as ensuring the toolbar is correctly
// enabled.
- (void)willBecomeSelectedTab;

// Call when the tab view is properly sized and the render widget host view
// should be put into the view hierarchy.
- (void)ensureContentsVisible;

// Called when the tab contents is updated in some non-descript way (the
// notification from the model isn't specific). |updatedContents| could reflect
// an entirely new tab contents object.
- (void)tabDidChange:(TabContents*)updatedContents;

// Shows |devToolsContents| in a split view, or removes the bottom view in the
// split viewif |devToolsContents| is NULL.
// TODO(thakis): Either move this to tab_window or move infobar handling to here
// too -- http://crbug.com/31633 .
- (void)showDevToolsContents:(TabContents*)devToolsContents;

// Returns the height required by devtools and divider, or 0 if no devtools are
// docked to the tab.
- (CGFloat)devToolsHeight;
@end

#endif  // CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_