| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/ui/panels/detached_panel_collection.h" | 13 #include "chrome/browser/ui/panels/detached_panel_collection.h" |
| 14 #include "chrome/browser/ui/panels/docked_panel_collection.h" | 14 #include "chrome/browser/ui/panels/docked_panel_collection.h" |
| 15 #include "chrome/browser/ui/panels/panel_drag_controller.h" | 15 #include "chrome/browser/ui/panels/panel_drag_controller.h" |
| 16 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 16 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
| 17 #include "chrome/browser/ui/panels/panel_resize_controller.h" | 17 #include "chrome/browser/ui/panels/panel_resize_controller.h" |
| 18 #include "chrome/browser/ui/panels/stacked_panel_collection.h" | 18 #include "chrome/browser/ui/panels/stacked_panel_collection.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
| 21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
| 23 #include "ui/base/hit_test.h" |
| 23 | 24 |
| 24 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 25 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
| 25 #include "base/environment.h" | 26 #include "base/environment.h" |
| 26 #include "base/nix/xdg_util.h" | 27 #include "base/nix/xdg_util.h" |
| 27 #include "ui/base/x/x11_util.h" | 28 #include "ui/base/x/x11_util.h" |
| 28 #endif | 29 #endif |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 // Maxmium width of a panel is based on a factor of the working area. | 32 // Maxmium width of a panel is based on a factor of the working area. |
| 32 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 449 |
| 449 void PanelManager::Drag(const gfx::Point& mouse_location) { | 450 void PanelManager::Drag(const gfx::Point& mouse_location) { |
| 450 drag_controller_->Drag(mouse_location); | 451 drag_controller_->Drag(mouse_location); |
| 451 } | 452 } |
| 452 | 453 |
| 453 void PanelManager::EndDragging(bool cancelled) { | 454 void PanelManager::EndDragging(bool cancelled) { |
| 454 drag_controller_->EndDragging(cancelled); | 455 drag_controller_->EndDragging(cancelled); |
| 455 } | 456 } |
| 456 | 457 |
| 457 void PanelManager::StartResizingByMouse(Panel* panel, | 458 void PanelManager::StartResizingByMouse(Panel* panel, |
| 458 const gfx::Point& mouse_location, | 459 const gfx::Point& mouse_location, |
| 459 panel::ResizingSides sides) { | 460 int component) { |
| 460 if (panel->CanResizeByMouse() != panel::NOT_RESIZABLE && | 461 if (panel->CanResizeByMouse() != panel::NOT_RESIZABLE && |
| 461 sides != panel::RESIZE_NONE) | 462 component != HTNOWHERE) { |
| 462 resize_controller_->StartResizing(panel, mouse_location, sides); | 463 resize_controller_->StartResizing(panel, mouse_location, component); |
| 464 } |
| 463 } | 465 } |
| 464 | 466 |
| 465 void PanelManager::ResizeByMouse(const gfx::Point& mouse_location) { | 467 void PanelManager::ResizeByMouse(const gfx::Point& mouse_location) { |
| 466 if (resize_controller_->IsResizing()) | 468 if (resize_controller_->IsResizing()) |
| 467 resize_controller_->Resize(mouse_location); | 469 resize_controller_->Resize(mouse_location); |
| 468 } | 470 } |
| 469 | 471 |
| 470 void PanelManager::EndResizingByMouse(bool cancelled) { | 472 void PanelManager::EndResizingByMouse(bool cancelled) { |
| 471 if (resize_controller_->IsResizing()) { | 473 if (resize_controller_->IsResizing()) { |
| 472 Panel* resized_panel = resize_controller_->EndResizing(cancelled); | 474 Panel* resized_panel = resize_controller_->EndResizing(cancelled); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { | 562 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { |
| 561 panel_mouse_watcher_.reset(watcher); | 563 panel_mouse_watcher_.reset(watcher); |
| 562 } | 564 } |
| 563 | 565 |
| 564 void PanelManager::OnPanelAnimationEnded(Panel* panel) { | 566 void PanelManager::OnPanelAnimationEnded(Panel* panel) { |
| 565 content::NotificationService::current()->Notify( | 567 content::NotificationService::current()->Notify( |
| 566 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, | 568 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
| 567 content::Source<Panel>(panel), | 569 content::Source<Panel>(panel), |
| 568 content::NotificationService::NoDetails()); | 570 content::NotificationService::NoDetails()); |
| 569 } | 571 } |
| OLD | NEW |