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/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 void LocationBarView::OnSetFocus() { | 1067 void LocationBarView::OnSetFocus() { |
1068 views::FocusManager* focus_manager = GetFocusManager(); | 1068 views::FocusManager* focus_manager = GetFocusManager(); |
1069 if (!focus_manager) { | 1069 if (!focus_manager) { |
1070 NOTREACHED(); | 1070 NOTREACHED(); |
1071 return; | 1071 return; |
1072 } | 1072 } |
1073 focus_manager->SetFocusedView(view_to_focus_); | 1073 focus_manager->SetFocusedView(view_to_focus_); |
1074 } | 1074 } |
1075 | 1075 |
1076 SkBitmap LocationBarView::GetFavicon() const { | 1076 SkBitmap LocationBarView::GetFavicon() const { |
1077 return delegate_->GetTabContents()->favicon_tab_helper()->GetFavicon(); | 1077 return delegate_->GetTabContents()->favicon_tab_helper()-> |
| 1078 GetFavicon().AsBitmap(); |
1078 } | 1079 } |
1079 | 1080 |
1080 string16 LocationBarView::GetTitle() const { | 1081 string16 LocationBarView::GetTitle() const { |
1081 return GetWebContentsFromDelegate(delegate_)->GetTitle(); | 1082 return GetWebContentsFromDelegate(delegate_)->GetTitle(); |
1082 } | 1083 } |
1083 | 1084 |
1084 InstantController* LocationBarView::GetInstant() { | 1085 InstantController* LocationBarView::GetInstant() { |
1085 return delegate_->GetInstant(); | 1086 return delegate_->GetInstant(); |
1086 } | 1087 } |
1087 | 1088 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 } | 1299 } |
1299 | 1300 |
1300 void LocationBarView::WriteDragDataForView(views::View* sender, | 1301 void LocationBarView::WriteDragDataForView(views::View* sender, |
1301 const gfx::Point& press_pt, | 1302 const gfx::Point& press_pt, |
1302 OSExchangeData* data) { | 1303 OSExchangeData* data) { |
1303 DCHECK_NE(GetDragOperationsForView(sender, press_pt), | 1304 DCHECK_NE(GetDragOperationsForView(sender, press_pt), |
1304 ui::DragDropTypes::DRAG_NONE); | 1305 ui::DragDropTypes::DRAG_NONE); |
1305 | 1306 |
1306 TabContents* tab_contents = delegate_->GetTabContents(); | 1307 TabContents* tab_contents = delegate_->GetTabContents(); |
1307 DCHECK(tab_contents); | 1308 DCHECK(tab_contents); |
| 1309 gfx::ImageSkia favicon = |
| 1310 tab_contents->favicon_tab_helper()->GetFavicon().AsImageSkia(); |
1308 button_drag_utils::SetURLAndDragImage( | 1311 button_drag_utils::SetURLAndDragImage( |
1309 tab_contents->web_contents()->GetURL(), | 1312 tab_contents->web_contents()->GetURL(), |
1310 tab_contents->web_contents()->GetTitle(), | 1313 tab_contents->web_contents()->GetTitle(), |
1311 tab_contents->favicon_tab_helper()->GetFavicon(), | 1314 favicon, |
1312 data, | 1315 data, |
1313 sender->GetWidget()); | 1316 sender->GetWidget()); |
1314 } | 1317 } |
1315 | 1318 |
1316 int LocationBarView::GetDragOperationsForView(views::View* sender, | 1319 int LocationBarView::GetDragOperationsForView(views::View* sender, |
1317 const gfx::Point& p) { | 1320 const gfx::Point& p) { |
1318 DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_)); | 1321 DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_)); |
1319 WebContents* web_contents = GetWebContentsFromDelegate(delegate_); | 1322 WebContents* web_contents = GetWebContentsFromDelegate(delegate_); |
1320 return (web_contents && web_contents->GetURL().is_valid() && | 1323 return (web_contents && web_contents->GetURL().is_valid() && |
1321 !GetLocationEntry()->IsEditingOrEmpty()) ? | 1324 !GetLocationEntry()->IsEditingOrEmpty()) ? |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 } | 1529 } |
1527 | 1530 |
1528 void LocationBarView::CleanupFadeAnimation() { | 1531 void LocationBarView::CleanupFadeAnimation() { |
1529 // Since we're no longer animating we don't need our layer. | 1532 // Since we're no longer animating we don't need our layer. |
1530 SetPaintToLayer(false); | 1533 SetPaintToLayer(false); |
1531 // Bubble labels don't need a transparent background anymore. | 1534 // Bubble labels don't need a transparent background anymore. |
1532 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1535 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1533 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1536 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1534 } | 1537 } |
1535 #endif // USE_AURA | 1538 #endif // USE_AURA |
OLD | NEW |