| 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/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
| 11 #include "chrome/browser/ui/monitor_info_provider.h" |
| 11 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 12 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
| 12 #include "chrome/browser/ui/panels/panel_strip.h" | 13 #include "chrome/browser/ui/panels/panel_strip.h" |
| 13 #include "chrome/browser/ui/window_sizer.h" | |
| 14 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 const int kOverflowStripThickness = 24; | 19 const int kOverflowStripThickness = 24; |
| 20 | 20 |
| 21 // Width of spacing around panel strip and the left/right edges of the screen. | 21 // Width of spacing around panel strip and the left/right edges of the screen. |
| 22 const int kPanelStripLeftMargin = kOverflowStripThickness + 6; | 22 const int kPanelStripLeftMargin = kOverflowStripThickness + 6; |
| 23 const int kPanelStripRightMargin = 24; | 23 const int kPanelStripRightMargin = 24; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 38 auto_sizing_enabled_(true) { | 38 auto_sizing_enabled_(true) { |
| 39 panel_strip_.reset(new PanelStrip(this)); | 39 panel_strip_.reset(new PanelStrip(this)); |
| 40 auto_hiding_desktop_bar_ = AutoHidingDesktopBar::Create(this); | 40 auto_hiding_desktop_bar_ = AutoHidingDesktopBar::Create(this); |
| 41 OnDisplayChanged(); | 41 OnDisplayChanged(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 PanelManager::~PanelManager() { | 44 PanelManager::~PanelManager() { |
| 45 } | 45 } |
| 46 | 46 |
| 47 void PanelManager::OnDisplayChanged() { | 47 void PanelManager::OnDisplayChanged() { |
| 48 scoped_ptr<WindowSizer::MonitorInfoProvider> info_provider( | 48 scoped_ptr<MonitorInfoProvider> monitor_info(MonitorInfoProvider::Create()); |
| 49 WindowSizer::CreateDefaultMonitorInfoProvider()); | |
| 50 #if defined(OS_MACOSX) | 49 #if defined(OS_MACOSX) |
| 51 // On OSX, panels should be dropped all the way to the bottom edge of the | 50 // On OSX, panels should be dropped all the way to the bottom edge of the |
| 52 // screen (and overlap Dock). | 51 // screen (and overlap Dock). |
| 53 gfx::Rect work_area = info_provider->GetPrimaryMonitorBounds(); | 52 gfx::Rect work_area = monitor_info->GetPrimaryMonitorBounds(); |
| 54 #else | 53 #else |
| 55 gfx::Rect work_area = info_provider->GetPrimaryMonitorWorkArea(); | 54 gfx::Rect work_area = monitor_info->GetPrimaryMonitorWorkArea(); |
| 56 #endif | 55 #endif |
| 57 SetWorkArea(work_area); | 56 SetWorkArea(work_area); |
| 58 } | 57 } |
| 59 | 58 |
| 60 void PanelManager::SetWorkArea(const gfx::Rect& work_area) { | 59 void PanelManager::SetWorkArea(const gfx::Rect& work_area) { |
| 61 if (work_area == work_area_) | 60 if (work_area == work_area_) |
| 62 return; | 61 return; |
| 63 work_area_ = work_area; | 62 work_area_ = work_area; |
| 64 | 63 |
| 65 auto_hiding_desktop_bar_->UpdateWorkArea(work_area_); | 64 auto_hiding_desktop_bar_->UpdateWorkArea(work_area_); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // TODO(jianli): + overflow_strip_->num_panels(); | 202 // TODO(jianli): + overflow_strip_->num_panels(); |
| 204 } | 203 } |
| 205 | 204 |
| 206 bool PanelManager::is_dragging_panel() const { | 205 bool PanelManager::is_dragging_panel() const { |
| 207 return panel_strip_->is_dragging_panel(); | 206 return panel_strip_->is_dragging_panel(); |
| 208 } | 207 } |
| 209 | 208 |
| 210 const PanelManager::Panels& PanelManager::panels() const { | 209 const PanelManager::Panels& PanelManager::panels() const { |
| 211 return panel_strip_->panels(); | 210 return panel_strip_->panels(); |
| 212 } | 211 } |
| OLD | NEW |