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