| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 } | 734 } |
| 735 OnMouseEvent(event, msg); | 735 OnMouseEvent(event, msg); |
| 736 return true; | 736 return true; |
| 737 } | 737 } |
| 738 | 738 |
| 739 bool LocationBarView::OnMouseDragged(const views::MouseEvent& event) { | 739 bool LocationBarView::OnMouseDragged(const views::MouseEvent& event) { |
| 740 OnMouseEvent(event, WM_MOUSEMOVE); | 740 OnMouseEvent(event, WM_MOUSEMOVE); |
| 741 return true; | 741 return true; |
| 742 } | 742 } |
| 743 | 743 |
| 744 void LocationBarView::OnMouseReleased(const views::MouseEvent& event, | 744 void LocationBarView::OnMouseReleased(const views::MouseEvent& event) { |
| 745 bool canceled) { | |
| 746 UINT msg; | 745 UINT msg; |
| 747 if (canceled) { | 746 if (event.IsLeftMouseButton()) { |
| 748 msg = WM_CAPTURECHANGED; | |
| 749 } else if (event.IsLeftMouseButton()) { | |
| 750 msg = WM_LBUTTONUP; | 747 msg = WM_LBUTTONUP; |
| 751 } else if (event.IsMiddleMouseButton()) { | 748 } else if (event.IsMiddleMouseButton()) { |
| 752 msg = WM_MBUTTONUP; | 749 msg = WM_MBUTTONUP; |
| 753 } else if (event.IsRightMouseButton()) { | 750 } else if (event.IsRightMouseButton()) { |
| 754 msg = WM_RBUTTONUP; | 751 msg = WM_RBUTTONUP; |
| 755 } else { | 752 } else { |
| 756 NOTREACHED(); | 753 NOTREACHED(); |
| 757 return; | 754 return; |
| 758 } | 755 } |
| 759 OnMouseEvent(event, msg); | 756 OnMouseEvent(event, msg); |
| 760 } | 757 } |
| 758 |
| 759 void LocationBarView::OnMouseCaptureLost() { |
| 760 location_entry_->HandleExternalMsg(WM_CAPTURECHANGED, 0, CPoint()); |
| 761 } |
| 761 #endif | 762 #endif |
| 762 | 763 |
| 763 void LocationBarView::OnAutocompleteAccept( | 764 void LocationBarView::OnAutocompleteAccept( |
| 764 const GURL& url, | 765 const GURL& url, |
| 765 WindowOpenDisposition disposition, | 766 WindowOpenDisposition disposition, |
| 766 PageTransition::Type transition, | 767 PageTransition::Type transition, |
| 767 const GURL& alternate_nav_url) { | 768 const GURL& alternate_nav_url) { |
| 768 // WARNING: don't add an early return here. The calls after the if must | 769 // WARNING: don't add an early return here. The calls after the if must |
| 769 // happen. | 770 // happen. |
| 770 if (url.is_valid()) { | 771 if (url.is_valid()) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, | 940 NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, |
| 940 Source<ExtensionAction>(action), | 941 Source<ExtensionAction>(action), |
| 941 Details<TabContents>(contents)); | 942 Details<TabContents>(contents)); |
| 942 } | 943 } |
| 943 } | 944 } |
| 944 } | 945 } |
| 945 } | 946 } |
| 946 | 947 |
| 947 #if defined(OS_WIN) | 948 #if defined(OS_WIN) |
| 948 void LocationBarView::OnMouseEvent(const views::MouseEvent& event, UINT msg) { | 949 void LocationBarView::OnMouseEvent(const views::MouseEvent& event, UINT msg) { |
| 949 UINT flags = 0; | 950 UINT flags = event.GetWindowsFlags(); |
| 950 if (event.IsControlDown()) | |
| 951 flags |= MK_CONTROL; | |
| 952 if (event.IsShiftDown()) | |
| 953 flags |= MK_SHIFT; | |
| 954 if (event.IsLeftMouseButton()) | |
| 955 flags |= MK_LBUTTON; | |
| 956 if (event.IsMiddleMouseButton()) | |
| 957 flags |= MK_MBUTTON; | |
| 958 if (event.IsRightMouseButton()) | |
| 959 flags |= MK_RBUTTON; | |
| 960 | |
| 961 gfx::Point screen_point(event.location()); | 951 gfx::Point screen_point(event.location()); |
| 962 ConvertPointToScreen(this, &screen_point); | 952 ConvertPointToScreen(this, &screen_point); |
| 963 location_entry_->HandleExternalMsg(msg, flags, screen_point.ToPOINT()); | 953 location_entry_->HandleExternalMsg(msg, flags, screen_point.ToPOINT()); |
| 964 } | 954 } |
| 965 #endif | 955 #endif |
| 966 | 956 |
| 967 void LocationBarView::ShowFirstRunBubbleInternal( | 957 void LocationBarView::ShowFirstRunBubbleInternal( |
| 968 FirstRun::BubbleType bubble_type) { | 958 FirstRun::BubbleType bubble_type) { |
| 969 #if defined(OS_WIN) // First run bubble doesn't make sense for Chrome OS. | 959 #if defined(OS_WIN) // First run bubble doesn't make sense for Chrome OS. |
| 970 // If the browser is no longer active, let's not show the info bubble, as this | 960 // If the browser is no longer active, let's not show the info bubble, as this |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 template_url_model_ = NULL; | 1182 template_url_model_ = NULL; |
| 1193 ShowFirstRunBubble(bubble_type_); | 1183 ShowFirstRunBubble(bubble_type_); |
| 1194 } | 1184 } |
| 1195 | 1185 |
| 1196 #if defined(OS_WIN) | 1186 #if defined(OS_WIN) |
| 1197 bool LocationBarView::HasValidSuggestText() const { | 1187 bool LocationBarView::HasValidSuggestText() const { |
| 1198 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1188 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
| 1199 !suggested_text_view_->GetText().empty(); | 1189 !suggested_text_view_->GetText().empty(); |
| 1200 } | 1190 } |
| 1201 #endif | 1191 #endif |
| OLD | NEW |