Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/content_setting_bubble_model.h

Issue 1367002: Revert 42665 - broke build as I missed a unit test when building locally.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/content_setting_bubble_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:eol-style
- LF
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_CONTENT_SETTING_BUBBLE_MODEL_H_ 5 #ifndef CHROME_BROWSER_CONTENT_SETTING_BUBBLE_MODEL_H_
6 #define CHROME_BROWSER_CONTENT_SETTING_BUBBLE_MODEL_H_ 6 #define CHROME_BROWSER_CONTENT_SETTING_BUBBLE_MODEL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "chrome/common/content_settings.h" 11 #include "chrome/common/content_settings.h"
12 #include "chrome/common/notification_observer.h" 12 #include "chrome/common/notification_observer.h"
13 #include "chrome/common/notification_registrar.h" 13 #include "chrome/common/notification_registrar.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
15 15
16 class GURL;
17 class Profile; 16 class Profile;
18 class SkBitmap; 17 class SkBitmap;
19 class TabContents; 18 class TabContents;
20 19
21 // This model provides data for ContentSettingBubble, and also controls 20 // This model provides data for ContentSettingBubble, and also controls
22 // the action triggered when the allow / block radio buttons are triggered. 21 // the action triggered when the allow / block radio buttons are triggered.
23 class ContentSettingBubbleModel : public NotificationObserver { 22 class ContentSettingBubbleModel : public NotificationObserver {
24 public: 23 public:
25 virtual ~ContentSettingBubbleModel(); 24 virtual ~ContentSettingBubbleModel();
26 25
(...skipping 13 matching lines...) Expand all
40 39
41 typedef std::vector<std::string> RadioItems; 40 typedef std::vector<std::string> RadioItems;
42 struct RadioGroup { 41 struct RadioGroup {
43 std::string host; 42 std::string host;
44 std::string title; 43 std::string title;
45 RadioItems radio_items; 44 RadioItems radio_items;
46 int default_item; 45 int default_item;
47 }; 46 };
48 typedef std::vector<RadioGroup> RadioGroups; 47 typedef std::vector<RadioGroup> RadioGroups;
49 48
50 struct DomainList {
51 std::string title;
52 std::vector<GURL> hosts;
53 };
54
55 struct BubbleContent { 49 struct BubbleContent {
56 std::string title; 50 std::string title;
57 PopupItems popup_items; 51 PopupItems popup_items;
58 RadioGroups radio_groups; 52 RadioGroups radio_groups;
59 std::vector<DomainList> domain_lists;
60 std::string manage_link; 53 std::string manage_link;
61 std::string clear_link;
62 }; 54 };
63 55
64 const BubbleContent& bubble_content() const { return bubble_content_; } 56 const BubbleContent& bubble_content() const { return bubble_content_; }
65 57
66 // NotificationObserver: 58 // NotificationObserver:
67 virtual void Observe(NotificationType type, 59 virtual void Observe(NotificationType type,
68 const NotificationSource& source, 60 const NotificationSource& source,
69 const NotificationDetails& details); 61 const NotificationDetails& details);
70 62
71 virtual void OnRadioClicked(int radio_group, int radio_index) {} 63 virtual void OnRadioClicked(int radio_group, int radio_index) {}
72 virtual void OnPopupClicked(int index) {} 64 virtual void OnPopupClicked(int index) {}
73 virtual void OnManageLinkClicked() {} 65 virtual void OnManageLinkClicked() {}
74 virtual void OnClearLinkClicked() {}
75 66
76 protected: 67 protected:
77 ContentSettingBubbleModel(TabContents* tab_contents, Profile* profile, 68 ContentSettingBubbleModel(TabContents* tab_contents, Profile* profile,
78 ContentSettingsType content_type); 69 ContentSettingsType content_type);
79 70
80 TabContents* tab_contents() const { return tab_contents_; } 71 TabContents* tab_contents() const { return tab_contents_; }
81 Profile* profile() const { return profile_; } 72 Profile* profile() const { return profile_; }
82 73
83 void set_title(const std::string& title) { bubble_content_.title = title; } 74 void set_title(const std::string& title) { bubble_content_.title = title; }
84 void add_popup(const PopupItem& popup) { 75 void add_popup(const PopupItem& popup) {
85 bubble_content_.popup_items.push_back(popup); 76 bubble_content_.popup_items.push_back(popup);
86 } 77 }
87 void add_radio_group(const RadioGroup& radio_group) { 78 void add_radio_group(const RadioGroup& radio_group) {
88 bubble_content_.radio_groups.push_back(radio_group); 79 bubble_content_.radio_groups.push_back(radio_group);
89 } 80 }
90 void add_domain_list(const DomainList& domain_list) {
91 bubble_content_.domain_lists.push_back(domain_list);
92 }
93 void set_manage_link(const std::string& link) { 81 void set_manage_link(const std::string& link) {
94 bubble_content_.manage_link = link; 82 bubble_content_.manage_link = link;
95 } 83 }
96 void set_clear_link(const std::string& link) {
97 bubble_content_.clear_link = link;
98 }
99 84
100 private: 85 private:
101 TabContents* tab_contents_; 86 TabContents* tab_contents_;
102 Profile* profile_; 87 Profile* profile_;
103 ContentSettingsType content_type_; 88 ContentSettingsType content_type_;
104 BubbleContent bubble_content_; 89 BubbleContent bubble_content_;
105 // A registrar for listening for TAB_CONTENTS_DESTROYED notifications. 90 // A registrar for listening for TAB_CONTENTS_DESTROYED notifications.
106 NotificationRegistrar registrar_; 91 NotificationRegistrar registrar_;
107 }; 92 };
108 93
109 #endif // CHROME_BROWSER_CONTENT_SETTING_BUBBLE_MODEL_H_ 94 #endif // CHROME_BROWSER_CONTENT_SETTING_BUBBLE_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/content_setting_bubble_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698