| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/panels/panel_manager.h" | 5 #include "chrome/browser/ui/panels/panel_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/fullscreen.h" | 9 #include "chrome/browser/fullscreen.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_list.h" | 11 #include "chrome/browser/ui/browser_list.h" |
| 12 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 12 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
| 13 #include "chrome/browser/ui/panels/panel_overflow_strip.h" | 13 #include "chrome/browser/ui/panels/panel_overflow_strip.h" |
| 14 #include "chrome/browser/ui/panels/panel_strip.h" | 14 #include "chrome/browser/ui/panels/panel_strip.h" |
| 15 #include "chrome/browser/ui/window_sizer.h" | |
| 16 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 18 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
| 18 #include "ui/gfx/screen.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 const int kOverflowStripThickness = 24; | 21 const int kOverflowStripThickness = 24; |
| 22 | 22 |
| 23 // Width of spacing around panel strip and the left/right edges of the screen. | 23 // Width of spacing around panel strip and the left/right edges of the screen. |
| 24 const int kPanelStripLeftMargin = kOverflowStripThickness + 6; | 24 const int kPanelStripLeftMargin = kOverflowStripThickness + 6; |
| 25 const int kPanelStripRightMargin = 24; | 25 const int kPanelStripRightMargin = 24; |
| 26 | 26 |
| 27 // Height of panel strip is based on the factor of the working area. | 27 // Height of panel strip is based on the factor of the working area. |
| 28 const double kPanelStripHeightFactor = 0.5; | 28 const double kPanelStripHeightFactor = 0.5; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 panel_strip_.reset(new PanelStrip(this)); | 44 panel_strip_.reset(new PanelStrip(this)); |
| 45 panel_overflow_strip_.reset(new PanelOverflowStrip(this)); | 45 panel_overflow_strip_.reset(new PanelOverflowStrip(this)); |
| 46 auto_hiding_desktop_bar_ = AutoHidingDesktopBar::Create(this); | 46 auto_hiding_desktop_bar_ = AutoHidingDesktopBar::Create(this); |
| 47 OnDisplayChanged(); | 47 OnDisplayChanged(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 PanelManager::~PanelManager() { | 50 PanelManager::~PanelManager() { |
| 51 } | 51 } |
| 52 | 52 |
| 53 void PanelManager::OnDisplayChanged() { | 53 void PanelManager::OnDisplayChanged() { |
| 54 scoped_ptr<WindowSizer::MonitorInfoProvider> info_provider( | |
| 55 WindowSizer::CreateDefaultMonitorInfoProvider()); | |
| 56 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
| 57 // On OSX, panels should be dropped all the way to the bottom edge of the | 55 // On OSX, panels should be dropped all the way to the bottom edge of the |
| 58 // screen (and overlap Dock). | 56 // screen (and overlap Dock). |
| 59 gfx::Rect work_area = info_provider->GetPrimaryMonitorBounds(); | 57 gfx::Rect work_area = gfx::Screen::GetPrimaryMonitorBounds(); |
| 60 #else | 58 #else |
| 61 gfx::Rect work_area = info_provider->GetPrimaryMonitorWorkArea(); | 59 gfx::Rect work_area = gfx::Screen::GetPrimaryMonitorWorkArea(); |
| 62 #endif | 60 #endif |
| 63 SetWorkArea(work_area); | 61 SetWorkArea(work_area); |
| 64 } | 62 } |
| 65 | 63 |
| 66 void PanelManager::SetWorkArea(const gfx::Rect& work_area) { | 64 void PanelManager::SetWorkArea(const gfx::Rect& work_area) { |
| 67 if (work_area == work_area_) | 65 if (work_area == work_area_) |
| 68 return; | 66 return; |
| 69 work_area_ = work_area; | 67 work_area_ = work_area; |
| 70 | 68 |
| 71 auto_hiding_desktop_bar_->UpdateWorkArea(work_area_); | 69 auto_hiding_desktop_bar_->UpdateWorkArea(work_area_); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 return panel_strip_->num_panels() + panel_overflow_strip_->num_panels(); | 223 return panel_strip_->num_panels() + panel_overflow_strip_->num_panels(); |
| 226 } | 224 } |
| 227 | 225 |
| 228 bool PanelManager::is_dragging_panel() const { | 226 bool PanelManager::is_dragging_panel() const { |
| 229 return panel_strip_->is_dragging_panel(); | 227 return panel_strip_->is_dragging_panel(); |
| 230 } | 228 } |
| 231 | 229 |
| 232 const PanelManager::Panels& PanelManager::panels() const { | 230 const PanelManager::Panels& PanelManager::panels() const { |
| 233 return panel_strip_->panels(); | 231 return panel_strip_->panels(); |
| 234 } | 232 } |
| OLD | NEW |