summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-04 07:39:53 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-04 07:39:53 +0000
commitaa19063bb8f22bffd161fb21415522124e9e09ef (patch)
tree9265268901de268dff5726cc54245644e98a7793
parent291d3bf490ff827b05fc6d775f53139630bce599 (diff)
downloadchromium_src-aa19063bb8f22bffd161fb21415522124e9e09ef.zip
chromium_src-aa19063bb8f22bffd161fb21415522124e9e09ef.tar.gz
chromium_src-aa19063bb8f22bffd161fb21415522124e9e09ef.tar.bz2
Remove unneeded TabContents::FromWebContents.
BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11414286 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170902 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/automation_provider_observers.cc15
-rw-r--r--chrome/browser/automation/automation_provider_observers.h17
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc4
-rw-r--r--chrome/browser/intents/register_intent_handler_helper.cc12
-rw-r--r--chrome/browser/sessions/tab_restore_service_helper.cc11
-rw-r--r--chrome/browser/ui/auto_login_info_bar_delegate.cc6
-rw-r--r--chrome/browser/ui/browser.cc13
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller.cc63
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller.h13
-rw-r--r--chrome/browser/ui/gtk/web_intent_picker_gtk.cc49
-rw-r--r--chrome/browser/ui/gtk/web_intent_picker_gtk.h5
-rw-r--r--chrome/browser/ui/intents/web_intent_picker_controller.cc9
-rw-r--r--chrome/browser/ui/pdf/pdf_unsupported_feature.cc53
-rw-r--r--chrome/browser/ui/sync/one_click_signin_helper.cc13
-rw-r--r--chrome/browser/ui/views/web_intent_picker_views.cc30
15 files changed, 146 insertions, 167 deletions
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index 50c5bfc..954e75f 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -59,7 +59,6 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/find_bar/find_notification_details.h"
#include "chrome/browser/ui/login/login_prompt.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/browser/ui/webui/ntp/most_visited_handler.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
@@ -1203,14 +1202,14 @@ void MetricEventDurationObserver::Observe(
InfoBarCountObserver::InfoBarCountObserver(AutomationProvider* automation,
IPC::Message* reply_message,
- TabContents* tab_contents,
+ WebContents* web_contents,
size_t target_count)
: automation_(automation->AsWeakPtr()),
reply_message_(reply_message),
- tab_contents_(tab_contents),
+ web_contents_(web_contents),
target_count_(target_count) {
content::Source<InfoBarTabHelper> source(
- InfoBarTabHelper::FromWebContents(tab_contents->web_contents()));
+ InfoBarTabHelper::FromWebContents(web_contents));
registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
source);
registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
@@ -1231,7 +1230,7 @@ void InfoBarCountObserver::Observe(
void InfoBarCountObserver::CheckCount() {
InfoBarTabHelper* infobar_tab_helper =
- InfoBarTabHelper::FromWebContents(tab_contents_->web_contents());
+ InfoBarTabHelper::FromWebContents(web_contents_);
if (infobar_tab_helper->GetInfoBarCount() != target_count_)
return;
@@ -1730,11 +1729,11 @@ void SavePackageNotificationObserver::Observe(
PageSnapshotTaker::PageSnapshotTaker(AutomationProvider* automation,
IPC::Message* reply_message,
- TabContents* tab_contents,
+ WebContents* web_contents,
const FilePath& path)
: automation_(automation->AsWeakPtr()),
reply_message_(reply_message),
- tab_contents_(tab_contents),
+ web_contents_(web_contents),
image_path_(path) {
registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
content::NotificationService::AllSources());
@@ -1744,7 +1743,7 @@ PageSnapshotTaker::~PageSnapshotTaker() {}
void PageSnapshotTaker::Start() {
AutomationTabHelper* automation_tab_helper =
- AutomationTabHelper::FromWebContents(tab_contents_->web_contents());
+ AutomationTabHelper::FromWebContents(web_contents_);
StartObserving(automation_tab_helper);
automation_tab_helper->SnapshotEntirePage();
}
diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h
index 142fdbb..29f5d27 100644
--- a/chrome/browser/automation/automation_provider_observers.h
+++ b/chrome/browser/automation/automation_provider_observers.h
@@ -62,7 +62,6 @@ class InfoBarTabHelper;
class Notification;
class Profile;
class SavePackage;
-class TabContents;
namespace automation {
class Error;
@@ -75,10 +74,6 @@ class WizardScreen;
}
#endif // defined(OS_CHROMEOS)
-namespace IPC {
-class Message;
-}
-
namespace content {
class NavigationController;
class RenderViewHost;
@@ -93,6 +88,10 @@ namespace history {
class TopSites;
}
+namespace IPC {
+class Message;
+}
+
namespace policy {
class BrowserPolicyConnector;
}
@@ -658,7 +657,7 @@ class InfoBarCountObserver : public content::NotificationObserver {
public:
InfoBarCountObserver(AutomationProvider* automation,
IPC::Message* reply_message,
- TabContents* tab_contents,
+ content::WebContents* web_contents,
size_t target_count);
virtual ~InfoBarCountObserver();
@@ -675,7 +674,7 @@ class InfoBarCountObserver : public content::NotificationObserver {
content::NotificationRegistrar registrar_;
base::WeakPtr<AutomationProvider> automation_;
scoped_ptr<IPC::Message> reply_message_;
- TabContents* tab_contents_;
+ content::WebContents* web_contents_;
const size_t target_count_;
@@ -1270,7 +1269,7 @@ class PageSnapshotTaker : public TabEventObserver,
public:
PageSnapshotTaker(AutomationProvider* automation,
IPC::Message* reply_message,
- TabContents* tab_contents,
+ content::WebContents* web_contents,
const FilePath& path);
virtual ~PageSnapshotTaker();
@@ -1294,7 +1293,7 @@ class PageSnapshotTaker : public TabEventObserver,
base::WeakPtr<AutomationProvider> automation_;
scoped_ptr<IPC::Message> reply_message_;
- TabContents* tab_contents_;
+ content::WebContents* web_contents_;
FilePath image_path_;
content::NotificationRegistrar registrar_;
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 2bf5542..293a82b 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -5883,7 +5883,7 @@ void TestingAutomationProvider::CaptureEntirePageJSON(
FilePath path(path_str);
// This will delete itself when finished.
PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker(
- this, reply_message, TabContents::FromWebContents(web_contents), path);
+ this, reply_message, web_contents, path);
snapshot_taker->Start();
} else {
AutomationJSONReply(this, reply_message)
@@ -6346,7 +6346,7 @@ void TestingAutomationProvider::WaitForInfoBarCount(
// The delegate will delete itself.
new InfoBarCountObserver(this, reply_message,
- TabContents::FromWebContents(controller->GetWebContents()), target_count);
+ controller->GetWebContents(), target_count);
}
void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle(
diff --git a/chrome/browser/intents/register_intent_handler_helper.cc b/chrome/browser/intents/register_intent_handler_helper.cc
index 01c1e2c..12e6acb 100644
--- a/chrome/browser/intents/register_intent_handler_helper.cc
+++ b/chrome/browser/intents/register_intent_handler_helper.cc
@@ -12,7 +12,6 @@
#include "chrome/browser/intents/web_intents_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "content/public/browser/web_contents.h"
#include "webkit/glue/web_intent_service_data.h"
@@ -23,19 +22,20 @@ void Browser::RegisterIntentHandlerHelper(
WebContents* web_contents,
const webkit_glue::WebIntentServiceData& data,
bool user_gesture) {
- TabContents* tab_contents = TabContents::FromWebContents(web_contents);
- if (!tab_contents || tab_contents->profile()->IsOffTheRecord())
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ if (profile->IsOffTheRecord())
return;
- if (!web_intents::IsWebIntentsEnabledForProfile(tab_contents->profile()))
+ if (!web_intents::IsWebIntentsEnabledForProfile(profile))
return;
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
- tab_contents->profile(), Profile::EXPLICIT_ACCESS);
+ profile, Profile::EXPLICIT_ACCESS);
RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar(
InfoBarTabHelper::FromWebContents(web_contents),
- WebIntentsRegistryFactory::GetForProfile(tab_contents->profile()),
+ WebIntentsRegistryFactory::GetForProfile(profile),
data,
favicon_service,
web_contents->GetURL());
diff --git a/chrome/browser/sessions/tab_restore_service_helper.cc b/chrome/browser/sessions/tab_restore_service_helper.cc
index f5e0978..903391e 100644
--- a/chrome/browser/sessions/tab_restore_service_helper.cc
+++ b/chrome/browser/sessions/tab_restore_service_helper.cc
@@ -395,13 +395,12 @@ void TabRestoreServiceHelper::PopulateTab(
tab->current_navigation_index = 0;
tab->tabstrip_index = index;
- TabContents* tab_contents =
- TabContents::FromWebContents(controller->GetWebContents());
- // tab_contents is NULL in some browser tests.
- if (tab_contents) {
+ extensions::TabHelper* extensions_tab_helper =
+ extensions::TabHelper::FromWebContents(controller->GetWebContents());
+ // extensions_tab_helper is NULL in some browser tests.
+ if (extensions_tab_helper) {
const extensions::Extension* extension =
- extensions::TabHelper::FromWebContents(controller->GetWebContents())->
- extension_app();
+ extensions_tab_helper->extension_app();
if (extension)
tab->extension_app_id = extension->id();
}
diff --git a/chrome/browser/ui/auto_login_info_bar_delegate.cc b/chrome/browser/ui/auto_login_info_bar_delegate.cc
index 8858b2b..10a3106 100644
--- a/chrome/browser/ui/auto_login_info_bar_delegate.cc
+++ b/chrome/browser/ui/auto_login_info_bar_delegate.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/ubertoken_fetcher.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
@@ -223,8 +222,9 @@ bool AutoLoginInfoBarDelegate::Accept() {
}
bool AutoLoginInfoBarDelegate::Cancel() {
- PrefService* pref_service = TabContents::FromWebContents(
- owner()->GetWebContents())->profile()->GetPrefs();
+ Profile* profile = Profile::FromBrowserContext(
+ owner()->GetWebContents()->GetBrowserContext());
+ PrefService* pref_service = profile->GetPrefs();
pref_service->SetBoolean(prefs::kAutologinEnabled, false);
RecordHistogramAction(HISTOGRAM_REJECTED);
button_pressed_ = true;
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 2555e19..e13461f 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -885,15 +885,15 @@ void Browser::RegisterProtocolHandlerHelper(WebContents* web_contents,
const string16& title,
bool user_gesture,
BrowserWindow* window) {
- TabContents* tab_contents = TabContents::FromWebContents(web_contents);
- if (!tab_contents || tab_contents->profile()->IsOffTheRecord())
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ if (profile->IsOffTheRecord())
return;
ProtocolHandler handler =
ProtocolHandler::CreateProtocolHandler(protocol, url, title);
- ProtocolHandlerRegistry* registry =
- tab_contents->profile()->GetProtocolHandlerRegistry();
+ ProtocolHandlerRegistry* registry = profile->GetProtocolHandlerRegistry();
TabSpecificContentSettings* tab_content_settings =
TabSpecificContentSettings::FromWebContents(web_contents);
@@ -963,10 +963,11 @@ void Browser::RequestMediaAccessPermissionHelper(
content::WebContents* web_contents,
const content::MediaStreamRequest* request,
const content::MediaResponseCallback& callback) {
- TabContents* tab = TabContents::FromWebContents(web_contents);
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
scoped_ptr<MediaStreamDevicesController>
- controller(new MediaStreamDevicesController(tab->profile(),
+ controller(new MediaStreamDevicesController(profile,
request,
callback));
if (!controller->DismissInfoBarAndTakeActionOnSettings()) {
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller.cc b/chrome/browser/ui/fullscreen/fullscreen_controller.cc
index bb8842f..3d21e07 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller.cc
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
@@ -63,9 +62,7 @@ bool FullscreenController::IsFullscreenForTabOrPending() const {
bool FullscreenController::IsFullscreenForTabOrPending(
const WebContents* web_contents) const {
- const TabContents* tab_contents =
- TabContents::FromWebContents(web_contents);
- if (!tab_contents || (tab_contents != fullscreened_tab_))
+ if (web_contents != fullscreened_tab_)
return false;
DCHECK(web_contents == chrome::GetActiveWebContents(browser_));
return true;
@@ -93,7 +90,7 @@ void FullscreenController::ToggleFullscreenModeForTab(WebContents* web_contents,
#endif
if (enter_fullscreen) {
- SetFullscreenedTab(TabContents::FromWebContents(web_contents));
+ SetFullscreenedTab(web_contents);
if (!in_browser_or_tab_fullscreen_mode) {
tab_caused_fullscreen_ = true;
#if defined(OS_MACOSX)
@@ -199,7 +196,7 @@ void FullscreenController::RequestToLockMouse(WebContents* web_contents,
web_contents->GotResponseToLockMouseRequest(false);
return;
}
- SetMouseLockTab(TabContents::FromWebContents(web_contents));
+ SetMouseLockTab(web_contents);
FullscreenExitBubbleType bubble_type = GetFullscreenExitBubbleType();
switch (GetMouseLockSetting(web_contents->GetURL())) {
@@ -237,17 +234,12 @@ void FullscreenController::RequestToLockMouse(WebContents* web_contents,
}
void FullscreenController::OnTabDeactivated(WebContents* web_contents) {
- const TabContents* contents = TabContents::FromWebContents(web_contents);
- if (contents &&
- (contents == fullscreened_tab_ || contents == mouse_lock_tab_)) {
+ if (web_contents == fullscreened_tab_ || web_contents == mouse_lock_tab_)
ExitTabFullscreenOrMouseLockIfNecessary();
- }
}
void FullscreenController::OnTabClosing(WebContents* web_contents) {
- const TabContents* contents = TabContents::FromWebContents(web_contents);
- if (contents &&
- (contents == fullscreened_tab_ || contents == mouse_lock_tab_)) {
+ if (web_contents == fullscreened_tab_ || web_contents == mouse_lock_tab_) {
ExitTabFullscreenOrMouseLockIfNecessary();
// The call to exit fullscreen may result in asynchronous notification of
// fullscreen state change (e.g., on Linux). We don't want to rely on it
@@ -310,8 +302,7 @@ void FullscreenController::OnAcceptFullscreenPermission(
}
if (mouse_lock_tab_ &&
- mouse_lock_tab_->web_contents() &&
- mouse_lock_tab_->web_contents()->GotResponseToLockMouseRequest(true)) {
+ mouse_lock_tab_->GotResponseToLockMouseRequest(true)) {
mouse_lock_state_ = MOUSELOCK_ACCEPTED;
} else {
mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED;
@@ -346,8 +337,8 @@ void FullscreenController::OnDenyFullscreenPermission(
if (mouse_lock) {
DCHECK(IsMouseLockRequested());
mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED;
- if (mouse_lock_tab_ && mouse_lock_tab_->web_contents())
- mouse_lock_tab_->web_contents()->GotResponseToLockMouseRequest(false);
+ if (mouse_lock_tab_)
+ mouse_lock_tab_->GotResponseToLockMouseRequest(false);
SetMouseLockTab(NULL);
NotifyMouseLockChange();
@@ -437,12 +428,11 @@ void FullscreenController::UpdateNotificationRegistrations() {
if (fullscreened_tab_ && mouse_lock_tab_)
DCHECK(fullscreened_tab_ == mouse_lock_tab_);
- TabContents* tab = fullscreened_tab_ ? fullscreened_tab_ : mouse_lock_tab_;
+ WebContents* tab = fullscreened_tab_ ? fullscreened_tab_ : mouse_lock_tab_;
if (tab && registrar_.IsEmpty()) {
registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
- content::Source<content::NavigationController>(
- &tab->web_contents()->GetController()));
+ content::Source<content::NavigationController>(&tab->GetController()));
} else if (!tab && !registrar_.IsEmpty()) {
registrar_.RemoveAll();
}
@@ -464,8 +454,7 @@ void FullscreenController::NotifyFullscreenChange(bool is_fullscreen) {
void FullscreenController::NotifyTabOfExitIfNecessary() {
if (fullscreened_tab_) {
- RenderViewHost* rvh =
- fullscreened_tab_->web_contents()->GetRenderViewHost();
+ RenderViewHost* rvh = fullscreened_tab_->GetRenderViewHost();
SetFullscreenedTab(NULL);
tab_caused_fullscreen_ = false;
tab_fullscreen_accepted_ = false;
@@ -474,13 +463,12 @@ void FullscreenController::NotifyTabOfExitIfNecessary() {
}
if (mouse_lock_tab_) {
- WebContents* web_contents = mouse_lock_tab_->web_contents();
if (IsMouseLockRequested()) {
- web_contents->GotResponseToLockMouseRequest(false);
+ mouse_lock_tab_->GotResponseToLockMouseRequest(false);
NotifyMouseLockChange();
- } else if (web_contents->GetRenderViewHost() &&
- web_contents->GetRenderViewHost()->GetView()) {
- web_contents->GetRenderViewHost()->GetView()->UnlockMouse();
+ } else if (mouse_lock_tab_->GetRenderViewHost() &&
+ mouse_lock_tab_->GetRenderViewHost()->GetView()) {
+ mouse_lock_tab_->GetRenderViewHost()->GetView()->UnlockMouse();
}
SetMouseLockTab(NULL);
mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED;
@@ -561,12 +549,12 @@ void FullscreenController::TogglePresentationModeInternal(bool for_tab) {
}
#endif
-void FullscreenController::SetFullscreenedTab(TabContents* tab) {
+void FullscreenController::SetFullscreenedTab(WebContents* tab) {
fullscreened_tab_ = tab;
UpdateNotificationRegistrations();
}
-void FullscreenController::SetMouseLockTab(TabContents* tab) {
+void FullscreenController::SetMouseLockTab(WebContents* tab) {
mouse_lock_tab_ = tab;
UpdateNotificationRegistrations();
}
@@ -581,9 +569,9 @@ void FullscreenController::ExitTabFullscreenOrMouseLockIfNecessary() {
void FullscreenController::UpdateFullscreenExitBubbleContent() {
GURL url;
if (fullscreened_tab_)
- url = fullscreened_tab_->web_contents()->GetURL();
+ url = fullscreened_tab_->GetURL();
else if (mouse_lock_tab_)
- url = mouse_lock_tab_->web_contents()->GetURL();
+ url = mouse_lock_tab_->GetURL();
else if (!extension_caused_fullscreen_.is_empty())
url = extension_caused_fullscreen_;
@@ -592,18 +580,17 @@ void FullscreenController::UpdateFullscreenExitBubbleContent() {
// If bubble displays buttons, unlock mouse to allow pressing them.
if (fullscreen_bubble::ShowButtonsForType(bubble_type) &&
IsMouseLocked() &&
- mouse_lock_tab_->web_contents()) {
- WebContents* web_contents = mouse_lock_tab_->web_contents();
- if (web_contents && web_contents->GetRenderViewHost() &&
- web_contents->GetRenderViewHost()->GetView())
- web_contents->GetRenderViewHost()->GetView()->UnlockMouse();
+ mouse_lock_tab_ &&
+ mouse_lock_tab_->GetRenderViewHost() &&
+ mouse_lock_tab_->GetRenderViewHost()->GetView()) {
+ mouse_lock_tab_->GetRenderViewHost()->GetView()->UnlockMouse();
}
window_->UpdateFullscreenExitBubbleContent(url, bubble_type);
}
ContentSetting
- FullscreenController::GetFullscreenSetting(const GURL& url) const {
+FullscreenController::GetFullscreenSetting(const GURL& url) const {
if (url.SchemeIsFile())
return CONTENT_SETTING_ALLOW;
@@ -612,7 +599,7 @@ ContentSetting
}
ContentSetting
- FullscreenController::GetMouseLockSetting(const GURL& url) const {
+FullscreenController::GetMouseLockSetting(const GURL& url) const {
if (url.SchemeIsFile())
return CONTENT_SETTING_ALLOW;
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller.h b/chrome/browser/ui/fullscreen/fullscreen_controller.h
index 3f1c0ff..757774e 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller.h
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller.h
@@ -16,7 +16,6 @@ class Browser;
class BrowserWindow;
class GURL;
class Profile;
-class TabContents;
namespace content {
class WebContents;
@@ -144,8 +143,8 @@ class FullscreenController : public content::NotificationObserver {
#if defined(OS_MACOSX)
void TogglePresentationModeInternal(bool for_tab);
#endif
- void SetFullscreenedTab(TabContents* tab);
- void SetMouseLockTab(TabContents* tab);
+ void SetFullscreenedTab(content::WebContents* tab);
+ void SetMouseLockTab(content::WebContents* tab);
// Make the current tab exit fullscreen mode or mouse lock if it is in it.
void ExitTabFullscreenOrMouseLockIfNecessary();
@@ -161,9 +160,9 @@ class FullscreenController : public content::NotificationObserver {
Profile* profile_;
// If there is currently a tab in fullscreen mode (entered via
- // webkitRequestFullScreen), this is its TabContents.
+ // webkitRequestFullScreen), this is its WebContents.
// Assign using SetFullscreenedTab().
- TabContents* fullscreened_tab_;
+ content::WebContents* fullscreened_tab_;
// The URL of the extension which trigerred "browser fullscreen" mode.
GURL extension_caused_fullscreen_;
@@ -177,9 +176,9 @@ class FullscreenController : public content::NotificationObserver {
// True if this controller has toggled into tab OR browser fullscreen.
bool toggled_into_fullscreen_;
- // TabContents for current tab requesting or currently in mouse lock.
+ // WebContents for current tab requesting or currently in mouse lock.
// Assign using SetMouseLockTab().
- TabContents* mouse_lock_tab_;
+ content::WebContents* mouse_lock_tab_;
MouseLockState mouse_lock_state_;
diff --git a/chrome/browser/ui/gtk/web_intent_picker_gtk.cc b/chrome/browser/ui/gtk/web_intent_picker_gtk.cc
index ea81274..9dc2f24 100644
--- a/chrome/browser/ui/gtk/web_intent_picker_gtk.cc
+++ b/chrome/browser/ui/gtk/web_intent_picker_gtk.cc
@@ -25,7 +25,6 @@
#include "chrome/browser/ui/intents/web_intent_picker_controller.h"
#include "chrome/browser/ui/intents/web_intent_picker_delegate.h"
#include "chrome/browser/ui/intents/web_intent_picker_model.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
@@ -64,8 +63,10 @@ enum {
kInstallButtonIndex,
};
-GtkThemeService *GetThemeService(TabContents* tab_contents) {
- return GtkThemeService::GetFrom(tab_contents->profile());
+GtkThemeService *GetThemeService(WebContents* web_contents) {
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ return GtkThemeService::GetFrom(profile);
}
// Set the image of |button| to |pixbuf|.
@@ -195,17 +196,16 @@ void WaitingDialog::Init() {
}
// static
-WebIntentPicker* WebIntentPicker::Create(content::WebContents* web_contents,
+WebIntentPicker* WebIntentPicker::Create(WebContents* web_contents,
WebIntentPickerDelegate* delegate,
WebIntentPickerModel* model) {
- TabContents* tab_contents = TabContents::FromWebContents(web_contents);
- return new WebIntentPickerGtk(tab_contents, delegate, model);
+ return new WebIntentPickerGtk(web_contents, delegate, model);
}
-WebIntentPickerGtk::WebIntentPickerGtk(TabContents* tab_contents,
+WebIntentPickerGtk::WebIntentPickerGtk(WebContents* web_contents,
WebIntentPickerDelegate* delegate,
WebIntentPickerModel* model)
- : tab_contents_(tab_contents),
+ : web_contents_(web_contents),
delegate_(delegate),
model_(model),
contents_(NULL),
@@ -223,12 +223,12 @@ WebIntentPickerGtk::WebIntentPickerGtk(TabContents* tab_contents,
UpdateCWSLabel();
UpdateSuggestedExtensions();
- GtkThemeService* theme_service = GetThemeService(tab_contents);
+ GtkThemeService* theme_service = GetThemeService(web_contents);
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>(theme_service));
theme_service->InitThemesFor(this);
- window_ = new ConstrainedWindowGtk(tab_contents->web_contents(), this);
+ window_ = new ConstrainedWindowGtk(web_contents, this);
if (model_->IsInlineDisposition())
OnInlineDisposition(string16(), model_->inline_disposition_url());
@@ -293,11 +293,11 @@ void WebIntentPickerGtk::OnExtensionIconChanged(
void WebIntentPickerGtk::OnInlineDisposition(const string16&,
const GURL& url) {
DCHECK(delegate_);
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents_->GetBrowserContext());
inline_disposition_web_contents_.reset(
- delegate_->CreateWebContentsForInlineDisposition(
- tab_contents_->profile(), url));
- Browser* browser = chrome::FindBrowserWithWebContents(
- tab_contents_->web_contents());
+ delegate_->CreateWebContentsForInlineDisposition(profile, url));
+ Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
inline_disposition_delegate_.reset(
new WebIntentInlineDispositionDelegate(
this, inline_disposition_web_contents_.get(), browser));
@@ -312,7 +312,7 @@ void WebIntentPickerGtk::OnInlineDisposition(const string16&,
window_->BackgroundColorChanged();
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
- GtkThemeService* theme_service = GetThemeService(tab_contents_);
+ GtkThemeService* theme_service = GetThemeService(web_contents_);
service_hbox_ = gtk_hbox_new(FALSE, ui::kControlSpacing);
// TODO(gbillock): Eventually get the service icon button here.
@@ -378,8 +378,7 @@ void WebIntentPickerGtk::OnInlineDisposition(const string16&,
inline_disposition_web_contents_->GetView()->SetInitialFocus();
host_signals_.reset(new ui::GtkSignalRegistrar());
host_signals_->Connect(
- tab_contents_->web_contents()->GetRenderViewHost()->GetView()->
- GetNativeView(),
+ web_contents_->GetRenderViewHost()->GetView()->GetNativeView(),
"size-allocate",
G_CALLBACK(OnHostContentsSizeAllocateThunk), this);
}
@@ -391,7 +390,7 @@ void WebIntentPickerGtk::OnInlineDispositionAutoResize(const gfx::Size& size) {
}
gfx::Size WebIntentPickerGtk::GetMaxInlineDispositionSize() {
- gfx::Rect tab_bounds(tab_contents_->web_contents()->GetRenderViewHost()->
+ gfx::Rect tab_bounds(web_contents_->GetRenderViewHost()->
GetView()->GetNativeView()->allocation);
GtkRequisition req = {};
if (service_hbox_)
@@ -429,7 +428,7 @@ void WebIntentPickerGtk::OnPendingAsyncCompleted() {
// Add the message text.
GtkWidget* hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(sub_contents), hbox, TRUE, TRUE, 0);
- GtkThemeService* theme_service = GetThemeService(tab_contents_);
+ GtkThemeService* theme_service = GetThemeService(web_contents_);
GtkWidget* no_service_label = theme_service->BuildLabel(
l10n_util::GetStringUTF8(IDS_INTENT_PICKER_NO_SERVICES).c_str(),
ui::kGdkBlack);
@@ -481,7 +480,7 @@ void WebIntentPickerGtk::Observe(int type,
const content::NotificationDetails& details) {
DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_THEME_CHANGED);
if (header_label_) {
- GtkThemeService* theme_service = GetThemeService(tab_contents_);
+ GtkThemeService* theme_service = GetThemeService(web_contents_);
if (theme_service->UsingNativeTheme())
gtk_util::UndoForceFontSize(header_label_);
else
@@ -579,7 +578,7 @@ void WebIntentPickerGtk::OnServiceButtonClick(GtkWidget* button) {
}
void WebIntentPickerGtk::InitContents() {
- GtkThemeService* theme_service = GetThemeService(tab_contents_);
+ GtkThemeService* theme_service = GetThemeService(web_contents_);
// Main contents vbox.
if (!contents_) {
@@ -601,7 +600,7 @@ void WebIntentPickerGtk::InitContents() {
}
void WebIntentPickerGtk::InitMainContents() {
- GtkThemeService* theme_service = GetThemeService(tab_contents_);
+ GtkThemeService* theme_service = GetThemeService(web_contents_);
ClearContents();
@@ -720,7 +719,7 @@ void WebIntentPickerGtk::AddCloseButton(GtkWidget* containingBox) {
gtk_box_pack_start(GTK_BOX(containingBox), close_hbox, TRUE, TRUE, 0);
close_button_.reset(
- CustomDrawButton::CloseButton(GetThemeService(tab_contents_)));
+ CustomDrawButton::CloseButton(GetThemeService(web_contents_)));
g_signal_connect(close_button_->widget(), "clicked",
G_CALLBACK(OnCloseButtonClickThunk), this);
gtk_widget_set_can_focus(close_button_->widget(), FALSE);
@@ -734,7 +733,7 @@ void WebIntentPickerGtk::AddTitle(GtkWidget* containingBox) {
gtk_box_pack_start(GTK_BOX(containingBox), header_hbox, TRUE, TRUE, 0);
// Label text will be set in the call to SetActionString().
- header_label_ = GetThemeService(tab_contents_)->BuildLabel(
+ header_label_ = GetThemeService(web_contents_)->BuildLabel(
std::string(), ui::kGdkBlack);
gtk_util::ForceFontSizePixels(header_label_, kHeaderLabelPixelSize);
gtk_box_pack_start(GTK_BOX(header_hbox), header_label_, TRUE, TRUE, 0);
@@ -793,7 +792,7 @@ void WebIntentPickerGtk::UpdateSuggestedExtensions() {
if (!extensions_vbox_)
return;
- GtkThemeService* theme_service = GetThemeService(tab_contents_);
+ GtkThemeService* theme_service = GetThemeService(web_contents_);
gtk_util::RemoveAllChildren(extensions_vbox_);
diff --git a/chrome/browser/ui/gtk/web_intent_picker_gtk.h b/chrome/browser/ui/gtk/web_intent_picker_gtk.h
index fe473c4..127c8a5 100644
--- a/chrome/browser/ui/gtk/web_intent_picker_gtk.h
+++ b/chrome/browser/ui/gtk/web_intent_picker_gtk.h
@@ -27,7 +27,6 @@ class GtkSignalRegistrar;
class CustomDrawButton;
class GURL;
-class TabContents;
class ThrobberGtk;
class WebIntentPickerDelegate;
class WaitingDialog;
@@ -38,7 +37,7 @@ class WebIntentPickerGtk : public WebIntentPicker,
public ConstrainedWindowGtkDelegate,
public content::NotificationObserver {
public:
- WebIntentPickerGtk(TabContents* tab_contents,
+ WebIntentPickerGtk(content::WebContents* tab_contents,
WebIntentPickerDelegate* delegate,
WebIntentPickerModel* model);
virtual ~WebIntentPickerGtk();
@@ -136,7 +135,7 @@ class WebIntentPickerGtk : public WebIntentPicker,
void RemoveThrobber();
// A weak pointer to the tab contents on which to display the picker UI.
- TabContents* tab_contents_;
+ content::WebContents* web_contents_;
// A weak pointer to the WebIntentPickerDelegate to notify when the user
// chooses a service or cancels.
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.cc b/chrome/browser/ui/intents/web_intent_picker_controller.cc
index 878ecb0..b6abe0ba 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller.cc
+++ b/chrome/browser/ui/intents/web_intent_picker_controller.cc
@@ -810,13 +810,12 @@ void WebIntentPickerController::LocationBarPickerButtonClicked() {
chrome::FindBrowserWithWebContents(web_contents_);
if (!service_browser) return;
- TabContents* client_tab =
- TabContents::FromWebContents(window_disposition_source_);
Browser* client_browser =
chrome::FindBrowserWithWebContents(window_disposition_source_);
- if (!client_browser || !client_tab) return;
- int client_index =
- client_browser->tab_strip_model()->GetIndexOfTabContents(client_tab);
+ if (!client_browser)
+ return;
+ int client_index = client_browser->tab_strip_model()->GetIndexOfWebContents(
+ window_disposition_source_);
DCHECK(client_index != TabStripModel::kNoTab);
source_intents_dispatcher_->ResetDispatch();
diff --git a/chrome/browser/ui/pdf/pdf_unsupported_feature.cc b/chrome/browser/ui/pdf/pdf_unsupported_feature.cc
index f7af1a9..c5517bc 100644
--- a/chrome/browser/ui/pdf/pdf_unsupported_feature.cc
+++ b/chrome/browser/ui/pdf/pdf_unsupported_feature.cc
@@ -20,7 +20,6 @@
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/pdf/open_pdf_in_reader_prompt_delegate.h"
#include "chrome/browser/ui/pdf/pdf_tab_helper.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/pref_names.h"
@@ -129,11 +128,11 @@ string16 PDFEnableAdobeReaderPromptDelegate::GetMessageText() const {
}
// Launch the url to get the latest Adbobe Reader installer.
-void OpenReaderUpdateURL(WebContents* tab) {
+void OpenReaderUpdateURL(WebContents* web_contents) {
OpenURLParams params(
GURL(kAdobeReaderUpdateUrl), Referrer(), NEW_FOREGROUND_TAB,
content::PAGE_TRANSITION_LINK, false);
- tab->OpenURL(params);
+ web_contents->OpenURL(params);
}
// Opens the PDF using Adobe Reader.
@@ -158,13 +157,13 @@ class PDFUnsupportedFeatureInterstitial
: public content::InterstitialPageDelegate {
public:
PDFUnsupportedFeatureInterstitial(
- TabContents* tab,
+ WebContents* web_contents,
const WebPluginInfo& reader_webplugininfo)
- : tab_contents_(tab),
+ : web_contents_(web_contents),
reader_webplugininfo_(reader_webplugininfo) {
content::RecordAction(UserMetricsAction("PDF_ReaderInterstitialShown"));
interstitial_page_ = InterstitialPage::Create(
- tab->web_contents(), false, tab->web_contents()->GetURL(), this);
+ web_contents, false, web_contents->GetURL(), this);
interstitial_page_->Show();
}
@@ -209,14 +208,13 @@ class PDFUnsupportedFeatureInterstitial
if (command == "1") {
content::RecordAction(
UserMetricsAction("PDF_ReaderInterstitialUpdate"));
- OpenReaderUpdateURL(tab_contents_->web_contents());
+ OpenReaderUpdateURL(web_contents_);
} else if (command == "2") {
content::RecordAction(
UserMetricsAction("PDF_ReaderInterstitialIgnore"));
// Pretend that the plug-in is up-to-date so that we don't block it.
reader_webplugininfo_.version = ASCIIToUTF16("11.0.0.0");
- OpenUsingReader(tab_contents_->web_contents(), reader_webplugininfo_,
- NULL);
+ OpenUsingReader(web_contents_, reader_webplugininfo_, NULL);
} else {
NOTREACHED();
}
@@ -225,12 +223,13 @@ class PDFUnsupportedFeatureInterstitial
virtual void OverrideRendererPrefs(
content::RendererPreferences* prefs) OVERRIDE {
- renderer_preferences_util::UpdateFromSystemSettings(
- prefs, tab_contents_->profile());
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents_->GetBrowserContext());
+ renderer_preferences_util::UpdateFromSystemSettings(prefs, profile);
}
private:
- TabContents* tab_contents_;
+ WebContents* web_contents_;
WebPluginInfo reader_webplugininfo_;
InterstitialPage* interstitial_page_; // Owns us.
@@ -243,7 +242,7 @@ class PDFUnsupportedFeaturePromptDelegate
: public OpenPDFInReaderPromptDelegate {
public:
// |reader| is NULL if Adobe Reader isn't installed.
- PDFUnsupportedFeaturePromptDelegate(TabContents* tab_contents,
+ PDFUnsupportedFeaturePromptDelegate(WebContents* web_contents,
const webkit::WebPluginInfo* reader,
PluginFinder* plugin_finder);
virtual ~PDFUnsupportedFeaturePromptDelegate();
@@ -258,7 +257,7 @@ class PDFUnsupportedFeaturePromptDelegate
virtual void Cancel() OVERRIDE;
private:
- TabContents* tab_contents_;
+ WebContents* web_contents_;
bool reader_installed_;
bool reader_vulnerable_;
WebPluginInfo reader_webplugininfo_;
@@ -267,10 +266,10 @@ class PDFUnsupportedFeaturePromptDelegate
};
PDFUnsupportedFeaturePromptDelegate::PDFUnsupportedFeaturePromptDelegate(
- TabContents* tab_contents,
+ WebContents* web_contents,
const webkit::WebPluginInfo* reader,
PluginFinder* plugin_finder)
- : tab_contents_(tab_contents),
+ : web_contents_(web_contents),
reader_installed_(!!reader),
reader_vulnerable_(false) {
if (!reader_installed_) {
@@ -331,22 +330,23 @@ void PDFUnsupportedFeaturePromptDelegate::Accept() {
if (!reader_installed_) {
content::RecordAction(UserMetricsAction("PDF_InstallReaderInfoBarOK"));
- OpenReaderUpdateURL(tab_contents_->web_contents());
+ OpenReaderUpdateURL(web_contents_);
return;
}
content::RecordAction(UserMetricsAction("PDF_UseReaderInfoBarOK"));
if (reader_vulnerable_) {
- new PDFUnsupportedFeatureInterstitial(tab_contents_, reader_webplugininfo_);
+ new PDFUnsupportedFeatureInterstitial(web_contents_, reader_webplugininfo_);
return;
}
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents_->GetBrowserContext());
OpenPDFInReaderPromptDelegate* delegate =
- new PDFEnableAdobeReaderPromptDelegate(tab_contents_->profile());
+ new PDFEnableAdobeReaderPromptDelegate(profile);
- OpenUsingReader(tab_contents_->web_contents(), reader_webplugininfo_,
- delegate);
+ OpenUsingReader(web_contents_, reader_webplugininfo_, delegate);
}
void PDFUnsupportedFeaturePromptDelegate::Cancel() {
@@ -364,10 +364,6 @@ void GotPluginsCallback(int process_id,
if (!web_contents)
return;
- TabContents* tab = TabContents::FromWebContents(web_contents);
- if (!tab)
- return;
-
const webkit::WebPluginInfo* reader = NULL;
PluginFinder* plugin_finder = PluginFinder::GetInstance();
for (size_t i = 0; i < plugins.size(); ++i) {
@@ -379,7 +375,9 @@ void GotPluginsCallback(int process_id,
DCHECK(!reader);
reader = &plugins[i];
// If the Reader plugin is disabled by policy, don't prompt them.
- PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(tab->profile());
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile);
if (plugin_prefs->PolicyStatusForPlugin(plugin_metadata->name()) ==
PluginPrefs::POLICY_DISABLED) {
return;
@@ -388,7 +386,8 @@ void GotPluginsCallback(int process_id,
}
scoped_ptr<OpenPDFInReaderPromptDelegate> prompt(
- new PDFUnsupportedFeaturePromptDelegate(tab, reader, plugin_finder));
+ new PDFUnsupportedFeaturePromptDelegate(
+ web_contents, reader, plugin_finder));
PDFTabHelper* pdf_tab_helper = PDFTabHelper::FromWebContents(web_contents);
pdf_tab_helper->ShowOpenInReaderPrompt(prompt.Pass());
}
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc
index b27b27b..964bb32 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc
@@ -32,7 +32,6 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/sync/one_click_signin_histogram.h"
#include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/net/url_util.h"
@@ -337,17 +336,17 @@ void OneClickInfoBarDelegateImpl::GetAlternateColors(
}
void OneClickInfoBarDelegateImpl::DisableOneClickSignIn() {
- PrefService* pref_service =
- TabContents::FromWebContents(owner()->GetWebContents())->
- profile()->GetPrefs();
+ Profile* profile = Profile::FromBrowserContext(
+ owner()->GetWebContents()->GetBrowserContext());
+ PrefService* pref_service = profile->GetPrefs();
pref_service->SetBoolean(prefs::kReverseAutologinEnabled, false);
}
void OneClickInfoBarDelegateImpl::AddEmailToOneClickRejectedList(
const std::string& email) {
- PrefService* pref_service =
- TabContents::FromWebContents(owner()->GetWebContents())->
- profile()->GetPrefs();
+ Profile* profile = Profile::FromBrowserContext(
+ owner()->GetWebContents()->GetBrowserContext());
+ PrefService* pref_service = profile->GetPrefs();
ListPrefUpdate updater(pref_service,
prefs::kReverseAutologinRejectedEmailList);
updater->AppendIfNotPresent(new base::StringValue(email));
diff --git a/chrome/browser/ui/views/web_intent_picker_views.cc b/chrome/browser/ui/views/web_intent_picker_views.cc
index 8b3bb8b..5aaeaa7 100644
--- a/chrome/browser/ui/views/web_intent_picker_views.cc
+++ b/chrome/browser/ui/views/web_intent_picker_views.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/ui/intents/web_intent_picker_delegate.h"
#include "chrome/browser/ui/intents/web_intent_picker_model.h"
#include "chrome/browser/ui/intents/web_intent_picker_model_observer.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/location_bar/location_icon_view.h"
@@ -900,7 +899,7 @@ class WebIntentPickerViews : public views::ButtonListener,
public WebIntentPickerModelObserver,
public IntentRowView::Delegate {
public:
- WebIntentPickerViews(TabContents* tab_contents,
+ WebIntentPickerViews(WebContents* web_contents,
WebIntentPickerDelegate* delegate,
WebIntentPickerModel* model);
virtual ~WebIntentPickerViews();
@@ -1013,8 +1012,8 @@ class WebIntentPickerViews : public views::ButtonListener,
// Delegate for inline disposition tab contents.
scoped_ptr<WebIntentInlineDispositionDelegate> inline_disposition_delegate_;
- // A weak pointer to the TabContents this picker is in.
- TabContents* tab_contents_;
+ // A weak pointer to the WebContents this picker is in.
+ WebContents* web_contents_;
// A weak pointer to the WebView that hosts the WebContents being displayed.
// Created locally, owned by Views.
@@ -1063,11 +1062,10 @@ class WebIntentPickerViews : public views::ButtonListener,
WebIntentPicker* WebIntentPicker::Create(content::WebContents* web_contents,
WebIntentPickerDelegate* delegate,
WebIntentPickerModel* model) {
- TabContents* tab_contents = TabContents::FromWebContents(web_contents);
- return new WebIntentPickerViews(tab_contents, delegate, model);
+ return new WebIntentPickerViews(web_contents, delegate, model);
}
-WebIntentPickerViews::WebIntentPickerViews(TabContents* tab_contents,
+WebIntentPickerViews::WebIntentPickerViews(WebContents* web_contents,
WebIntentPickerDelegate* delegate,
WebIntentPickerModel* model)
: state_(INITIAL),
@@ -1075,8 +1073,9 @@ WebIntentPickerViews::WebIntentPickerViews(TabContents* tab_contents,
model_(model),
action_label_(NULL),
extensions_(NULL),
- tab_contents_(tab_contents),
- webview_(new views::WebView(tab_contents->profile())),
+ web_contents_(web_contents),
+ webview_(new views::WebView(
+ Profile::FromBrowserContext(web_contents->GetBrowserContext()))),
window_(NULL),
more_suggestions_link_(NULL),
inline_service_icon_(NULL),
@@ -1092,7 +1091,7 @@ WebIntentPickerViews::WebIntentPickerViews(TabContents* tab_contents,
ConstrainedWindow::GetBackgroundColor()));
// Show the dialog.
- window_ = new ConstrainedWindowViews(tab_contents->web_contents(), this,
+ window_ = new ConstrainedWindowViews(web_contents, this,
enable_chrome_style,
ConstrainedWindowViews::NO_INSETS);
if (model_->IsInlineDisposition())
@@ -1374,17 +1373,18 @@ void WebIntentPickerViews::OnExtensionIconChanged(
void WebIntentPickerViews::OnInlineDisposition(
const string16&, const GURL& url) {
DCHECK(delegate_);
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents_->GetBrowserContext());
if (!webview_)
- webview_ = new views::WebView(tab_contents_->profile());
+ webview_ = new views::WebView(profile);
- inline_web_contents_.reset(delegate_->CreateWebContentsForInlineDisposition(
- tab_contents_->profile(), url));
+ inline_web_contents_.reset(
+ delegate_->CreateWebContentsForInlineDisposition(profile, url));
// Does not take ownership, so we keep a scoped_ptr
// for the WebContents locally.
webview_->SetWebContents(inline_web_contents_.get());
- Browser* browser = chrome::FindBrowserWithWebContents(
- tab_contents_->web_contents());
+ Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
inline_disposition_delegate_.reset(
new WebIntentInlineDispositionDelegate(this, inline_web_contents_.get(),
browser));