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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 4694008: Make pink's TabContentsWrapper change compile on Windows.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
===================================================================
--- chrome/browser/ui/views/location_bar/location_bar_view.cc (revision 66453)
+++ chrome/browser/ui/views/location_bar/location_bar_view.cc (working copy)
@@ -25,6 +25,7 @@
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/browser/ui/views/location_bar/suggested_text_view.h"
#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/browser_dialogs.h"
@@ -50,6 +51,13 @@
using views::View;
+namespace {
+TabContents* GetTabContentsFromDelegate(LocationBarView::Delegate* delegate) {
+ const TabContentsWrapper* wrapper = delegate->GetTabContentsWrapper();
+ return wrapper ? wrapper->tab_contents() : NULL;
+}
+} // namespace
+
// static
const int LocationBarView::kNormalHorizontalEdgeThickness = 1;
const int LocationBarView::kVerticalEdgeThickness = 2;
@@ -335,8 +343,8 @@
}
}
-TabContents* LocationBarView::GetTabContents() const {
- return delegate_->GetTabContents();
+TabContentsWrapper* LocationBarView::GetTabContentsWrapper() const {
+ return delegate_->GetTabContentsWrapper();
}
void LocationBarView::SetPreviewEnabledPageAction(ExtensionAction* page_action,
@@ -345,7 +353,7 @@
return;
DCHECK(page_action);
- TabContents* contents = delegate_->GetTabContents();
+ TabContents* contents = GetTabContentsFromDelegate(delegate_);
RefreshPageActionViews();
PageActionWithBadgeView* page_action_view =
@@ -839,10 +847,10 @@
InstantController* instant = delegate_->GetInstant();
string16 suggested_text;
- if (update_instant_ && instant && GetTabContents()) {
+ if (update_instant_ && instant && GetTabContentsWrapper()) {
if (location_entry_->model()->user_input_in_progress() &&
location_entry_->model()->popup_model()->IsOpen()) {
- instant->Update(GetTabContents(),
+ instant->Update(GetTabContentsWrapper(),
location_entry_->model()->CurrentMatch(),
WideToUTF16(location_entry_->GetText()),
&suggested_text);
@@ -876,15 +884,11 @@
}
SkBitmap LocationBarView::GetFavIcon() const {
- DCHECK(delegate_);
- DCHECK(delegate_->GetTabContents());
- return delegate_->GetTabContents()->GetFavIcon();
+ return GetTabContentsFromDelegate(delegate_)->GetFavIcon();
}
std::wstring LocationBarView::GetTitle() const {
- DCHECK(delegate_);
- DCHECK(delegate_->GetTabContents());
- return UTF16ToWideHack(delegate_->GetTabContents()->GetTitle());
+ return UTF16ToWideHack(GetTabContentsFromDelegate(delegate_)->GetTitle());
}
int LocationBarView::AvailableWidth(int location_bar_width) {
@@ -911,11 +915,10 @@
}
void LocationBarView::RefreshContentSettingViews() {
- const TabContents* tab_contents = delegate_->GetTabContents();
for (ContentSettingViews::const_iterator i(content_setting_views_.begin());
i != content_setting_views_.end(); ++i) {
(*i)->UpdateFromTabContents(
- model_->input_in_progress() ? NULL : tab_contents);
+ model_->input_in_progress() ? NULL : GetTabContentsFromDelegate(delegate_));
}
}
@@ -964,7 +967,7 @@
}
}
- TabContents* contents = delegate_->GetTabContents();
+ TabContents* contents = GetTabContentsFromDelegate(delegate_);
if (!page_action_views_.empty() && contents) {
GURL url = GURL(WideToUTF8(model_->GetText()));
@@ -1067,7 +1070,7 @@
OSExchangeData* data) {
DCHECK(GetDragOperations(sender, press_pt) != DragDropTypes::DRAG_NONE);
- TabContents* tab_contents = delegate_->GetTabContents();
+ TabContents* tab_contents = GetTabContentsFromDelegate(delegate_);
DCHECK(tab_contents);
drag_utils::SetURLAndDragImage(tab_contents->GetURL(),
UTF16ToWideHack(tab_contents->GetTitle()),
@@ -1077,7 +1080,7 @@
int LocationBarView::GetDragOperations(views::View* sender,
const gfx::Point& p) {
DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_));
- TabContents* tab_contents = delegate_->GetTabContents();
+ TabContents* tab_contents = GetTabContentsFromDelegate(delegate_);
return (tab_contents && tab_contents->GetURL().is_valid() &&
!location_entry()->IsEditingOrEmpty()) ?
(DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_LINK) :

Powered by Google App Engine
This is Rietveld 408576698