| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <Cocoa/Cocoa.h> | 8 #include <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 class FullscreenObserver; | 12 class FullscreenObserver; |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class WebContents; | 15 class WebContents; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // A class that controls the WebContents view. It internally creates a container | 18 // A class that controls the WebContents view. It internally creates a container |
| 19 // view (the NSView accessed by calling |-view|) which manages the layout and | 19 // view (the NSView accessed by calling |-view|) which manages the layout and |
| 20 // display of the WebContents view. | 20 // display of the WebContents view. |
| 21 // | 21 // |
| 22 // Client code that inserts [controller view] into the view hierarchy needs to | 22 // Client code that inserts [controller view] into the view hierarchy needs to |
| 23 // call -ensureContentsVisibleInSuperview:(NSView*)superview to match the | 23 // call -ensureContentsVisibleInSuperview:(NSView*)superview to match the |
| 24 // container to the [superview bounds] and avoid multiple resize messages being | 24 // container to the [superview bounds] and avoid multiple resize messages being |
| 25 // sent to the renderer, which triggers redundant and costly layouts. | 25 // sent to the renderer, which triggers redundant and costly layouts. |
| 26 // | 26 // |
| 27 // AutoEmbedFullscreen mode: When enabled, TabContentsController will observe | 27 // AutoEmbedFullscreen mode: When enabled, TabContentsController will observe |
| 28 // for WebContents fullscreen changes and automatically swap the normal | 28 // for WebContents fullscreen changes and automatically swap the normal |
| 29 // WebContents view with the fullscreen view (if different). In addition, if a | 29 // WebContents view with the fullscreen view (if different). In addition, if a |
| 30 // WebContents is being screen-captured, the view will be centered within the | 30 // WebContents is being screen-captured, the WebContentsView will be centered |
| 31 // container view, sized to the aspect ratio of the capture video resolution, | 31 // within the container view and sized to the aspect ratio of the capture video |
| 32 // and scaling will be avoided whenever possible. | 32 // resolution; also, the WebContentsView will be sized so that the page is |
| 33 // rendered at the capture video resolution. This means the container view can |
| 34 // have a different size than the WebContentsView, and the tab content may |
| 35 // appear scaled within the browser window on the local screen. The reason for |
| 36 // doing all this is to improve quality and performance: For example, pages that |
| 37 // stream video content will dynamically adapt their video playback resolution |
| 38 // based on their rendering size; and so this should ideally match the tab |
| 39 // capture size. |
| 33 @interface TabContentsController : NSViewController { | 40 @interface TabContentsController : NSViewController { |
| 34 @private | 41 @private |
| 35 content::WebContents* contents_; // weak | 42 content::WebContents* contents_; // weak |
| 36 // When |fullscreenObserver_| is not-NULL, TabContentsController monitors for | 43 // When |fullscreenObserver_| is not-NULL, TabContentsController monitors for |
| 37 // and auto-embeds fullscreen widgets as a subview. | 44 // and auto-embeds fullscreen widgets as a subview. |
| 38 std::unique_ptr<FullscreenObserver> fullscreenObserver_; | 45 std::unique_ptr<FullscreenObserver> fullscreenObserver_; |
| 39 // Set to true while TabContentsController is embedding a fullscreen widget | 46 // Set to true while TabContentsController is embedding a fullscreen widget |
| 40 // view as a subview instead of the normal WebContentsView render view. | 47 // view as a subview instead of the normal WebContentsView render view. |
| 41 // Note: This will be false in the case of non-Flash fullscreen. | 48 // Note: This will be false in the case of non-Flash fullscreen. |
| 42 BOOL isEmbeddingFullscreenWidget_; | 49 BOOL isEmbeddingFullscreenWidget_; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // an entirely new tab contents object. | 91 // an entirely new tab contents object. |
| 85 - (void)tabDidChange:(content::WebContents*)updatedContents; | 92 - (void)tabDidChange:(content::WebContents*)updatedContents; |
| 86 | 93 |
| 87 // Called to switch the container's subview to the WebContents-owned fullscreen | 94 // Called to switch the container's subview to the WebContents-owned fullscreen |
| 88 // widget or back to WebContentsView's widget. | 95 // widget or back to WebContentsView's widget. |
| 89 - (void)toggleFullscreenWidget:(BOOL)enterFullscreen; | 96 - (void)toggleFullscreenWidget:(BOOL)enterFullscreen; |
| 90 | 97 |
| 91 @end | 98 @end |
| 92 | 99 |
| 93 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ | 100 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ |
| OLD | NEW |