| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXCLUSIVE_ACCESS_FULLSCREEN_WITHIN_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_WITHIN_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_WITHIN_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_WITHIN_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "content/public/browser/web_contents_user_data.h" | 9 #include "content/public/browser/web_contents_user_data.h" |
| 10 | 10 |
| 11 // Helper used by FullscreenController to track the state of a WebContents that | 11 // Helper used by FullscreenController to track the state of a WebContents that |
| 12 // is in fullscreen mode, but the browser window is not. See | 12 // is in fullscreen mode, but the browser window is not. See |
| 13 // 'FullscreenWithinTab Note' in fullscreen_controller.h. | 13 // 'FullscreenWithinTab Note' in fullscreen_controller.h. |
| 14 // | 14 // |
| 15 // The purpose of this class is to associate some fullscreen state at the tab | 15 // The purpose of this class is to associate some fullscreen state at the tab |
| 16 // level rather than at the Browser level. This allows tabs to be | 16 // level rather than at the Browser level. This allows tabs to be |
| 17 // dragged/dropped between Browsers and have their fullscreen state handed off | 17 // dragged/dropped between Browsers and have their fullscreen state handed off |
| 18 // between FullscreenControllers as well. | 18 // between FullscreenControllers as well. |
| 19 // | 19 // |
| 20 // FullscreenWithinTabHelper is created on-demand, and its lifecycle is tied to | 20 // FullscreenWithinTabHelper is created on-demand, and its lifecycle is tied to |
| 21 // that of its associated WebContents. It is automatically destroyed. | 21 // that of its associated WebContents. It is automatically destroyed. |
| 22 class FullscreenWithinTabHelper | 22 class FullscreenWithinTabHelper |
| 23 : public content::WebContentsUserData<FullscreenWithinTabHelper> { | 23 : public content::WebContentsUserData<FullscreenWithinTabHelper> { |
| 24 public: | 24 public: |
| 25 ~FullscreenWithinTabHelper() override; |
| 26 |
| 25 bool is_fullscreen_for_captured_tab() const { | 27 bool is_fullscreen_for_captured_tab() const { |
| 26 return is_fullscreen_for_captured_tab_; | 28 return is_fullscreen_for_captured_tab_; |
| 27 } | 29 } |
| 28 | 30 |
| 29 void SetIsFullscreenForCapturedTab(bool is_fullscreen) { | 31 void SetIsFullscreenForCapturedTab(bool is_fullscreen) { |
| 30 is_fullscreen_for_captured_tab_ = is_fullscreen; | 32 is_fullscreen_for_captured_tab_ = is_fullscreen; |
| 31 } | 33 } |
| 32 | 34 |
| 33 // Immediately remove and destroy the FullscreenWithinTabHelper instance | 35 // Immediately remove and destroy the FullscreenWithinTabHelper instance |
| 34 // associated with |web_contents|. | 36 // associated with |web_contents|. |
| 35 static void RemoveForWebContents(content::WebContents* web_contents); | 37 static void RemoveForWebContents(content::WebContents* web_contents); |
| 36 | 38 |
| 37 private: | 39 private: |
| 38 friend class content::WebContentsUserData<FullscreenWithinTabHelper>; | 40 friend class content::WebContentsUserData<FullscreenWithinTabHelper>; |
| 39 explicit FullscreenWithinTabHelper(content::WebContents* ignored); | 41 explicit FullscreenWithinTabHelper(content::WebContents* ignored); |
| 40 ~FullscreenWithinTabHelper() override; | |
| 41 | 42 |
| 42 bool is_fullscreen_for_captured_tab_; | 43 bool is_fullscreen_for_captured_tab_; |
| 43 | 44 |
| 44 DISALLOW_COPY_AND_ASSIGN(FullscreenWithinTabHelper); | 45 DISALLOW_COPY_AND_ASSIGN(FullscreenWithinTabHelper); |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_WITHIN_TAB_HELPER_H_ | 48 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_WITHIN_TAB_HELPER_H_ |
| OLD | NEW |