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

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_model.h

Issue 10825352: Change picker model API to allow less notification messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
OLDNEW
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_INTENTS_WEB_INTENT_PICKER_MODEL_H_ 5 #ifndef CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_MODEL_H_
6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_MODEL_H_ 6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_MODEL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 // Return the intent service that uses |url| as its service url, or NULL. 102 // Return the intent service that uses |url| as its service url, or NULL.
103 const InstalledService* GetInstalledServiceWithURL(const GURL& url) const; 103 const InstalledService* GetInstalledServiceWithURL(const GURL& url) const;
104 104
105 // Return the number of intent services in the picker. 105 // Return the number of intent services in the picker.
106 size_t GetInstalledServiceCount() const; 106 size_t GetInstalledServiceCount() const;
107 107
108 // Update the favicon for the intent service at |index| to |image|. 108 // Update the favicon for the intent service at |index| to |image|.
109 void UpdateFaviconAt(size_t index, const gfx::Image& image); 109 void UpdateFaviconAt(size_t index, const gfx::Image& image);
110 110
111 // Add a new suggested extension with |id|, |title| and |average_rating| to 111 // Add a list of suggested extensions to the model.
112 // the picker. 112 void AddSuggestedExtensions(
113 void AddSuggestedExtension(const string16& title, 113 const std::vector<SuggestedExtension>& suggestions);
114 const string16& id,
115 double average_rating);
116
117 // Remove a suggested extension from the picker at |index|.
118 void RemoveSuggestedExtensionAt(size_t index);
119 114
120 // Return the suggested extension at |index|. 115 // Return the suggested extension at |index|.
121 const SuggestedExtension& GetSuggestedExtensionAt(size_t index) const; 116 const SuggestedExtension& GetSuggestedExtensionAt(size_t index) const;
122 117
123 // Return the number of suggested extensions to be displayed. 118 // Return the number of suggested extensions to be displayed.
124 size_t GetSuggestedExtensionCount() const; 119 size_t GetSuggestedExtensionCount() const;
125 120
126 // Return the text to use in the "Get more suggestions" link. Returns UTF8. 121 // Return the text to use in the "Get more suggestions" link. Returns UTF8.
127 // Will return an empty string if the link should not be shown. 122 // Will return an empty string if the link should not be shown.
128 string16 GetSuggestionsLinkText() const; 123 string16 GetSuggestionsLinkText() const;
(...skipping 14 matching lines...) Expand all
143 138
144 private: 139 private:
145 // Delete all elements in |installed_services_| and |suggested_extensions_|. 140 // Delete all elements in |installed_services_| and |suggested_extensions_|.
146 // Note that this method does not reset the observer. 141 // Note that this method does not reset the observer.
147 void DestroyAll(); 142 void DestroyAll();
148 143
149 // A vector of all installed services in the picker. Each installed service 144 // A vector of all installed services in the picker. Each installed service
150 // is owned by this model. 145 // is owned by this model.
151 std::vector<InstalledService*> installed_services_; 146 std::vector<InstalledService*> installed_services_;
152 147
153 // A vector of all suggested extensions in the picker. Each element is owned 148 // A vector of all suggested extensions in the picker.
154 // by this model. 149 std::vector<SuggestedExtension> suggested_extensions_;
155 std::vector<SuggestedExtension*> suggested_extensions_;
156 150
157 // The observer to send notifications to, or NULL if none. Not owned. 151 // The observer to send notifications to, or NULL if none. Not owned.
158 WebIntentPickerModelObserver* observer_; 152 WebIntentPickerModelObserver* observer_;
159 153
160 // The url of the intent service that is being displayed inline, or 154 // The url of the intent service that is being displayed inline, or
161 // GURL::EmptyGURL() if none. 155 // GURL::EmptyGURL() if none.
162 GURL inline_disposition_url_; 156 GURL inline_disposition_url_;
163 157
164 // A cached copy of the action that instantiated the picker. 158 // A cached copy of the action that instantiated the picker.
165 string16 action_; 159 string16 action_;
166 160
167 // A cached copy of the type that instantiated the picker. 161 // A cached copy of the type that instantiated the picker.
168 string16 type_; 162 string16 type_;
169 163
170 // The non-empty url of the default service if the WebIntentsRegistry 164 // The non-empty url of the default service if the WebIntentsRegistry
171 // finds a default service matching the intent being dispatched. 165 // finds a default service matching the intent being dispatched.
172 GURL default_service_url_; 166 GURL default_service_url_;
173 167
174 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerModel); 168 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerModel);
175 }; 169 };
176 170
177 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_MODEL_H_ 171 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698