OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 5 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/content_settings/content_settings_utils.h" | 8 #include "chrome/browser/content_settings/content_settings_utils.h" |
9 #include "chrome/browser/content_settings/cookie_settings.h" | 9 #include "chrome/browser/content_settings/cookie_settings.h" |
10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 if (radio_index == RPH_ALLOW) | 684 if (radio_index == RPH_ALLOW) |
685 RegisterProtocolHandler(); | 685 RegisterProtocolHandler(); |
686 else if (radio_index == RPH_BLOCK) | 686 else if (radio_index == RPH_BLOCK) |
687 UnregisterProtocolHandler(); | 687 UnregisterProtocolHandler(); |
688 else if (radio_index == RPH_IGNORE) | 688 else if (radio_index == RPH_IGNORE) |
689 IgnoreProtocolHandler(); | 689 IgnoreProtocolHandler(); |
690 else | 690 else |
691 NOTREACHED(); | 691 NOTREACHED(); |
692 } | 692 } |
693 | 693 |
| 694 void ContentSettingRPHBubbleModel::OnDoneClicked() { |
| 695 // The user has one chance to deal with the RPH content setting UI, |
| 696 // then we remove it. |
| 697 tab_contents()->content_settings()->ClearPendingProtocolHandler(); |
| 698 content::NotificationService::current()->Notify( |
| 699 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
| 700 content::Source<WebContents>(tab_contents()->web_contents()), |
| 701 content::NotificationService::NoDetails()); |
| 702 } |
| 703 |
694 void ContentSettingRPHBubbleModel::RegisterProtocolHandler() { | 704 void ContentSettingRPHBubbleModel::RegisterProtocolHandler() { |
695 // A no-op if the handler hasn't been ignored, but needed in case the user | 705 // A no-op if the handler hasn't been ignored, but needed in case the user |
696 // selects sequences like register/ignore/register. | 706 // selects sequences like register/ignore/register. |
697 registry_->RemoveIgnoredHandler(pending_handler_); | 707 registry_->RemoveIgnoredHandler(pending_handler_); |
698 | 708 |
699 registry_->OnAcceptRegisterProtocolHandler(pending_handler_); | 709 registry_->OnAcceptRegisterProtocolHandler(pending_handler_); |
700 tab_contents()->content_settings()->set_pending_protocol_handler_setting( | 710 tab_contents()->content_settings()->set_pending_protocol_handler_setting( |
701 CONTENT_SETTING_ALLOW); | 711 CONTENT_SETTING_ALLOW); |
702 } | 712 } |
703 | 713 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 const content::NotificationDetails& details) { | 813 const content::NotificationDetails& details) { |
804 if (type == chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED) { | 814 if (type == chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED) { |
805 DCHECK_EQ(tab_contents_, content::Source<TabContents>(source).ptr()); | 815 DCHECK_EQ(tab_contents_, content::Source<TabContents>(source).ptr()); |
806 tab_contents_ = NULL; | 816 tab_contents_ = NULL; |
807 } else { | 817 } else { |
808 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 818 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
809 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 819 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
810 profile_ = NULL; | 820 profile_ = NULL; |
811 } | 821 } |
812 } | 822 } |
OLD | NEW |