Commit 8683ad2d authored by sky@chromium.org's avatar sky@chromium.org

Removes RenderViewHostDelegate::GetBrowserWindowID. Instead the places

that care send the correct message. This change is motivated by
wanting to remove SessionID from content. At later cl will remove
TabContentsDelegate::RenderViewCreated.

BUG=none
TEST=none
R=jam@chromium.org,mpcomplete@chromium.org

Review URL: http://codereview.chromium.org/7046041

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88376 0039d316-1c4b-4281-b951-d872f2087c98
parent 7f2b242b
...@@ -210,6 +210,19 @@ void ExtensionHost::CreateRenderViewSoon(RenderWidgetHostView* host_view) { ...@@ -210,6 +210,19 @@ void ExtensionHost::CreateRenderViewSoon(RenderWidgetHostView* host_view) {
void ExtensionHost::CreateRenderViewNow() { void ExtensionHost::CreateRenderViewNow() {
render_view_host_->CreateRenderView(string16()); render_view_host_->CreateRenderView(string16());
if (extension_host_type_ == ViewType::EXTENSION_POPUP ||
extension_host_type_ == ViewType::EXTENSION_DIALOG ||
extension_host_type_ == ViewType::EXTENSION_INFOBAR) {
// If the host is bound to a browser, then extract its window id.
// Extensions hosted in ExternalTabContainer objects may not have
// an associated browser.
const Browser* browser = GetBrowser();
if (browser && render_view_host_) {
render_view_host_->Send(new ExtensionMsg_UpdateBrowserWindowId(
render_view_host_->routing_id(),
ExtensionTabUtil::GetWindowId(browser)));
}
}
NavigateToURL(url_); NavigateToURL(url_);
DCHECK(IsRenderViewLive()); DCHECK(IsRenderViewLive());
if (is_background_page()) if (is_background_page())
...@@ -789,25 +802,6 @@ void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { ...@@ -789,25 +802,6 @@ void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) {
} }
} }
int ExtensionHost::GetBrowserWindowID() const {
// Hosts not attached to any browser window have an id of -1. This includes
// those mentioned below, and background pages.
int window_id = extension_misc::kUnknownWindowId;
if (extension_host_type_ == ViewType::EXTENSION_POPUP ||
extension_host_type_ == ViewType::EXTENSION_DIALOG ||
extension_host_type_ == ViewType::EXTENSION_INFOBAR) {
// If the host is bound to a browser, then extract its window id.
// Extensions hosted in ExternalTabContainer objects may not have
// an associated browser.
const Browser* browser = GetBrowser();
if (browser)
window_id = ExtensionTabUtil::GetWindowId(browser);
} else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) {
NOTREACHED();
}
return window_id;
}
void ExtensionHost::OnRunFileChooser( void ExtensionHost::OnRunFileChooser(
const ViewHostMsg_RunFileChooser_Params& params) { const ViewHostMsg_RunFileChooser_Params& params) {
if (file_select_helper_.get() == NULL) if (file_select_helper_.get() == NULL)
......
...@@ -115,7 +115,6 @@ class ExtensionHost : public RenderViewHostDelegate, ...@@ -115,7 +115,6 @@ class ExtensionHost : public RenderViewHostDelegate,
virtual const GURL& GetURL() const; virtual const GURL& GetURL() const;
virtual void RenderViewCreated(RenderViewHost* render_view_host); virtual void RenderViewCreated(RenderViewHost* render_view_host);
virtual ViewType::Type GetRenderViewType() const; virtual ViewType::Type GetRenderViewType() const;
virtual int GetBrowserWindowID() const;
virtual void RenderViewGone(RenderViewHost* render_view_host, virtual void RenderViewGone(RenderViewHost* render_view_host,
base::TerminationStatus status, base::TerminationStatus status,
int error_code); int error_code);
......
...@@ -33,8 +33,6 @@ bool ExtensionMessageHandler::OnMessageReceived( ...@@ -33,8 +33,6 @@ bool ExtensionMessageHandler::OnMessageReceived(
void ExtensionMessageHandler::RenderViewHostInitialized() { void ExtensionMessageHandler::RenderViewHostInitialized() {
Send(new ExtensionMsg_NotifyRenderViewType( Send(new ExtensionMsg_NotifyRenderViewType(
routing_id(), render_view_host()->delegate()->GetRenderViewType())); routing_id(), render_view_host()->delegate()->GetRenderViewType()));
Send(new ExtensionMsg_UpdateBrowserWindowId(
routing_id(), render_view_host()->delegate()->GetBrowserWindowID()));
} }
void ExtensionMessageHandler::OnPostMessage(int port_id, void ExtensionMessageHandler::OnPostMessage(int port_id,
......
...@@ -110,10 +110,6 @@ void BalloonHost::RenderViewGone(RenderViewHost* render_view_host, ...@@ -110,10 +110,6 @@ void BalloonHost::RenderViewGone(RenderViewHost* render_view_host,
Close(render_view_host); Close(render_view_host);
} }
int BalloonHost::GetBrowserWindowID() const {
return extension_misc::kUnknownWindowId;
}
ViewType::Type BalloonHost::GetRenderViewType() const { ViewType::Type BalloonHost::GetRenderViewType() const {
return ViewType::NOTIFICATION; return ViewType::NOTIFICATION;
} }
......
...@@ -62,7 +62,6 @@ class BalloonHost : public RenderViewHostDelegate, ...@@ -62,7 +62,6 @@ class BalloonHost : public RenderViewHostDelegate,
int error_code); int error_code);
virtual void UpdateTitle(RenderViewHost* render_view_host, virtual void UpdateTitle(RenderViewHost* render_view_host,
int32 page_id, const std::wstring& title) {} int32 page_id, const std::wstring& title) {}
virtual int GetBrowserWindowID() const;
virtual ViewType::Type GetRenderViewType() const; virtual ViewType::Type GetRenderViewType() const;
virtual RenderViewHostDelegate::View* GetViewDelegate(); virtual RenderViewHostDelegate::View* GetViewDelegate();
......
...@@ -74,10 +74,6 @@ ViewType::Type BackgroundContents::GetRenderViewType() const { ...@@ -74,10 +74,6 @@ ViewType::Type BackgroundContents::GetRenderViewType() const {
return ViewType::BACKGROUND_CONTENTS; return ViewType::BACKGROUND_CONTENTS;
} }
int BackgroundContents::GetBrowserWindowID() const {
return extension_misc::kUnknownWindowId;
}
void BackgroundContents::DidNavigate( void BackgroundContents::DidNavigate(
RenderViewHost* render_view_host, RenderViewHost* render_view_host,
const ViewHostMsg_FrameNavigate_Params& params) { const ViewHostMsg_FrameNavigate_Params& params) {
......
...@@ -63,7 +63,6 @@ class BackgroundContents : public RenderViewHostDelegate, ...@@ -63,7 +63,6 @@ class BackgroundContents : public RenderViewHostDelegate,
virtual RenderViewHostDelegate::View* GetViewDelegate(); virtual RenderViewHostDelegate::View* GetViewDelegate();
virtual const GURL& GetURL() const; virtual const GURL& GetURL() const;
virtual ViewType::Type GetRenderViewType() const; virtual ViewType::Type GetRenderViewType() const;
virtual int GetBrowserWindowID() const;
virtual void DidNavigate(RenderViewHost* render_view_host, virtual void DidNavigate(RenderViewHost* render_view_host,
const ViewHostMsg_FrameNavigate_Params& params); const ViewHostMsg_FrameNavigate_Params& params);
virtual WebPreferences GetWebkitPrefs(); virtual WebPreferences GetWebkitPrefs();
......
...@@ -2859,6 +2859,7 @@ void Browser::TabInsertedAt(TabContentsWrapper* contents, ...@@ -2859,6 +2859,7 @@ void Browser::TabInsertedAt(TabContentsWrapper* contents,
// Extension code in the renderer holds the ID of the window that hosts it. // Extension code in the renderer holds the ID of the window that hosts it.
// Notify it that the window ID changed. // Notify it that the window ID changed.
// TODO(sky): move this to a better place.
contents->render_view_host()->Send(new ExtensionMsg_UpdateBrowserWindowId( contents->render_view_host()->Send(new ExtensionMsg_UpdateBrowserWindowId(
contents->render_view_host()->routing_id(), contents->render_view_host()->routing_id(),
contents->controller().window_id().id())); contents->controller().window_id().id()));
...@@ -3436,6 +3437,14 @@ content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { ...@@ -3436,6 +3437,14 @@ content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() {
return GetJavaScriptDialogCreatorInstance(); return GetJavaScriptDialogCreatorInstance();
} }
void Browser::RenderViewCreated(TabContents* source, RenderViewHost* host) {
// TODO(sky): move this to a TabContentsObserver hung off TabContentsWrapper,
// then nuke this method.
host->Send(new ExtensionMsg_UpdateBrowserWindowId(
host->routing_id(),
source->controller().window_id().id()));
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Browser, TabContentsWrapperDelegate implementation: // Browser, TabContentsWrapperDelegate implementation:
......
...@@ -853,6 +853,8 @@ class Browser : public TabHandlerDelegate, ...@@ -853,6 +853,8 @@ class Browser : public TabHandlerDelegate,
const MainFrameCommitDetails& details); const MainFrameCommitDetails& details);
virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator() virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator()
OVERRIDE; OVERRIDE;
virtual void RenderViewCreated(TabContents* source,
RenderViewHost* host) OVERRIDE;
// Overridden from TabContentsWrapperDelegate: // Overridden from TabContentsWrapperDelegate:
virtual void OnDidGetApplicationInfo(TabContentsWrapper* source, virtual void OnDidGetApplicationInfo(TabContentsWrapper* source,
......
...@@ -274,10 +274,6 @@ class RenderViewHostDelegate : public IPC::Channel::Listener { ...@@ -274,10 +274,6 @@ class RenderViewHostDelegate : public IPC::Channel::Listener {
// object is not a BackgroundContents, returns NULL. // object is not a BackgroundContents, returns NULL.
virtual BackgroundContents* GetAsBackgroundContents(); virtual BackgroundContents* GetAsBackgroundContents();
// Return id number of browser window which this object is attached to. If no
// browser window is attached to, just return -1.
virtual int GetBrowserWindowID() const = 0;
// Return type of RenderView which is attached with this object. // Return type of RenderView which is attached with this object.
virtual ViewType::Type GetRenderViewType() const = 0; virtual ViewType::Type GetRenderViewType() const = 0;
......
...@@ -372,7 +372,7 @@ class RenderWidgetHost : public IPC::Channel::Listener, ...@@ -372,7 +372,7 @@ class RenderWidgetHost : public IPC::Channel::Listener,
// Notification that the user has made some kind of input that could // Notification that the user has made some kind of input that could
// perform an action. See OnUserGesture for more details. // perform an action. See OnUserGesture for more details.
void StartUserGesture(); void StartUserGesture();
protected: protected:
// Internal implementation of the public Forward*Event() methods. // Internal implementation of the public Forward*Event() methods.
void ForwardInputEvent(const WebKit::WebInputEvent& input_event, void ForwardInputEvent(const WebKit::WebInputEvent& input_event,
......
...@@ -719,10 +719,6 @@ void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( ...@@ -719,10 +719,6 @@ void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply(
int active_match_ordinal, bool final_update) { int active_match_ordinal, bool final_update) {
} }
int InterstitialPage::GetBrowserWindowID() const {
return tab_->GetBrowserWindowID();
}
void InterstitialPage::UpdateInspectorSetting(const std::string& key, void InterstitialPage::UpdateInspectorSetting(const std::string& key,
const std::string& value) { const std::string& value) {
RenderViewHostDelegateHelper::UpdateInspectorSetting( RenderViewHostDelegateHelper::UpdateInspectorSetting(
......
...@@ -102,7 +102,6 @@ class InterstitialPage : public NotificationObserver, ...@@ -102,7 +102,6 @@ class InterstitialPage : public NotificationObserver,
void FocusThroughTabTraversal(bool reverse); void FocusThroughTabTraversal(bool reverse);
virtual ViewType::Type GetRenderViewType() const; virtual ViewType::Type GetRenderViewType() const;
virtual int GetBrowserWindowID() const;
// See description above field. // See description above field.
void set_reload_on_dont_proceed(bool value) { void set_reload_on_dont_proceed(bool value) {
......
...@@ -1245,10 +1245,6 @@ ViewType::Type TabContents::GetRenderViewType() const { ...@@ -1245,10 +1245,6 @@ ViewType::Type TabContents::GetRenderViewType() const {
return ViewType::TAB_CONTENTS; return ViewType::TAB_CONTENTS;
} }
int TabContents::GetBrowserWindowID() const {
return controller().window_id().id();
}
void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { void TabContents::RenderViewCreated(RenderViewHost* render_view_host) {
NotificationService::current()->Notify( NotificationService::current()->Notify(
NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB,
...@@ -1273,6 +1269,9 @@ void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { ...@@ -1273,6 +1269,9 @@ void TabContents::RenderViewCreated(RenderViewHost* render_view_host) {
FOR_EACH_OBSERVER( FOR_EACH_OBSERVER(
TabContentsObserver, observers_, RenderViewCreated(render_view_host)); TabContentsObserver, observers_, RenderViewCreated(render_view_host));
if (delegate())
delegate()->RenderViewCreated(this, render_view_host);
} }
void TabContents::RenderViewReady(RenderViewHost* rvh) { void TabContents::RenderViewReady(RenderViewHost* rvh) {
......
...@@ -626,7 +626,6 @@ class TabContents : public PageNavigator, ...@@ -626,7 +626,6 @@ class TabContents : public PageNavigator,
GetRendererManagementDelegate(); GetRendererManagementDelegate();
virtual TabContents* GetAsTabContents(); virtual TabContents* GetAsTabContents();
virtual ViewType::Type GetRenderViewType() const; virtual ViewType::Type GetRenderViewType() const;
virtual int GetBrowserWindowID() const;
virtual void RenderViewCreated(RenderViewHost* render_view_host); virtual void RenderViewCreated(RenderViewHost* render_view_host);
virtual void RenderViewReady(RenderViewHost* render_view_host); virtual void RenderViewReady(RenderViewHost* render_view_host);
virtual void RenderViewGone(RenderViewHost* render_view_host, virtual void RenderViewGone(RenderViewHost* render_view_host,
......
...@@ -237,5 +237,9 @@ TabContentsDelegate::GetJavaScriptDialogCreator() { ...@@ -237,5 +237,9 @@ TabContentsDelegate::GetJavaScriptDialogCreator() {
return JavaScriptDialogCreatorStub::GetInstance(); return JavaScriptDialogCreatorStub::GetInstance();
} }
void TabContentsDelegate::RenderViewCreated(TabContents* source,
RenderViewHost* host) {
}
TabContentsDelegate::~TabContentsDelegate() { TabContentsDelegate::~TabContentsDelegate() {
} }
...@@ -308,6 +308,9 @@ class TabContentsDelegate { ...@@ -308,6 +308,9 @@ class TabContentsDelegate {
// and displays nothing. // and displays nothing.
virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator(); virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator();
// Invoked when a new renderer is created.
virtual void RenderViewCreated(TabContents* source, RenderViewHost* host);
protected: protected:
virtual ~TabContentsDelegate(); virtual ~TabContentsDelegate();
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment