| 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/views/panels/panel_frame_view.h" | 5 #include "chrome/browser/ui/views/panels/panel_frame_view.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/ui/panels/panel.h" | 8 #include "chrome/browser/ui/panels/panel.h" |
| 9 #include "chrome/browser/ui/panels/panel_constants.h" | 9 #include "chrome/browser/ui/panels/panel_constants.h" |
| 10 #include "chrome/browser/ui/views/panels/panel_view.h" | 10 #include "chrome/browser/ui/views/panels/panel_view.h" |
| 11 #include "chrome/browser/ui/views/tab_icon_view.h" | 11 #include "chrome/browser/ui/views/tab_icon_view.h" |
| 12 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
| 15 #include "ui/base/hit_test.h" | 15 #include "ui/base/hit_test.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 18 #include "ui/display/screen.h" |
| 18 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
| 19 #include "ui/gfx/font_list.h" | 20 #include "ui/gfx/font_list.h" |
| 20 #include "ui/gfx/path.h" | 21 #include "ui/gfx/path.h" |
| 21 #include "ui/gfx/screen.h" | |
| 22 #include "ui/resources/grit/ui_resources.h" | 22 #include "ui/resources/grit/ui_resources.h" |
| 23 #include "ui/views/controls/button/image_button.h" | 23 #include "ui/views/controls/button/image_button.h" |
| 24 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
| 25 #include "ui/views/resources/grit/views_resources.h" | 25 #include "ui/views/resources/grit/views_resources.h" |
| 26 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
| 27 #include "ui/views/widget/widget_delegate.h" | 27 #include "ui/views/widget/widget_delegate.h" |
| 28 | 28 |
| 29 #if defined(USE_AURA) | 29 #if defined(USE_AURA) |
| 30 #include "ui/aura/window.h" | 30 #include "ui/aura/window.h" |
| 31 #endif | 31 #endif |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 return true; | 585 return true; |
| 586 } | 586 } |
| 587 return NonClientFrameView::OnMousePressed(event); | 587 return NonClientFrameView::OnMousePressed(event); |
| 588 } | 588 } |
| 589 | 589 |
| 590 bool PanelFrameView::OnMouseDragged(const ui::MouseEvent& event) { | 590 bool PanelFrameView::OnMouseDragged(const ui::MouseEvent& event) { |
| 591 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 591 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 592 // Converting the mouse location to screen coordinates returns an incorrect | 592 // Converting the mouse location to screen coordinates returns an incorrect |
| 593 // location while the panel is moving. See crbug.com/353393 for more details. | 593 // location while the panel is moving. See crbug.com/353393 for more details. |
| 594 // TODO(pkotwicz): Fix conversion to screen coordinates | 594 // TODO(pkotwicz): Fix conversion to screen coordinates |
| 595 gfx::Screen* screen = gfx::Screen::GetScreen(); | 595 display::Screen* screen = display::Screen::GetScreen(); |
| 596 gfx::Point mouse_location = screen->GetCursorScreenPoint(); | 596 gfx::Point mouse_location = screen->GetCursorScreenPoint(); |
| 597 #else | 597 #else |
| 598 // |event.location| is in the view's coordinate system. Convert it to the | 598 // |event.location| is in the view's coordinate system. Convert it to the |
| 599 // screen coordinate system. | 599 // screen coordinate system. |
| 600 gfx::Point mouse_location = event.location(); | 600 gfx::Point mouse_location = event.location(); |
| 601 views::View::ConvertPointToScreen(this, &mouse_location); | 601 views::View::ConvertPointToScreen(this, &mouse_location); |
| 602 #endif | 602 #endif |
| 603 | 603 |
| 604 if (panel_view_->OnTitlebarMouseDragged(mouse_location)) | 604 if (panel_view_->OnTitlebarMouseDragged(mouse_location)) |
| 605 return true; | 605 return true; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 #endif | 781 #endif |
| 782 } | 782 } |
| 783 | 783 |
| 784 bool PanelFrameView::IsWithinResizingArea( | 784 bool PanelFrameView::IsWithinResizingArea( |
| 785 const gfx::Point& mouse_location) const { | 785 const gfx::Point& mouse_location) const { |
| 786 panel::Resizability resizability = panel_view_->panel()->CanResizeByMouse(); | 786 panel::Resizability resizability = panel_view_->panel()->CanResizeByMouse(); |
| 787 int edge_hittest = GetFrameEdgeHitTest( | 787 int edge_hittest = GetFrameEdgeHitTest( |
| 788 mouse_location, size(), PanelView::kResizeInsideBoundsSize, resizability); | 788 mouse_location, size(), PanelView::kResizeInsideBoundsSize, resizability); |
| 789 return edge_hittest != HTNOWHERE; | 789 return edge_hittest != HTNOWHERE; |
| 790 } | 790 } |
| OLD | NEW |