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

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

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