| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_TAB_CONTENTS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <Cocoa/Cocoa.h> | 9 #include <Cocoa/Cocoa.h> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 | |
| 13 class TabContentsNotificationBridge; | |
| 14 @class TabContentsController; | |
| 15 | |
| 16 namespace content { | 11 namespace content { |
| 17 class WebContents; | 12 class WebContents; |
| 18 } | 13 } |
| 19 | 14 |
| 20 // The interface for the tab contents view controller's delegate. | |
| 21 | |
| 22 @protocol TabContentsControllerDelegate | |
| 23 | |
| 24 // Tells the delegate when the tab contents view's frame is about to change. | |
| 25 - (void)tabContentsViewFrameWillChange:(TabContentsController*)source | |
| 26 frameRect:(NSRect)frameRect; | |
| 27 | |
| 28 @end | |
| 29 | |
| 30 // A class that controls the WebContents view. It manages displaying the | 15 // A class that controls the WebContents view. It manages displaying the |
| 31 // native view for a given WebContents. | 16 // native view for a given WebContents. |
| 32 // Note that just creating the class does not display the view. We defer | 17 // Note that just creating the class does not display the view. We defer |
| 33 // inserting it until the box is the correct size to avoid multiple resize | 18 // inserting it until the box is the correct size to avoid multiple resize |
| 34 // messages to the renderer. You must call |-ensureContentsVisible| to display | 19 // messages to the renderer. You must call |-ensureContentsVisible| to display |
| 35 // the render widget host view. | 20 // the render widget host view. |
| 36 | 21 |
| 37 @interface TabContentsController : NSViewController { | 22 @interface TabContentsController : NSViewController { |
| 38 @private | 23 @private |
| 39 content::WebContents* contents_; // weak | 24 content::WebContents* contents_; // weak |
| 40 // Delegate to be notified about size changes. | |
| 41 id<TabContentsControllerDelegate> delegate_; // weak | |
| 42 scoped_ptr<TabContentsNotificationBridge> tabContentsBridge_; | |
| 43 } | 25 } |
| 44 @property(readonly, nonatomic) content::WebContents* webContents; | 26 @property(readonly, nonatomic) content::WebContents* webContents; |
| 45 | 27 |
| 46 - (id)initWithContents:(content::WebContents*)contents | 28 // Create the contents of a tab represented by |contents|. |
| 47 delegate:(id<TabContentsControllerDelegate>)delegate; | 29 - (id)initWithContents:(content::WebContents*)contents; |
| 48 | 30 |
| 49 // Call when the tab contents is about to be replaced with the currently | 31 // Call when the tab contents is about to be replaced with the currently |
| 50 // selected tab contents to do not trigger unnecessary content relayout. | 32 // selected tab contents to do not trigger unnecessary content relayout. |
| 51 - (void)ensureContentsSizeDoesNotChange; | 33 - (void)ensureContentsSizeDoesNotChange; |
| 52 | 34 |
| 53 // Call when the tab view is properly sized and the render widget host view | 35 // Call when the tab view is properly sized and the render widget host view |
| 54 // should be put into the view hierarchy. | 36 // should be put into the view hierarchy. |
| 55 - (void)ensureContentsVisible; | 37 - (void)ensureContentsVisible; |
| 56 | 38 |
| 57 // Call to change the underlying web contents object. View is not changed, | 39 // Call to change the underlying web contents object. View is not changed, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 69 - (void)willBecomeSelectedTab; | 51 - (void)willBecomeSelectedTab; |
| 70 | 52 |
| 71 // Called when the tab contents is updated in some non-descript way (the | 53 // Called when the tab contents is updated in some non-descript way (the |
| 72 // notification from the model isn't specific). |updatedContents| could reflect | 54 // notification from the model isn't specific). |updatedContents| could reflect |
| 73 // an entirely new tab contents object. | 55 // an entirely new tab contents object. |
| 74 - (void)tabDidChange:(content::WebContents*)updatedContents; | 56 - (void)tabDidChange:(content::WebContents*)updatedContents; |
| 75 | 57 |
| 76 @end | 58 @end |
| 77 | 59 |
| 78 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ | 60 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ |
| OLD | NEW |