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

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

Issue 10834174: intents: Constantify some getter accessors. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/string16.h" 11 #include "base/string16.h"
11 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
12 #include "ui/gfx/image/image.h" 13 #include "ui/gfx/image/image.h"
13 14
14 class WebIntentPickerModelObserver; 15 class WebIntentPickerModelObserver;
15 16
16 namespace gfx {
17 class Image;
18 }
19
20 // Model for the WebIntentPicker. 17 // Model for the WebIntentPicker.
21 class WebIntentPickerModel { 18 class WebIntentPickerModel {
22 public: 19 public:
23 // The intent service disposition. 20 // The intent service disposition.
24 // TODO(gbillock): use the webkit_glue::WebIntentServiceData::Disposition 21 // TODO(gbillock): use the webkit_glue::WebIntentServiceData::Disposition
25 enum Disposition { 22 enum Disposition {
26 DISPOSITION_WINDOW, // Display the intent service in a new window. 23 DISPOSITION_WINDOW, // Display the intent service in a new window.
27 DISPOSITION_INLINE, // Display the intent service in the picker. 24 DISPOSITION_INLINE, // Display the intent service in the picker.
28 }; 25 };
29 26
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 gfx::Image icon; 64 gfx::Image icon;
68 }; 65 };
69 66
70 WebIntentPickerModel(); 67 WebIntentPickerModel();
71 ~WebIntentPickerModel(); 68 ~WebIntentPickerModel();
72 69
73 void set_observer(WebIntentPickerModelObserver* observer) { 70 void set_observer(WebIntentPickerModelObserver* observer) {
74 observer_ = observer; 71 observer_ = observer;
75 } 72 }
76 73
74 const string16& action() const { return action_; }
77 void set_action(const string16& action) { action_ = action; } 75 void set_action(const string16& action) { action_ = action; }
78 76
79 const string16& action() { return action_; } 77 const string16& mimetype() const { return mimetype_; }
Greg Billock 2012/08/06 18:01:58 Can you change this name to just "type"? This isn'
tfarina 2012/08/07 01:08:56 Done.
80
81 void set_mimetype(const string16& mimetype) { mimetype_ = mimetype; } 78 void set_mimetype(const string16& mimetype) { mimetype_ = mimetype; }
82 79
83 const string16& mimetype() { return mimetype_; } 80 const GURL& default_service_url() const { return default_service_url_; }
84
85 void set_default_service_url(const GURL& default_url) { 81 void set_default_service_url(const GURL& default_url) {
86 default_service_url_ = default_url; 82 default_service_url_ = default_url;
87 } 83 }
88 84
89 const GURL& default_service_url() { return default_service_url_; }
90
91 // Add a new installed service with |title|, |url| and |disposition| to the 85 // Add a new installed service with |title|, |url| and |disposition| to the
92 // picker. 86 // picker.
93 void AddInstalledService(const string16& title, 87 void AddInstalledService(const string16& title,
94 const GURL& url, 88 const GURL& url,
95 Disposition disposition); 89 Disposition disposition);
96 90
97 // Remove an installed service from the picker at |index|. 91 // Remove an installed service from the picker at |index|.
98 void RemoveInstalledServiceAt(size_t index); 92 void RemoveInstalledServiceAt(size_t index);
99 93
100 // Remove all installed services from the picker, and resets to not 94 // Remove all installed services from the picker, and resets to not
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 const gfx::Image& image); 132 const gfx::Image& image);
139 133
140 // Set the picker to display the intent service with |url| inline. 134 // Set the picker to display the intent service with |url| inline.
141 void SetInlineDisposition(const GURL& url); 135 void SetInlineDisposition(const GURL& url);
142 136
143 // Returns true if the picker is currently displaying an inline service. 137 // Returns true if the picker is currently displaying an inline service.
144 bool IsInlineDisposition() const; 138 bool IsInlineDisposition() const;
145 139
146 // Returns the url of the intent service that is being displayed inline, or 140 // Returns the url of the intent service that is being displayed inline, or
147 // GURL::EmptyGURL() if none. 141 // GURL::EmptyGURL() if none.
148 GURL inline_disposition_url() const { return inline_disposition_url_; } 142 const GURL& inline_disposition_url() const { return inline_disposition_url_; }
149 143
150 private: 144 private:
151 // Delete all elements in |installed_services_| and |suggested_extensions_|. 145 // Delete all elements in |installed_services_| and |suggested_extensions_|.
152 // Note that this method does not reset the observer. 146 // Note that this method does not reset the observer.
153 void DestroyAll(); 147 void DestroyAll();
154 148
155 // A vector of all installed services in the picker. Each installed service 149 // A vector of all installed services in the picker. Each installed service
156 // is owned by this model. 150 // is owned by this model.
157 std::vector<InstalledService*> installed_services_; 151 std::vector<InstalledService*> installed_services_;
158 152
159 // A vector of all suggested extensions in the picker. Each element is owned 153 // A vector of all suggested extensions in the picker. Each element is owned
160 // by this model. 154 // by this model.
161 std::vector<SuggestedExtension*> suggested_extensions_; 155 std::vector<SuggestedExtension*> suggested_extensions_;
162 156
163 // The observer to send notifications to, or NULL if none. 157 // The observer to send notifications to, or NULL if none. Not owned.
164 WebIntentPickerModelObserver* observer_; 158 WebIntentPickerModelObserver* observer_;
165 159
166 // The url of the intent service that is being displayed inline, or 160 // The url of the intent service that is being displayed inline, or
167 // GURL::EmptyGURL() if none. 161 // GURL::EmptyGURL() if none.
168 GURL inline_disposition_url_; 162 GURL inline_disposition_url_;
169 163
170 // A cached copy of the action that instantiated the picker. 164 // A cached copy of the action that instantiated the picker.
171 string16 action_; 165 string16 action_;
172 166
173 // A cached copy of the mimetype that instantiated the picker. 167 // A cached copy of the mimetype that instantiated the picker.
174 string16 mimetype_; 168 string16 mimetype_;
175 169
176 // The non-empty url of the default service if the WebIntentsRegistry 170 // The non-empty url of the default service if the WebIntentsRegistry
177 // finds a default service matching the intent being dispatched. 171 // finds a default service matching the intent being dispatched.
178 GURL default_service_url_; 172 GURL default_service_url_;
179 173
180 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerModel); 174 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerModel);
181 }; 175 };
182 176
183 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_MODEL_H_ 177 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_MODEL_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698