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_browser_frame_view.h" | 5 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 border_thickness, | 511 border_thickness, |
512 top_height, | 512 top_height, |
513 std::max(0, width() - (2 * border_thickness)), | 513 std::max(0, width() - (2 * border_thickness)), |
514 std::max(0, height() - top_height - border_thickness)); | 514 std::max(0, height() - top_height - border_thickness)); |
515 } | 515 } |
516 | 516 |
517 void PanelBrowserFrameView::GetAccessibleState(ui::AccessibleViewState* state) { | 517 void PanelBrowserFrameView::GetAccessibleState(ui::AccessibleViewState* state) { |
518 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; | 518 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; |
519 } | 519 } |
520 | 520 |
521 bool PanelBrowserFrameView::OnMousePressed(const views::MouseEvent& event) { | 521 bool PanelBrowserFrameView::OnMousePressed(const ui::MouseEvent& event) { |
522 gfx::Point mouse_location = event.location(); | 522 gfx::Point mouse_location = event.location(); |
523 | 523 |
524 if (CanResize() && | 524 if (CanResize() && |
525 IsHitTestValueForResizing(NonClientHitTest(mouse_location))) | 525 IsHitTestValueForResizing(NonClientHitTest(mouse_location))) |
526 return BrowserNonClientFrameView::OnMousePressed(event); | 526 return BrowserNonClientFrameView::OnMousePressed(event); |
527 | 527 |
528 // |event.location| is in the view's coordinate system. Convert it to the | 528 // |event.location| is in the view's coordinate system. Convert it to the |
529 // screen coordinate system. | 529 // screen coordinate system. |
530 views::View::ConvertPointToScreen(this, &mouse_location); | 530 views::View::ConvertPointToScreen(this, &mouse_location); |
531 | 531 |
532 if (event.IsOnlyLeftMouseButton() && | 532 if (event.IsOnlyLeftMouseButton() && |
533 panel_browser_view_->OnTitlebarMousePressed(mouse_location)) { | 533 panel_browser_view_->OnTitlebarMousePressed(mouse_location)) { |
534 return true; | 534 return true; |
535 } | 535 } |
536 return BrowserNonClientFrameView::OnMousePressed(event); | 536 return BrowserNonClientFrameView::OnMousePressed(event); |
537 } | 537 } |
538 | 538 |
539 bool PanelBrowserFrameView::OnMouseDragged(const views::MouseEvent& event) { | 539 bool PanelBrowserFrameView::OnMouseDragged(const ui::MouseEvent& event) { |
540 // |event.location| is in the view's coordinate system. Convert it to the | 540 // |event.location| is in the view's coordinate system. Convert it to the |
541 // screen coordinate system. | 541 // screen coordinate system. |
542 gfx::Point mouse_location = event.location(); | 542 gfx::Point mouse_location = event.location(); |
543 views::View::ConvertPointToScreen(this, &mouse_location); | 543 views::View::ConvertPointToScreen(this, &mouse_location); |
544 | 544 |
545 if (panel_browser_view_->OnTitlebarMouseDragged(mouse_location)) | 545 if (panel_browser_view_->OnTitlebarMouseDragged(mouse_location)) |
546 return true; | 546 return true; |
547 return BrowserNonClientFrameView::OnMouseDragged(event); | 547 return BrowserNonClientFrameView::OnMouseDragged(event); |
548 } | 548 } |
549 | 549 |
550 void PanelBrowserFrameView::OnMouseReleased(const views::MouseEvent& event) { | 550 void PanelBrowserFrameView::OnMouseReleased(const ui::MouseEvent& event) { |
551 if (panel_browser_view_->OnTitlebarMouseReleased( | 551 if (panel_browser_view_->OnTitlebarMouseReleased( |
552 event.IsControlDown() ? panel::APPLY_TO_ALL : panel::NO_MODIFIER)) | 552 event.IsControlDown() ? panel::APPLY_TO_ALL : panel::NO_MODIFIER)) |
553 return; | 553 return; |
554 BrowserNonClientFrameView::OnMouseReleased(event); | 554 BrowserNonClientFrameView::OnMouseReleased(event); |
555 } | 555 } |
556 | 556 |
557 void PanelBrowserFrameView::OnMouseCaptureLost() { | 557 void PanelBrowserFrameView::OnMouseCaptureLost() { |
558 if (panel_browser_view_->OnTitlebarMouseCaptureLost()) | 558 if (panel_browser_view_->OnTitlebarMouseCaptureLost()) |
559 return; | 559 return; |
560 BrowserNonClientFrameView::OnMouseCaptureLost(); | 560 BrowserNonClientFrameView::OnMouseCaptureLost(); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 } | 803 } |
804 | 804 |
805 bool PanelBrowserFrameView::CanResize() const { | 805 bool PanelBrowserFrameView::CanResize() const { |
806 return panel_browser_view_->panel()->CanResizeByMouse() != | 806 return panel_browser_view_->panel()->CanResizeByMouse() != |
807 panel::NOT_RESIZABLE; | 807 panel::NOT_RESIZABLE; |
808 } | 808 } |
809 | 809 |
810 bool PanelBrowserFrameView::IsShowingTitlebarOnly() const { | 810 bool PanelBrowserFrameView::IsShowingTitlebarOnly() const { |
811 return height() <= panel::kTitlebarHeight; | 811 return height() <= panel::kTitlebarHeight; |
812 } | 812 } |
OLD | NEW |