Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 6 #define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "chrome/common/content_settings.h" | 13 #include "chrome/common/content_settings.h" |
| 14 #include "chrome/common/custom_handlers/protocol_handler.h" | |
| 14 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 17 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
| 18 | 19 |
| 19 class ContentSettingBubbleModelDelegate; | 20 class ContentSettingBubbleModelDelegate; |
| 20 class Profile; | 21 class Profile; |
| 22 class ProtocolHandlerRegistry; | |
| 21 class TabContents; | 23 class TabContents; |
| 22 | 24 |
| 23 // This model provides data for ContentSettingBubble, and also controls | 25 // This model provides data for ContentSettingBubble, and also controls |
| 24 // the action triggered when the allow / block radio buttons are triggered. | 26 // the action triggered when the allow / block radio buttons are triggered. |
| 25 class ContentSettingBubbleModel : public content::NotificationObserver { | 27 class ContentSettingBubbleModel : public content::NotificationObserver { |
| 26 public: | 28 public: |
| 27 typedef ContentSettingBubbleModelDelegate Delegate; | 29 typedef ContentSettingBubbleModelDelegate Delegate; |
| 28 | 30 |
| 29 struct PopupItem { | 31 struct PopupItem { |
| 30 SkBitmap bitmap; | 32 SkBitmap bitmap; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 TabContents* tab_contents_; | 129 TabContents* tab_contents_; |
| 128 Profile* profile_; | 130 Profile* profile_; |
| 129 ContentSettingsType content_type_; | 131 ContentSettingsType content_type_; |
| 130 BubbleContent bubble_content_; | 132 BubbleContent bubble_content_; |
| 131 // A registrar for listening for TAB_CONTENTS_DESTROYED notifications. | 133 // A registrar for listening for TAB_CONTENTS_DESTROYED notifications. |
| 132 content::NotificationRegistrar registrar_; | 134 content::NotificationRegistrar registrar_; |
| 133 | 135 |
| 134 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleModel); | 136 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleModel); |
| 135 }; | 137 }; |
| 136 | 138 |
| 139 class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel { | |
|
Greg Billock
2012/07/19 14:49:57
Looks like this still needs merged.
Steve McKay
2012/07/19 16:59:55
Done.
| |
| 140 public: | |
| 141 ContentSettingTitleAndLinkModel(Delegate* delegate, | |
| 142 TabContents* tab_contents, | |
| 143 Profile* profile, | |
| 144 ContentSettingsType content_type); | |
| 145 virtual ~ContentSettingTitleAndLinkModel() {} | |
| 146 Delegate* delegate() const { return delegate_; } | |
| 147 | |
| 148 private: | |
| 149 void SetBlockedResources(); | |
| 150 void SetTitle(); | |
| 151 void SetManageLink(); | |
| 152 virtual void OnManageLinkClicked() OVERRIDE; | |
| 153 | |
| 154 Delegate* delegate_; | |
| 155 }; | |
| 156 | |
| 157 class ContentSettingRPHBubbleModel : public ContentSettingTitleAndLinkModel { | |
| 158 public: | |
| 159 | |
| 160 // Deprecated. Use constructor that accepts a |ProtocolHandlerRegistry|. | |
| 161 ContentSettingRPHBubbleModel(Delegate* delegate, | |
| 162 TabContents* tab_contents, | |
| 163 Profile* profile, | |
| 164 ContentSettingsType content_type); | |
| 165 | |
| 166 ContentSettingRPHBubbleModel(Delegate* delegate, | |
| 167 TabContents* tab_contents, | |
| 168 Profile* profile, | |
| 169 ProtocolHandlerRegistry* registry, | |
| 170 ContentSettingsType content_type); | |
| 171 | |
| 172 virtual void OnRadioClicked(int radio_index) OVERRIDE; | |
| 173 | |
| 174 private: | |
| 175 // These states must match the order of appearance of the radio buttons | |
| 176 // in the XIB file for the Mac port. | |
| 177 enum RPHState { | |
| 178 RPH_ALLOW = 0, | |
| 179 RPH_BLOCK, | |
| 180 RPH_IGNORE, | |
| 181 }; | |
| 182 | |
| 183 void Init(); | |
| 184 void RegisterProtocolHandler(); | |
| 185 void UnregisterProtocolHandler(); | |
| 186 void IgnoreProtocolHandler(); | |
| 187 void ClearOrSetPreviousHandler(); | |
| 188 | |
| 189 int selected_item_; | |
| 190 ProtocolHandlerRegistry* registry_; | |
| 191 ProtocolHandler pending_handler_; | |
| 192 ProtocolHandler previous_handler_; | |
| 193 }; | |
| 194 | |
| 137 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 195 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
| OLD | NEW |