| 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_view.h" | 5 #include "chrome/browser/ui/views/panels/panel_view.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 mouse_pressed_ = true; | 760 mouse_pressed_ = true; |
| 761 mouse_dragging_state_ = NO_DRAGGING; | 761 mouse_dragging_state_ = NO_DRAGGING; |
| 762 last_mouse_location_ = mouse_location; | 762 last_mouse_location_ = mouse_location; |
| 763 return true; | 763 return true; |
| 764 } | 764 } |
| 765 | 765 |
| 766 bool PanelView::OnTitlebarMouseDragged(const gfx::Point& mouse_location) { | 766 bool PanelView::OnTitlebarMouseDragged(const gfx::Point& mouse_location) { |
| 767 if (!mouse_pressed_) | 767 if (!mouse_pressed_) |
| 768 return false; | 768 return false; |
| 769 | 769 |
| 770 int delta_x = mouse_location.x() - last_mouse_location_.x(); | |
| 771 int delta_y = mouse_location.y() - last_mouse_location_.y(); | |
| 772 if (mouse_dragging_state_ == NO_DRAGGING && | 770 if (mouse_dragging_state_ == NO_DRAGGING && |
| 773 ExceededDragThreshold(delta_x, delta_y)) { | 771 ExceededDragThreshold(mouse_location - last_mouse_location_)) { |
| 774 // When a drag begins, we do not want to the client area to still receive | 772 // When a drag begins, we do not want to the client area to still receive |
| 775 // the focus. We do not need to do this for the unfocused minimized panel. | 773 // the focus. We do not need to do this for the unfocused minimized panel. |
| 776 if (!panel_->IsMinimized()) { | 774 if (!panel_->IsMinimized()) { |
| 777 old_focused_view_ = GetFocusManager()->GetFocusedView(); | 775 old_focused_view_ = GetFocusManager()->GetFocusedView(); |
| 778 GetFocusManager()->SetFocusedView(GetFrameView()); | 776 GetFocusManager()->SetFocusedView(GetFrameView()); |
| 779 } | 777 } |
| 780 | 778 |
| 781 panel_->manager()->StartDragging(panel_.get(), last_mouse_location_); | 779 panel_->manager()->StartDragging(panel_.get(), last_mouse_location_); |
| 782 mouse_dragging_state_ = DRAGGING_STARTED; | 780 mouse_dragging_state_ = DRAGGING_STARTED; |
| 783 } | 781 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 int height = web_view_->size().height(); | 889 int height = web_view_->size().height(); |
| 892 SkRegion* region = new SkRegion; | 890 SkRegion* region = new SkRegion; |
| 893 region->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op); | 891 region->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op); |
| 894 region->op(width - kResizeInsideBoundsSize, 0, width, height, | 892 region->op(width - kResizeInsideBoundsSize, 0, width, height, |
| 895 SkRegion::kUnion_Op); | 893 SkRegion::kUnion_Op); |
| 896 region->op(0, height - kResizeInsideBoundsSize, width, height, | 894 region->op(0, height - kResizeInsideBoundsSize, width, height, |
| 897 SkRegion::kUnion_Op); | 895 SkRegion::kUnion_Op); |
| 898 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); | 896 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); |
| 899 #endif | 897 #endif |
| 900 } | 898 } |
| OLD | NEW |