summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/aeropeek_manager.cc8
-rw-r--r--chrome/browser/automation/automation_provider_win.cc25
-rw-r--r--chrome/browser/chromeos/login/web_page_view.cc2
-rw-r--r--chrome/browser/chromeos/login/webui_login_view.cc2
-rw-r--r--chrome/browser/debugger/devtools_window.cc8
-rw-r--r--chrome/browser/extensions/extension_host.cc2
-rw-r--r--chrome/browser/external_tab_container_win.cc2
-rw-r--r--chrome/browser/history/history_tab_helper.cc4
-rw-r--r--chrome/browser/instant/instant_loader.cc6
-rw-r--r--chrome/browser/instant/instant_unload_handler.cc4
-rw-r--r--chrome/browser/notifications/balloon_host.cc2
-rw-r--r--chrome/browser/prerender/prerender_contents.cc4
-rw-r--r--chrome/browser/prerender/prerender_manager.cc4
-rw-r--r--chrome/browser/printing/print_preview_tab_controller.cc2
-rw-r--r--chrome/browser/sidebar/sidebar_container.cc2
-rw-r--r--chrome/browser/tab_contents/background_contents.cc2
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc8
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.cc12
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_gtk.cc22
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_mac.mm6
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc4
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc4
-rw-r--r--chrome/browser/ui/blocked_content/blocked_content_container.cc8
-rw-r--r--chrome/browser/ui/browser.cc4
-rw-r--r--chrome/browser/ui/cocoa/applescript/tab_applescript.mm2
-rw-r--r--chrome/browser/ui/cocoa/constrained_html_delegate_mac.mm4
-rw-r--r--chrome/browser/ui/cocoa/html_dialog_window_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm4
-rw-r--r--chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/html_dialog_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/tabs/drag_data.cc2
-rw-r--r--chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc14
-rw-r--r--chrome/browser/ui/gtk/web_intent_picker_gtk.cc2
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper.cc6
-rw-r--r--chrome/browser/ui/views/aura/app_list_window.cc2
-rw-r--r--chrome/browser/ui/views/constrained_html_delegate_gtk.cc4
-rw-r--r--chrome/browser/ui/views/constrained_html_delegate_views.cc4
-rw-r--r--chrome/browser/ui/views/create_application_shortcut_view.cc4
-rw-r--r--chrome/browser/ui/views/html_dialog_view.cc4
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_views.cc4
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_win.cc4
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc24
-rw-r--r--chrome/browser/ui/views/tabs/default_tab_drag_controller.cc16
-rw-r--r--chrome/browser/ui/webui/constrained_html_ui.cc2
-rw-r--r--chrome/browser/ui/webui/html_dialog_ui.cc4
-rw-r--r--content/browser/debugger/devtools_manager_unittest.cc6
-rw-r--r--content/browser/tab_contents/navigation_controller.cc2
-rw-r--r--content/browser/tab_contents/navigation_controller_unittest.cc18
-rw-r--r--content/browser/tab_contents/tab_contents.cc124
-rw-r--r--content/browser/tab_contents/tab_contents.h22
-rw-r--r--content/browser/tab_contents/tab_contents_delegate.cc2
-rw-r--r--content/browser/tab_contents/tab_contents_delegate_unittest.cc38
-rw-r--r--content/browser/tab_contents/tab_contents_view_win.cc8
-rw-r--r--content/content_browser.gypi1
-rw-r--r--content/public/browser/child_process_data.h6
-rw-r--r--content/public/browser/web_page.h41
-rw-r--r--content/shell/shell.cc2
59 files changed, 297 insertions, 246 deletions
diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc
index f09c305..7ebba34 100644
--- a/chrome/browser/aeropeek_manager.cc
+++ b/chrome/browser/aeropeek_manager.cc
@@ -948,8 +948,8 @@ void AeroPeekManager::ActivateTab(int tab_id) {
// We don't have to update thumbnails now since TabStrip will call
// ActiveTabChanged() when it actually activates this tab.
TabContents* contents = GetTabContents(tab_id);
- if (contents && contents->delegate())
- contents->delegate()->ActivateContents(contents);
+ if (contents && contents->GetDelegate())
+ contents->GetDelegate()->ActivateContents(contents);
}
void AeroPeekManager::CloseTab(int tab_id) {
@@ -957,8 +957,8 @@ void AeroPeekManager::CloseTab(int tab_id) {
// TabStrip will call TabClosingAt() when it actually closes this tab. We
// will delete the AeroPeekWindow object attached to this tab there.
TabContents* contents = GetTabContents(tab_id);
- if (contents && contents->delegate())
- contents->delegate()->CloseContents(contents);
+ if (contents && contents->GetDelegate())
+ contents->GetDelegate()->CloseContents(contents);
}
void AeroPeekManager::GetContentInsets(gfx::Insets* insets) {
diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc
index b3f14d2..7d5b022 100644
--- a/chrome/browser/automation/automation_provider_win.cc
+++ b/chrome/browser/automation/automation_provider_win.cc
@@ -285,21 +285,22 @@ void AutomationProvider::OnTabReposition(
void AutomationProvider::OnForwardContextMenuCommandToChrome(int tab_handle,
int command) {
- if (tab_tracker_->ContainsHandle(tab_handle)) {
- NavigationController* tab = tab_tracker_->GetResource(tab_handle);
- if (!tab) {
- NOTREACHED();
- return;
- }
+ if (!tab_tracker_->ContainsHandle(tab_handle))
+ return;
- TabContents* tab_contents = tab->tab_contents();
- if (!tab_contents || !tab_contents->delegate()) {
- NOTREACHED();
- return;
- }
+ NavigationController* tab = tab_tracker_->GetResource(tab_handle);
+ if (!tab) {
+ NOTREACHED();
+ return;
+ }
- tab_contents->delegate()->ExecuteContextMenuCommand(command);
+ TabContents* tab_contents = tab->tab_contents();
+ if (!tab_contents || !tab_contents->GetDelegate()) {
+ NOTREACHED();
+ return;
}
+
+ tab_contents->GetDelegate()->ExecuteContextMenuCommand(command);
}
void AutomationProvider::ConnectExternalTab(
diff --git a/chrome/browser/chromeos/login/web_page_view.cc b/chrome/browser/chromeos/login/web_page_view.cc
index 81f386e..0826963 100644
--- a/chrome/browser/chromeos/login/web_page_view.cc
+++ b/chrome/browser/chromeos/login/web_page_view.cc
@@ -89,7 +89,7 @@ void WizardWebPageViewTabContents::DocumentLoadedInFrame(
void WebPageDomView::SetTabContentsDelegate(
TabContentsDelegate* delegate) {
- dom_contents_->tab_contents()->set_delegate(delegate);
+ dom_contents_->tab_contents()->SetDelegate(delegate);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/login/webui_login_view.cc b/chrome/browser/chromeos/login/webui_login_view.cc
index 284af06..3fc4542 100644
--- a/chrome/browser/chromeos/login/webui_login_view.cc
+++ b/chrome/browser/chromeos/login/webui_login_view.cc
@@ -147,7 +147,7 @@ void WebUILoginView::Init(views::Widget* login_window) {
webui_login_->SetVisible(true);
TabContents* tab_contents = webui_login_->dom_contents()->tab_contents();
- tab_contents->set_delegate(this);
+ tab_contents->SetDelegate(this);
tab_watcher_.reset(new TabFirstRenderWatcher(tab_contents, this));
}
diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc
index c60c1db..fcc2e2f 100644
--- a/chrome/browser/debugger/devtools_window.cc
+++ b/chrome/browser/debugger/devtools_window.cc
@@ -264,7 +264,7 @@ void DevToolsWindow::Show(DevToolsToggleAction action) {
FindInspectedBrowserAndTabIndex(&inspected_browser,
&inspected_tab_index)) {
BrowserWindow* inspected_window = inspected_browser->window();
- tab_contents_->tab_contents()->set_delegate(this);
+ tab_contents_->tab_contents()->SetDelegate(this);
inspected_window->UpdateDevTools();
tab_contents_->tab_contents()->view()->SetInitialFocus();
inspected_window->Show();
@@ -558,7 +558,7 @@ void DevToolsWindow::AddNewContents(TabContents* source,
const gfx::Rect& initial_pos,
bool user_gesture) {
if (inspected_tab_) {
- inspected_tab_->tab_contents()->delegate()->AddNewContents(
+ inspected_tab_->tab_contents()->GetDelegate()->AddNewContents(
source, new_contents, disposition, initial_pos, user_gesture);
}
}
@@ -681,8 +681,8 @@ void DevToolsWindow::SaveToFile(const std::string& suggested_file_name,
}
content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() {
- if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) {
- return inspected_tab_->tab_contents()->delegate()->
+ if (inspected_tab_ && inspected_tab_->tab_contents()->GetDelegate()) {
+ return inspected_tab_->tab_contents()->GetDelegate()->
GetJavaScriptDialogCreator();
}
return TabContentsDelegate::GetJavaScriptDialogCreator();
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 92401b8..af31082 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -132,7 +132,7 @@ ExtensionHost::ExtensionHost(const Extension* extension,
host_contents_.reset(new TabContents(
profile_, site_instance, MSG_ROUTING_NONE, NULL, NULL));
TabContentsObserver::Observe(host_contents_.get());
- host_contents_->set_delegate(this);
+ host_contents_->SetDelegate(this);
host_contents_->set_view_type(host_type);
// TODO(mpcomplete): This was lifted from PrefsTabHelper, but it might be
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 094e6b9..603df3d 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -180,7 +180,7 @@ bool ExternalTabContainer::Init(Profile* profile,
if (!infobars_enabled)
tab_contents_->infobar_tab_helper()->set_infobars_enabled(false);
- tab_contents_->tab_contents()->set_delegate(this);
+ tab_contents_->tab_contents()->SetDelegate(this);
tab_contents_->tab_contents()->
GetMutableRendererPrefs()->browser_handles_top_level_requests =
diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc
index 8564749..8bc32c2 100644
--- a/chrome/browser/history/history_tab_helper.cc
+++ b/chrome/browser/history/history_tab_helper.cc
@@ -99,8 +99,8 @@ void HistoryTabHelper::DidNavigateAnyFrame(
// the TabContents' URL getter does.
scoped_refptr<history::HistoryAddPageArgs> add_page_args(
CreateHistoryAddPageArgs(tab_contents()->GetURL(), details, params));
- if (!tab_contents()->delegate() ||
- !tab_contents()->delegate()->ShouldAddNavigationToHistory(
+ if (!tab_contents()->GetDelegate() ||
+ !tab_contents()->GetDelegate()->ShouldAddNavigationToHistory(
*add_page_args, details.type))
return;
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index 783644e..8b79e93 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -777,7 +777,7 @@ TabContentsWrapper* InstantLoader::ReleasePreviewContents(
&preview_contents_->tab_contents()->controller()));
#endif
}
- preview_contents_->tab_contents()->set_delegate(NULL);
+ preview_contents_->tab_contents()->SetDelegate(NULL);
ready_ = false;
}
update_bounds_timer_.Stop();
@@ -987,7 +987,7 @@ void InstantLoader::ReplacePreviewContents(TabContentsWrapper* old_tc,
// Cleanup the old preview contents.
old_tc->constrained_window_tab_helper()->set_delegate(NULL);
old_tc->core_tab_helper()->set_delegate(NULL);
- old_tc->tab_contents()->set_delegate(NULL);
+ old_tc->tab_contents()->SetDelegate(NULL);
#if defined(OS_MACOSX)
registrar_.Remove(
@@ -1011,7 +1011,7 @@ void InstantLoader::ReplacePreviewContents(TabContentsWrapper* old_tc,
}
void InstantLoader::SetupPreviewContents(TabContentsWrapper* tab_contents) {
- preview_contents_->tab_contents()->set_delegate(
+ preview_contents_->tab_contents()->SetDelegate(
preview_tab_contents_delegate_.get());
preview_contents_->blocked_content_tab_helper()->SetAllContentsBlocked(true);
preview_contents_->constrained_window_tab_helper()->set_delegate(
diff --git a/chrome/browser/instant/instant_unload_handler.cc b/chrome/browser/instant/instant_unload_handler.cc
index d4e8e78..a999439 100644
--- a/chrome/browser/instant/instant_unload_handler.cc
+++ b/chrome/browser/instant/instant_unload_handler.cc
@@ -22,7 +22,7 @@ class InstantUnloadHandler::TabContentsDelegateImpl
: handler_(handler),
tab_contents_(tab_contents),
index_(index) {
- tab_contents->tab_contents()->set_delegate(this);
+ tab_contents->tab_contents()->SetDelegate(this);
}
~TabContentsDelegateImpl() {
@@ -31,7 +31,7 @@ class InstantUnloadHandler::TabContentsDelegateImpl
// Releases ownership of the TabContentsWrapper to the caller.
TabContentsWrapper* ReleaseTab() {
TabContentsWrapper* tab = tab_contents_.release();
- tab->tab_contents()->set_delegate(NULL);
+ tab->tab_contents()->SetDelegate(NULL);
return tab;
}
diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc
index d0ba053..77e504c 100644
--- a/chrome/browser/notifications/balloon_host.cc
+++ b/chrome/browser/notifications/balloon_host.cc
@@ -118,7 +118,7 @@ void BalloonHost::Init() {
NULL,
NULL));
tab_contents_->set_view_type(chrome::VIEW_TYPE_NOTIFICATION);
- tab_contents_->set_delegate(this);
+ tab_contents_->SetDelegate(this);
Observe(tab_contents_.get());
tab_contents_->controller().LoadURL(
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index d6e4ab4..ef5a632 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -287,7 +287,7 @@ void PrerenderContents::StartPrerendering(
starting_page_id_);
tab_contents_delegate_.reset(new TabContentsDelegateImpl(this));
- new_contents->set_delegate(tab_contents_delegate_.get());
+ new_contents->SetDelegate(tab_contents_delegate_.get());
// Set the size of the prerender TabContents.
prerender_contents_->tab_contents()->view()->SizeContents(tab_bounds.size());
@@ -650,7 +650,7 @@ void PrerenderContents::DestroyWhenUsingTooManyResources() {
}
TabContentsWrapper* PrerenderContents::ReleasePrerenderContents() {
- prerender_contents_->tab_contents()->set_delegate(NULL);
+ prerender_contents_->tab_contents()->SetDelegate(NULL);
render_view_host_observer_.reset();
TabContentsObserver::Observe(NULL);
return prerender_contents_.release();
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index 134a51b..3125e1e 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -109,7 +109,7 @@ class PrerenderManager::OnCloseTabContentsDeleter
TabContentsWrapper* tab)
: manager_(manager),
tab_(tab) {
- tab_->tab_contents()->set_delegate(this);
+ tab_->tab_contents()->SetDelegate(this);
MessageLoop::current()->PostDelayedTask(FROM_HERE,
base::Bind(&OnCloseTabContentsDeleter::ScheduleTabContentsForDeletion,
this->AsWeakPtr(), true), kDeleteWithExtremePrejudiceTimeMs);
@@ -133,7 +133,7 @@ class PrerenderManager::OnCloseTabContentsDeleter
static const int kDeleteWithExtremePrejudiceTimeMs = 3000;
void ScheduleTabContentsForDeletion(bool timeout) {
- tab_->tab_contents()->set_delegate(NULL);
+ tab_->tab_contents()->SetDelegate(NULL);
manager_->ScheduleDeleteOldTabContents(tab_.release(), this);
UMA_HISTOGRAM_BOOLEAN("Prerender.TabContentsDeleterTimeout", timeout);
}
diff --git a/chrome/browser/printing/print_preview_tab_controller.cc b/chrome/browser/printing/print_preview_tab_controller.cc
index 5c7d56e..cadc4fe 100644
--- a/chrome/browser/printing/print_preview_tab_controller.cc
+++ b/chrome/browser/printing/print_preview_tab_controller.cc
@@ -303,7 +303,7 @@ void PrintPreviewTabController::OnNavEntryCommitted(
SetInitiatorTabURLAndTitle(preview_tab);
// Disabling the delegate will prevent all future navigation.
- tab->tab_contents()->set_delegate(NULL);
+ tab->tab_contents()->SetDelegate(NULL);
return;
}
diff --git a/chrome/browser/sidebar/sidebar_container.cc b/chrome/browser/sidebar/sidebar_container.cc
index f9db3f3..c3b77a9 100644
--- a/chrome/browser/sidebar/sidebar_container.cc
+++ b/chrome/browser/sidebar/sidebar_container.cc
@@ -33,7 +33,7 @@ SidebarContainer::SidebarContainer(TabContents* tab,
sidebar_contents_.reset(
new TabContents(Profile::FromBrowserContext(tab->browser_context()),
NULL, MSG_ROUTING_NONE, NULL, NULL));
- sidebar_contents_->set_delegate(this);
+ sidebar_contents_->SetDelegate(this);
}
SidebarContainer::~SidebarContainer() {
diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc
index b856729..c153edb 100644
--- a/chrome/browser/tab_contents/background_contents.cc
+++ b/chrome/browser/tab_contents/background_contents.cc
@@ -34,7 +34,7 @@ BackgroundContents::BackgroundContents(SiteInstance* site_instance,
tab_contents_.reset(new TabContents(
profile_, site_instance, routing_id, NULL, NULL));
tab_contents_->set_view_type(chrome::VIEW_TYPE_BACKGROUND_CONTENTS);
- tab_contents_->set_delegate(this);
+ tab_contents_->SetDelegate(this);
TabContentsObserver::Observe(tab_contents_.get());
// Close ourselves when the application is shutting down.
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index dd5ea04..2e3fa8a 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -1054,8 +1054,8 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
return source_tab_contents_->controller().CanGoForward();
case IDC_RELOAD:
- return source_tab_contents_->delegate() &&
- source_tab_contents_->delegate()->CanReloadContents(
+ return source_tab_contents_->GetDelegate() &&
+ source_tab_contents_->GetDelegate()->CanReloadContents(
source_tab_contents_);
case IDC_VIEW_SOURCE:
@@ -1415,8 +1415,8 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
params_.link_url,
params_.frame_url.is_empty() ? params_.page_url : params_.frame_url,
params_.frame_id,
- source_tab_contents_->delegate() &&
- source_tab_contents_->delegate()->IsApplication() ?
+ source_tab_contents_->GetDelegate() &&
+ source_tab_contents_->GetDelegate()->IsApplication() ?
NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB,
content::PAGE_TRANSITION_LINK);
break;
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
index 3e5e6fe..e73314c 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
@@ -269,8 +269,8 @@ TabContents* RenderViewHostDelegateViewHelper::CreateNewWindowFromTabContents(
params.frame_name);
if (new_contents) {
- if (tab_contents->delegate())
- tab_contents->delegate()->TabContentsCreated(new_contents);
+ if (tab_contents->GetDelegate())
+ tab_contents->GetDelegate()->TabContentsCreated(new_contents);
RetargetingDetails details;
details.source_tab_contents = tab_contents;
@@ -309,8 +309,8 @@ TabContents* RenderViewHostDelegateViewHelper::ShowCreatedWindow(
RenderWidgetHostView* RenderViewHostDelegateViewHelper::ShowCreatedWidget(
TabContents* tab_contents, int route_id, const gfx::Rect& initial_pos) {
- if (tab_contents->delegate())
- tab_contents->delegate()->RenderWidgetShowing();
+ if (tab_contents->GetDelegate())
+ tab_contents->GetDelegate()->RenderWidgetShowing();
RenderWidgetHostView* widget_host_view = GetCreatedWidget(route_id);
widget_host_view->InitAsPopup(tab_contents->GetRenderWidgetHostView(),
@@ -322,8 +322,8 @@ RenderWidgetHostView* RenderViewHostDelegateViewHelper::ShowCreatedWidget(
RenderWidgetHostView*
RenderViewHostDelegateViewHelper::ShowCreatedFullscreenWidget(
TabContents* tab_contents, int route_id) {
- if (tab_contents->delegate())
- tab_contents->delegate()->RenderWidgetShowing();
+ if (tab_contents->GetDelegate())
+ tab_contents->GetDelegate()->RenderWidgetShowing();
RenderWidgetHostView* widget_host_view = GetCreatedWidget(route_id);
widget_host_view->InitAsFullscreen(tab_contents->GetRenderWidgetHostView());
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
index 1b2c5d6..d6b9162 100644
--- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
@@ -36,8 +36,8 @@ namespace {
// Called when the mouse leaves the widget. We notify our delegate.
gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event,
TabContents* tab_contents) {
- if (tab_contents->delegate())
- tab_contents->delegate()->ContentsMouseEvent(
+ if (tab_contents->GetDelegate())
+ tab_contents->GetDelegate()->ContentsMouseEvent(
tab_contents, gfx::Point(event->x_root, event->y_root), false);
return FALSE;
}
@@ -45,8 +45,8 @@ gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event,
// Called when the mouse moves within the widget. We notify our delegate.
gboolean OnMouseMove(GtkWidget* widget, GdkEventMotion* event,
TabContents* tab_contents) {
- if (tab_contents->delegate())
- tab_contents->delegate()->ContentsMouseEvent(
+ if (tab_contents->GetDelegate())
+ tab_contents->GetDelegate()->ContentsMouseEvent(
tab_contents, gfx::Point(event->x_root, event->y_root), true);
return FALSE;
}
@@ -59,7 +59,7 @@ gboolean OnMouseScroll(GtkWidget* widget, GdkEventScroll* event,
return FALSE;
}
- TabContentsDelegate* delegate = tab_contents->delegate();
+ TabContentsDelegate* delegate = tab_contents->GetDelegate();
if (!delegate)
return FALSE;
@@ -282,9 +282,9 @@ void TabContentsViewGtk::GotFocus() {
// This is called when the renderer asks us to take focus back (i.e., it has
// iterated past the last focusable element on the page).
void TabContentsViewGtk::TakeFocus(bool reverse) {
- if (!tab_contents_->delegate())
+ if (!tab_contents_->GetDelegate())
return;
- if (!tab_contents_->delegate()->TakeFocus(reverse)) {
+ if (!tab_contents_->GetDelegate()->TakeFocus(reverse)) {
gtk_widget_child_focus(GTK_WIDGET(GetTopLevelNativeWindow()),
reverse ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD);
}
@@ -401,9 +401,9 @@ void TabContentsViewGtk::StartDragging(const WebDropData& drop_data,
void TabContentsViewGtk::OnChildSizeRequest(GtkWidget* widget,
GtkWidget* child,
GtkRequisition* requisition) {
- if (tab_contents_->delegate()) {
+ if (tab_contents_->GetDelegate()) {
requisition->height +=
- tab_contents_->delegate()->GetExtraRenderViewHeight();
+ tab_contents_->GetDelegate()->GetExtraRenderViewHeight();
}
}
@@ -412,8 +412,8 @@ void TabContentsViewGtk::OnSizeAllocate(GtkWidget* widget,
int width = allocation->width;
int height = allocation->height;
// |delegate()| can be NULL here during browser teardown.
- if (tab_contents_->delegate())
- height += tab_contents_->delegate()->GetExtraRenderViewHeight();
+ if (tab_contents_->GetDelegate())
+ height += tab_contents_->GetDelegate()->GetExtraRenderViewHeight();
gfx::Size size(width, height);
requested_size_ = size;
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm
index 927af25..8b533b2 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -465,13 +465,13 @@ void TabContentsViewMac::CloseTab() {
- (void)mouseEvent:(NSEvent *)theEvent {
TabContents* tabContents = [self tabContents];
- if (tabContents && tabContents->delegate()) {
+ if (tabContents && tabContents->GetDelegate()) {
NSPoint location = [NSEvent mouseLocation];
if ([theEvent type] == NSMouseMoved)
- tabContents->delegate()->ContentsMouseEvent(
+ tabContents->GetDelegate()->ContentsMouseEvent(
tabContents, gfx::Point(location.x, location.y), true);
if ([theEvent type] == NSMouseExited)
- tabContents->delegate()->ContentsMouseEvent(
+ tabContents->GetDelegate()->ContentsMouseEvent(
tabContents, gfx::Point(location.x, location.y), false);
}
}
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index 96b7c7b..158e3d1 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -783,7 +783,7 @@ bool TabStripModel::IsContextMenuCommandEnabled(
std::vector<int> indices = GetIndicesForCommand(context_index);
for (size_t i = 0; i < indices.size(); ++i) {
TabContentsWrapper* tab = GetTabContentsAt(indices[i]);
- if (tab && tab->tab_contents()->delegate()->CanReloadContents(
+ if (tab && tab->tab_contents()->GetDelegate()->CanReloadContents(
tab->tab_contents())) {
return true;
}
@@ -844,7 +844,7 @@ void TabStripModel::ExecuteContextMenuCommand(
std::vector<int> indices = GetIndicesForCommand(context_index);
for (size_t i = 0; i < indices.size(); ++i) {
TabContentsWrapper* tab = GetTabContentsAt(indices[i]);
- if (tab && tab->tab_contents()->delegate()->CanReloadContents(
+ if (tab && tab->tab_contents()->GetDelegate()->CanReloadContents(
tab->tab_contents())) {
tab->tab_contents()->controller().Reload(true);
}
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 447d349..5f8fa5a 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -187,12 +187,12 @@ class TabStripModelTest : public ChromeRenderViewHostTestHarness {
// Sets the id of the specified contents.
void SetID(TabContents* contents, int id) {
- GetIDAccessor()->SetProperty(contents->property_bag(), id);
+ GetIDAccessor()->SetProperty(contents->GetPropertyBag(), id);
}
// Returns the id of the specified contents.
int GetID(TabContents* contents) {
- return *GetIDAccessor()->GetProperty(contents->property_bag());
+ return *GetIDAccessor()->GetProperty(contents->GetPropertyBag());
}
// Returns the state of the given tab strip as a string. The state consists
diff --git a/chrome/browser/ui/blocked_content/blocked_content_container.cc b/chrome/browser/ui/blocked_content/blocked_content_container.cc
index 71beb90..e2f3aee 100644
--- a/chrome/browser/ui/blocked_content/blocked_content_container.cc
+++ b/chrome/browser/ui/blocked_content/blocked_content_container.cc
@@ -50,7 +50,7 @@ void BlockedContentContainer::AddTabContents(TabContentsWrapper* tab_contents,
blocked_contents_.push_back(
BlockedContent(tab_contents, disposition, bounds, user_gesture));
- tab_contents->tab_contents()->set_delegate(this);
+ tab_contents->tab_contents()->SetDelegate(this);
tab_contents->blocked_content_tab_helper()->set_delegate(this);
// Since the new tab_contents will not be shown, call WasHidden to change
// its status on both RenderViewHost and RenderView.
@@ -68,7 +68,7 @@ void BlockedContentContainer::LaunchForContents(
BlockedContent content(*i);
blocked_contents_.erase(i);
i = blocked_contents_.end();
- tab_contents->tab_contents()->set_delegate(NULL);
+ tab_contents->tab_contents()->SetDelegate(NULL);
tab_contents->blocked_content_tab_helper()->set_delegate(NULL);
// We needn't call WasRestored to change its status because the
// TabContents::AddNewContents will do it.
@@ -98,7 +98,7 @@ void BlockedContentContainer::Clear() {
for (BlockedContents::iterator i(blocked_contents_.begin());
i != blocked_contents_.end(); ++i) {
TabContentsWrapper* tab_contents = i->tab_contents;
- tab_contents->tab_contents()->set_delegate(NULL);
+ tab_contents->tab_contents()->SetDelegate(NULL);
tab_contents->blocked_content_tab_helper()->set_delegate(NULL);
delete tab_contents;
}
@@ -127,7 +127,7 @@ void BlockedContentContainer::CloseContents(TabContents* source) {
i != blocked_contents_.end(); ++i) {
TabContentsWrapper* tab_contents = i->tab_contents;
if (tab_contents->tab_contents() == source) {
- tab_contents->tab_contents()->set_delegate(NULL);
+ tab_contents->tab_contents()->SetDelegate(NULL);
tab_contents->blocked_content_tab_helper()->set_delegate(NULL);
blocked_contents_.erase(i);
delete tab_contents;
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 999a643..ed3bf6a 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -3719,7 +3719,7 @@ void Browser::OnStartDownload(TabContents* source, DownloadItem* download) {
if (constrained != wrapper) {
// Download in a constrained popup is shown in the tab that opened it.
TabContents* constrained_tab = constrained->tab_contents();
- constrained_tab->delegate()->OnStartDownload(constrained_tab, download);
+ constrained_tab->GetDelegate()->OnStartDownload(constrained_tab, download);
return;
}
@@ -5020,7 +5020,7 @@ Browser* Browser::GetOrCreateTabbedBrowser(Profile* profile) {
void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) {
// TabContents...
- tab->tab_contents()->set_delegate(delegate);
+ tab->tab_contents()->SetDelegate(delegate);
// ...and all the helpers.
tab->blocked_content_tab_helper()->set_delegate(delegate);
diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm
index 6c3c5ee..ef8aa25 100644
--- a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm
+++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm
@@ -383,7 +383,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) {
- (void)handlesCloseScriptCommand:(NSScriptCommand*)command {
TabContents* contents = tabContents_->tab_contents();
- contents->delegate()->CloseContents(contents);
+ contents->GetDelegate()->CloseContents(contents);
}
- (void)handlesViewSourceScriptCommand:(NSScriptCommand*)command {
diff --git a/chrome/browser/ui/cocoa/constrained_html_delegate_mac.mm b/chrome/browser/ui/cocoa/constrained_html_delegate_mac.mm
index 2d5c3a7..426d959 100644
--- a/chrome/browser/ui/cocoa/constrained_html_delegate_mac.mm
+++ b/chrome/browser/ui/cocoa/constrained_html_delegate_mac.mm
@@ -98,12 +98,12 @@ ConstrainedHtmlDelegateMac::ConstrainedHtmlDelegateMac(
TabContents* tab_contents =
new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL, NULL);
tab_.reset(new TabContentsWrapper(tab_contents));
- tab_contents->set_delegate(this);
+ tab_contents->SetDelegate(this);
// Set |this| as a property on the tab contents so that the ConstrainedHtmlUI
// can get a reference to |this|.
ConstrainedHtmlUI::GetPropertyAccessor().SetProperty(
- tab_contents->property_bag(), this);
+ tab_contents->GetPropertyBag(), this);
tab_contents->controller().LoadURL(delegate->GetDialogContentURL(),
content::Referrer(),
diff --git a/chrome/browser/ui/cocoa/html_dialog_window_controller.mm b/chrome/browser/ui/cocoa/html_dialog_window_controller.mm
index 46e491e..694afe5f 100644
--- a/chrome/browser/ui/cocoa/html_dialog_window_controller.mm
+++ b/chrome/browser/ui/cocoa/html_dialog_window_controller.mm
@@ -291,12 +291,12 @@ void HtmlDialogWindowDelegateBridge::HandleKeyboardEvent(
delegate_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL)));
[[self window]
setContentView:contentsWrapper_->tab_contents()->GetNativeView()];
- contentsWrapper_->tab_contents()->set_delegate(delegate_.get());
+ contentsWrapper_->tab_contents()->SetDelegate(delegate_.get());
// This must be done before loading the page; see the comments in
// HtmlDialogUI.
HtmlDialogUI::GetPropertyAccessor().SetProperty(
- contentsWrapper_->tab_contents()->property_bag(), delegate_.get());
+ contentsWrapper_->tab_contents()->GetPropertyBag(), delegate_.get());
contentsWrapper_->tab_contents()->controller().LoadURL(
delegate_->GetDialogContentURL(),
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
index 38aa4b3..6a37d8e 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
@@ -112,10 +112,10 @@ base::PropertyAccessor<OmniboxViewMacState>* GetStateAccessor() {
// Accessors for storing and getting the state from the tab.
void StoreStateToTab(TabContents* tab,
const OmniboxViewMacState& state) {
- GetStateAccessor()->SetProperty(tab->property_bag(), state);
+ GetStateAccessor()->SetProperty(tab->GetPropertyBag(), state);
}
const OmniboxViewMacState* GetStateFromTab(const TabContents* tab) {
- return GetStateAccessor()->GetProperty(tab->property_bag());
+ return GetStateAccessor()->GetProperty(tab->GetPropertyBag());
}
// Helper to make converting url_parse ranges to NSRange easier to
diff --git a/chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc b/chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc
index 132779f..50de533 100644
--- a/chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc
+++ b/chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc
@@ -101,12 +101,12 @@ ConstrainedHtmlDelegateGtk::ConstrainedHtmlDelegateGtk(
TabContents* tab_contents =
new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL, NULL);
tab_.reset(new TabContentsWrapper(tab_contents));
- tab_contents->set_delegate(this);
+ tab_contents->SetDelegate(this);
// Set |this| as a property on the tab contents so that the ConstrainedHtmlUI
// can get a reference to |this|.
ConstrainedHtmlUI::GetPropertyAccessor().SetProperty(
- tab_contents->property_bag(), this);
+ tab_contents->GetPropertyBag(), this);
tab_contents->controller().LoadURL(delegate->GetDialogContentURL(),
content::Referrer(),
diff --git a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc
index b443fa5..23adc0f 100644
--- a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc
@@ -293,8 +293,8 @@ CreateWebApplicationShortcutsDialogGtk::CreateWebApplicationShortcutsDialogGtk(
}
void CreateWebApplicationShortcutsDialogGtk::OnCreatedShortcut() {
- if (tab_contents_->tab_contents()->delegate())
- tab_contents_->tab_contents()->delegate()->ConvertContentsToApplication(
+ if (tab_contents_->tab_contents()->GetDelegate())
+ tab_contents_->tab_contents()->GetDelegate()->ConvertContentsToApplication(
tab_contents_->tab_contents());
}
diff --git a/chrome/browser/ui/gtk/html_dialog_gtk.cc b/chrome/browser/ui/gtk/html_dialog_gtk.cc
index fdd4796..44a06b7 100644
--- a/chrome/browser/ui/gtk/html_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/html_dialog_gtk.cc
@@ -172,12 +172,12 @@ void HtmlDialogGtk::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
gfx::NativeWindow HtmlDialogGtk::InitDialog() {
tab_.reset(new TabContentsWrapper(
new TabContents(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL)));
- tab_->tab_contents()->set_delegate(this);
+ tab_->tab_contents()->SetDelegate(this);
// This must be done before loading the page; see the comments in
// HtmlDialogUI.
HtmlDialogUI::GetPropertyAccessor().SetProperty(
- tab_->tab_contents()->property_bag(), this);
+ tab_->tab_contents()->GetPropertyBag(), this);
tab_->tab_contents()->controller().LoadURL(
GetDialogContentURL(),
diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
index b3295bc..853eebf 100644
--- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
+++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
@@ -466,7 +466,7 @@ void OmniboxViewGtk::SaveStateToTab(TabContents* tab) {
// NOTE: GetStateForTabSwitch may affect GetSelection, so order is important.
AutocompleteEditModel::State model_state = model_->GetStateForTabSwitch();
GetStateAccessor()->SetProperty(
- tab->property_bag(),
+ tab->GetPropertyBag(),
AutocompleteEditState(model_state, ViewState(GetSelection())));
}
@@ -484,7 +484,7 @@ void OmniboxViewGtk::Update(const TabContents* contents) {
selected_text_.clear();
RevertAll();
const AutocompleteEditState* state =
- GetStateAccessor()->GetProperty(contents->property_bag());
+ GetStateAccessor()->GetProperty(contents->GetPropertyBag());
if (state) {
model_->RestoreState(state->model_state);
diff --git a/chrome/browser/ui/gtk/tabs/drag_data.cc b/chrome/browser/ui/gtk/tabs/drag_data.cc
index 7490fd7..3246b11 100644
--- a/chrome/browser/ui/gtk/tabs/drag_data.cc
+++ b/chrome/browser/ui/gtk/tabs/drag_data.cc
@@ -37,7 +37,7 @@ DraggedTabData::~DraggedTabData() {
}
void DraggedTabData::ResetDelegate() {
- contents_->tab_contents()->set_delegate(original_delegate_);
+ contents_->tab_contents()->SetDelegate(original_delegate_);
}
DragData::DragData(std::vector<DraggedTabData> drag_data, int source_tab_index)
diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc
index edb4acc..971abb4 100644
--- a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc
@@ -154,8 +154,8 @@ DraggedTabData DraggedTabControllerGtk::InitDraggedTabData(TabGtk* tab) {
// collected/destroyed while the drag is in process, leading to
// nasty crashes.
TabContentsDelegate* original_delegate =
- contents->tab_contents()->delegate();
- contents->tab_contents()->set_delegate(this);
+ contents->tab_contents()->GetDelegate();
+ contents->tab_contents()->SetDelegate(this);
DraggedTabData dragged_tab_data(tab, contents, original_delegate,
source_model_index, pinned, mini);
@@ -228,8 +228,8 @@ void DraggedTabControllerGtk::Observe(
for (size_t i = 0; i < drag_data_->size(); ++i) {
if (drag_data_->get(i)->contents_->tab_contents() == destroyed_contents) {
// One of the tabs we're dragging has been destroyed. Cancel the drag.
- if (destroyed_contents->delegate() == this)
- destroyed_contents->set_delegate(NULL);
+ if (destroyed_contents->GetDelegate() == this)
+ destroyed_contents->SetDelegate(NULL);
drag_data_->get(i)->contents_ = NULL;
drag_data_->get(i)->original_delegate_ = NULL;
EndDragImpl(TAB_DESTROYED);
@@ -423,7 +423,7 @@ void DraggedTabControllerGtk::Attach(TabStripGtk* attached_tabstrip,
// Remove ourselves as the delegate now that the dragged TabContents is
// being inserted back into a Browser.
for (size_t i = 0; i < drag_data_->size(); ++i) {
- drag_data_->get(i)->contents_->tab_contents()->set_delegate(NULL);
+ drag_data_->get(i)->contents_->tab_contents()->SetDelegate(NULL);
drag_data_->get(i)->original_delegate_ = NULL;
}
@@ -487,7 +487,7 @@ void DraggedTabControllerGtk::Detach() {
// Detaching resets the delegate, but we still want to be the delegate.
for (size_t i = 0; i < drag_data_->size(); ++i)
- drag_data_->get(i)->contents_->tab_contents()->set_delegate(this);
+ drag_data_->get(i)->contents_->tab_contents()->SetDelegate(this);
attached_tabstrip_ = NULL;
}
@@ -782,7 +782,7 @@ bool DraggedTabControllerGtk::CompleteDrag() {
void DraggedTabControllerGtk::ResetDelegates() {
for (size_t i = 0; i < drag_data_->size(); ++i) {
if (drag_data_->get(i)->contents_ &&
- drag_data_->get(i)->contents_->tab_contents()->delegate() == this) {
+ drag_data_->get(i)->contents_->tab_contents()->GetDelegate() == this) {
drag_data_->get(i)->ResetDelegate();
}
}
diff --git a/chrome/browser/ui/gtk/web_intent_picker_gtk.cc b/chrome/browser/ui/gtk/web_intent_picker_gtk.cc
index 5272d5c..212bae1 100644
--- a/chrome/browser/ui/gtk/web_intent_picker_gtk.cc
+++ b/chrome/browser/ui/gtk/web_intent_picker_gtk.cc
@@ -249,7 +249,7 @@ TabContents* WebIntentPickerGtk::SetInlineDisposition(const GURL& url) {
browser_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL);
inline_disposition_tab_contents_.reset(new TabContentsWrapper(tab_contents));
inline_disposition_delegate_.reset(new InlineDispositionDelegate);
- tab_contents->set_delegate(inline_disposition_delegate_.get());
+ tab_contents->SetDelegate(inline_disposition_delegate_.get());
tab_contents_container_.reset(new TabContentsContainerGtk(NULL));
tab_contents_container_->SetTab(inline_disposition_tab_contents_.get());
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
index f5a26ef..9c20772 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
@@ -66,7 +66,7 @@ TabContentsWrapper::TabContentsWrapper(TabContents* contents)
// Stash this in the property bag so it can be retrieved without having to
// go to a Browser.
- property_accessor()->SetProperty(contents->property_bag(), this);
+ property_accessor()->SetProperty(contents->GetPropertyBag(), this);
// Create the tab helpers.
autocomplete_history_manager_.reset(new AutocompleteHistoryManager(contents));
@@ -157,7 +157,7 @@ TabContentsWrapper* TabContentsWrapper::Clone() {
TabContentsWrapper* TabContentsWrapper::GetCurrentWrapperForContents(
TabContents* contents) {
TabContentsWrapper** wrapper =
- property_accessor()->GetProperty(contents->property_bag());
+ property_accessor()->GetProperty(contents->GetPropertyBag());
return wrapper ? *wrapper : NULL;
}
@@ -166,7 +166,7 @@ TabContentsWrapper* TabContentsWrapper::GetCurrentWrapperForContents(
const TabContentsWrapper* TabContentsWrapper::GetCurrentWrapperForContents(
const TabContents* contents) {
TabContentsWrapper* const* wrapper =
- property_accessor()->GetProperty(contents->property_bag());
+ property_accessor()->GetProperty(contents->GetPropertyBag());
return wrapper ? *wrapper : NULL;
}
diff --git a/chrome/browser/ui/views/aura/app_list_window.cc b/chrome/browser/ui/views/aura/app_list_window.cc
index 036790e..d0de9d8 100644
--- a/chrome/browser/ui/views/aura/app_list_window.cc
+++ b/chrome/browser/ui/views/aura/app_list_window.cc
@@ -96,7 +96,7 @@ void AppListWindow::Init(const gfx::Rect& bounds) {
TabContents* tab = contents_->dom_contents()->tab_contents();
tab_watcher_.reset(new TabFirstRenderWatcher(tab, this));
- tab->set_delegate(this);
+ tab->SetDelegate(this);
contents_->LoadURL(GURL(chrome::kChromeUIAppListURL));
static_cast<AppListUI*>(tab->web_ui())->set_delegate(this);
diff --git a/chrome/browser/ui/views/constrained_html_delegate_gtk.cc b/chrome/browser/ui/views/constrained_html_delegate_gtk.cc
index 3638b8c..ea6200d 100644
--- a/chrome/browser/ui/views/constrained_html_delegate_gtk.cc
+++ b/chrome/browser/ui/views/constrained_html_delegate_gtk.cc
@@ -98,11 +98,11 @@ ConstrainedHtmlDelegateGtk::ConstrainedHtmlDelegateGtk(
TabContents* tab_contents =
new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL, NULL);
html_tab_contents_.reset(new TabContentsWrapper(tab_contents));
- tab_contents->set_delegate(this);
+ tab_contents->SetDelegate(this);
// Set |this| as a property so the ConstrainedHtmlUI can retrieve it.
ConstrainedHtmlUI::GetPropertyAccessor().SetProperty(
- tab_contents->property_bag(), this);
+ tab_contents->GetPropertyBag(), this);
tab_contents->controller().LoadURL(delegate->GetDialogContentURL(),
content::Referrer(),
content::PAGE_TRANSITION_START_PAGE,
diff --git a/chrome/browser/ui/views/constrained_html_delegate_views.cc b/chrome/browser/ui/views/constrained_html_delegate_views.cc
index fbbd60c..c41dd95 100644
--- a/chrome/browser/ui/views/constrained_html_delegate_views.cc
+++ b/chrome/browser/ui/views/constrained_html_delegate_views.cc
@@ -110,11 +110,11 @@ ConstrainedHtmlDelegateViews::ConstrainedHtmlDelegateViews(
TabContents* tab_contents =
new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL, NULL);
html_tab_contents_.reset(new TabContentsWrapper(tab_contents));
- tab_contents->set_delegate(this);
+ tab_contents->SetDelegate(this);
// Set |this| as a property so the ConstrainedHtmlUI can retrieve it.
ConstrainedHtmlUI::GetPropertyAccessor().SetProperty(
- html_tab_contents_->tab_contents()->property_bag(), this);
+ html_tab_contents_->tab_contents()->GetPropertyBag(), this);
tab_contents->controller().LoadURL(delegate->GetDialogContentURL(),
content::Referrer(),
content::PAGE_TRANSITION_START_PAGE,
diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc
index 1e4f4d0..43bf2e8 100644
--- a/chrome/browser/ui/views/create_application_shortcut_view.cc
+++ b/chrome/browser/ui/views/create_application_shortcut_view.cc
@@ -436,8 +436,8 @@ bool CreateUrlApplicationShortcutView::Accept() {
return false;
tab_contents_->extension_tab_helper()->SetAppIcon(shortcut_info_.favicon);
- if (tab_contents_->tab_contents()->delegate()) {
- tab_contents_->tab_contents()->delegate()->ConvertContentsToApplication(
+ if (tab_contents_->tab_contents()->GetDelegate()) {
+ tab_contents_->tab_contents()->GetDelegate()->ConvertContentsToApplication(
tab_contents_->tab_contents());
}
return true;
diff --git a/chrome/browser/ui/views/html_dialog_view.cc b/chrome/browser/ui/views/html_dialog_view.cc
index 7c5c5da..f77d8d9 100644
--- a/chrome/browser/ui/views/html_dialog_view.cc
+++ b/chrome/browser/ui/views/html_dialog_view.cc
@@ -250,12 +250,12 @@ void HtmlDialogView::InitDialog() {
DOMView::Init(profile(), NULL);
TabContents* tab_contents = dom_contents_->tab_contents();
- tab_contents->set_delegate(this);
+ tab_contents->SetDelegate(this);
// Set the delegate. This must be done before loading the page. See
// the comment above HtmlDialogUI in its header file for why.
HtmlDialogUI::GetPropertyAccessor().SetProperty(
- tab_contents->property_bag(), this);
+ tab_contents->GetPropertyBag(), this);
tab_watcher_.reset(new TabFirstRenderWatcher(tab_contents, this));
DOMView::LoadURL(GetDialogContentURL());
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index 117703b..903aaf1 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -346,7 +346,7 @@ void OmniboxViewViews::SaveStateToTab(TabContents* tab) {
gfx::SelectionModel selection;
textfield_->GetSelectionModel(&selection);
GetStateAccessor()->SetProperty(
- tab->property_bag(),
+ tab->GetPropertyBag(),
AutocompleteEditState(model_state, ViewState(selection)));
}
@@ -365,7 +365,7 @@ void OmniboxViewViews::Update(const TabContents* contents) {
if (contents) {
RevertAll();
const AutocompleteEditState* state =
- GetStateAccessor()->GetProperty(contents->property_bag());
+ GetStateAccessor()->GetProperty(contents->GetPropertyBag());
if (state) {
model_->RestoreState(state->model_state);
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
index 6ef5ae5..25bbd3d 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
@@ -554,7 +554,7 @@ void OmniboxViewWin::SaveStateToTab(TabContents* tab) {
CHARRANGE selection;
GetSelection(selection);
- GetStateAccessor()->SetProperty(tab->property_bag(),
+ GetStateAccessor()->SetProperty(tab->GetPropertyBag(),
AutocompleteEditState(
model_state,
State(selection, saved_selection_for_focus_change_)));
@@ -587,7 +587,7 @@ void OmniboxViewWin::Update(const TabContents* tab_for_state_restoring) {
RevertAll();
const AutocompleteEditState* state = GetStateAccessor()->GetProperty(
- tab_for_state_restoring->property_bag());
+ tab_for_state_restoring->GetPropertyBag());
if (state) {
model_->RestoreState(state->model_state);
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc
index 36f5071..25545a4 100644
--- a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc
@@ -275,13 +275,13 @@ void TabContentsViewViews::UpdateDragCursor(WebDragOperation operation) {
}
void TabContentsViewViews::GotFocus() {
- if (tab_contents_->delegate())
- tab_contents_->delegate()->TabContentsFocused(tab_contents_);
+ if (tab_contents_->GetDelegate())
+ tab_contents_->GetDelegate()->TabContentsFocused(tab_contents_);
}
void TabContentsViewViews::TakeFocus(bool reverse) {
- if (tab_contents_->delegate() &&
- !tab_contents_->delegate()->TakeFocus(reverse)) {
+ if (tab_contents_->GetDelegate() &&
+ !tab_contents_->GetDelegate()->TakeFocus(reverse)) {
views::FocusManager* focus_manager = GetFocusManager();
// We may not have a focus manager if the tab has been switched before this
@@ -333,8 +333,8 @@ void TabContentsViewViews::ShowCreatedFullscreenWidget(int route_id) {
void TabContentsViewViews::ShowContextMenu(const ContextMenuParams& params) {
// Allow delegates to handle the context menu operation first.
- if (tab_contents_->delegate() &&
- tab_contents_->delegate()->HandleContextMenu(params)) {
+ if (tab_contents_->GetDelegate() &&
+ tab_contents_->GetDelegate()->HandleContextMenu(params)) {
return;
}
@@ -394,21 +394,21 @@ void TabContentsViewViews::OnNativeTabContentsViewSized(const gfx::Size& size) {
}
void TabContentsViewViews::OnNativeTabContentsViewWheelZoom(bool zoom_in) {
- if (tab_contents_->delegate())
- tab_contents_->delegate()->ContentsZoomChange(zoom_in);
+ if (tab_contents_->GetDelegate())
+ tab_contents_->GetDelegate()->ContentsZoomChange(zoom_in);
}
void TabContentsViewViews::OnNativeTabContentsViewMouseDown() {
// Make sure this TabContents is activated when it is clicked on.
- if (tab_contents_->delegate())
- tab_contents_->delegate()->ActivateContents(tab_contents_);
+ if (tab_contents_->GetDelegate())
+ tab_contents_->GetDelegate()->ActivateContents(tab_contents_);
}
void TabContentsViewViews::OnNativeTabContentsViewMouseMove(bool motion) {
// Let our delegate know that the mouse moved (useful for resetting status
// bubble state).
- if (tab_contents_->delegate()) {
- tab_contents_->delegate()->ContentsMouseEvent(
+ if (tab_contents_->GetDelegate()) {
+ tab_contents_->GetDelegate()->ContentsMouseEvent(
tab_contents_, gfx::Screen::GetCursorScreenPoint(), motion);
}
}
diff --git a/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc b/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc
index 22e4b5a..e414d06 100644
--- a/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc
+++ b/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc
@@ -385,8 +385,8 @@ void DefaultTabDragController::InitTabDragData(BaseTab* tab,
// our dragged TabContents may be replaced and subsequently
// collected/destroyed while the drag is in process, leading to nasty crashes.
drag_data->original_delegate =
- drag_data->contents->tab_contents()->delegate();
- drag_data->contents->tab_contents()->set_delegate(this);
+ drag_data->contents->tab_contents()->GetDelegate();
+ drag_data->contents->tab_contents()->SetDelegate(this);
}
void DefaultTabDragController::Drag() {
@@ -490,8 +490,8 @@ void DefaultTabDragController::Observe(
for (size_t i = 0; i < drag_data_.size(); ++i) {
if (drag_data_[i].contents->tab_contents() == destroyed_contents) {
// One of the tabs we're dragging has been destroyed. Cancel the drag.
- if (destroyed_contents->delegate() == this)
- destroyed_contents->set_delegate(NULL);
+ if (destroyed_contents->GetDelegate() == this)
+ destroyed_contents->SetDelegate(NULL);
drag_data_[i].contents = NULL;
drag_data_[i].original_delegate = NULL;
EndDragImpl(TAB_DESTROYED);
@@ -836,7 +836,7 @@ void DefaultTabDragController::Attach(TabStrip* attached_tabstrip,
// Remove ourselves as the delegate now that the dragged TabContents is
// being inserted back into a Browser.
for (size_t i = 0; i < drag_data_.size(); ++i) {
- drag_data_[i].contents->tab_contents()->set_delegate(NULL);
+ drag_data_[i].contents->tab_contents()->SetDelegate(NULL);
drag_data_[i].original_delegate = NULL;
}
@@ -919,7 +919,7 @@ void DefaultTabDragController::Detach() {
attached_model->DetachTabContentsAt(index);
// Detaching resets the delegate, but we still want to be the delegate.
- drag_data_[i].contents->tab_contents()->set_delegate(this);
+ drag_data_[i].contents->tab_contents()->SetDelegate(this);
// Detaching may end up deleting the tab, drop references to it.
drag_data_[i].attached_tab = NULL;
@@ -1268,8 +1268,8 @@ void DefaultTabDragController::CompleteDrag() {
void DefaultTabDragController::ResetDelegates() {
for (size_t i = 0; i < drag_data_.size(); ++i) {
if (drag_data_[i].contents &&
- drag_data_[i].contents->tab_contents()->delegate() == this) {
- drag_data_[i].contents->tab_contents()->set_delegate(
+ drag_data_[i].contents->tab_contents()->GetDelegate() == this) {
+ drag_data_[i].contents->tab_contents()->SetDelegate(
drag_data_[i].original_delegate);
}
}
diff --git a/chrome/browser/ui/webui/constrained_html_ui.cc b/chrome/browser/ui/webui/constrained_html_ui.cc
index ee880a5..1c6515d 100644
--- a/chrome/browser/ui/webui/constrained_html_ui.cc
+++ b/chrome/browser/ui/webui/constrained_html_ui.cc
@@ -71,7 +71,7 @@ void ConstrainedHtmlUI::OnDialogCloseMessage(const ListValue* args) {
ConstrainedHtmlUIDelegate* ConstrainedHtmlUI::GetConstrainedDelegate() {
ConstrainedHtmlUIDelegate** property =
- GetPropertyAccessor().GetProperty(tab_contents()->property_bag());
+ GetPropertyAccessor().GetProperty(tab_contents()->GetPropertyBag());
return property ? *property : NULL;
}
diff --git a/chrome/browser/ui/webui/html_dialog_ui.cc b/chrome/browser/ui/webui/html_dialog_ui.cc
index 4a35f0a..dce3f95 100644
--- a/chrome/browser/ui/webui/html_dialog_ui.cc
+++ b/chrome/browser/ui/webui/html_dialog_ui.cc
@@ -56,7 +56,7 @@ void HtmlDialogUI::RenderViewCreated(RenderViewHost* render_view_host) {
std::string dialog_args;
std::vector<WebUIMessageHandler*> handlers;
HtmlDialogUIDelegate** delegate = GetPropertyAccessor().GetProperty(
- tab_contents()->property_bag());
+ tab_contents()->GetPropertyBag());
if (delegate) {
dialog_args = (*delegate)->GetDialogArgs();
(*delegate)->GetWebUIMessageHandlers(&handlers);
@@ -80,7 +80,7 @@ void HtmlDialogUI::RenderViewCreated(RenderViewHost* render_view_host) {
void HtmlDialogUI::OnDialogClosed(const ListValue* args) {
HtmlDialogUIDelegate** delegate = GetPropertyAccessor().GetProperty(
- tab_contents()->property_bag());
+ tab_contents()->GetPropertyBag());
if (delegate) {
std::string json_retval;
if (args && !args->empty() && !args->GetString(0, &json_retval))
diff --git a/content/browser/debugger/devtools_manager_unittest.cc b/content/browser/debugger/devtools_manager_unittest.cc
index 830ce55..244ebd2 100644
--- a/content/browser/debugger/devtools_manager_unittest.cc
+++ b/content/browser/debugger/devtools_manager_unittest.cc
@@ -181,9 +181,9 @@ TEST_F(DevToolsManagerTest, ForwardMessageToClient) {
TEST_F(DevToolsManagerTest, NoUnresponsiveDialogInInspectedTab) {
TestRenderViewHost* inspected_rvh = rvh();
inspected_rvh->set_render_view_created(true);
- EXPECT_FALSE(contents()->delegate());
+ EXPECT_FALSE(contents()->GetDelegate());
TestTabContentsDelegate delegate;
- contents()->set_delegate(&delegate);
+ contents()->SetDelegate(&delegate);
TestDevToolsClientHost client_host;
DevToolsAgentHost* agent_host =
@@ -209,7 +209,7 @@ TEST_F(DevToolsManagerTest, NoUnresponsiveDialogInInspectedTab) {
MessageLoop::current()->Run();
EXPECT_TRUE(delegate.renderer_unresponsive_received());
- contents()->set_delegate(NULL);
+ contents()->SetDelegate(NULL);
}
TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) {
diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc
index b3e80ceb..4c7c10f 100644
--- a/content/browser/tab_contents/navigation_controller.cc
+++ b/content/browser/tab_contents/navigation_controller.cc
@@ -196,7 +196,7 @@ void NavigationController::ReloadInternal(bool check_for_repost,
pending_reload_ = reload_type;
tab_contents_->Activate();
- tab_contents_->delegate()->ShowRepostFormWarningDialog(tab_contents_);
+ tab_contents_->GetDelegate()->ShowRepostFormWarningDialog(tab_contents_);
} else {
DiscardNonCommittedEntriesInternal();
diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc
index 60dfb25..df7790c 100644
--- a/content/browser/tab_contents/navigation_controller_unittest.cc
+++ b/content/browser/tab_contents/navigation_controller_unittest.cc
@@ -379,8 +379,8 @@ TEST_F(NavigationControllerTest, LoadURL_IgnorePreemptsPending) {
// Set a TabContentsDelegate to listen for state changes.
scoped_ptr<TestTabContentsDelegate> delegate(new TestTabContentsDelegate());
- EXPECT_FALSE(contents()->delegate());
- contents()->set_delegate(delegate.get());
+ EXPECT_FALSE(contents()->GetDelegate());
+ contents()->SetDelegate(delegate.get());
// Without any navigations, the renderer starts at about:blank.
const GURL kExistingURL("about:blank");
@@ -407,7 +407,7 @@ TEST_F(NavigationControllerTest, LoadURL_IgnorePreemptsPending) {
EXPECT_EQ(-1, controller().last_committed_entry_index());
EXPECT_EQ(2, delegate->navigation_state_change_count());
- contents()->set_delegate(NULL);
+ contents()->SetDelegate(NULL);
}
// Tests that the pending entry state is correct after an abort.
@@ -417,8 +417,8 @@ TEST_F(NavigationControllerTest, LoadURL_AbortCancelsPending) {
// Set a TabContentsDelegate to listen for state changes.
scoped_ptr<TestTabContentsDelegate> delegate(new TestTabContentsDelegate());
- EXPECT_FALSE(contents()->delegate());
- contents()->set_delegate(delegate.get());
+ EXPECT_FALSE(contents()->GetDelegate());
+ contents()->SetDelegate(delegate.get());
// Without any navigations, the renderer starts at about:blank.
const GURL kExistingURL("about:blank");
@@ -454,7 +454,7 @@ TEST_F(NavigationControllerTest, LoadURL_AbortCancelsPending) {
EXPECT_EQ(-1, controller().last_committed_entry_index());
EXPECT_EQ(2, delegate->navigation_state_change_count());
- contents()->set_delegate(NULL);
+ contents()->SetDelegate(NULL);
}
// Tests that the pending entry state is correct after a redirect and abort.
@@ -465,8 +465,8 @@ TEST_F(NavigationControllerTest, LoadURL_RedirectAbortCancelsPending) {
// Set a TabContentsDelegate to listen for state changes.
scoped_ptr<TestTabContentsDelegate> delegate(new TestTabContentsDelegate());
- EXPECT_FALSE(contents()->delegate());
- contents()->set_delegate(delegate.get());
+ EXPECT_FALSE(contents()->GetDelegate());
+ contents()->SetDelegate(delegate.get());
// Without any navigations, the renderer starts at about:blank.
const GURL kExistingURL("about:blank");
@@ -515,7 +515,7 @@ TEST_F(NavigationControllerTest, LoadURL_RedirectAbortCancelsPending) {
EXPECT_EQ(-1, controller().last_committed_entry_index());
EXPECT_EQ(2, delegate->navigation_state_change_count());
- contents()->set_delegate(NULL);
+ contents()->SetDelegate(NULL);
}
TEST_F(NavigationControllerTest, Reload) {
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 390acb4..324deba 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -264,18 +264,7 @@ TabContents::~TabContents() {
FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed());
- set_delegate(NULL);
-}
-
-// TODO(cbentzel): Either remove the debugging code, or rename to SetDelegate.
-void TabContents::set_delegate(TabContentsDelegate* delegate) {
- if (delegate == delegate_)
- return;
- if (delegate_)
- delegate_->Detach(this);
- delegate_ = delegate;
- if (delegate_)
- delegate_->Attach(this);
+ SetDelegate(NULL);
}
bool TabContents::OnMessageReceived(const IPC::Message& message) {
@@ -336,7 +325,7 @@ bool TabContents::OnMessageReceived(const IPC::Message& message) {
void TabContents::RunFileChooser(
RenderViewHost* render_view_host,
const content::FileChooserParams& params) {
- delegate()->RunFileChooser(this, params);
+ delegate_->RunFileChooser(this, params);
}
content::RenderProcessHost* TabContents::GetRenderProcessHost() const {
@@ -758,21 +747,19 @@ bool TabContents::FocusLocationBarByDefault() {
}
void TabContents::SetFocusToLocationBar(bool select_all) {
- if (delegate())
- delegate()->SetFocusToLocationBar(select_all);
+ if (delegate_)
+ delegate_->SetFocusToLocationBar(select_all);
}
bool TabContents::CanDownload(int request_id) {
- TabContentsDelegate* d = delegate();
- if (d)
- return d->CanDownload(this, request_id);
+ if (delegate_)
+ return delegate_->CanDownload(this, request_id);
return true;
}
void TabContents::OnStartDownload(DownloadItem* download) {
- TabContentsDelegate* d = delegate();
- if (d)
- d->OnStartDownload(this, download);
+ if (delegate_)
+ delegate_->OnStartDownload(this, download);
}
void TabContents::OnSavePage() {
@@ -842,7 +829,7 @@ bool TabContents::ShouldAcceptDragAndDrop() const {
#if defined(OS_CHROMEOS)
// ChromeOS panels (pop-ups) do not take drag-n-drop.
// See http://crosbug.com/2413
- if (delegate() && delegate()->IsPopupOrPanel(this))
+ if (delegate_ && delegate_->IsPopupOrPanel(this))
return false;
return true;
#else
@@ -853,8 +840,8 @@ bool TabContents::ShouldAcceptDragAndDrop() const {
void TabContents::SystemDragEnded() {
if (render_view_host())
render_view_host()->DragSourceSystemDragEnded();
- if (delegate())
- delegate()->DragEnded();
+ if (delegate_)
+ delegate_->DragEnded();
}
double TabContents::GetZoomLevel() const {
@@ -910,7 +897,7 @@ void TabContents::ViewFrameSource(const GURL& url,
void TabContents::SetContentRestrictions(int restrictions) {
content_restrictions_ = restrictions;
- delegate()->ContentRestrictionsChanged(this);
+ delegate_->ContentRestrictionsChanged(this);
}
void TabContents::OnRegisterIntentService(const string16& action,
@@ -918,14 +905,14 @@ void TabContents::OnRegisterIntentService(const string16& action,
const string16& href,
const string16& title,
const string16& disposition) {
- delegate()->RegisterIntentHandler(
+ delegate_->RegisterIntentHandler(
this, action, type, href, title, disposition);
}
void TabContents::OnWebIntentDispatch(const webkit_glue::WebIntentData& intent,
int intent_id) {
IntentsHostImpl* intents_host = new IntentsHostImpl(this, intent, intent_id);
- delegate()->WebIntentDispatch(this, intents_host);
+ delegate_->WebIntentDispatch(this, intents_host);
}
void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id,
@@ -1156,17 +1143,17 @@ void TabContents::OnUpdateZoomLimits(int minimum_percent,
void TabContents::OnEnumerateDirectory(int request_id,
const FilePath& path) {
- delegate()->EnumerateDirectory(this, request_id, path);
+ delegate_->EnumerateDirectory(this, request_id, path);
}
void TabContents::OnJSOutOfMemory() {
- delegate()->JSOutOfMemory(this);
+ delegate_->JSOutOfMemory(this);
}
void TabContents::OnRegisterProtocolHandler(const std::string& protocol,
const GURL& url,
const string16& title) {
- delegate()->RegisterProtocolHandler(this, protocol, url, title);
+ delegate_->RegisterProtocolHandler(this, protocol, url, title);
}
void TabContents::OnFindReply(int request_id,
@@ -1174,8 +1161,8 @@ void TabContents::OnFindReply(int request_id,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) {
- delegate()->FindReply(this, request_id, number_of_matches, selection_rect,
- active_match_ordinal, final_update);
+ delegate_->FindReply(this, request_id, number_of_matches, selection_rect,
+ active_match_ordinal, final_update);
// Send a notification to the renderer that we are ready to receive more
// results from the scoping effort of the Find operation. The FindInPage
// scoping is asynchronous and periodically sends results back up to the
@@ -1187,7 +1174,7 @@ void TabContents::OnFindReply(int request_id,
}
void TabContents::OnCrashedPlugin(const FilePath& plugin_path) {
- delegate()->CrashedPlugin(this, plugin_path);
+ delegate_->CrashedPlugin(this, plugin_path);
}
void TabContents::OnAppCacheAccessed(const GURL& manifest_url,
@@ -1417,6 +1404,29 @@ void TabContents::NotifyDisconnected() {
content::NotificationService::NoDetails());
}
+const base::PropertyBag* TabContents::GetPropertyBag() const {
+ return &property_bag_;
+}
+
+base::PropertyBag* TabContents::GetPropertyBag() {
+ return &property_bag_;
+}
+
+TabContentsDelegate* TabContents::GetDelegate() {
+ return delegate_;
+}
+
+void TabContents::SetDelegate(TabContentsDelegate* delegate) {
+ // TODO(cbentzel): remove this debugging code?
+ if (delegate == delegate_)
+ return;
+ if (delegate_)
+ delegate_->Detach(this);
+ delegate_ = delegate;
+ if (delegate_)
+ delegate_->Attach(this);
+}
+
RenderViewHostDelegate::View* TabContents::GetViewDelegate() {
return view_.get();
}
@@ -1568,8 +1578,8 @@ void TabContents::DidNavigate(RenderViewHost* rvh,
// Run post-commit tasks.
if (details.is_main_frame) {
DidNavigateMainFramePostCommit(details, params);
- if (delegate())
- delegate()->DidNavigateMainFramePostCommit(this);
+ if (delegate_)
+ delegate_->DidNavigateMainFramePostCommit(this);
}
DidNavigateAnyFramePostCommit(rvh, details, params);
}
@@ -1627,8 +1637,8 @@ void TabContents::UpdateEncoding(RenderViewHost* render_view_host,
}
void TabContents::UpdateTargetURL(int32 page_id, const GURL& url) {
- if (delegate())
- delegate()->UpdateTargetURL(this, page_id, url);
+ if (delegate_)
+ delegate_->UpdateTargetURL(this, page_id, url);
}
void TabContents::Close(RenderViewHost* rvh) {
@@ -1655,26 +1665,26 @@ void TabContents::Close(RenderViewHost* rvh) {
}
// Ignore this if it comes from a RenderViewHost that we aren't showing.
- if (delegate() && rvh == render_view_host())
- delegate()->CloseContents(this);
+ if (delegate_ && rvh == render_view_host())
+ delegate_->CloseContents(this);
}
void TabContents::SwappedOut(RenderViewHost* rvh) {
- if (delegate() && rvh == render_view_host())
- delegate()->SwappedOut(this);
+ if (delegate_ && rvh == render_view_host())
+ delegate_->SwappedOut(this);
}
void TabContents::RequestMove(const gfx::Rect& new_bounds) {
- if (delegate() && delegate()->IsPopupOrPanel(this))
- delegate()->MoveContents(this, new_bounds);
+ if (delegate_ && delegate_->IsPopupOrPanel(this))
+ delegate_->MoveContents(this, new_bounds);
}
void TabContents::DidStartLoading() {
SetIsLoading(true, NULL);
- if (delegate() && content_restrictions_) {
+ if (delegate_ && content_restrictions_) {
content_restrictions_ = 0;
- delegate()->ContentRestrictionsChanged(this);
+ delegate_->ContentRestrictionsChanged(this);
}
// Notify observers about navigation.
@@ -1712,8 +1722,8 @@ void TabContents::DidCancelLoading() {
}
void TabContents::DidChangeLoadProgress(double progress) {
- if (delegate())
- delegate()->LoadProgressChanged(progress);
+ if (delegate_)
+ delegate_->LoadProgressChanged(progress);
}
void TabContents::DocumentAvailableInMainFrame(
@@ -1835,8 +1845,8 @@ void TabContents::RunJavaScriptMessage(
void TabContents::RunBeforeUnloadConfirm(const RenderViewHost* rvh,
const string16& message,
IPC::Message* reply_msg) {
- if (delegate())
- delegate()->WillRunBeforeUnloadConfirm();
+ if (delegate_)
+ delegate_->WillRunBeforeUnloadConfirm();
bool suppress_this_message =
rvh->is_swapped_out() ||
@@ -1923,13 +1933,13 @@ void TabContents::RendererUnresponsive(RenderViewHost* rvh,
if (!render_view_host() || !render_view_host()->IsRenderViewLive())
return;
- if (delegate())
- delegate()->RendererUnresponsive(this);
+ if (delegate_)
+ delegate_->RendererUnresponsive(this);
}
void TabContents::RendererResponsive(RenderViewHost* render_view_host) {
- if (delegate())
- delegate()->RendererResponsive(this);
+ if (delegate_)
+ delegate_->RendererResponsive(this);
}
void TabContents::LoadStateChanged(const GURL& url,
@@ -1949,15 +1959,15 @@ void TabContents::LoadStateChanged(const GURL& url,
}
void TabContents::WorkerCrashed() {
- if (delegate())
- delegate()->WorkerCrashed(this);
+ if (delegate_)
+ delegate_->WorkerCrashed(this);
}
void TabContents::BeforeUnloadFiredFromRenderManager(
bool proceed,
bool* proceed_to_fire_unload) {
- if (delegate())
- delegate()->BeforeUnloadFired(this, proceed, proceed_to_fire_unload);
+ if (delegate_)
+ delegate_->BeforeUnloadFired(this, proceed, proceed_to_fire_unload);
}
void TabContents::DidStartLoadingFromRenderManager(
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index 21fa71f..3cef05fb7 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -27,6 +27,7 @@
#include "content/browser/tab_contents/tab_contents_observer.h"
#include "content/browser/webui/web_ui.h"
#include "content/common/content_export.h"
+#include "content/public/browser/web_page.h"
#include "content/public/common/renderer_preferences.h"
#include "net/base/load_states.h"
#include "ui/gfx/native_widget_types.h"
@@ -50,9 +51,8 @@ namespace webkit_glue {
struct WebIntentData;
}
-// Describes what goes in the main content area of a tab. TabContents is
-// the only type of TabContents, and these should be merged together.
-class CONTENT_EXPORT TabContents : public PageNavigator,
+class CONTENT_EXPORT TabContents : public content::WebPage,
+ public PageNavigator,
public RenderViewHostDelegate,
public RenderViewHostManager::Delegate,
public content::JavaScriptDialogDelegate {
@@ -84,15 +84,6 @@ class CONTENT_EXPORT TabContents : public PageNavigator,
// Intrinsic tab state -------------------------------------------------------
- // Returns the property bag for this tab contents, where callers can add
- // extra data they may wish to associate with the tab. Returns a pointer
- // rather than a reference since the PropertyAccessors expect this.
- const base::PropertyBag* property_bag() const { return &property_bag_; }
- base::PropertyBag* property_bag() { return &property_bag_; }
-
- TabContentsDelegate* delegate() const { return delegate_; }
- void set_delegate(TabContentsDelegate* delegate);
-
// Gets the controller for this tab contents.
NavigationController& controller() { return controller_; }
const NavigationController& controller() const { return controller_; }
@@ -479,6 +470,13 @@ class CONTENT_EXPORT TabContents : public PageNavigator,
return java_bridge_dispatcher_host_manager_.get();
}
+ // content::WebPage ----------------------------------------------------------
+ virtual const base::PropertyBag* GetPropertyBag() const OVERRIDE;
+ virtual base::PropertyBag* GetPropertyBag() OVERRIDE;
+ virtual TabContentsDelegate* GetDelegate() OVERRIDE;
+ virtual void SetDelegate(TabContentsDelegate* delegate) OVERRIDE;
+
+
// RenderViewHostDelegate ----------------------------------------------------
virtual RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE;
diff --git a/content/browser/tab_contents/tab_contents_delegate.cc b/content/browser/tab_contents/tab_contents_delegate.cc
index 1bb95f2..20d8f52 100644
--- a/content/browser/tab_contents/tab_contents_delegate.cc
+++ b/content/browser/tab_contents/tab_contents_delegate.cc
@@ -336,7 +336,7 @@ void TabContentsDelegate::RequestToLockMouse(TabContents* tab) {
TabContentsDelegate::~TabContentsDelegate() {
while (!attached_contents_.empty()) {
TabContents* tab_contents = *attached_contents_.begin();
- tab_contents->set_delegate(NULL);
+ tab_contents->SetDelegate(NULL);
}
DCHECK(attached_contents_.empty());
content::NotificationService::current()->Notify(
diff --git a/content/browser/tab_contents/tab_contents_delegate_unittest.cc b/content/browser/tab_contents/tab_contents_delegate_unittest.cc
index ea876fb..8075ce1 100644
--- a/content/browser/tab_contents/tab_contents_delegate_unittest.cc
+++ b/content/browser/tab_contents/tab_contents_delegate_unittest.cc
@@ -60,39 +60,39 @@ TEST(TabContentsDelegateTest, UnregisterInDestructor) {
new TabContents(&browser_context, NULL, 0, NULL, NULL));
scoped_ptr<TabContents> contents_b(
new TabContents(&browser_context, NULL, 0, NULL, NULL));
- EXPECT_TRUE(contents_a->delegate() == NULL);
- EXPECT_TRUE(contents_b->delegate() == NULL);
+ EXPECT_TRUE(contents_a->GetDelegate() == NULL);
+ EXPECT_TRUE(contents_b->GetDelegate() == NULL);
scoped_ptr<MockTabContentsDelegate> delegate(new MockTabContentsDelegate());
// Setting a delegate should work correctly.
- contents_a->set_delegate(delegate.get());
- EXPECT_EQ(delegate.get(), contents_a->delegate());
- EXPECT_TRUE(contents_b->delegate() == NULL);
+ contents_a->SetDelegate(delegate.get());
+ EXPECT_EQ(delegate.get(), contents_a->GetDelegate());
+ EXPECT_TRUE(contents_b->GetDelegate() == NULL);
// A delegate can be a delegate to multiple TabContents.
- contents_b->set_delegate(delegate.get());
- EXPECT_EQ(delegate.get(), contents_a->delegate());
- EXPECT_EQ(delegate.get(), contents_b->delegate());
+ contents_b->SetDelegate(delegate.get());
+ EXPECT_EQ(delegate.get(), contents_a->GetDelegate());
+ EXPECT_EQ(delegate.get(), contents_b->GetDelegate());
// Setting the same delegate multiple times should work correctly.
- contents_b->set_delegate(delegate.get());
- EXPECT_EQ(delegate.get(), contents_a->delegate());
- EXPECT_EQ(delegate.get(), contents_b->delegate());
+ contents_b->SetDelegate(delegate.get());
+ EXPECT_EQ(delegate.get(), contents_a->GetDelegate());
+ EXPECT_EQ(delegate.get(), contents_b->GetDelegate());
// Setting delegate to NULL should work correctly.
- contents_b->set_delegate(NULL);
- EXPECT_EQ(delegate.get(), contents_a->delegate());
- EXPECT_TRUE(contents_b->delegate() == NULL);
+ contents_b->SetDelegate(NULL);
+ EXPECT_EQ(delegate.get(), contents_a->GetDelegate());
+ EXPECT_TRUE(contents_b->GetDelegate() == NULL);
// Destroying the delegate while it is still the delegate
// for a TabContents should unregister it.
- contents_b->set_delegate(delegate.get());
- EXPECT_EQ(delegate.get(), contents_a->delegate());
- EXPECT_EQ(delegate.get(), contents_b->delegate());
+ contents_b->SetDelegate(delegate.get());
+ EXPECT_EQ(delegate.get(), contents_a->GetDelegate());
+ EXPECT_EQ(delegate.get(), contents_b->GetDelegate());
delegate.reset(NULL);
- EXPECT_TRUE(contents_a->delegate() == NULL);
- EXPECT_TRUE(contents_b->delegate() == NULL);
+ EXPECT_TRUE(contents_a->GetDelegate() == NULL);
+ EXPECT_TRUE(contents_b->GetDelegate() == NULL);
// Destroy the tab contents and run the message loop to prevent leaks.
contents_a.reset(NULL);
diff --git a/content/browser/tab_contents/tab_contents_view_win.cc b/content/browser/tab_contents/tab_contents_view_win.cc
index 0dc9826f..bee22d7 100644
--- a/content/browser/tab_contents/tab_contents_view_win.cc
+++ b/content/browser/tab_contents/tab_contents_view_win.cc
@@ -226,13 +226,13 @@ void TabContentsViewWin::UpdateDragCursor(WebKit::WebDragOperation operation) {
}
void TabContentsViewWin::GotFocus() {
- if (tab_contents_->delegate())
- tab_contents_->delegate()->TabContentsFocused(tab_contents_);
+ if (tab_contents_->GetDelegate())
+ tab_contents_->GetDelegate()->TabContentsFocused(tab_contents_);
}
void TabContentsViewWin::TakeFocus(bool reverse) {
- if (tab_contents_->delegate())
- tab_contents_->delegate()->TakeFocus(reverse);
+ if (tab_contents_->GetDelegate())
+ tab_contents_->GetDelegate()->TakeFocus(reverse);
}
LRESULT TabContentsViewWin::OnWindowPosChanged(
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 0759043..3000a6f 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -63,6 +63,7 @@
'public/browser/sensors.h',
'public/browser/sensors_listener.h',
'public/browser/user_metrics.h',
+ 'public/browser/web_page.h',
'browser/accessibility/browser_accessibility.cc',
'browser/accessibility/browser_accessibility.h',
'browser/accessibility/browser_accessibility_cocoa.h',
diff --git a/content/public/browser/child_process_data.h b/content/public/browser/child_process_data.h
index 46a10ac..6f20dd3 100644
--- a/content/public/browser/child_process_data.h
+++ b/content/public/browser/child_process_data.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_PUBLIC_CHILD_PROCESS_DATA_H_
-#define CONTENT_PUBLIC_CHILD_PROCESS_DATA_H_
+#ifndef CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_DATA_H_
+#define CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_DATA_H_
#pragma once
#include "base/process.h"
@@ -35,4 +35,4 @@ struct ChildProcessData {
} // namespace content
-#endif // CONTENT_PUBLIC_CHILD_PROCESS_DATA_H_
+#endif // CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_DATA_H_
diff --git a/content/public/browser/web_page.h b/content/public/browser/web_page.h
new file mode 100644
index 0000000..d6dcbf6
--- /dev/null
+++ b/content/public/browser/web_page.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_BROWSER_WEB_PAGE_H_
+#define CONTENT_PUBLIC_BROWSER_WEB_PAGE_H_
+#pragma once
+
+#include "base/string16.h"
+#include "content/common/content_export.h"
+
+// TODO(jam): of course we will have to rename TabContentsDelgate,
+// TabContentsView etc to use WebPage.
+class TabContentsDelegate;
+
+namespace base {
+class PropertyBag;
+}
+
+namespace content {
+
+// Describes what goes in the main content area of a tab.
+class WebPage {
+ public:
+ // Intrinsic tab state -------------------------------------------------------
+
+ // Returns the property bag for this tab contents, where callers can add
+ // extra data they may wish to associate with the tab. Returns a pointer
+ // rather than a reference since the PropertyAccessors expect this.
+ virtual const base::PropertyBag* GetPropertyBag() const = 0;
+ virtual base::PropertyBag* GetPropertyBag() = 0;
+
+ // Get/Set the delegate.
+ virtual TabContentsDelegate* GetDelegate() = 0;
+ virtual void SetDelegate(TabContentsDelegate* delegate) = 0;
+
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_WEB_PAGE_H_
diff --git a/content/shell/shell.cc b/content/shell/shell.cc
index 4627e07..449052a 100644
--- a/content/shell/shell.cc
+++ b/content/shell/shell.cc
@@ -58,7 +58,7 @@ Shell* Shell::CreateNewWindow(content::BrowserContext* browser_context,
routing_id,
base_tab_contents,
NULL));
- shell->tab_contents_->set_delegate(shell);
+ shell->tab_contents_->SetDelegate(shell);
#if defined(OS_WIN)
TabContentsViewWin* view =