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 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 void LocationBarView::OnSetFocus() { | 1042 void LocationBarView::OnSetFocus() { |
1043 views::FocusManager* focus_manager = GetFocusManager(); | 1043 views::FocusManager* focus_manager = GetFocusManager(); |
1044 if (!focus_manager) { | 1044 if (!focus_manager) { |
1045 NOTREACHED(); | 1045 NOTREACHED(); |
1046 return; | 1046 return; |
1047 } | 1047 } |
1048 focus_manager->SetFocusedView(view_to_focus_); | 1048 focus_manager->SetFocusedView(view_to_focus_); |
1049 } | 1049 } |
1050 | 1050 |
1051 SkBitmap LocationBarView::GetFavicon() const { | 1051 SkBitmap LocationBarView::GetFavicon() const { |
1052 return delegate_->GetTabContents()->favicon_tab_helper()-> | 1052 const gfx::Image& icon = delegate_->GetTabContents()-> |
1053 GetFavicon().AsBitmap(); | 1053 favicon_tab_helper()->GetFavicon(); |
| 1054 return icon.IsEmpty() ? SkBitmap() : *icon.ToSkBitmap(); |
1054 } | 1055 } |
1055 | 1056 |
1056 string16 LocationBarView::GetTitle() const { | 1057 string16 LocationBarView::GetTitle() const { |
1057 return GetWebContentsFromDelegate(delegate_)->GetTitle(); | 1058 return GetWebContentsFromDelegate(delegate_)->GetTitle(); |
1058 } | 1059 } |
1059 | 1060 |
1060 InstantController* LocationBarView::GetInstant() { | 1061 InstantController* LocationBarView::GetInstant() { |
1061 return delegate_->GetInstant(); | 1062 return delegate_->GetInstant(); |
1062 } | 1063 } |
1063 | 1064 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 } | 1271 } |
1271 | 1272 |
1272 void LocationBarView::WriteDragDataForView(views::View* sender, | 1273 void LocationBarView::WriteDragDataForView(views::View* sender, |
1273 const gfx::Point& press_pt, | 1274 const gfx::Point& press_pt, |
1274 OSExchangeData* data) { | 1275 OSExchangeData* data) { |
1275 DCHECK_NE(GetDragOperationsForView(sender, press_pt), | 1276 DCHECK_NE(GetDragOperationsForView(sender, press_pt), |
1276 ui::DragDropTypes::DRAG_NONE); | 1277 ui::DragDropTypes::DRAG_NONE); |
1277 | 1278 |
1278 TabContents* tab_contents = GetTabContents(); | 1279 TabContents* tab_contents = GetTabContents(); |
1279 DCHECK(tab_contents); | 1280 DCHECK(tab_contents); |
| 1281 const gfx::Image& icon = tab_contents->favicon_tab_helper()->GetFavicon(); |
1280 gfx::ImageSkia favicon = | 1282 gfx::ImageSkia favicon = |
1281 tab_contents->favicon_tab_helper()->GetFavicon().AsImageSkia(); | 1283 icon.IsEmpty() ? gfx::ImageSkia() : *icon.ToImageSkia(); |
1282 button_drag_utils::SetURLAndDragImage( | 1284 button_drag_utils::SetURLAndDragImage( |
1283 tab_contents->web_contents()->GetURL(), | 1285 tab_contents->web_contents()->GetURL(), |
1284 tab_contents->web_contents()->GetTitle(), | 1286 tab_contents->web_contents()->GetTitle(), |
1285 favicon, | 1287 favicon, |
1286 data, | 1288 data, |
1287 sender->GetWidget()); | 1289 sender->GetWidget()); |
1288 } | 1290 } |
1289 | 1291 |
1290 int LocationBarView::GetDragOperationsForView(views::View* sender, | 1292 int LocationBarView::GetDragOperationsForView(views::View* sender, |
1291 const gfx::Point& p) { | 1293 const gfx::Point& p) { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 } | 1502 } |
1501 | 1503 |
1502 void LocationBarView::CleanupFadeAnimation() { | 1504 void LocationBarView::CleanupFadeAnimation() { |
1503 // Since we're no longer animating we don't need our layer. | 1505 // Since we're no longer animating we don't need our layer. |
1504 SetPaintToLayer(false); | 1506 SetPaintToLayer(false); |
1505 // Bubble labels don't need a transparent background anymore. | 1507 // Bubble labels don't need a transparent background anymore. |
1506 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1508 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1507 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1509 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1508 } | 1510 } |
1509 #endif // USE_AURA | 1511 #endif // USE_AURA |
OLD | NEW |