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