diff options
-rw-r--r-- | chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc | 12 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/browser_window_controller.mm | 8 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h | 14 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm | 16 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/tab_contents/sad_tab_controller_unittest.mm | 2 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/sad_tab_gtk.cc | 16 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/sad_tab_gtk.h | 8 | ||||
-rw-r--r-- | chrome/browser/ui/sad_tab_observer.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/hung_renderer_view.cc | 14 | ||||
-rw-r--r-- | content/public/browser/web_contents_observer.h | 2 |
10 files changed, 52 insertions, 44 deletions
diff --git a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc index cd04fbe..256fe25 100644 --- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc +++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc @@ -11,12 +11,12 @@ #include "chrome/browser/ui/blocked_content/blocked_content_container.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/navigation_details.h" +#include "content/public/browser/web_contents.h" BlockedContentTabHelper::BlockedContentTabHelper( TabContentsWrapper* tab_contents) - : content::WebContentsObserver(tab_contents->tab_contents()), + : content::WebContentsObserver(tab_contents->web_contents()), blocked_contents_(new BlockedContentContainer(tab_contents)), all_contents_blocked_(false), tab_contents_wrapper_(tab_contents), @@ -42,7 +42,7 @@ void BlockedContentTabHelper::DidNavigateMainFrame( void BlockedContentTabHelper::PopupNotificationVisibilityChanged( bool visible) { - if (tab_contents()->IsBeingDestroyed()) + if (web_contents()->IsBeingDestroyed()) return; tab_contents_wrapper_->content_settings()->SetPopupsBlocked(visible); } @@ -81,10 +81,10 @@ void BlockedContentTabHelper::AddPopup(TabContentsWrapper* new_contents, // page. For this reason, we can't use GetURL() to get the opener URL, // because it returns the active entry. NavigationEntry* entry = - tab_contents()->GetController().GetLastCommittedEntry(); + web_contents()->GetController().GetLastCommittedEntry(); GURL creator = entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); Profile* profile = - Profile::FromBrowserContext(tab_contents()->GetBrowserContext()); + Profile::FromBrowserContext(web_contents()->GetBrowserContext()); if (creator.is_valid() && profile->GetHostContentSettingsMap()->GetContentSetting( @@ -92,7 +92,7 @@ void BlockedContentTabHelper::AddPopup(TabContentsWrapper* new_contents, creator, CONTENT_SETTINGS_TYPE_POPUPS, "") == CONTENT_SETTING_ALLOW) { - tab_contents()->AddNewContents(new_contents->tab_contents(), + web_contents()->AddNewContents(new_contents->tab_contents(), NEW_POPUP, initial_pos, true); // user_gesture diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index 1fa3264..bdc2ca8 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -146,6 +146,8 @@ // longer indicate that the window is shrinking from an apparent zoomed state) // and if it's set we continue to constrain the resize. +using content::WebContents; + @interface NSWindow (NSPrivateApis) // Note: These functions are private, use -[NSObject respondsToSelector:] // before calling them. @@ -1750,11 +1752,11 @@ enum { - (void)openLearnMoreAboutCrashLink:(id)sender { if ([sender isKindOfClass:[SadTabController class]]) { SadTabController* sad_tab = static_cast<SadTabController*>(sender); - TabContents* tab_contents = [sad_tab tabContents]; - if (tab_contents) { + WebContents* web_contents = [sad_tab webContents]; + if (web_contents) { GURL helpUrl = google_util::AppendGoogleLocaleParam(GURL(chrome::kCrashReasonURL)); - tab_contents->OpenURL( + web_contents->OpenURL( helpUrl, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_LINK); } } diff --git a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h index f91327d..e3d6478 100644 --- a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h +++ b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h @@ -12,26 +12,28 @@ #import <Cocoa/Cocoa.h> #endif // __OBJC__ -class TabContents; +namespace content { +class WebContents; +} #if defined(__OBJC__) // A controller class that manages the SadTabView (aka "Aw Snap" or crash page). @interface SadTabController : NSViewController { @private - TabContents* tabContents_; // Weak reference. + content::WebContents* webContents_; // Weak reference. } // Designated initializer. -- (id)initWithTabContents:(TabContents*)tabContents; +- (id)initWithWebContents:(content::WebContents*)webContents; // This action just calls the NSApp sendAction to get it into the standard // Cocoa action processing. - (IBAction)openLearnMoreAboutCrashLink:(id)sender; -// Returns a weak reference to the TabContents whose TabContentsView created +// Returns a weak reference to the WebContents whose WebContentsView created // this SadTabController. -- (TabContents*)tabContents; +- (content::WebContents*)webContents; @end @@ -43,7 +45,7 @@ class SadTabController; // Functions that may be accessed from non-Objective-C C/C++ code. namespace sad_tab_controller_mac { -SadTabController* CreateSadTabController(TabContents* tab_contents); +SadTabController* CreateSadTabController(content::WebContents* web_contents); gfx::NativeView GetViewOfSadTabController(SadTabController* sad_tab); } diff --git a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm index 5812a8c..3a0a12e 100644 --- a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm +++ b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm @@ -7,10 +7,12 @@ #include "base/mac/mac_util.h" #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_view.h" +using content::WebContents; + namespace sad_tab_controller_mac { -SadTabController* CreateSadTabController(TabContents* tab_contents) { - return [[SadTabController alloc] initWithTabContents:tab_contents]; +SadTabController* CreateSadTabController(WebContents* web_contents) { + return [[SadTabController alloc] initWithWebContents:web_contents]; } gfx::NativeView GetViewOfSadTabController(SadTabController* sad_tab) { @@ -21,10 +23,10 @@ gfx::NativeView GetViewOfSadTabController(SadTabController* sad_tab) { @implementation SadTabController -- (id)initWithTabContents:(TabContents*)tabContents { +- (id)initWithWebContents:(WebContents*)webContents { if ((self = [super initWithNibName:@"SadTab" bundle:base::mac::MainAppBundle()])) { - tabContents_ = tabContents; + webContents_ = webContents; } return self; @@ -32,14 +34,14 @@ gfx::NativeView GetViewOfSadTabController(SadTabController* sad_tab) { - (void)awakeFromNib { // If tab_contents_ is nil, ask view to remove link. - if (!tabContents_) { + if (!webContents_) { SadTabView* sad_view = static_cast<SadTabView*>([self view]); [sad_view removeHelpText]; } } -- (TabContents*)tabContents { - return tabContents_; +- (WebContents*)webContents { + return webContents_; } - (void)openLearnMoreAboutCrashLink:(id)sender { diff --git a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller_unittest.mm b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller_unittest.mm index 2694d1d..00d687e 100644 --- a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller_unittest.mm @@ -53,7 +53,7 @@ class SadTabControllerTest : public ChromeRenderViewHostTestHarness { // Creates the controller and adds its view to contents, caller has ownership. SadTabController* CreateController() { SadTabController* controller = - [[SadTabController alloc] initWithTabContents:contents()]; + [[SadTabController alloc] initWithWebContents:contents()]; EXPECT_TRUE(controller); NSView* view = [controller view]; EXPECT_TRUE(view); diff --git a/chrome/browser/ui/gtk/sad_tab_gtk.cc b/chrome/browser/ui/gtk/sad_tab_gtk.cc index 5d4f11d..f365e30 100644 --- a/chrome/browser/ui/gtk/sad_tab_gtk.cc +++ b/chrome/browser/ui/gtk/sad_tab_gtk.cc @@ -8,7 +8,7 @@ #include "chrome/browser/google/google_util.h" #include "chrome/browser/ui/gtk/gtk_chrome_link_button.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/locale_settings.h" #include "grit/theme_resources.h" @@ -17,6 +17,8 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" +using content::WebContents; + namespace { // Background color of the content (a grayish blue) for a crashed tab. @@ -49,10 +51,10 @@ GtkWidget* MakeWhiteMarkupLabel(const char* format, const std::string& str) { } // namespace -SadTabGtk::SadTabGtk(TabContents* tab_contents, Kind kind) - : tab_contents_(tab_contents), +SadTabGtk::SadTabGtk(WebContents* web_contents, Kind kind) + : web_contents_(web_contents), kind_(kind) { - DCHECK(tab_contents_); + DCHECK(web_contents_); // Use an event box to get the background painting correctly. event_box_.Own(gtk_event_box_new()); @@ -107,7 +109,7 @@ SadTabGtk::SadTabGtk(TabContents* tab_contents, Kind kind) spacer = gtk_label_new(" "); gtk_box_pack_start(GTK_BOX(vbox), spacer, FALSE, FALSE, 0); - if (tab_contents_ != NULL) { + if (web_contents_ != NULL) { // Create the help link and alignment. std::string link_text(l10n_util::GetStringUTF8( kind == CRASHED ? IDS_SAD_TAB_HELP_LINK : IDS_LEARN_MORE)); @@ -154,13 +156,13 @@ SadTabGtk::~SadTabGtk() { } void SadTabGtk::OnLinkButtonClick(GtkWidget* sender) { - if (tab_contents_ != NULL) { + if (web_contents_ != NULL) { 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, content::PAGE_TRANSITION_LINK, false)); } diff --git a/chrome/browser/ui/gtk/sad_tab_gtk.h b/chrome/browser/ui/gtk/sad_tab_gtk.h index 467002b..1ca3675 100644 --- a/chrome/browser/ui/gtk/sad_tab_gtk.h +++ b/chrome/browser/ui/gtk/sad_tab_gtk.h @@ -11,7 +11,9 @@ typedef struct _GtkWidget GtkWidget; #include "ui/base/gtk/gtk_signal.h" #include "ui/base/gtk/owned_widget_gtk.h" -class TabContents; +namespace content { +class WebContents; +} class SadTabGtk { public: @@ -20,7 +22,7 @@ class SadTabGtk { KILLED // The tab was killed. Display the killed tab page. }; - SadTabGtk(TabContents* tab_contents, Kind kind); + SadTabGtk(content::WebContents* web_contents, Kind kind); ~SadTabGtk(); GtkWidget* widget() const { return event_box_.get(); } @@ -30,7 +32,7 @@ class SadTabGtk { void OnLinkButtonClick(); - TabContents* tab_contents_; + content::WebContents* web_contents_; ui::OwnedWidgetGtk event_box_; Kind kind_; diff --git a/chrome/browser/ui/sad_tab_observer.cc b/chrome/browser/ui/sad_tab_observer.cc index b402211..350ba67 100644 --- a/chrome/browser/ui/sad_tab_observer.cc +++ b/chrome/browser/ui/sad_tab_observer.cc @@ -61,7 +61,7 @@ void SadTabObserver::Observe(int type, gfx::NativeView SadTabObserver::AcquireSadTab(base::TerminationStatus status) { #if defined(OS_MACOSX) sad_tab_.reset( - sad_tab_controller_mac::CreateSadTabController(tab_contents())); + sad_tab_controller_mac::CreateSadTabController(web_contents())); return sad_tab_controller_mac::GetViewOfSadTabController(sad_tab_.get()); #elif defined(TOOLKIT_VIEWS) SadTabView::Kind kind = @@ -82,7 +82,7 @@ gfx::NativeView SadTabObserver::AcquireSadTab(base::TerminationStatus status) { return sad_tab_->GetNativeView(); #elif defined(TOOLKIT_GTK) sad_tab_.reset(new SadTabGtk( - tab_contents(), + web_contents(), status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? SadTabGtk::KILLED : SadTabGtk::CRASHED)); diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc index 791d02f..cc719bf 100644 --- a/chrome/browser/ui/views/hung_renderer_view.cc +++ b/chrome/browser/ui/views/hung_renderer_view.cc @@ -84,8 +84,8 @@ class HungPagesTableModel : public views::GroupTableModel { WebContentsObserverImpl(HungPagesTableModel* model, TabContentsWrapper* tab); - TabContents* tab_contents() const { - return content::WebContentsObserver::tab_contents(); + WebContents* web_contents() const { + return content::WebContentsObserver::web_contents(); } FaviconTabHelper* favicon_tab_helper() { @@ -129,12 +129,12 @@ HungPagesTableModel::~HungPagesTableModel() { content::RenderProcessHost* HungPagesTableModel::GetRenderProcessHost() { return tab_observers_.empty() ? NULL : - tab_observers_[0]->tab_contents()->GetRenderProcessHost(); + tab_observers_[0]->web_contents()->GetRenderProcessHost(); } RenderViewHost* HungPagesTableModel::GetRenderViewHost() { return tab_observers_.empty() ? NULL : - tab_observers_[0]->tab_contents()->GetRenderViewHost(); + tab_observers_[0]->web_contents()->GetRenderViewHost(); } void HungPagesTableModel::InitForTabContents(TabContents* hung_contents) { @@ -147,7 +147,7 @@ void HungPagesTableModel::InitForTabContents(TabContents* hung_contents) { tab_observers_.push_back(new WebContentsObserverImpl(this, hung_wrapper)); for (TabContentsIterator it; !it.done(); ++it) { if (*it != hung_wrapper && - it->tab_contents()->GetRenderProcessHost() == + it->web_contents()->GetRenderProcessHost() == hung_contents->GetRenderProcessHost()) tab_observers_.push_back(new WebContentsObserverImpl(this, *it)); } @@ -166,7 +166,7 @@ int HungPagesTableModel::RowCount() { string16 HungPagesTableModel::GetText(int row, int column_id) { DCHECK(row >= 0 && row < RowCount()); - string16 title = tab_observers_[row]->tab_contents()->GetTitle(); + string16 title = tab_observers_[row]->web_contents()->GetTitle(); if (title.empty()) title = CoreTabHelper::GetDefaultTitle(); // TODO(xji): Consider adding a special case if the title text is a URL, @@ -210,7 +210,7 @@ void HungPagesTableModel::TabDestroyed(WebContentsObserverImpl* tab) { HungPagesTableModel::WebContentsObserverImpl::WebContentsObserverImpl( HungPagesTableModel* model, TabContentsWrapper* tab) - : content::WebContentsObserver(tab->tab_contents()), + : content::WebContentsObserver(tab->web_contents()), model_(model), tab_(tab) { } diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h index cc44ca0..121ca8d 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h @@ -120,8 +120,6 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Channel::Listener, void Observe(WebContents* web_contents); WebContents* web_contents() const; - // TODO(jam): remove me - TabContents* tab_contents() const { return tab_contents_; } private: friend class ::TabContents; |