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_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/string16.h" | 10 #include "base/string16.h" |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
12 #include "ui/gfx/image/image.h" | 12 #include "ui/gfx/image/image.h" |
| 13 #include "webkit/glue/web_intent_service_data.h" |
13 | 14 |
14 class WebIntentPickerModelObserver; | 15 class WebIntentPickerModelObserver; |
15 | 16 |
16 namespace gfx { | 17 namespace gfx { |
17 class Image; | 18 class Image; |
18 } | 19 } |
19 | 20 |
20 // Model for the WebIntentPicker. | 21 // Model for the WebIntentPicker. |
21 class WebIntentPickerModel { | 22 class WebIntentPickerModel { |
22 public: | 23 public: |
23 // The intent service disposition. | |
24 // TODO(gbillock): use the webkit_glue::WebIntentServiceData::Disposition | |
25 enum Disposition { | |
26 DISPOSITION_WINDOW, // Display the intent service in a new window. | |
27 DISPOSITION_INLINE, // Display the intent service in the picker. | |
28 }; | |
29 | |
30 // An intent service to display in the picker. | 24 // An intent service to display in the picker. |
31 struct InstalledService { | 25 struct InstalledService { |
32 InstalledService(const string16& title, | 26 InstalledService( |
33 const GURL& url, | 27 const string16& title, |
34 Disposition disposition); | 28 const GURL& url, |
| 29 webkit_glue::WebIntentServiceData::Disposition disposition); |
35 ~InstalledService(); | 30 ~InstalledService(); |
36 | 31 |
37 // The title of this service. | 32 // The title of this service. |
38 string16 title; | 33 string16 title; |
39 | 34 |
40 // The URL of this service. | 35 // The URL of this service. |
41 GURL url; | 36 GURL url; |
42 | 37 |
43 // A favicon of this service. | 38 // A favicon of this service. |
44 gfx::Image favicon; | 39 gfx::Image favicon; |
45 | 40 |
46 // The disposition to use when displaying this service. | 41 // The disposition to use when displaying this service. |
47 Disposition disposition; | 42 webkit_glue::WebIntentServiceData::Disposition disposition; |
48 }; | 43 }; |
49 | 44 |
50 // A suggested extension to display in the picker. | 45 // A suggested extension to display in the picker. |
51 struct SuggestedExtension { | 46 struct SuggestedExtension { |
52 SuggestedExtension(const string16& title, | 47 SuggestedExtension(const string16& title, |
53 const string16& id, | 48 const string16& id, |
54 double average_rating); | 49 double average_rating); |
55 ~SuggestedExtension(); | 50 ~SuggestedExtension(); |
56 | 51 |
57 // The title of the intent service. | 52 // The title of the intent service. |
(...skipping 25 matching lines...) Expand all Loading... |
83 const string16& mimetype() { return mimetype_; } | 78 const string16& mimetype() { return mimetype_; } |
84 | 79 |
85 void set_default_service_url(const GURL& default_url) { | 80 void set_default_service_url(const GURL& default_url) { |
86 default_service_url_ = default_url; | 81 default_service_url_ = default_url; |
87 } | 82 } |
88 | 83 |
89 const GURL& default_service_url() { return default_service_url_; } | 84 const GURL& default_service_url() { return default_service_url_; } |
90 | 85 |
91 // Add a new installed service with |title|, |url| and |disposition| to the | 86 // Add a new installed service with |title|, |url| and |disposition| to the |
92 // picker. | 87 // picker. |
93 void AddInstalledService(const string16& title, | 88 void AddInstalledService( |
94 const GURL& url, | 89 const string16& title, |
95 Disposition disposition); | 90 const GURL& url, |
| 91 webkit_glue::WebIntentServiceData::Disposition disposition); |
96 | 92 |
97 // Remove an installed service from the picker at |index|. | 93 // Remove an installed service from the picker at |index|. |
98 void RemoveInstalledServiceAt(size_t index); | 94 void RemoveInstalledServiceAt(size_t index); |
99 | 95 |
100 // Remove all installed services from the picker, and resets to not | 96 // Remove all installed services from the picker, and resets to not |
101 // displaying inline disposition. Note that this does not clear the | 97 // displaying inline disposition. Note that this does not clear the |
102 // observer. | 98 // observer. |
103 void Clear(); | 99 void Clear(); |
104 | 100 |
105 // Return the intent service installed at |index|. | 101 // Return the intent service installed at |index|. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 string16 mimetype_; | 170 string16 mimetype_; |
175 | 171 |
176 // The non-empty url of the default service if the WebIntentsRegistry | 172 // The non-empty url of the default service if the WebIntentsRegistry |
177 // finds a default service matching the intent being dispatched. | 173 // finds a default service matching the intent being dispatched. |
178 GURL default_service_url_; | 174 GURL default_service_url_; |
179 | 175 |
180 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerModel); | 176 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerModel); |
181 }; | 177 }; |
182 | 178 |
183 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_MODEL_H_ | 179 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_MODEL_H_ |
OLD | NEW |