Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Unified Diff: chrome/browser/ui/panels/display_settings_provider.h

Issue 10051020: Move full-screen detection logic from PanelManager to DisplaySettingsProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux asan Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/display_settings_provider.h
diff --git a/chrome/browser/ui/panels/display_settings_provider.h b/chrome/browser/ui/panels/display_settings_provider.h
index b50eb5694a2e110b9d0b7f5c1c06d535f339d7ca..f7fcce6a1095c264a402a96bc98d2290ec05101e 100644
--- a/chrome/browser/ui/panels/display_settings_provider.h
+++ b/chrome/browser/ui/panels/display_settings_provider.h
@@ -6,6 +6,8 @@
#define CHROME_BROWSER_UI_PANELS_DISPLAY_SETTINGS_PROVIDER_H_
#pragma once
+#include "base/observer_list.h"
+#include "base/timer.h"
#include "ui/gfx/rect.h"
// Encapsulates the logic to provide display settings support, including the
@@ -29,23 +31,36 @@ class DisplaySettingsProvider {
DESKTOP_BAR_HIDDEN
};
- // Observer can listen to the event regarding the display area change.
class DisplayAreaObserver {
public:
virtual void OnDisplayAreaChanged(const gfx::Rect& display_area) = 0;
};
- // Observer can listen to the event regarding the desktop bar change.
class DesktopBarObserver {
public:
virtual void OnAutoHidingDesktopBarVisibilityChanged(
DesktopBarAlignment alignment, DesktopBarVisibility visibility) = 0;
};
+ class FullScreenObserver {
+ public:
+ virtual void OnFullScreenModeChanged(bool is_full_screen) = 0;
+ };
+
static DisplaySettingsProvider* Create();
virtual ~DisplaySettingsProvider();
+ // Subscribes/unsubscribes from the display settings change notification.
+ void AddDisplayAreaObserver(DisplayAreaObserver* observer);
+ void RemoveDisplayAreaObserver(DisplayAreaObserver* observer);
+
+ void AddDesktopBarObserver(DesktopBarObserver* observer);
+ void RemoveDesktopBarObserver(DesktopBarObserver* observer);
+
+ void AddFullScreenObserver(FullScreenObserver* observer);
+ void RemoveFullScreenObserver(FullScreenObserver* observer);
+
// Returns the bounds of the display area.
gfx::Rect GetDisplayArea();
@@ -70,21 +85,20 @@ class DisplaySettingsProvider {
virtual DesktopBarVisibility GetDesktopBarVisibility(
DesktopBarAlignment alignment) const;
- DisplayAreaObserver* display_area_observer() const {
- return display_area_observer_;
- }
- void set_display_area_observer(DisplayAreaObserver* display_area_observer) {
- display_area_observer_ = display_area_observer;
+ ObserverList<DisplayAreaObserver>& display_area_observers() {
+ return display_area_observers_;
}
- DesktopBarObserver* desktop_bar_observer() const {
- return desktop_bar_observer_;
+ ObserverList<DesktopBarObserver>& desktop_bar_observers() {
+ return desktop_bar_observers_;
}
- void set_desktop_bar_observer(DesktopBarObserver* desktop_bar_observer) {
- desktop_bar_observer_ = desktop_bar_observer;
+
+ ObserverList<FullScreenObserver>& full_screen_observers() {
+ return full_screen_observers_;
}
gfx::Rect work_area() const { return work_area_; }
+ bool is_full_screen() const { return is_full_screen_; }
protected:
DisplaySettingsProvider();
@@ -94,14 +108,19 @@ class DisplaySettingsProvider {
// testing code.
virtual gfx::Rect GetWorkArea() const;
+ // Callback to perform periodic check for full screen mode changes.
+ virtual void CheckFullScreenMode();
+
void OnAutoHidingDesktopBarChanged();
private:
// Adjusts the work area to exclude the influence of auto-hiding desktop bars.
void AdjustWorkAreaForAutoHidingDesktopBars();
- DisplayAreaObserver* display_area_observer_;
- DesktopBarObserver* desktop_bar_observer_;
+ // Observers that listen to various display settings changes.
+ ObserverList<DisplayAreaObserver> display_area_observers_;
+ ObserverList<DesktopBarObserver> desktop_bar_observers_;
+ ObserverList<FullScreenObserver> full_screen_observers_;
// The maximum work area avaialble. This area does not include the area taken
// by the always-visible (non-auto-hiding) desktop bars.
@@ -112,6 +131,14 @@ class DisplaySettingsProvider {
// bars (we only consider those bars that are aligned to bottom, left, and
// right of the screen edges) when they become fully visible.
gfx::Rect adjusted_work_area_;
+
+ // True if full screen mode or presentation mode is entered.
+ bool is_full_screen_;
+
+ // Timer used to detect full-screen mode change.
+ base::RepeatingTimer<DisplaySettingsProvider> full_screen_mode_timer_;
+
+ DISALLOW_COPY_AND_ASSIGN(DisplaySettingsProvider);
};
#endif // CHROME_BROWSER_UI_PANELS_DISPLAY_SETTINGS_PROVIDER_H_
« no previous file with comments | « chrome/browser/ui/panels/base_panel_browser_test.cc ('k') | chrome/browser/ui/panels/display_settings_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698