| 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 |
| 11 #include "app/drag_drop_types.h" | |
| 12 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 13 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 14 #include "app/theme_provider.h" | 13 #include "app/theme_provider.h" |
| 15 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 16 #include "base/stl_util-inl.h" | 15 #include "base/stl_util-inl.h" |
| 17 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 18 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
| 19 #include "chrome/browser/alternate_nav_url_fetcher.h" | 18 #include "chrome/browser/alternate_nav_url_fetcher.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 19 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 21 #include "chrome/browser/defaults.h" | 20 #include "chrome/browser/defaults.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 37 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 36 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
| 38 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" | 37 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" |
| 39 #include "chrome/browser/ui/views/location_bar/star_view.h" | 38 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 40 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 41 #include "chrome/common/notification_service.h" | 40 #include "chrome/common/notification_service.h" |
| 42 #include "gfx/canvas_skia.h" | 41 #include "gfx/canvas_skia.h" |
| 43 #include "gfx/color_utils.h" | 42 #include "gfx/color_utils.h" |
| 44 #include "gfx/skia_util.h" | 43 #include "gfx/skia_util.h" |
| 45 #include "grit/generated_resources.h" | 44 #include "grit/generated_resources.h" |
| 46 #include "grit/theme_resources.h" | 45 #include "grit/theme_resources.h" |
| 46 #include "ui/base/dragdrop/drag_drop_types.h" |
| 47 #include "views/controls/label.h" | 47 #include "views/controls/label.h" |
| 48 #include "views/drag_utils.h" | 48 #include "views/drag_utils.h" |
| 49 | 49 |
| 50 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
| 51 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" | 51 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" |
| 52 #include "chrome/browser/ui/views/first_run_bubble.h" | 52 #include "chrome/browser/ui/views/first_run_bubble.h" |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 using views::View; | 55 using views::View; |
| 56 | 56 |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 #endif | 1077 #endif |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 AccessibilityTypes::Role LocationBarView::GetAccessibleRole() { | 1080 AccessibilityTypes::Role LocationBarView::GetAccessibleRole() { |
| 1081 return AccessibilityTypes::ROLE_GROUPING; | 1081 return AccessibilityTypes::ROLE_GROUPING; |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 void LocationBarView::WriteDragData(views::View* sender, | 1084 void LocationBarView::WriteDragData(views::View* sender, |
| 1085 const gfx::Point& press_pt, | 1085 const gfx::Point& press_pt, |
| 1086 OSExchangeData* data) { | 1086 OSExchangeData* data) { |
| 1087 DCHECK(GetDragOperations(sender, press_pt) != DragDropTypes::DRAG_NONE); | 1087 DCHECK(GetDragOperations(sender, press_pt) != ui::DragDropTypes::DRAG_NONE); |
| 1088 | 1088 |
| 1089 TabContents* tab_contents = GetTabContentsFromDelegate(delegate_); | 1089 TabContents* tab_contents = GetTabContentsFromDelegate(delegate_); |
| 1090 DCHECK(tab_contents); | 1090 DCHECK(tab_contents); |
| 1091 drag_utils::SetURLAndDragImage(tab_contents->GetURL(), | 1091 drag_utils::SetURLAndDragImage(tab_contents->GetURL(), |
| 1092 UTF16ToWideHack(tab_contents->GetTitle()), | 1092 UTF16ToWideHack(tab_contents->GetTitle()), |
| 1093 tab_contents->GetFavIcon(), data); | 1093 tab_contents->GetFavIcon(), data); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 int LocationBarView::GetDragOperations(views::View* sender, | 1096 int LocationBarView::GetDragOperations(views::View* sender, |
| 1097 const gfx::Point& p) { | 1097 const gfx::Point& p) { |
| 1098 DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_)); | 1098 DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_)); |
| 1099 TabContents* tab_contents = GetTabContentsFromDelegate(delegate_); | 1099 TabContents* tab_contents = GetTabContentsFromDelegate(delegate_); |
| 1100 return (tab_contents && tab_contents->GetURL().is_valid() && | 1100 return (tab_contents && tab_contents->GetURL().is_valid() && |
| 1101 !location_entry()->IsEditingOrEmpty()) ? | 1101 !location_entry()->IsEditingOrEmpty()) ? |
| 1102 (DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_LINK) : | 1102 (ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK) : |
| 1103 DragDropTypes::DRAG_NONE; | 1103 ui::DragDropTypes::DRAG_NONE; |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 bool LocationBarView::CanStartDrag(View* sender, | 1106 bool LocationBarView::CanStartDrag(View* sender, |
| 1107 const gfx::Point& press_pt, | 1107 const gfx::Point& press_pt, |
| 1108 const gfx::Point& p) { | 1108 const gfx::Point& p) { |
| 1109 return true; | 1109 return true; |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 //////////////////////////////////////////////////////////////////////////////// | 1112 //////////////////////////////////////////////////////////////////////////////// |
| 1113 // LocationBarView, LocationBar implementation: | 1113 // LocationBarView, LocationBar implementation: |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 template_url_model_ = NULL; | 1259 template_url_model_ = NULL; |
| 1260 ShowFirstRunBubble(bubble_type_); | 1260 ShowFirstRunBubble(bubble_type_); |
| 1261 } | 1261 } |
| 1262 | 1262 |
| 1263 #if defined(OS_WIN) | 1263 #if defined(OS_WIN) |
| 1264 bool LocationBarView::HasValidSuggestText() { | 1264 bool LocationBarView::HasValidSuggestText() { |
| 1265 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1265 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
| 1266 !suggested_text_view_->GetText().empty(); | 1266 !suggested_text_view_->GetText().empty(); |
| 1267 } | 1267 } |
| 1268 #endif | 1268 #endif |
| OLD | NEW |