summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-04 03:39:53 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-04 03:39:53 +0000
commit1d06a9d4459fbe76d5ea6e6a11e1f533768be4fb (patch)
tree13a912567fce7aa40f3bb784074a48b2a5541add /chrome
parenta112bdbcca06d33f07ea66042a32e57f65fb2b69 (diff)
downloadchromium_src-1d06a9d4459fbe76d5ea6e6a11e1f533768be4fb.zip
chromium_src-1d06a9d4459fbe76d5ea6e6a11e1f533768be4fb.tar.gz
chromium_src-1d06a9d4459fbe76d5ea6e6a11e1f533768be4fb.tar.bz2
Cleanup the SSLPolicyBackend class.
This removes some code that now are obsolete. BUG=None TEST=trybots Review URL: http://codereview.chromium.org/3337005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58577 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/ssl/ssl_manager.cc16
-rw-r--r--chrome/browser/ssl/ssl_manager.h26
-rw-r--r--chrome/browser/ssl/ssl_policy_backend.cc102
-rw-r--r--chrome/browser/ssl/ssl_policy_backend.h47
4 files changed, 3 insertions, 188 deletions
diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc
index 39e90a4..a2a34ab 100644
--- a/chrome/browser/ssl/ssl_manager.cc
+++ b/chrome/browser/ssl/ssl_manager.cc
@@ -155,7 +155,6 @@ void SSLManager::DidCommitProvisionalLoad(
entry->ssl().set_security_bits(ssl_security_bits);
entry->ssl().set_connection_status(ssl_connection_status);
}
- backend_.ShowPendingMessages();
}
UpdateEntry(entry);
@@ -182,8 +181,7 @@ void SSLManager::Observe(NotificationType type,
// Dispatch by type.
switch (type.value) {
case NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR:
- DidFailProvisionalLoadWithError(
- Details<ProvisionalLoadDetails>(details).ptr());
+ // Do nothing.
break;
case NotificationType::RESOURCE_RESPONSE_STARTED:
DidStartResourceResponse(Details<ResourceRequestDetails>(details).ptr());
@@ -225,18 +223,6 @@ void SSLManager::DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details) {
policy()->OnRequestStarted(info.get());
}
-void SSLManager::DidFailProvisionalLoadWithError(
- ProvisionalLoadDetails* details) {
- DCHECK(details);
-
- // Ignore in-page navigations.
- if (details->in_page_navigation())
- return;
-
- if (details->main_frame())
- backend_.ClearPendingMessages();
-}
-
void SSLManager::DidStartResourceResponse(ResourceRequestDetails* details) {
DCHECK(details);
diff --git a/chrome/browser/ssl/ssl_manager.h b/chrome/browser/ssl/ssl_manager.h
index 62e1138..6340f57 100644
--- a/chrome/browser/ssl/ssl_manager.h
+++ b/chrome/browser/ssl/ssl_manager.h
@@ -24,7 +24,6 @@ class ResourceDispatcherHost;
class ResourceRedirectDetails;
class ResourceRequestDetails;
class SSLPolicy;
-class Task;
class URLRequest;
// The SSLManager SSLManager controls the SSL UI elements in a TabContents. It
@@ -98,36 +97,11 @@ class SSLManager : public NotificationObserver {
const NotificationDetails& details);
private:
- // SSLMessageInfo contains the information necessary for displaying a message
- // in an info-bar.
- struct SSLMessageInfo {
- public:
- explicit SSLMessageInfo(const std::wstring& text)
- : message(text),
- action(NULL) { }
-
- SSLMessageInfo(const std::wstring& message,
- const std::wstring& link_text,
- Task* action)
- : message(message), link_text(link_text), action(action) { }
-
- // Overridden so that std::find works.
- bool operator==(const std::wstring& other_message) const {
- // We are uniquing SSLMessageInfo by their message only.
- return message == other_message;
- }
-
- std::wstring message;
- std::wstring link_text;
- Task* action;
- };
-
// Entry points for notifications to which we subscribe. Note that
// DidCommitProvisionalLoad uses the abstract NotificationDetails type since
// the type we need is in NavigationController which would create a circular
// header file dependency.
void DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details);
- void DidFailProvisionalLoadWithError(ProvisionalLoadDetails* details);
void DidStartResourceResponse(ResourceRequestDetails* details);
void DidReceiveResourceRedirect(ResourceRedirectDetails* details);
void DidChangeSSLInternalState();
diff --git a/chrome/browser/ssl/ssl_policy_backend.cc b/chrome/browser/ssl/ssl_policy_backend.cc
index 6d7b6ab..76d75ac 100644
--- a/chrome/browser/ssl/ssl_policy_backend.cc
+++ b/chrome/browser/ssl/ssl_policy_backend.cc
@@ -4,69 +4,13 @@
#include "chrome/browser/ssl/ssl_policy_backend.h"
-#include "app/resource_bundle.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/ssl/ssl_host_state.h"
-#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
-#include "chrome/browser/tab_contents/navigation_entry.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-
-class SSLInfoBarDelegate : public ConfirmInfoBarDelegate {
- public:
- SSLInfoBarDelegate(TabContents* contents,
- const string16& message,
- const string16& button_label,
- Task* task)
- : ConfirmInfoBarDelegate(contents),
- message_(message),
- button_label_(button_label),
- task_(task) {
- }
- virtual ~SSLInfoBarDelegate() {}
-
- // Overridden from ConfirmInfoBarDelegate:
- virtual void InfoBarClosed() {
- delete this;
- }
- virtual string16 GetMessageText() const {
- return message_;
- }
- virtual SkBitmap* GetIcon() const {
- return ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_INFOBAR_SSL_WARNING);
- }
- virtual int GetButtons() const {
- return !button_label_.empty() ? BUTTON_OK : BUTTON_NONE;
- }
- virtual string16 GetButtonLabel(InfoBarButton button) const {
- return button_label_;
- }
- virtual bool Accept() {
- if (task_.get()) {
- task_->Run();
- task_.reset(); // Ensures we won't run the task again.
- }
- return true;
- }
-
- private:
- // Labels for the InfoBar's message and button.
- string16 message_;
- string16 button_label_;
-
- // A task to run when the InfoBar is accepted.
- scoped_ptr<Task> task_;
-
- DISALLOW_COPY_AND_ASSIGN(SSLInfoBarDelegate);
-};
SSLPolicyBackend::SSLPolicyBackend(NavigationController* controller)
- : controller_(controller),
- ssl_host_state_(controller->profile()->GetSSLHostState()) {
- DCHECK(controller_);
+ : ssl_host_state_(controller->profile()->GetSSLHostState()) {
+ DCHECK(controller);
}
void SSLPolicyBackend::HostRanInsecureContent(const std::string& host, int id) {
@@ -93,45 +37,3 @@ net::CertPolicy::Judgment SSLPolicyBackend::QueryPolicy(
net::X509Certificate* cert, const std::string& host) {
return ssl_host_state_->QueryPolicy(cert, host);
}
-
-void SSLPolicyBackend::ShowPendingMessages() {
- std::vector<SSLMessageInfo>::const_iterator iter;
- for (iter = pending_messages_.begin();
- iter != pending_messages_.end(); ++iter) {
- ShowMessageWithLink(iter->message, iter->link_text, iter->action);
- }
- ClearPendingMessages();
-}
-
-void SSLPolicyBackend::ClearPendingMessages() {
- pending_messages_.clear();
-}
-
-void SSLPolicyBackend::ShowMessageWithLink(const string16& msg,
- const string16& link_text,
- Task* task) {
- if (controller_->pending_entry()) {
- // The main frame is currently loading, wait until the load is committed so
- // to show the error on the right page (once the location bar shows the
- // correct url).
- if (std::find(pending_messages_.begin(), pending_messages_.end(), msg) ==
- pending_messages_.end())
- pending_messages_.push_back(SSLMessageInfo(msg, link_text, task));
-
- return;
- }
-
- NavigationEntry* entry = controller_->GetActiveEntry();
- if (!entry)
- return;
-
- // Don't show the message if the user doesn't expect an authenticated session.
- if (entry->ssl().security_style() <= SECURITY_STYLE_UNAUTHENTICATED)
- return;
-
- if (controller_->tab_contents()) {
- controller_->tab_contents()->AddInfoBar(
- new SSLInfoBarDelegate(controller_->tab_contents(),
- msg, link_text, task));
- }
-}
diff --git a/chrome/browser/ssl/ssl_policy_backend.h b/chrome/browser/ssl/ssl_policy_backend.h
index 06bc8fe..813f2be 100644
--- a/chrome/browser/ssl/ssl_policy_backend.h
+++ b/chrome/browser/ssl/ssl_policy_backend.h
@@ -15,7 +15,6 @@
class NavigationController;
class SSLHostState;
-class Task;
class SSLPolicyBackend {
public:
@@ -37,56 +36,10 @@ class SSLPolicyBackend {
net::CertPolicy::Judgment QueryPolicy(
net::X509Certificate* cert, const std::string& host);
- // Shows the pending messages (in info-bars) if any.
- void ShowPendingMessages();
-
- // Clears any pending messages.
- void ClearPendingMessages();
-
private:
- // SSLMessageInfo contains the information necessary for displaying a message
- // in an info-bar.
- struct SSLMessageInfo {
- public:
- explicit SSLMessageInfo(const string16& text)
- : message(text),
- action(NULL) { }
-
- SSLMessageInfo(const string16& message,
- const string16& link_text,
- Task* action)
- : message(message), link_text(link_text), action(action) { }
-
- // Overridden so that std::find works.
- bool operator==(const string16& other_message) const {
- // We are uniquing SSLMessageInfo by their message only.
- return message == other_message;
- }
-
- string16 message;
- string16 link_text;
- Task* action;
- };
-
- // Ensure that the specified message is displayed to the user. This will
- // display an InfoBar at the top of the associated tab. It also contains a
- // link that when clicked run the specified task. The SSL Manager becomes the
- // owner of the task.
- void ShowMessageWithLink(const string16& msg,
- const string16& link_text,
- Task* task);
-
- // The NavigationController that owns this SSLManager. We are responsible
- // for the security UI of this tab.
- NavigationController* controller_;
-
// SSL state specific for each host.
SSLHostState* ssl_host_state_;
- // The list of messages that should be displayed (in info bars) when the page
- // currently loading had loaded.
- std::vector<SSLMessageInfo> pending_messages_;
-
DISALLOW_COPY_AND_ASSIGN(SSLPolicyBackend);
};