Index: chrome/browser/ui/panels/panel_manager.cc |
diff --git a/chrome/browser/ui/panels/panel_manager.cc b/chrome/browser/ui/panels/panel_manager.cc |
index f41baf98dd22032a2041a4068f3604b23737efe7..0dcc46fb4318dbfdcbe1be2fc4651df2f95b2977 100644 |
--- a/chrome/browser/ui/panels/panel_manager.cc |
+++ b/chrome/browser/ui/panels/panel_manager.cc |
@@ -8,7 +8,6 @@ |
#include "base/command_line.h" |
#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
-#include "chrome/browser/fullscreen.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_list.h" |
#include "chrome/browser/ui/panels/detached_panel_strip.h" |
@@ -36,9 +35,6 @@ const int kPanelStripRightMargin = 24; |
// Height of panel strip is based on the factor of the working area. |
const double kPanelStripHeightFactor = 0.5; |
- |
-static const int kFullScreenModeCheckIntervalMs = 1000; |
- |
} // namespace |
// static |
@@ -81,12 +77,11 @@ bool PanelManager::ShouldUsePanels(const std::string& extension_id) { |
PanelManager::PanelManager() |
: panel_mouse_watcher_(PanelMouseWatcher::Create()), |
auto_sizing_enabled_(true), |
- is_full_screen_(false), |
is_processing_overflow_(false) { |
// DisplaySettingsProvider should be created before the creation of strips |
// since some strip might depend on it. |
display_settings_provider_.reset(DisplaySettingsProvider::Create()); |
- display_settings_provider_->set_display_area_observer(this); |
+ display_settings_provider_->AddDisplayAreaObserver(this); |
detached_strip_.reset(new DetachedPanelStrip(this)); |
docked_strip_.reset(new DockedPanelStrip(this)); |
@@ -96,6 +91,7 @@ PanelManager::PanelManager() |
} |
PanelManager::~PanelManager() { |
+ display_settings_provider_->RemoveDisplayAreaObserver(this); |
} |
void PanelManager::OnDisplayAreaChanged(const gfx::Rect& display_area) { |
@@ -114,6 +110,11 @@ void PanelManager::OnDisplayAreaChanged(const gfx::Rect& display_area) { |
overflow_strip_->SetDisplayArea(overflow_area); |
} |
+void PanelManager::OnFullScreenModeChanged(bool is_full_screen) { |
+ docked_strip_->OnFullScreenModeChanged(is_full_screen); |
+ overflow_strip_->OnFullScreenModeChanged(is_full_screen); |
+} |
+ |
Panel* PanelManager::CreatePanel(Browser* browser) { |
// Need to sync the display area if no panel is present. This is because: |
// 1) Display area is not initialized until first panel is created. |
@@ -135,26 +136,16 @@ Panel* PanelManager::CreatePanel(Browser* browser) { |
content::NotificationService::NoDetails()); |
if (num_panels() == 1) { |
- full_screen_mode_timer_.Start(FROM_HERE, |
- base::TimeDelta::FromMilliseconds(kFullScreenModeCheckIntervalMs), |
- this, &PanelManager::CheckFullScreenMode); |
+ display_settings_provider_->AddFullScreenObserver(this); |
} |
return panel; |
} |
-void PanelManager::CheckFullScreenMode() { |
- bool is_full_screen_new = IsFullScreenMode(); |
- if (is_full_screen_ == is_full_screen_new) |
- return; |
- is_full_screen_ = is_full_screen_new; |
- docked_strip_->OnFullScreenModeChanged(is_full_screen_); |
- overflow_strip_->OnFullScreenModeChanged(is_full_screen_); |
-} |
- |
void PanelManager::OnPanelClosed(Panel* panel) { |
- if (num_panels() == 1) |
- full_screen_mode_timer_.Stop(); |
+ if (num_panels() == 1) { |
+ display_settings_provider_->RemoveFullScreenObserver(this); |
+ } |
drag_controller_->OnPanelClosed(panel); |
resize_controller_->OnPanelClosed(panel); |