summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-28 21:14:51 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-28 21:14:51 +0000
commit867ea80559a87f8870e550c1e1e7630a7d63daa3 (patch)
tree5e30ff70ef7a6873f2f2fab4ab9f66f641e08800
parentbe149a3f00285713d18efe9c0fbe8d95b8b343a7 (diff)
downloadchromium_src-867ea80559a87f8870e550c1e1e7630a7d63daa3.zip
chromium_src-867ea80559a87f8870e550c1e1e7630a7d63daa3.tar.gz
chromium_src-867ea80559a87f8870e550c1e1e7630a7d63daa3.tar.bz2
Relanding this as the earlier attempt broke chrome frame tests.
Register the RenderViewHost instance created when a desktop notification bubble is displayed in CF with the AutomationResourceMessagefilter. This ensures that any HTTP requests issued by this bubble go through the host network stack implemenation. I also fixed a bug in the pending http jobs resumption code in the AutomationResourceMessagefilter which could cause a job to be registered in the old filter and the new filter for a while. Fixes bug http://code.google.com/p/chromium/issues/detail?id=64251 BUG=64251 Review URL: http://codereview.chromium.org/8414030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107795 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/automation_resource_message_filter.cc17
-rw-r--r--chrome/browser/external_tab_container_win.cc59
2 files changed, 47 insertions, 29 deletions
diff --git a/chrome/browser/automation/automation_resource_message_filter.cc b/chrome/browser/automation/automation_resource_message_filter.cc
index ec98e61d..574afd8 100644
--- a/chrome/browser/automation/automation_resource_message_filter.cc
+++ b/chrome/browser/automation/automation_resource_message_filter.cc
@@ -265,6 +265,16 @@ void AutomationResourceMessageFilter::RegisterRenderViewInIOThread(
if (automation_details_iter != filtered_render_views_.Get().end()) {
DCHECK_GT(automation_details_iter->second.ref_count, 0);
automation_details_iter->second.ref_count++;
+ // The tab handle may have changed:-
+ // 1.A external tab container is being destroyed and a new one is being
+ // created.
+ // 2.The external tab container being destroyed receives a RVH created
+ // notification for the new RVH created to host the newly created tab.
+ // In this case the tab handle in the AutomationDetails structure would
+ // be invalid as it points to a destroyed tab.
+ // We need to replace the handle of the external tab being destroyed with
+ // the new one that is being created."
+ automation_details_iter->second.tab_handle = tab_handle;
} else {
filtered_render_views_.Get()[renderer_key] =
AutomationDetails(tab_handle, filter, pending_view);
@@ -471,15 +481,14 @@ void AutomationResourceMessageFilter::ResumeJobsForPendingView(
DCHECK(new_filter != NULL);
RequestMap pending_requests = old_filter->pending_request_map_;
+ old_filter->pending_request_map_.clear();
- for (RequestMap::iterator index = old_filter->pending_request_map_.begin();
- index != old_filter->pending_request_map_.end(); index++) {
+ for (RequestMap::iterator index = pending_requests.begin();
+ index != pending_requests.end(); index++) {
URLRequestAutomationJob* job = (*index).second;
DCHECK_EQ(job->message_filter(), old_filter);
DCHECK(job->is_pending());
// StartPendingJob will register the job with the new filter.
job->StartPendingJob(tab_handle, new_filter);
}
-
- old_filter->pending_request_map_.clear();
}
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index dc8992c..c2e1bf6 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -219,6 +219,8 @@ bool ExternalTabContainer::Init(Profile* profile,
content::Source<TabContents>(tab_contents_->tab_contents()));
registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED,
content::NotificationService::AllSources());
+ registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED,
+ content::NotificationService::AllSources());
TabContentsObserver::Observe(tab_contents_->tab_contents());
@@ -838,33 +840,33 @@ void ExternalTabContainer::Observe(int type,
break;
}
case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
- if (ignore_next_load_notification_) {
- ignore_next_load_notification_ = false;
- return;
- }
+ if (ignore_next_load_notification_) {
+ ignore_next_load_notification_ = false;
+ return;
+ }
- const content::LoadCommittedDetails* commit =
- content::Details<content::LoadCommittedDetails>(details).ptr();
-
- if (commit->http_status_code >= kHttpClientErrorStart &&
- commit->http_status_code <= kHttpServerErrorEnd) {
- automation_->Send(new AutomationMsg_NavigationFailed(
- tab_handle_, commit->http_status_code, commit->entry->url()));
-
- ignore_next_load_notification_ = true;
- } else {
- NavigationInfo navigation_info;
- // When the previous entry index is invalid, it will be -1, which
- // will still make the computation come out right (navigating to the
- // 0th entry will be +1).
- if (InitNavigationInfo(&navigation_info, commit->type,
- commit->previous_entry_index -
- tab_contents_->controller().last_committed_entry_index()))
- automation_->Send(new AutomationMsg_DidNavigate(tab_handle_,
- navigation_info));
- }
- break;
+ const content::LoadCommittedDetails* commit =
+ content::Details<content::LoadCommittedDetails>(details).ptr();
+
+ if (commit->http_status_code >= kHttpClientErrorStart &&
+ commit->http_status_code <= kHttpServerErrorEnd) {
+ automation_->Send(new AutomationMsg_NavigationFailed(
+ tab_handle_, commit->http_status_code, commit->entry->url()));
+
+ ignore_next_load_notification_ = true;
+ } else {
+ NavigationInfo navigation_info;
+ // When the previous entry index is invalid, it will be -1, which
+ // will still make the computation come out right (navigating to the
+ // 0th entry will be +1).
+ if (InitNavigationInfo(&navigation_info, commit->type,
+ commit->previous_entry_index -
+ tab_contents_->controller().last_committed_entry_index()))
+ automation_->Send(new AutomationMsg_DidNavigate(tab_handle_,
+ navigation_info));
}
+ break;
+ }
case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR: {
const ProvisionalLoadDetails* load_details =
content::Details<ProvisionalLoadDetails>(details).ptr();
@@ -888,6 +890,13 @@ void ExternalTabContainer::Observe(int type,
}
break;
}
+ case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED: {
+ if (load_requests_via_automation_) {
+ RenderViewHost* rvh = content::Source<RenderViewHost>(source).ptr();
+ RegisterRenderViewHostForAutomation(rvh, false);
+ }
+ break;
+ }
default:
NOTREACHED();
}