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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 top_height, | 587 top_height, |
588 std::max(0, width() - (2 * border_thickness)), | 588 std::max(0, width() - (2 * border_thickness)), |
589 std::max(0, height() - top_height - border_thickness)); | 589 std::max(0, height() - top_height - border_thickness)); |
590 } | 590 } |
591 | 591 |
592 void PanelBrowserFrameView::GetAccessibleState(ui::AccessibleViewState* state) { | 592 void PanelBrowserFrameView::GetAccessibleState(ui::AccessibleViewState* state) { |
593 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; | 593 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; |
594 } | 594 } |
595 | 595 |
596 bool PanelBrowserFrameView::OnMousePressed(const views::MouseEvent& event) { | 596 bool PanelBrowserFrameView::OnMousePressed(const views::MouseEvent& event) { |
| 597 // |event.location| is in the view's coordinate system. Convert it to the |
| 598 // screen coordinate system. |
| 599 gfx::Point mouse_location = event.location(); |
| 600 views::View::ConvertPointToScreen(this, &mouse_location); |
| 601 |
597 if (event.IsOnlyLeftMouseButton() && | 602 if (event.IsOnlyLeftMouseButton() && |
598 panel_browser_view_->OnTitlebarMousePressed(event.location())) { | 603 panel_browser_view_->OnTitlebarMousePressed(mouse_location)) { |
599 return true; | 604 return true; |
600 } | 605 } |
601 return BrowserNonClientFrameView::OnMousePressed(event); | 606 return BrowserNonClientFrameView::OnMousePressed(event); |
602 } | 607 } |
603 | 608 |
604 bool PanelBrowserFrameView::OnMouseDragged(const views::MouseEvent& event) { | 609 bool PanelBrowserFrameView::OnMouseDragged(const views::MouseEvent& event) { |
605 if (panel_browser_view_->OnTitlebarMouseDragged(event.location())) | 610 // |event.location| is in the view's coordinate system. Convert it to the |
| 611 // screen coordinate system. |
| 612 gfx::Point mouse_location = event.location(); |
| 613 views::View::ConvertPointToScreen(this, &mouse_location); |
| 614 |
| 615 if (panel_browser_view_->OnTitlebarMouseDragged(mouse_location)) |
606 return true; | 616 return true; |
607 return BrowserNonClientFrameView::OnMouseDragged(event); | 617 return BrowserNonClientFrameView::OnMouseDragged(event); |
608 } | 618 } |
609 | 619 |
610 void PanelBrowserFrameView::OnMouseReleased(const views::MouseEvent& event) { | 620 void PanelBrowserFrameView::OnMouseReleased(const views::MouseEvent& event) { |
611 if (panel_browser_view_->OnTitlebarMouseReleased()) | 621 if (panel_browser_view_->OnTitlebarMouseReleased()) |
612 return; | 622 return; |
613 BrowserNonClientFrameView::OnMouseReleased(event); | 623 BrowserNonClientFrameView::OnMouseReleased(event); |
614 } | 624 } |
615 | 625 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 | 928 |
919 settings_menu_model_.reset( | 929 settings_menu_model_.reset( |
920 new PanelSettingsMenuModel(panel_browser_view_->panel())); | 930 new PanelSettingsMenuModel(panel_browser_view_->panel())); |
921 settings_menu_adapter_.reset( | 931 settings_menu_adapter_.reset( |
922 new views::MenuModelAdapter(settings_menu_model_.get())); | 932 new views::MenuModelAdapter(settings_menu_model_.get())); |
923 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get()); | 933 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get()); |
924 settings_menu_adapter_->BuildMenu(settings_menu_); | 934 settings_menu_adapter_->BuildMenu(settings_menu_); |
925 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_)); | 935 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_)); |
926 return true; | 936 return true; |
927 } | 937 } |
OLD | NEW |