summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/alternate_error_tab_observer.cc26
-rw-r--r--chrome/browser/ui/alternate_error_tab_observer.h10
-rw-r--r--chrome/browser/ui/bookmarks/bookmark_tab_helper.cc12
-rw-r--r--chrome/browser/ui/browser_browsertest.cc4
-rw-r--r--chrome/browser/ui/constrained_window_tab_helper.cc2
-rw-r--r--chrome/browser/ui/find_bar/find_bar_controller.cc6
-rw-r--r--chrome/browser/ui/find_bar/find_tab_helper.cc11
-rw-r--r--chrome/browser/ui/prefs/prefs_tab_helper.cc21
-rw-r--r--chrome/browser/ui/prefs/prefs_tab_helper.h5
-rw-r--r--chrome/browser/ui/sad_tab_observer.cc8
-rw-r--r--chrome/browser/ui/snapshot_tab_helper.cc4
-rw-r--r--chrome/browser/ui/tab_contents/core_tab_helper.cc30
-rw-r--r--chrome/browser/ui/tab_contents/core_tab_helper.h6
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper.cc8
-rw-r--r--chrome/browser/ui/views/find_bar_host_interactive_uitest.cc4
-rw-r--r--chrome/browser/ui/views/sad_tab_view.cc22
-rw-r--r--chrome/browser/ui/views/sad_tab_view.h8
17 files changed, 99 insertions, 88 deletions
diff --git a/chrome/browser/ui/alternate_error_tab_observer.cc b/chrome/browser/ui/alternate_error_tab_observer.cc
index efd7d12..bc18f9a 100644
--- a/chrome/browser/ui/alternate_error_tab_observer.cc
+++ b/chrome/browser/ui/alternate_error_tab_observer.cc
@@ -7,18 +7,18 @@
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
#include "content/browser/renderer_host/render_view_host.h"
-#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/web_contents.h"
+
+using content::WebContents;
AlternateErrorPageTabObserver::AlternateErrorPageTabObserver(
- TabContentsWrapper* wrapper)
- : content::WebContentsObserver(wrapper->tab_contents()),
- wrapper_(wrapper) {
- PrefService* prefs = wrapper_->profile()->GetPrefs();
+ WebContents* web_contents)
+ : content::WebContentsObserver(web_contents) {
+ PrefService* prefs = GetProfile()->GetPrefs();
if (prefs) {
pref_change_registrar_.Init(prefs);
pref_change_registrar_.Add(prefs::kAlternateErrorPagesEnabled, this);
@@ -38,6 +38,10 @@ void AlternateErrorPageTabObserver::RegisterUserPrefs(PrefService* prefs) {
PrefService::SYNCABLE_PREF);
}
+Profile* AlternateErrorPageTabObserver::GetProfile() const {
+ return Profile::FromBrowserContext(web_contents()->GetBrowserContext());
+}
+
////////////////////////////////////////////////////////////////////////////////
// WebContentsObserver overrides
@@ -54,14 +58,14 @@ void AlternateErrorPageTabObserver::Observe(int type,
const content::NotificationDetails& details) {
switch (type) {
case chrome::NOTIFICATION_GOOGLE_URL_UPDATED:
- UpdateAlternateErrorPageURL(tab_contents()->GetRenderViewHost());
+ UpdateAlternateErrorPageURL(web_contents()->GetRenderViewHost());
break;
case chrome::NOTIFICATION_PREF_CHANGED: {
std::string* pref_name = content::Details<std::string>(details).ptr();
DCHECK(content::Source<PrefService>(source).ptr() ==
- wrapper_->profile()->GetPrefs());
+ GetProfile()->GetPrefs());
if (*pref_name == prefs::kAlternateErrorPagesEnabled) {
- UpdateAlternateErrorPageURL(tab_contents()->GetRenderViewHost());
+ UpdateAlternateErrorPageURL(web_contents()->GetRenderViewHost());
} else {
NOTREACHED() << "unexpected pref change notification" << *pref_name;
}
@@ -78,10 +82,10 @@ void AlternateErrorPageTabObserver::Observe(int type,
GURL AlternateErrorPageTabObserver::GetAlternateErrorPageURL() const {
GURL url;
// Disable alternate error pages when in Incognito mode.
- if (wrapper_->profile()->IsOffTheRecord())
+ if (GetProfile()->IsOffTheRecord())
return url;
- PrefService* prefs = wrapper_->profile()->GetPrefs();
+ PrefService* prefs = GetProfile()->GetPrefs();
if (prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)) {
url = google_util::AppendGoogleLocaleParam(
GURL(google_util::kLinkDoctorBaseURL));
diff --git a/chrome/browser/ui/alternate_error_tab_observer.h b/chrome/browser/ui/alternate_error_tab_observer.h
index fe5ecad..ecce0e1 100644
--- a/chrome/browser/ui/alternate_error_tab_observer.h
+++ b/chrome/browser/ui/alternate_error_tab_observer.h
@@ -10,18 +10,21 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
-class TabContentsWrapper;
+class Profile;
// Per-tab class to implement alternate error page functionality.
class AlternateErrorPageTabObserver : public content::WebContentsObserver,
public content::NotificationObserver {
public:
- explicit AlternateErrorPageTabObserver(TabContentsWrapper* wrapper);
+ explicit AlternateErrorPageTabObserver(content::WebContents* web_contents);
virtual ~AlternateErrorPageTabObserver();
static void RegisterUserPrefs(PrefService* prefs);
private:
+ // Helper to return the profile for this tab.
+ Profile* GetProfile() const;
+
// content::WebContentsObserver overrides:
virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
@@ -39,9 +42,6 @@ class AlternateErrorPageTabObserver : public content::WebContentsObserver,
// Send the alternate error page URL to the renderer.
void UpdateAlternateErrorPageURL(RenderViewHost* rvh);
- // Our owning TabContentsWrapper.
- TabContentsWrapper* wrapper_;
-
content::NotificationRegistrar registrar_;
PrefChangeRegistrar pref_change_registrar_;
diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc
index 1ced986..5776409 100644
--- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc
@@ -42,22 +42,22 @@ BookmarkTabHelper::~BookmarkTabHelper() {
}
bool BookmarkTabHelper::ShouldShowBookmarkBar() {
- if (tab_contents()->ShowingInterstitialPage())
+ if (web_contents()->ShowingInterstitialPage())
return false;
// See TabContents::GetWebUIForCurrentState() comment for more info. This case
// is very similar, but for non-first loads, we want to use the committed
// entry. This is so the bookmarks bar disappears at the same time the page
// does.
- if (tab_contents()->GetController().GetLastCommittedEntry()) {
+ if (web_contents()->GetController().GetLastCommittedEntry()) {
// Not the first load, always use the committed Web UI.
- return CanShowBookmarkBar(tab_contents()->GetCommittedWebUI());
+ return CanShowBookmarkBar(web_contents()->GetCommittedWebUI());
}
// When it's the first load, we know either the pending one or the committed
// one will have the Web UI in it (see GetWebUIForCurrentState), and only one
// of them will be valid, so we can just check both.
- return CanShowBookmarkBar(tab_contents()->GetWebUI());
+ return CanShowBookmarkBar(web_contents()->GetWebUI());
}
void BookmarkTabHelper::DidNavigateMainFrame(
@@ -101,10 +101,10 @@ BookmarkTabHelper::BookmarkDrag*
void BookmarkTabHelper::UpdateStarredStateForCurrentURL() {
Profile* profile =
- Profile::FromBrowserContext(tab_contents()->GetBrowserContext());
+ Profile::FromBrowserContext(web_contents()->GetBrowserContext());
BookmarkModel* model = profile->GetBookmarkModel();
const bool old_state = is_starred_;
- is_starred_ = (model && model->IsBookmarked(tab_contents()->GetURL()));
+ is_starred_ = (model && model->IsBookmarked(web_contents()->GetURL()));
if (is_starred_ != old_state && delegate())
delegate()->URLStarredChanged(tab_contents_wrapper_, is_starred_);
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index a66b330..7c57661 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -60,6 +60,8 @@
#include "chrome/browser/browser_process.h"
#endif
+using content::WebContents;
+
namespace {
const char* kBeforeUnloadHTML =
@@ -788,7 +790,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_PageLanguageDetection) {
TabContents* current_tab = browser()->GetSelectedTabContents();
TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper();
TranslateTabHelper* helper = wrapper->translate_tab_helper();
- content::Source<TabContents> source(current_tab);
+ content::Source<WebContents> source(current_tab);
ui_test_utils::WindowedNotificationObserverWithDetails<std::string>
en_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
diff --git a/chrome/browser/ui/constrained_window_tab_helper.cc b/chrome/browser/ui/constrained_window_tab_helper.cc
index b718fb3..cdc9f21e 100644
--- a/chrome/browser/ui/constrained_window_tab_helper.cc
+++ b/chrome/browser/ui/constrained_window_tab_helper.cc
@@ -70,7 +70,7 @@ void ConstrainedWindowTabHelper::WillClose(ConstrainedWindow* window) {
}
void ConstrainedWindowTabHelper::BlockTabContent(bool blocked) {
- TabContents* contents = tab_contents();
+ WebContents* contents = web_contents();
if (!contents) {
// The TabContents has already disconnected.
return;
diff --git a/chrome/browser/ui/find_bar/find_bar_controller.cc b/chrome/browser/ui/find_bar/find_bar_controller.cc
index c518060..605ae04 100644
--- a/chrome/browser/ui/find_bar/find_bar_controller.cc
+++ b/chrome/browser/ui/find_bar/find_bar_controller.cc
@@ -20,6 +20,8 @@
#include "content/public/browser/notification_source.h"
#include "ui/gfx/rect.h"
+using content::WebContents;
+
// The minimum space between the FindInPage window and the search result.
static const int kMinFindWndDistanceFromSelection = 5;
@@ -88,7 +90,7 @@ void FindBarController::ChangeTabContents(TabContentsWrapper* contents) {
registrar_.Add(this,
chrome::NOTIFICATION_FIND_RESULT_AVAILABLE,
- content::Source<TabContents>(tab_contents_->tab_contents()));
+ content::Source<WebContents>(tab_contents_->tab_contents()));
registrar_.Add(
this,
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
@@ -119,7 +121,7 @@ void FindBarController::Observe(int type,
if (type == chrome::NOTIFICATION_FIND_RESULT_AVAILABLE) {
// Don't update for notifications from TabContentses other than the one we
// are actively tracking.
- if (content::Source<TabContents>(source).ptr() ==
+ if (content::Source<WebContents>(source).ptr() ==
tab_contents_->tab_contents()) {
UpdateFindBarForCurrentResult();
if (find_tab_helper->find_result().final_update() &&
diff --git a/chrome/browser/ui/find_bar/find_tab_helper.cc b/chrome/browser/ui/find_bar/find_tab_helper.cc
index 39ba133..da932d5 100644
--- a/chrome/browser/ui/find_bar/find_tab_helper.cc
+++ b/chrome/browser/ui/find_bar/find_tab_helper.cc
@@ -16,6 +16,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h"
using WebKit::WebFindOptions;
+using content::WebContents;
// static
int FindTabHelper::find_request_id_counter_ = -1;
@@ -39,7 +40,7 @@ void FindTabHelper::StartFinding(string16 search_string,
// shortcut so unless we have something to search for we return early.
if (search_string.empty() && find_text_.empty()) {
Profile* profile =
- Profile::FromBrowserContext(tab_contents()->GetBrowserContext());
+ Profile::FromBrowserContext(web_contents()->GetBrowserContext());
string16 last_search_prepopulate_text =
FindBarState::GetLastPrepopulateText(profile);
@@ -76,7 +77,7 @@ void FindTabHelper::StartFinding(string16 search_string,
// Keep track of what the last search was across the tabs.
Profile* profile =
- Profile::FromBrowserContext(tab_contents()->GetBrowserContext());
+ Profile::FromBrowserContext(web_contents()->GetBrowserContext());
FindBarState* find_bar_state = profile->GetFindBarState();
find_bar_state->set_last_prepopulate_text(find_text_);
@@ -84,7 +85,7 @@ void FindTabHelper::StartFinding(string16 search_string,
options.forward = forward_direction;
options.matchCase = case_sensitive;
options.findNext = find_next;
- tab_contents()->GetRenderViewHost()->Find(current_find_request_id_,
+ web_contents()->GetRenderViewHost()->Find(current_find_request_id_,
find_text_, options);
}
@@ -119,7 +120,7 @@ void FindTabHelper::StopFinding(
NOTREACHED();
action = content::STOP_FIND_ACTION_KEEP_SELECTION;
}
- tab_contents()->GetRenderViewHost()->StopFinding(action);
+ web_contents()->GetRenderViewHost()->StopFinding(action);
}
void FindTabHelper::HandleFindReply(int request_id,
@@ -148,7 +149,7 @@ void FindTabHelper::HandleFindReply(int request_id,
final_update);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_FIND_RESULT_AVAILABLE,
- content::Source<TabContents>(tab_contents()),
+ content::Source<WebContents>(web_contents()),
content::Details<FindNotificationDetails>(&last_search_result_));
}
}
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc
index c0f2b41..bcf0600 100644
--- a/chrome/browser/ui/prefs/prefs_tab_helper.cc
+++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc
@@ -16,9 +16,10 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
#include "content/browser/renderer_host/render_view_host.h"
-#include "content/browser/tab_contents/tab_contents.h"
+#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/web_contents.h"
#include "grit/locale_settings.h"
#include "grit/platform_locale_settings.h"
#include "webkit/glue/webpreferences.h"
@@ -212,9 +213,8 @@ const size_t kPerScriptFontDefaultsLength = arraysize(kPerScriptFontDefaults);
} // namespace
-PrefsTabHelper::PrefsTabHelper(TabContents* contents)
- : content::WebContentsObserver(contents),
- contents_(contents) {
+PrefsTabHelper::PrefsTabHelper(WebContents* contents)
+ : content::WebContentsObserver(contents) {
PrefService* prefs = GetProfile()->GetPrefs();
pref_change_registrar_.Init(prefs);
if (prefs) {
@@ -244,7 +244,7 @@ PrefsTabHelper::PrefsTabHelper(TabContents* contents)
}
renderer_preferences_util::UpdateFromSystemSettings(
- tab_contents()->GetMutableRendererPrefs(), GetProfile());
+ web_contents()->GetMutableRendererPrefs(), GetProfile());
registrar_.Add(this, chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED,
content::NotificationService::AllSources());
@@ -426,19 +426,20 @@ void PrefsTabHelper::Observe(int type,
}
void PrefsTabHelper::UpdateWebPreferences() {
- RenderViewHostDelegate* rvhd = tab_contents();
+ RenderViewHostDelegate* rvhd =
+ web_contents()->GetRenderViewHost()->delegate();
WebPreferences prefs = rvhd->GetWebkitPrefs();
prefs.javascript_enabled =
per_tab_prefs_->GetBoolean(prefs::kWebKitJavascriptEnabled);
- tab_contents()->GetRenderViewHost()->UpdateWebkitPreferences(prefs);
+ web_contents()->GetRenderViewHost()->UpdateWebkitPreferences(prefs);
}
void PrefsTabHelper::UpdateRendererPreferences() {
renderer_preferences_util::UpdateFromSystemSettings(
- tab_contents()->GetMutableRendererPrefs(), GetProfile());
- tab_contents()->GetRenderViewHost()->SyncRendererPrefs();
+ web_contents()->GetMutableRendererPrefs(), GetProfile());
+ web_contents()->GetRenderViewHost()->SyncRendererPrefs();
}
Profile* PrefsTabHelper::GetProfile() {
- return Profile::FromBrowserContext(contents_->GetBrowserContext());
+ return Profile::FromBrowserContext(web_contents()->GetBrowserContext());
}
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.h b/chrome/browser/ui/prefs/prefs_tab_helper.h
index f5c5d35..a06f12d 100644
--- a/chrome/browser/ui/prefs/prefs_tab_helper.h
+++ b/chrome/browser/ui/prefs/prefs_tab_helper.h
@@ -18,7 +18,7 @@ struct WebPreferences;
class PrefsTabHelper : public content::WebContentsObserver,
public content::NotificationObserver {
public:
- explicit PrefsTabHelper(TabContents* contents);
+ explicit PrefsTabHelper(content::WebContents* contents);
virtual ~PrefsTabHelper();
static void RegisterUserPrefs(PrefService* prefs);
@@ -46,9 +46,6 @@ class PrefsTabHelper : public content::WebContentsObserver,
Profile* GetProfile();
- // Our owning TabContents.
- TabContents* contents_;
-
content::NotificationRegistrar registrar_;
scoped_ptr<PrefService> per_tab_prefs_;
diff --git a/chrome/browser/ui/sad_tab_observer.cc b/chrome/browser/ui/sad_tab_observer.cc
index 9052eb3..b402211 100644
--- a/chrome/browser/ui/sad_tab_observer.cc
+++ b/chrome/browser/ui/sad_tab_observer.cc
@@ -39,7 +39,7 @@ void SadTabObserver::RenderViewGone(base::TerminationStatus status) {
return;
gfx::NativeView view = AcquireSadTab(status);
- tab_contents()->GetView()->InstallOverlayView(view);
+ web_contents()->GetView()->InstallOverlayView(view);
}
void SadTabObserver::Observe(int type,
@@ -48,7 +48,7 @@ void SadTabObserver::Observe(int type,
switch (type) {
case content::NOTIFICATION_TAB_CONTENTS_CONNECTED:
if (HasSadTab()) {
- tab_contents()->GetView()->RemoveOverlayView();
+ web_contents()->GetView()->RemoveOverlayView();
ReleaseSadTab();
}
break;
@@ -73,12 +73,12 @@ gfx::NativeView SadTabObserver::AcquireSadTab(base::TerminationStatus status) {
// and later re-parent it.
// TODO(avi): This is a cheat. Can this be made cleaner?
sad_tab_params.parent_widget =
- static_cast<TabContentsViewViews*>(tab_contents()->GetView());
+ static_cast<TabContentsViewViews*>(web_contents()->GetView());
sad_tab_params.ownership =
views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
sad_tab_.reset(new views::Widget);
sad_tab_->Init(sad_tab_params);
- sad_tab_->SetContentsView(new SadTabView(tab_contents(), kind));
+ sad_tab_->SetContentsView(new SadTabView(web_contents(), kind));
return sad_tab_->GetNativeView();
#elif defined(TOOLKIT_GTK)
sad_tab_.reset(new SadTabGtk(
diff --git a/chrome/browser/ui/snapshot_tab_helper.cc b/chrome/browser/ui/snapshot_tab_helper.cc
index 998a3546..6953ad0 100644
--- a/chrome/browser/ui/snapshot_tab_helper.cc
+++ b/chrome/browser/ui/snapshot_tab_helper.cc
@@ -7,8 +7,8 @@
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/render_messages.h"
-#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/web_contents.h"
using content::WebContents;
@@ -41,6 +41,6 @@ bool SnapshotTabHelper::OnMessageReceived(const IPC::Message& message) {
void SnapshotTabHelper::OnSnapshot(const SkBitmap& bitmap) {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN,
- content::Source<WebContents>(tab_contents()),
+ content::Source<WebContents>(web_contents()),
content::Details<const SkBitmap>(&bitmap));
}
diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.cc b/chrome/browser/ui/tab_contents/core_tab_helper.cc
index 000df30..c6a563b 100644
--- a/chrome/browser/ui/tab_contents/core_tab_helper.cc
+++ b/chrome/browser/ui/tab_contents/core_tab_helper.cc
@@ -7,14 +7,16 @@
#include "chrome/browser/renderer_host/web_cache_manager.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "content/browser/renderer_host/render_view_host.h"
-#include "content/browser/tab_contents/tab_contents.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
-CoreTabHelper::CoreTabHelper(TabContentsWrapper* wrapper)
- : content::WebContentsObserver(wrapper->tab_contents()),
- delegate_(NULL),
- wrapper_(wrapper) {
+using content::WebContents;
+
+CoreTabHelper::CoreTabHelper(WebContents* web_contents)
+ : content::WebContentsObserver(web_contents),
+ delegate_(NULL) {
}
CoreTabHelper::~CoreTabHelper() {
@@ -25,15 +27,15 @@ string16 CoreTabHelper::GetDefaultTitle() {
}
string16 CoreTabHelper::GetStatusText() const {
- if (!tab_contents()->IsLoading() ||
- tab_contents()->GetLoadState().state == net::LOAD_STATE_IDLE) {
+ if (!web_contents()->IsLoading() ||
+ web_contents()->GetLoadState().state == net::LOAD_STATE_IDLE) {
return string16();
}
- switch (tab_contents()->GetLoadState().state) {
+ switch (web_contents()->GetLoadState().state) {
case net::LOAD_STATE_WAITING_FOR_DELEGATE:
return l10n_util::GetStringFUTF16(IDS_LOAD_STATE_WAITING_FOR_DELEGATE,
- tab_contents()->GetLoadState().param);
+ web_contents()->GetLoadState().param);
case net::LOAD_STATE_WAITING_FOR_CACHE:
return l10n_util::GetStringUTF16(IDS_LOAD_STATE_WAITING_FOR_CACHE);
case net::LOAD_STATE_WAITING_FOR_APPCACHE:
@@ -53,17 +55,17 @@ string16 CoreTabHelper::GetStatusText() const {
case net::LOAD_STATE_SSL_HANDSHAKE:
return l10n_util::GetStringUTF16(IDS_LOAD_STATE_SSL_HANDSHAKE);
case net::LOAD_STATE_SENDING_REQUEST:
- if (tab_contents()->GetUploadSize()) {
+ if (web_contents()->GetUploadSize()) {
return l10n_util::GetStringFUTF16Int(
IDS_LOAD_STATE_SENDING_REQUEST_WITH_PROGRESS,
- static_cast<int>((100 * tab_contents()->GetUploadPosition()) /
- tab_contents()->GetUploadSize()));
+ static_cast<int>((100 * web_contents()->GetUploadPosition()) /
+ web_contents()->GetUploadSize()));
} else {
return l10n_util::GetStringUTF16(IDS_LOAD_STATE_SENDING_REQUEST);
}
case net::LOAD_STATE_WAITING_FOR_RESPONSE:
return l10n_util::GetStringFUTF16(IDS_LOAD_STATE_WAITING_FOR_RESPONSE,
- tab_contents()->GetLoadStateHost());
+ web_contents()->GetLoadStateHost());
// Ignore net::LOAD_STATE_READING_RESPONSE and net::LOAD_STATE_IDLE
case net::LOAD_STATE_IDLE:
case net::LOAD_STATE_READING_RESPONSE:
@@ -78,5 +80,5 @@ string16 CoreTabHelper::GetStatusText() const {
void CoreTabHelper::DidBecomeSelected() {
WebCacheManager::GetInstance()->ObserveActivity(
- tab_contents()->GetRenderProcessHost()->GetID());
+ web_contents()->GetRenderProcessHost()->GetID());
}
diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.h b/chrome/browser/ui/tab_contents/core_tab_helper.h
index cd37ccd..b6d6366 100644
--- a/chrome/browser/ui/tab_contents/core_tab_helper.h
+++ b/chrome/browser/ui/tab_contents/core_tab_helper.h
@@ -9,12 +9,11 @@
#include "content/public/browser/web_contents_observer.h"
class CoreTabHelperDelegate;
-class TabContentsWrapper;
// Per-tab class to handle functionality that is core to the operation of tabs.
class CoreTabHelper : public content::WebContentsObserver {
public:
- explicit CoreTabHelper(TabContentsWrapper* wrapper);
+ explicit CoreTabHelper(content::WebContents* web_contents);
virtual ~CoreTabHelper();
CoreTabHelperDelegate* delegate() const { return delegate_; }
@@ -33,9 +32,6 @@ class CoreTabHelper : public content::WebContentsObserver {
// Delegate for notifying our owner about stuff. Not owned by us.
CoreTabHelperDelegate* delegate_;
- // Our owning TabContentsWrapper.
- TabContentsWrapper* wrapper_;
-
DISALLOW_COPY_AND_ASSIGN(CoreTabHelper);
};
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
index e0b33d1..449cd5d 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
@@ -85,7 +85,7 @@ TabContentsWrapper::TabContentsWrapper(TabContents* contents)
blocked_content_tab_helper_.reset(new BlockedContentTabHelper(this));
bookmark_tab_helper_.reset(new BookmarkTabHelper(this));
constrained_window_tab_helper_.reset(new ConstrainedWindowTabHelper(this));
- core_tab_helper_.reset(new CoreTabHelper(this));
+ core_tab_helper_.reset(new CoreTabHelper(contents));
extension_tab_helper_.reset(new ExtensionTabHelper(this));
favicon_tab_helper_.reset(new FaviconTabHelper(contents));
find_tab_helper_.reset(new FindTabHelper(contents));
@@ -109,7 +109,7 @@ TabContentsWrapper::TabContentsWrapper(TabContents* contents)
// Create the per-tab observers.
alternate_error_page_tab_observer_.reset(
- new AlternateErrorPageTabObserver(this));
+ new AlternateErrorPageTabObserver(contents));
download_request_limiter_observer_.reset(
new DownloadRequestLimiterObserver(contents));
webnavigation_observer_.reset(
@@ -145,7 +145,7 @@ base::PropertyAccessor<TabContentsWrapper*>*
}
TabContentsWrapper* TabContentsWrapper::Clone() {
- TabContents* new_contents = tab_contents()->Clone();
+ TabContents* new_contents = web_contents()->Clone();
TabContentsWrapper* new_wrapper = new TabContentsWrapper(new_contents);
// TODO(avi): Can we generalize this so that knowledge of the functionings of
@@ -178,7 +178,7 @@ WebContents* TabContentsWrapper::web_contents() const {
}
Profile* TabContentsWrapper::profile() const {
- return Profile::FromBrowserContext(tab_contents()->GetBrowserContext());
+ return Profile::FromBrowserContext(web_contents()->GetBrowserContext());
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
index ff295ff..e93e569 100644
--- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
+++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
@@ -24,6 +24,8 @@
#include "ui/views/view.h"
#include "ui/views/views_delegate.h"
+using content::WebContents;
+
namespace {
// The delay waited after sending an OS simulated event.
@@ -350,7 +352,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_PasteWithoutTextChange) {
// Press Ctrl-V to paste the content back, it should start finding even if the
// content is not changed.
- content::Source<TabContents> notification_source(
+ content::Source<WebContents> notification_source(
browser()->GetSelectedTabContents());
ui_test_utils::WindowedNotificationObserverWithDetails
<FindNotificationDetails> observer(
diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc
index cbf5dcc..3479e1e 100644
--- a/chrome/browser/ui/views/sad_tab_view.cc
+++ b/chrome/browser/ui/views/sad_tab_view.cc
@@ -11,7 +11,7 @@
#include "chrome/browser/ui/webui/bug_report_ui.h"
#include "chrome/browser/userfeedback/proto/extension.pb.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/tab_contents/tab_contents.h"
+#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -23,6 +23,8 @@
#include "ui/views/controls/link.h"
#include "ui/views/layout/grid_layout.h"
+using content::WebContents;
+
static const int kPadding = 20;
static const float kMessageSize = 0.65f;
static const SkColor kTextColor = SK_ColorWHITE;
@@ -38,8 +40,8 @@ static const int kTitleFontSizeDelta = 2;
static const int kMessageFontSizeDelta = 1;
#endif
-SadTabView::SadTabView(TabContents* tab_contents, Kind kind)
- : tab_contents_(tab_contents),
+SadTabView::SadTabView(WebContents* web_contents, Kind kind)
+ : web_contents_(web_contents),
kind_(kind),
painted_(false),
base_font_(ResourceBundle::GetSharedInstance().GetFont(
@@ -48,7 +50,7 @@ SadTabView::SadTabView(TabContents* tab_contents, Kind kind)
help_link_(NULL),
feedback_link_(NULL),
reload_button_(NULL) {
- DCHECK(tab_contents);
+ DCHECK(web_contents);
// Sometimes the user will never see this tab, so keep track of the total
// number of creation events to compare to display events.
@@ -62,13 +64,13 @@ SadTabView::SadTabView(TabContents* tab_contents, Kind kind)
SadTabView::~SadTabView() {}
void SadTabView::LinkClicked(views::Link* source, int event_flags) {
- DCHECK(tab_contents_);
+ DCHECK(web_contents_);
if (source == help_link_) {
GURL help_url =
google_util::AppendGoogleLocaleParam(GURL(kind_ == CRASHED ?
chrome::kCrashReasonURL :
chrome::kKillReasonURL));
- tab_contents_->OpenURL(OpenURLParams(
+ web_contents_->OpenURL(OpenURLParams(
help_url,
content::Referrer(),
CURRENT_TAB,
@@ -76,7 +78,7 @@ void SadTabView::LinkClicked(views::Link* source, int event_flags) {
false /* is renderer initiated */));
} else if (source == feedback_link_) {
browser::ShowHtmlBugReportView(
- Browser::GetBrowserForController(&tab_contents_->GetController(), NULL),
+ Browser::GetBrowserForController(&web_contents_->GetController(), NULL),
l10n_util::GetStringUTF8(IDS_KILLED_TAB_FEEDBACK_MESSAGE),
userfeedback::ChromeOsData_ChromeOsCategory_CRASH);
}
@@ -84,9 +86,9 @@ void SadTabView::LinkClicked(views::Link* source, int event_flags) {
void SadTabView::ButtonPressed(views::Button* source,
const views::Event& event) {
- DCHECK(tab_contents_);
+ DCHECK(web_contents_);
DCHECK(source == reload_button_);
- tab_contents_->GetController().Reload(true);
+ web_contents_->GetController().Reload(true);
}
void SadTabView::Layout() {
@@ -129,7 +131,7 @@ void SadTabView::ViewHierarchyChanged(bool is_add,
layout->StartRowWithPadding(0, column_set_id, 0, kPadding);
layout->AddView(message_);
- if (tab_contents_) {
+ if (web_contents_) {
layout->StartRowWithPadding(0, column_set_id, 0, kPadding);
reload_button_ = new views::TextButton(
this,
diff --git a/chrome/browser/ui/views/sad_tab_view.h b/chrome/browser/ui/views/sad_tab_view.h
index 9eda1ed..a3dcbc4 100644
--- a/chrome/browser/ui/views/sad_tab_view.h
+++ b/chrome/browser/ui/views/sad_tab_view.h
@@ -12,7 +12,9 @@
#include "ui/views/controls/link_listener.h"
#include "ui/views/view.h"
-class TabContents;
+namespace content {
+class WebContents;
+}
namespace gfx {
class Font;
@@ -42,7 +44,7 @@ class SadTabView : public views::View,
KILLED // Tab killed. Display the "He's dead, Jim!" tab page.
};
- SadTabView(TabContents* tab_contents, Kind kind);
+ SadTabView(content::WebContents* web_contents, Kind kind);
virtual ~SadTabView();
// Overridden from views::View:
@@ -66,7 +68,7 @@ class SadTabView : public views::View,
views::Label* CreateLabel(const string16& text);
views::Link* CreateLink(const string16& text);
- TabContents* tab_contents_;
+ content::WebContents* web_contents_;
Kind kind_;
bool painted_;
const gfx::Font& base_font_;