| Index: chrome/browser/ui/content_settings/content_setting_bubble_model.cc
|
| diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
|
| index 1437b1ccdcbbc975278ebf6ec87b1bf93b28d004..9e943960da82d1df91166d7be58704746ddf7afe 100644
|
| --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
|
| +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
|
| @@ -9,6 +9,7 @@
|
| #include "chrome/browser/content_settings/cookie_settings.h"
|
| #include "chrome/browser/content_settings/tab_specific_content_settings.h"
|
| #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
|
| +#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
|
| #include "chrome/browser/favicon/favicon_tab_helper.h"
|
| #include "chrome/browser/infobars/infobar_tab_helper.h"
|
| #include "chrome/browser/prefs/pref_service.h"
|
| @@ -606,16 +607,36 @@ ContentSettingRPHBubbleModel::ContentSettingRPHBubbleModel(
|
| Delegate* delegate,
|
| TabContents* tab_contents,
|
| Profile* profile,
|
| + ProtocolHandlerRegistry* registry,
|
| ContentSettingsType content_type)
|
| : ContentSettingTitleAndLinkModel(
|
| delegate, tab_contents, profile, content_type),
|
| selected_item_(0),
|
| + registry_(registry),
|
| pending_handler_(ProtocolHandler::EmptyProtocolHandler()),
|
| previous_handler_(ProtocolHandler::EmptyProtocolHandler()) {
|
| - DCHECK_EQ(CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, content_type);
|
| + Init();
|
| +}
|
| +
|
| +ContentSettingRPHBubbleModel::ContentSettingRPHBubbleModel(
|
| + Delegate* delegate,
|
| + TabContents* tab_contents,
|
| + Profile* profile,
|
| + ContentSettingsType content_type)
|
| + : ContentSettingTitleAndLinkModel(
|
| + delegate, tab_contents, profile, content_type),
|
| + selected_item_(0),
|
| + registry_(ProtocolHandlerRegistryFactory::GetForProfile(profile)),
|
| + pending_handler_(ProtocolHandler::EmptyProtocolHandler()),
|
| + previous_handler_(ProtocolHandler::EmptyProtocolHandler()) {
|
| + Init();
|
| +}
|
| +
|
| +void ContentSettingRPHBubbleModel::Init() {
|
| + DCHECK_EQ(CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, content_type());
|
|
|
| TabSpecificContentSettings* content_settings =
|
| - tab_contents->content_settings();
|
| + tab_contents()->content_settings();
|
| pending_handler_ = content_settings->pending_protocol_handler();
|
| previous_handler_ = content_settings->previous_protocol_handler();
|
|
|
| @@ -650,7 +671,7 @@ ContentSettingRPHBubbleModel::ContentSettingRPHBubbleModel(
|
| std::string radio_ignore_label =
|
| l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_IGNORE);
|
|
|
| - GURL url = tab_contents->web_contents()->GetURL();
|
| + GURL url = tab_contents()->web_contents()->GetURL();
|
| RadioGroup radio_group;
|
| radio_group.url = url;
|
|
|
| @@ -690,26 +711,22 @@ void ContentSettingRPHBubbleModel::OnRadioClicked(int radio_index) {
|
| void ContentSettingRPHBubbleModel::RegisterProtocolHandler() {
|
| // A no-op if the handler hasn't been ignored, but needed in case the user
|
| // selects sequences like register/ignore/register.
|
| - profile()->GetProtocolHandlerRegistry()->RemoveIgnoredHandler(
|
| - pending_handler_);
|
| + registry_->RemoveIgnoredHandler(pending_handler_);
|
|
|
| - profile()->GetProtocolHandlerRegistry()->OnAcceptRegisterProtocolHandler(
|
| - pending_handler_);
|
| + registry_->OnAcceptRegisterProtocolHandler(pending_handler_);
|
| tab_contents()->content_settings()->set_pending_protocol_handler_setting(
|
| CONTENT_SETTING_ALLOW);
|
| }
|
|
|
| void ContentSettingRPHBubbleModel::UnregisterProtocolHandler() {
|
| - profile()->GetProtocolHandlerRegistry()->OnDenyRegisterProtocolHandler(
|
| - pending_handler_);
|
| + registry_->OnDenyRegisterProtocolHandler(pending_handler_);
|
| tab_contents()->content_settings()->set_pending_protocol_handler_setting(
|
| CONTENT_SETTING_BLOCK);
|
| ClearOrSetPreviousHandler();
|
| }
|
|
|
| void ContentSettingRPHBubbleModel::IgnoreProtocolHandler() {
|
| - profile()->GetProtocolHandlerRegistry()->OnIgnoreRegisterProtocolHandler(
|
| - pending_handler_);
|
| + registry_->OnIgnoreRegisterProtocolHandler(pending_handler_);
|
| tab_contents()->content_settings()->set_pending_protocol_handler_setting(
|
| CONTENT_SETTING_DEFAULT);
|
| ClearOrSetPreviousHandler();
|
| @@ -717,11 +734,9 @@ void ContentSettingRPHBubbleModel::IgnoreProtocolHandler() {
|
|
|
| void ContentSettingRPHBubbleModel::ClearOrSetPreviousHandler() {
|
| if (previous_handler_.IsEmpty()) {
|
| - profile()->GetProtocolHandlerRegistry()->ClearDefault(
|
| - pending_handler_.protocol());
|
| + registry_->ClearDefault(pending_handler_.protocol());
|
| } else {
|
| - profile()->GetProtocolHandlerRegistry()->OnAcceptRegisterProtocolHandler(
|
| - previous_handler_);
|
| + registry_->OnAcceptRegisterProtocolHandler(previous_handler_);
|
| }
|
| }
|
|
|
|
|