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 "chrome/common/custom_handlers/protocol_handler.h" | 
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" | 
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" | 
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" | 
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" | 
| 19 | 19 | 
| 20 class ContentSettingBubbleModelDelegate; | 20 class ContentSettingBubbleModelDelegate; | 
| 21 class Profile; | 21 class Profile; | 
| 22 class ProtocolHandlerRegistry; | |
| 22 class TabContents; | 23 class TabContents; | 
| 23 | 24 | 
| 24 // This model provides data for ContentSettingBubble, and also controls | 25 // This model provides data for ContentSettingBubble, and also controls | 
| 25 // the action triggered when the allow / block radio buttons are triggered. | 26 // the action triggered when the allow / block radio buttons are triggered. | 
| 26 class ContentSettingBubbleModel : public content::NotificationObserver { | 27 class ContentSettingBubbleModel : public content::NotificationObserver { | 
| 27 public: | 28 public: | 
| 28 typedef ContentSettingBubbleModelDelegate Delegate; | 29 typedef ContentSettingBubbleModelDelegate Delegate; | 
| 29 | 30 | 
| 30 struct PopupItem { | 31 struct PopupItem { | 
| 31 SkBitmap bitmap; | 32 SkBitmap bitmap; | 
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 void SetBlockedResources(); | 149 void SetBlockedResources(); | 
| 149 void SetTitle(); | 150 void SetTitle(); | 
| 150 void SetManageLink(); | 151 void SetManageLink(); | 
| 151 virtual void OnManageLinkClicked() OVERRIDE; | 152 virtual void OnManageLinkClicked() OVERRIDE; | 
| 152 | 153 | 
| 153 Delegate* delegate_; | 154 Delegate* delegate_; | 
| 154 }; | 155 }; | 
| 155 | 156 | 
| 156 class ContentSettingRPHBubbleModel : public ContentSettingTitleAndLinkModel { | 157 class ContentSettingRPHBubbleModel : public ContentSettingTitleAndLinkModel { | 
| 157 public: | 158 public: | 
| 159 | |
| 160 // Deprecated. Use constructor that accepts a |ProtocolHandlerRegistry|. | |
| 
 
Bernhard Bauer
2012/07/19 20:52:56
Remove this constructor please :)
 
 | |
| 158 ContentSettingRPHBubbleModel(Delegate* delegate, | 161 ContentSettingRPHBubbleModel(Delegate* delegate, | 
| 159 TabContents* tab_contents, | 162 TabContents* tab_contents, | 
| 160 Profile* profile, | 163 Profile* profile, | 
| 161 ContentSettingsType content_type); | 164 ContentSettingsType content_type); | 
| 162 | 165 | 
| 166 ContentSettingRPHBubbleModel(Delegate* delegate, | |
| 167 TabContents* tab_contents, | |
| 168 Profile* profile, | |
| 169 ProtocolHandlerRegistry* registry, | |
| 170 ContentSettingsType content_type); | |
| 171 | |
| 163 virtual void OnRadioClicked(int radio_index) OVERRIDE; | 172 virtual void OnRadioClicked(int radio_index) OVERRIDE; | 
| 164 | 173 | 
| 165 private: | 174 private: | 
| 166 // These states must match the order of appearance of the radio buttons | 175 // These states must match the order of appearance of the radio buttons | 
| 167 // in the XIB file for the Mac port. | 176 // in the XIB file for the Mac port. | 
| 168 enum RPHState { | 177 enum RPHState { | 
| 169 RPH_ALLOW = 0, | 178 RPH_ALLOW = 0, | 
| 170 RPH_BLOCK, | 179 RPH_BLOCK, | 
| 171 RPH_IGNORE, | 180 RPH_IGNORE, | 
| 172 }; | 181 }; | 
| 173 | 182 | 
| 183 void Init(); | |
| 174 void RegisterProtocolHandler(); | 184 void RegisterProtocolHandler(); | 
| 175 void UnregisterProtocolHandler(); | 185 void UnregisterProtocolHandler(); | 
| 176 void IgnoreProtocolHandler(); | 186 void IgnoreProtocolHandler(); | 
| 177 void ClearOrSetPreviousHandler(); | 187 void ClearOrSetPreviousHandler(); | 
| 178 | 188 | 
| 179 int selected_item_; | 189 int selected_item_; | 
| 190 ProtocolHandlerRegistry* registry_; | |
| 180 ProtocolHandler pending_handler_; | 191 ProtocolHandler pending_handler_; | 
| 181 ProtocolHandler previous_handler_; | 192 ProtocolHandler previous_handler_; | 
| 182 }; | 193 }; | 
| 183 | 194 | 
| 184 #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 |