summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 15:45:34 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 15:45:34 +0000
commit6ad0d2496fe2ac946dc54ee7b849593cc426a45b (patch)
tree3c6602f4abef0fbe4d7a745930424ab53732323a
parent3455af4ec36895748b2a8f2063a2a1af805f199a (diff)
downloadchromium_src-6ad0d2496fe2ac946dc54ee7b849593cc426a45b.zip
chromium_src-6ad0d2496fe2ac946dc54ee7b849593cc426a45b.tar.gz
chromium_src-6ad0d2496fe2ac946dc54ee7b849593cc426a45b.tar.bz2
Remove ProvisionalLoadDetails struct and notification, since WebContentsObserver provides the same notification.
BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9662049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126145 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/DEPS1
-rw-r--r--chrome/browser/external_tab_container_win.cc23
-rw-r--r--chrome/browser/external_tab_container_win.h6
-rw-r--r--chrome/browser/instant/instant_loader.cc33
-rw-r--r--chrome/browser/ssl/ssl_browser_tests.cc40
-rw-r--r--content/browser/ssl/ssl_manager.cc6
-rw-r--r--content/browser/tab_contents/provisional_load_details.cc30
-rw-r--r--content/browser/tab_contents/provisional_load_details.h78
-rw-r--r--content/browser/tab_contents/tab_contents.cc16
-rw-r--r--content/content_browser.gypi2
-rw-r--r--content/public/browser/notification_types.h6
11 files changed, 73 insertions, 168 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index 99d6b1b..6023538 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -48,7 +48,6 @@ include_rules = [
"+content/browser/renderer_host/resource_request_details.h",
"+content/browser/renderer_host/resource_request_info_impl.h",
"+content/browser/renderer_host/test_render_view_host.h",
- "+content/browser/tab_contents/provisional_load_details.h",
"+content/browser/tab_contents/tab_contents_view_win.h",
"+content/browser/tab_contents/tab_contents_view_gtk.h",
"+content/browser/tab_contents/tab_contents_view_helper.h",
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 9ab16cd..5812742 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -40,7 +40,6 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/tab_contents/provisional_load_details.h"
#include "content/public/browser/load_notification_details.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/navigation_details.h"
@@ -205,8 +204,6 @@ bool ExternalTabContainer::Init(Profile* profile,
&tab_contents_->web_contents()->GetController();
registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
content::Source<NavigationController>(controller));
- registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
- content::Source<NavigationController>(controller));
registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(controller));
registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB,
@@ -783,6 +780,17 @@ bool ExternalTabContainer::OnMessageReceived(const IPC::Message& message) {
return handled;
}
+void ExternalTabContainer::DidFailProvisionalLoad(
+ int64 frame_id,
+ bool is_main_frame,
+ const GURL& validated_url,
+ int error_code,
+ const string16& error_description) {
+ automation_->Send(new AutomationMsg_NavigationFailed(
+ tab_handle_, error_code, validated_url));
+ ignore_next_load_notification_ = true;
+}
+
void ExternalTabContainer::OnForwardMessageToExternalHost(
const std::string& message,
const std::string& origin,
@@ -847,15 +855,6 @@ void ExternalTabContainer::Observe(
}
break;
}
- case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR: {
- const ProvisionalLoadDetails* load_details =
- content::Details<ProvisionalLoadDetails>(details).ptr();
- automation_->Send(new AutomationMsg_NavigationFailed(
- tab_handle_, load_details->error_code(), load_details->url()));
-
- ignore_next_load_notification_ = true;
- break;
- }
case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: {
if (load_requests_via_automation_) {
RenderViewHost* rvh = content::Details<RenderViewHost>(details).ptr();
diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h
index 8f15f6d..72da46b 100644
--- a/chrome/browser/external_tab_container_win.h
+++ b/chrome/browser/external_tab_container_win.h
@@ -194,6 +194,12 @@ class ExternalTabContainer : public content::WebContentsDelegate,
// Overridden from content::WebContentsObserver:
virtual bool OnMessageReceived(const IPC::Message& message);
+ virtual void DidFailProvisionalLoad(
+ int64 frame_id,
+ bool is_main_frame,
+ const GURL& validated_url,
+ int error_code,
+ const string16& error_description) OVERRIDE;
// Message handlers
void OnForwardMessageToExternalHost(const std::string& message,
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index 14cbf31..a2764e1 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -31,7 +31,6 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/render_messages.h"
-#include "content/browser/tab_contents/provisional_load_details.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
@@ -252,6 +251,12 @@ class InstantLoader::TabContentsDelegateImpl
// content::WebContentsObserver:
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ virtual void DidFailProvisionalLoad(
+ int64 frame_id,
+ bool is_main_frame,
+ const GURL& validated_url,
+ int error_code,
+ const string16& error_description) OVERRIDE;
private:
typedef std::vector<scoped_refptr<history::HistoryAddPageArgs> >
@@ -307,9 +312,6 @@ InstantLoader::TabContentsDelegateImpl::TabContentsDelegateImpl(
DCHECK(loader->preview_contents());
registrar_.Add(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED,
content::Source<WebContents>(loader->preview_contents()->web_contents()));
- registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
- content::Source<NavigationController>(
- &loader->preview_contents()->web_contents()->GetController()));
}
void InstantLoader::TabContentsDelegateImpl::PrepareForNewLoad() {
@@ -415,15 +417,6 @@ void InstantLoader::TabContentsDelegateImpl::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR:
- if (content::Details<ProvisionalLoadDetails>(details)->url() ==
- loader_->url_) {
- // This typically happens with downloads (which are disabled with
- // instant active). To ensure the download happens when the user presses
- // enter we set needs_reload_ to true, which triggers a reload.
- loader_->needs_reload_ = true;
- }
- break;
case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT:
UnregisterForPaintNotifications();
PreviewPainted();
@@ -561,6 +554,20 @@ bool InstantLoader::TabContentsDelegateImpl::OnMessageReceived(
return handled;
}
+void InstantLoader::TabContentsDelegateImpl::DidFailProvisionalLoad(
+ int64 frame_id,
+ bool is_main_frame,
+ const GURL& validated_url,
+ int error_code,
+ const string16& error_description) {
+ if (validated_url == loader_->url_) {
+ // This typically happens with downloads (which are disabled with
+ // instant active). To ensure the download happens when the user presses
+ // enter we set needs_reload_ to true, which triggers a reload.
+ loader_->needs_reload_ = true;
+ }
+}
+
void InstantLoader::TabContentsDelegateImpl::OnSetSuggestions(
int32 page_id,
const std::vector<std::string>& suggestions,
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index 3bd8d86..3c313320 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -21,6 +21,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/security_style.h"
#include "content/public/common/ssl_status.h"
#include "net/base/cert_status_flags.h"
@@ -34,6 +35,39 @@ using content::WebContents;
const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data");
+namespace {
+
+class ProvisionalLoadWaiter : public content::WebContentsObserver {
+ public:
+ explicit ProvisionalLoadWaiter(WebContents* tab)
+ : WebContentsObserver(tab), waiting_(false), seen_(false) {}
+
+ void Wait() {
+ if (seen_)
+ return;
+
+ waiting_ = true;
+ ui_test_utils::RunMessageLoop();
+ }
+
+ void DidFailProvisionalLoad(
+ int64 frame_id,
+ bool is_main_frame,
+ const GURL& validated_url,
+ int error_code,
+ const string16& error_description) OVERRIDE {
+ seen_ = true;
+ if (waiting_)
+ MessageLoopForUI::current()->Quit();
+ }
+
+ private:
+ bool waiting_;
+ bool seen_;
+};
+
+} // namespace
+
class SSLUITest : public InProcessBrowserTest {
typedef net::TestServer::HTTPSOptions HTTPSOptions;
@@ -144,7 +178,7 @@ class SSLUITest : public InProcessBrowserTest {
EXPECT_EQ(expectLoaded, actuallyLoadedContent);
}
- void ProceedThroughInterstitial(content::WebContents* tab) {
+ void ProceedThroughInterstitial(WebContents* tab) {
InterstitialPage* interstitial_page = tab->GetInterstitialPage();
ASSERT_TRUE(interstitial_page);
ui_test_utils::WindowedNotificationObserver observer(
@@ -383,9 +417,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest,
CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
true); // Interstitial showing
- ui_test_utils::WindowedNotificationObserver load_failed_observer(
- content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
- content::NotificationService::AllSources());
+ ProvisionalLoadWaiter load_failed_observer(tab);
// Simulate user clicking on back button (crbug.com/39248).
browser()->GoBack(CURRENT_TAB);
diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc
index b4aa8cc..0322de0 100644
--- a/content/browser/ssl/ssl_manager.cc
+++ b/content/browser/ssl/ssl_manager.cc
@@ -14,7 +14,6 @@
#include "content/browser/ssl/ssl_policy.h"
#include "content/browser/ssl/ssl_request_info.h"
#include "content/browser/tab_contents/navigation_entry_impl.h"
-#include "content/browser/tab_contents/provisional_load_details.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/ssl_status_serialization.h"
#include "content/public/browser/browser_thread.h"
@@ -73,8 +72,6 @@ SSLManager::SSLManager(NavigationControllerImpl* controller)
DCHECK(controller_);
// Subscribe to various notifications.
- registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
- content::Source<NavigationController>(controller_));
registrar_.Add(
this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED,
content::Source<WebContents>(controller_->tab_contents()));
@@ -138,9 +135,6 @@ void SSLManager::Observe(int type,
const content::NotificationDetails& details) {
// Dispatch by type.
switch (type) {
- case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR:
- // Do nothing.
- break;
case content::NOTIFICATION_RESOURCE_RESPONSE_STARTED:
DidStartResourceResponse(
content::Details<ResourceRequestDetails>(details).ptr());
diff --git a/content/browser/tab_contents/provisional_load_details.cc b/content/browser/tab_contents/provisional_load_details.cc
deleted file mode 100644
index 75a218d..0000000
--- a/content/browser/tab_contents/provisional_load_details.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2006-2008 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.
-
-#include "content/browser/tab_contents/provisional_load_details.h"
-
-#include "content/common/ssl_status_serialization.h"
-#include "net/base/net_errors.h"
-
-ProvisionalLoadDetails::ProvisionalLoadDetails(bool is_main_frame,
- bool is_in_page_navigation,
- const GURL& url,
- const std::string& security_info,
- bool is_error_page,
- int64 frame_id)
- : error_code_(net::OK),
- transition_type_(content::PAGE_TRANSITION_LINK),
- url_(url),
- is_main_frame_(is_main_frame),
- is_in_page_navigation_(is_in_page_navigation),
- ssl_cert_id_(0),
- ssl_cert_status_(0),
- ssl_security_bits_(-1),
- ssl_connection_status_(0),
- is_error_page_(is_error_page),
- frame_id_(frame_id) {
- content::DeserializeSecurityInfo(security_info, &ssl_cert_id_,
- &ssl_cert_status_, &ssl_security_bits_,
- &ssl_connection_status_);
-}
diff --git a/content/browser/tab_contents/provisional_load_details.h b/content/browser/tab_contents/provisional_load_details.h
deleted file mode 100644
index 9e5d256..0000000
--- a/content/browser/tab_contents/provisional_load_details.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// 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_BROWSER_TAB_CONTENTS_PROVISIONAL_LOAD_DETAILS_H_
-#define CONTENT_BROWSER_TAB_CONTENTS_PROVISIONAL_LOAD_DETAILS_H_
-#pragma once
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "content/public/common/page_transition_types.h"
-#include "googleurl/src/gurl.h"
-#include "net/base/cert_status_flags.h"
-
-// This class captures some of the information associated to the provisional
-// load of a frame. It is provided as Details with the
-// NOTIFY_FAIL_PROVISIONAL_LOAD_WITH_ERROR notification
-// (see notification_types.h).
-
-// TODO(brettw) this mostly duplicates
-// NavigationController::LoadCommittedDetails, it would be nice to unify these
-// somehow.
-class ProvisionalLoadDetails {
- public:
- ProvisionalLoadDetails(bool main_frame,
- bool in_page_navigation,
- const GURL& url,
- const std::string& security_info,
- bool is_error_page,
- int64 frame_id);
- virtual ~ProvisionalLoadDetails() { }
-
- void set_error_code(int error_code) { error_code_ = error_code; }
- int error_code() const { return error_code_; }
-
- void set_transition_type(content::PageTransition transition_type) {
- transition_type_ = transition_type;
- }
- content::PageTransition transition_type() const {
- return transition_type_;
- }
-
- const GURL& url() const { return url_; }
-
- bool main_frame() const { return is_main_frame_; }
-
- bool in_page_navigation() const { return is_in_page_navigation_; }
-
- int ssl_cert_id() const { return ssl_cert_id_; }
-
- net::CertStatus ssl_cert_status() const { return ssl_cert_status_; }
-
- int ssl_security_bits() const { return ssl_security_bits_; }
-
- int ssl_connection_status() const { return ssl_connection_status_; }
-
- bool is_error_page() const { return is_error_page_; }
-
- int64 frame_id() const { return frame_id_; }
-
- private:
- int error_code_;
- content::PageTransition transition_type_;
- GURL url_;
- bool is_main_frame_;
- bool is_in_page_navigation_;
- int ssl_cert_id_;
- net::CertStatus ssl_cert_status_;
- int ssl_security_bits_;
- int ssl_connection_status_;
- bool is_error_page_;
- int64 frame_id_;
-
- DISALLOW_COPY_AND_ASSIGN(ProvisionalLoadDetails);
-};
-
-#endif // CONTENT_BROWSER_TAB_CONTENTS_PROVISIONAL_LOAD_DETAILS_H_
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 1bc7503..094c6cb 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -32,7 +32,6 @@
#include "content/browser/site_instance_impl.h"
#include "content/browser/tab_contents/interstitial_page_impl.h"
#include "content/browser/tab_contents/navigation_entry_impl.h"
-#include "content/browser/tab_contents/provisional_load_details.h"
#include "content/browser/webui/web_ui_impl.h"
#include "content/common/intents_messages.h"
#include "content/common/ssl_status_serialization.h"
@@ -1489,21 +1488,6 @@ void TabContents::OnDidFailProvisionalLoadWithError(
render_manager_.RendererAbortedProvisionalLoad(GetRenderViewHost());
}
- // Send out a notification that we failed a provisional load with an error.
- ProvisionalLoadDetails details(
- params.is_main_frame,
- controller_.IsURLInPageNavigation(validated_url),
- validated_url,
- std::string(),
- false,
- params.frame_id);
- details.set_error_code(params.error_code);
-
- content::NotificationService::current()->Notify(
- content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
- content::Source<NavigationController>(&controller_),
- content::Details<ProvisionalLoadDetails>(&details));
-
FOR_EACH_OBSERVER(WebContentsObserver,
observers_,
DidFailProvisionalLoad(params.frame_id,
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 2076bf5..c8a15bf 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -645,8 +645,6 @@
'browser/tab_contents/navigation_entry_impl.h',
'browser/tab_contents/popup_menu_helper_mac.h',
'browser/tab_contents/popup_menu_helper_mac.mm',
- 'browser/tab_contents/provisional_load_details.cc',
- 'browser/tab_contents/provisional_load_details.h',
'browser/tab_contents/render_view_host_manager.cc',
'browser/tab_contents/render_view_host_manager.h',
'browser/tab_contents/tab_contents.cc',
diff --git a/content/public/browser/notification_types.h b/content/public/browser/notification_types.h
index c2605046..111b47f 100644
--- a/content/public/browser/notification_types.h
+++ b/content/public/browser/notification_types.h
@@ -102,12 +102,6 @@ enum NotificationType {
// are provided.
NOTIFICATION_LOAD_FROM_MEMORY_CACHE,
- // A provisional content load has failed with an error. The source will be
- // a Source<NavigationController> corresponding to the tab in which the
- // load occurred. Details in the form of a ProvisionalLoadDetails object
- // are provided.
- NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
-
// A response has been received for a resource request. The source will be
// a Source<WebContents> corresponding to the tab in which the request was
// issued. Details in the form of a ResourceRequestDetails object are