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 "base/memory/scoped_ptr.h" | 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 // beforehand call the |-ensureContentsSizeDoesNotChange| method. This will | 23 // beforehand call the |-ensureContentsSizeDoesNotChange| method. This will |
24 // avoid multiple resize messages being sent to the renderer and triggering | 24 // avoid multiple resize messages being sent to the renderer and triggering |
25 // redundant and costly layouts. After the view has been inserted, client code | 25 // redundant and costly layouts. After the view has been inserted, client code |
26 // calls |-ensureContentsVisible| to display the WebContents view. | 26 // calls |-ensureContentsVisible| to display the WebContents view. |
27 // | 27 // |
28 // AutoEmbedFullscreen mode: When enabled, TabContentsController will observe | 28 // AutoEmbedFullscreen mode: When enabled, TabContentsController will observe |
29 // for WebContents fullscreen changes and automatically swap the normal | 29 // for WebContents fullscreen changes and automatically swap the normal |
30 // WebContents view with the fullscreen view (if different). In addition, if a | 30 // WebContents view with the fullscreen view (if different). In addition, if a |
31 // WebContents is being screen-captured, the view will be centered within the | 31 // WebContents is being screen-captured, the view will be centered within the |
32 // container view, sized to the aspect ratio of the capture video resolution, | 32 // container view, sized to the aspect ratio of the capture video resolution, |
33 // and scaling will be avoided whenever possible. | 33 // and scaling will be avoided whenever possible. |
34 @interface TabContentsController : NSViewController { | 34 @interface TabContentsController : NSViewController { |
35 @private | 35 @private |
36 content::WebContents* contents_; // weak | 36 content::WebContents* contents_; // weak |
37 // When |fullscreenObserver_| is not-NULL, TabContentsController monitors for | 37 // When |fullscreenObserver_| is not-NULL, TabContentsController monitors for |
38 // and auto-embeds fullscreen widgets as a subview. | 38 // and auto-embeds fullscreen widgets as a subview. |
39 scoped_ptr<FullscreenObserver> fullscreenObserver_; | 39 std::unique_ptr<FullscreenObserver> fullscreenObserver_; |
40 // Set to true while TabContentsController is embedding a fullscreen widget | 40 // Set to true while TabContentsController is embedding a fullscreen widget |
41 // view as a subview instead of the normal WebContentsView render view. | 41 // view as a subview instead of the normal WebContentsView render view. |
42 // Note: This will be false in the case of non-Flash fullscreen. | 42 // Note: This will be false in the case of non-Flash fullscreen. |
43 BOOL isEmbeddingFullscreenWidget_; | 43 BOOL isEmbeddingFullscreenWidget_; |
44 } | 44 } |
45 @property(readonly, nonatomic) content::WebContents* webContents; | 45 @property(readonly, nonatomic) content::WebContents* webContents; |
46 | 46 |
47 // This flag is set to true when we don't want the fullscreen widget to | 47 // This flag is set to true when we don't want the fullscreen widget to |
48 // resize. This is done so that we can avoid resizing the fullscreen widget | 48 // resize. This is done so that we can avoid resizing the fullscreen widget |
49 // to intermediate sizes during the fullscreen transition. | 49 // to intermediate sizes during the fullscreen transition. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // an entirely new tab contents object. | 87 // an entirely new tab contents object. |
88 - (void)tabDidChange:(content::WebContents*)updatedContents; | 88 - (void)tabDidChange:(content::WebContents*)updatedContents; |
89 | 89 |
90 // Called to switch the container's subview to the WebContents-owned fullscreen | 90 // Called to switch the container's subview to the WebContents-owned fullscreen |
91 // widget or back to WebContentsView's widget. | 91 // widget or back to WebContentsView's widget. |
92 - (void)toggleFullscreenWidget:(BOOL)enterFullscreen; | 92 - (void)toggleFullscreenWidget:(BOOL)enterFullscreen; |
93 | 93 |
94 @end | 94 @end |
95 | 95 |
96 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ | 96 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ |
OLD | NEW |