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

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

Issue 6735042: Move favicon from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 8 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) 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 "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/stl_util-inl.h" 12 #include "base/stl_util-inl.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/app/chrome_command_ids.h" 14 #include "chrome/app/chrome_command_ids.h"
15 #include "chrome/browser/alternate_nav_url_fetcher.h" 15 #include "chrome/browser/alternate_nav_url_fetcher.h"
16 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" 16 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
17 #include "chrome/browser/defaults.h" 17 #include "chrome/browser/defaults.h"
18 #include "chrome/browser/extensions/extension_browser_event_router.h" 18 #include "chrome/browser/extensions/extension_browser_event_router.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/favicon_tab_helper.h"
20 #include "chrome/browser/instant/instant_controller.h" 21 #include "chrome/browser/instant/instant_controller.h"
21 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/search_engines/template_url.h" 23 #include "chrome/browser/search_engines/template_url.h"
23 #include "chrome/browser/search_engines/template_url_model.h" 24 #include "chrome/browser/search_engines/template_url_model.h"
24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
25 #include "chrome/browser/ui/view_ids.h" 26 #include "chrome/browser/ui/view_ids.h"
26 #include "chrome/browser/ui/views/browser_dialogs.h" 27 #include "chrome/browser/ui/views/browser_dialogs.h"
27 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" 28 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
28 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" 29 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
29 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" 30 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 void LocationBarView::OnSetFocus() { 826 void LocationBarView::OnSetFocus() {
826 views::FocusManager* focus_manager = GetFocusManager(); 827 views::FocusManager* focus_manager = GetFocusManager();
827 if (!focus_manager) { 828 if (!focus_manager) {
828 NOTREACHED(); 829 NOTREACHED();
829 return; 830 return;
830 } 831 }
831 focus_manager->SetFocusedView(this); 832 focus_manager->SetFocusedView(this);
832 } 833 }
833 834
834 SkBitmap LocationBarView::GetFavicon() const { 835 SkBitmap LocationBarView::GetFavicon() const {
835 return GetTabContentsFromDelegate(delegate_)->GetFavicon(); 836 return delegate_->GetTabContentsWrapper()->favicon_tab_helper()->GetFavicon();
836 } 837 }
837 838
838 string16 LocationBarView::GetTitle() const { 839 string16 LocationBarView::GetTitle() const {
839 return GetTabContentsFromDelegate(delegate_)->GetTitle(); 840 return GetTabContentsFromDelegate(delegate_)->GetTitle();
840 } 841 }
841 842
842 InstantController* LocationBarView::GetInstant() { 843 InstantController* LocationBarView::GetInstant() {
843 return delegate_->GetInstant(); 844 return delegate_->GetInstant();
844 } 845 }
845 846
846 TabContentsWrapper* LocationBarView::GetTabContentsWrapper() { 847 TabContentsWrapper* LocationBarView::GetTabContentsWrapper() const {
847 return delegate_->GetTabContentsWrapper(); 848 return delegate_->GetTabContentsWrapper();
848 } 849 }
849 850
850 int LocationBarView::AvailableWidth(int location_bar_width) { 851 int LocationBarView::AvailableWidth(int location_bar_width) {
851 return location_bar_width - location_entry_->TextWidth(); 852 return location_bar_width - location_entry_->TextWidth();
852 } 853 }
853 854
854 void LocationBarView::LayoutView(views::View* view, 855 void LocationBarView::LayoutView(views::View* view,
855 int padding, 856 int padding,
856 int available_width, 857 int available_width,
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 state->selection_start = entry_start; 1028 state->selection_start = entry_start;
1028 state->selection_end = entry_end; 1029 state->selection_end = entry_end;
1029 } 1030 }
1030 1031
1031 void LocationBarView::WriteDragDataForView(views::View* sender, 1032 void LocationBarView::WriteDragDataForView(views::View* sender,
1032 const gfx::Point& press_pt, 1033 const gfx::Point& press_pt,
1033 OSExchangeData* data) { 1034 OSExchangeData* data) {
1034 DCHECK_NE(GetDragOperationsForView(sender, press_pt), 1035 DCHECK_NE(GetDragOperationsForView(sender, press_pt),
1035 ui::DragDropTypes::DRAG_NONE); 1036 ui::DragDropTypes::DRAG_NONE);
1036 1037
1037 TabContents* tab_contents = GetTabContentsFromDelegate(delegate_); 1038 TabContentsWrapper* tab_contents = delegate_->GetTabContentsWrapper();
1038 DCHECK(tab_contents); 1039 DCHECK(tab_contents);
1039 drag_utils::SetURLAndDragImage(tab_contents->GetURL(), 1040 drag_utils::SetURLAndDragImage(
1040 UTF16ToWideHack(tab_contents->GetTitle()), 1041 tab_contents->tab_contents()->GetURL(),
1041 tab_contents->GetFavicon(), data); 1042 UTF16ToWideHack(tab_contents->tab_contents()->GetTitle()),
1043 tab_contents->favicon_tab_helper()->GetFavicon(),
1044 data);
1042 } 1045 }
1043 1046
1044 int LocationBarView::GetDragOperationsForView(views::View* sender, 1047 int LocationBarView::GetDragOperationsForView(views::View* sender,
1045 const gfx::Point& p) { 1048 const gfx::Point& p) {
1046 DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_)); 1049 DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_));
1047 TabContents* tab_contents = GetTabContentsFromDelegate(delegate_); 1050 TabContents* tab_contents = GetTabContentsFromDelegate(delegate_);
1048 return (tab_contents && tab_contents->GetURL().is_valid() && 1051 return (tab_contents && tab_contents->GetURL().is_valid() &&
1049 !location_entry()->IsEditingOrEmpty()) ? 1052 !location_entry()->IsEditingOrEmpty()) ?
1050 (ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK) : 1053 (ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK) :
1051 ui::DragDropTypes::DRAG_NONE; 1054 ui::DragDropTypes::DRAG_NONE;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 template_url_model_ = NULL; 1185 template_url_model_ = NULL;
1183 ShowFirstRunBubble(bubble_type_); 1186 ShowFirstRunBubble(bubble_type_);
1184 } 1187 }
1185 1188
1186 #if defined(OS_WIN) 1189 #if defined(OS_WIN)
1187 bool LocationBarView::HasValidSuggestText() const { 1190 bool LocationBarView::HasValidSuggestText() const {
1188 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1191 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1189 !suggested_text_view_->GetText().empty(); 1192 !suggested_text_view_->GetText().empty();
1190 } 1193 }
1191 #endif 1194 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('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