Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / exclusive_access / fullscreen_within_tab_helper.h
blob694f89e92da3038761f3c3c5207ad50e4c549032
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.
5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_WITHIN_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_WITHIN_TAB_HELPER_H_
8 #include "content/public/browser/web_contents_user_data.h"
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.
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.
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:
24 bool is_fullscreen_for_captured_tab() const {
25 return is_fullscreen_for_captured_tab_;
28 void SetIsFullscreenForCapturedTab(bool is_fullscreen) {
29 is_fullscreen_for_captured_tab_ = is_fullscreen;
32 // Immediately remove and destroy the FullscreenWithinTabHelper instance
33 // associated with |web_contents|.
34 static void RemoveForWebContents(content::WebContents* web_contents);
36 private:
37 friend class content::WebContentsUserData<FullscreenWithinTabHelper>;
38 explicit FullscreenWithinTabHelper(content::WebContents* ignored);
39 ~FullscreenWithinTabHelper() override;
41 bool is_fullscreen_for_captured_tab_;
43 DISALLOW_COPY_AND_ASSIGN(FullscreenWithinTabHelper);
46 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_WITHIN_TAB_HELPER_H_