Chromium Code Reviews| Index: chrome/browser/ui/cocoa/fullscreen_low_power_coordinator.h |
| diff --git a/chrome/browser/ui/cocoa/fullscreen_low_power_coordinator.h b/chrome/browser/ui/cocoa/fullscreen_low_power_coordinator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dae2c14553736fd86912d7cb9d2f99c96c778ff8 |
| --- /dev/null |
| +++ b/chrome/browser/ui/cocoa/fullscreen_low_power_coordinator.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_COCOA_FULLSCREEN_LOW_POWER_COORDINATOR_H_ |
| +#define CHROME_BROWSER_UI_COCOA_FULLSCREEN_LOW_POWER_COORDINATOR_H_ |
| + |
| +#include "ui/accelerated_widget_mac/accelerated_widget_mac.h" |
| +#include "ui/accelerated_widget_mac/fullscreen_low_power_coordinator.h" |
| + |
| +@class FullscreenLowPowerWindow; |
| + |
| +class FullscreenLowPowerCoordinatorCocoa |
|
erikchen
2016/05/05 17:47:38
Write a comment describing what this class does so
ccameron
2016/05/05 19:27:18
Done.
|
| + : public ui::FullscreenLowPowerCoordinator { |
| + public: |
| + FullscreenLowPowerCoordinatorCocoa(NSWindow* content_window, |
| + ui::AcceleratedWidgetMac* widget); |
| + ~FullscreenLowPowerCoordinatorCocoa(); |
| + |
| + // Interface to BrowserWindowController. |
| + NSWindow* GetFullscreenLowPowerWindow(); |
|
ccameron
2016/05/05 02:26:23
It may be that we'll want to have some sort of sco
|
| + void AddLowPowerModeSuppression(); |
| + void RemoveLowPowerModeSuppression(); |
| + |
| + // ui::FullscreenLowPowerCoordinator implementation. |
| + void SetLowPowerLayerValid(bool valid) override; |
| + void WillLoseAcceleratedWidget() override; |
| + |
| + private: |
| + // Determine if we should be fullscreen low power mode, and enter or exit |
| + // the mode as needed. |
| + void EnterOrExitLowPowerModeIfNeeded(); |
| + |
| + // The main fullscreen window. |
| + base::scoped_nsobject<NSWindow> content_window_ = nil; |
| + |
| + // Weak, reset by WillLoseAcceleratedWidget before it goes away. |
| + ui::AcceleratedWidgetMac* widget_ = nullptr; |
| + |
| + // The window that we will put in front of the main fullscreen window when we |
| + // can. |
| + base::scoped_nsobject<FullscreenLowPowerWindow> low_power_window_; |
| + |
| + // Set by the AcceleratedWidgetHost with each frame. This must be true to |
| + // enter low power mode. |
| + bool low_power_layer_valid_ = false; |
| + |
| + // The balance of alls to Add/RemoveLowPowerModeSuppression. This must be |
|
erikchen
2016/05/05 17:47:38
s/alls/calls
ccameron
2016/05/05 19:27:18
Done.
|
| + // zero to enter low power mode. |
| + int suppression_count_ = 0; |
| + |
| + // Updated by EnterOrExitLowPowerModeIfNeeded. |
| + bool in_low_power_mode_ = false; |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_LOW_POWER_COORDINATOR_H_ |