Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 11011002: Switch FaviconTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/command_line.h" 10 #include "base/command_line.h"
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 void LocationBarView::OnSetFocus() { 1146 void LocationBarView::OnSetFocus() {
1147 views::FocusManager* focus_manager = GetFocusManager(); 1147 views::FocusManager* focus_manager = GetFocusManager();
1148 if (!focus_manager) { 1148 if (!focus_manager) {
1149 NOTREACHED(); 1149 NOTREACHED();
1150 return; 1150 return;
1151 } 1151 }
1152 focus_manager->SetFocusedView(view_to_focus_); 1152 focus_manager->SetFocusedView(view_to_focus_);
1153 } 1153 }
1154 1154
1155 gfx::Image LocationBarView::GetFavicon() const { 1155 gfx::Image LocationBarView::GetFavicon() const {
1156 return delegate_->GetTabContents()->favicon_tab_helper()-> 1156 return FaviconTabHelper::FromWebContents(
1157 GetFavicon(); 1157 delegate_->GetTabContents()->web_contents())->GetFavicon();
1158 } 1158 }
1159 1159
1160 string16 LocationBarView::GetTitle() const { 1160 string16 LocationBarView::GetTitle() const {
1161 return GetWebContentsFromDelegate(delegate_)->GetTitle(); 1161 return GetWebContentsFromDelegate(delegate_)->GetTitle();
1162 } 1162 }
1163 1163
1164 InstantController* LocationBarView::GetInstant() { 1164 InstantController* LocationBarView::GetInstant() {
1165 return delegate_->GetInstant(); 1165 return delegate_->GetInstant();
1166 } 1166 }
1167 1167
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 bool LocationBarView::HasFocus() const { 1380 bool LocationBarView::HasFocus() const {
1381 return location_entry_->model()->has_focus(); 1381 return location_entry_->model()->has_focus();
1382 } 1382 }
1383 1383
1384 void LocationBarView::WriteDragDataForView(views::View* sender, 1384 void LocationBarView::WriteDragDataForView(views::View* sender,
1385 const gfx::Point& press_pt, 1385 const gfx::Point& press_pt,
1386 OSExchangeData* data) { 1386 OSExchangeData* data) {
1387 DCHECK_NE(GetDragOperationsForView(sender, press_pt), 1387 DCHECK_NE(GetDragOperationsForView(sender, press_pt),
1388 ui::DragDropTypes::DRAG_NONE); 1388 ui::DragDropTypes::DRAG_NONE);
1389 1389
1390 TabContents* tab_contents = GetTabContents(); 1390 WebContents* web_contents = GetTabContents()->web_contents();
1391 DCHECK(tab_contents); 1391 FaviconTabHelper* favicon_tab_helper =
1392 gfx::ImageSkia favicon = 1392 FaviconTabHelper::FromWebContents(web_contents);
1393 tab_contents->favicon_tab_helper()->GetFavicon().AsImageSkia(); 1393 gfx::ImageSkia favicon = favicon_tab_helper->GetFavicon().AsImageSkia();
1394 button_drag_utils::SetURLAndDragImage( 1394 button_drag_utils::SetURLAndDragImage(web_contents->GetURL(),
1395 tab_contents->web_contents()->GetURL(), 1395 web_contents->GetTitle(),
1396 tab_contents->web_contents()->GetTitle(), 1396 favicon,
1397 favicon, 1397 data,
1398 data, 1398 sender->GetWidget());
1399 sender->GetWidget());
1400 } 1399 }
1401 1400
1402 int LocationBarView::GetDragOperationsForView(views::View* sender, 1401 int LocationBarView::GetDragOperationsForView(views::View* sender,
1403 const gfx::Point& p) { 1402 const gfx::Point& p) {
1404 DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_)); 1403 DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_));
1405 WebContents* web_contents = GetWebContentsFromDelegate(delegate_); 1404 WebContents* web_contents = GetWebContentsFromDelegate(delegate_);
1406 return (web_contents && web_contents->GetURL().is_valid() && 1405 return (web_contents && web_contents->GetURL().is_valid() &&
1407 !GetLocationEntry()->IsEditingOrEmpty()) ? 1406 !GetLocationEntry()->IsEditingOrEmpty()) ?
1408 (ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK) : 1407 (ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK) :
1409 ui::DragDropTypes::DRAG_NONE; 1408 ui::DragDropTypes::DRAG_NONE;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 } 1646 }
1648 1647
1649 void LocationBarView::CleanupFadeAnimation() { 1648 void LocationBarView::CleanupFadeAnimation() {
1650 // Since we're no longer animating we don't need our layer. 1649 // Since we're no longer animating we don't need our layer.
1651 SetPaintToLayer(false); 1650 SetPaintToLayer(false);
1652 // Bubble labels don't need a transparent background anymore. 1651 // Bubble labels don't need a transparent background anymore.
1653 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1652 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1654 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1653 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1655 } 1654 }
1656 #endif // USE_AURA 1655 #endif // USE_AURA
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/hung_renderer_view.cc ('k') | chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698