OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_INTENTS_DEFAULT_WEB_INTENT_SERVICE_H_ | |
6 #define CHROME_BROWSER_INTENTS_DEFAULT_WEB_INTENT_SERVICE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/string16.h" | |
11 #include "extensions/common/url_pattern.h" | |
12 | |
13 // Holds data related to a default settings for web intents service | |
14 // selection. Holds data in a row in the web_intents_defaults table. | |
15 // The key for the table is the |action|, |type|, and |url_pattern|. | |
16 // These describe the action and type of the web intent for which the | |
17 // default is set, and the url prefix (if any) of source pages for | |
18 // which the default applies. The main actionable value is the URL | |
19 // of the service or extension page handling the intent. The |user_date| | |
20 // and |suppression| fields are provided for more intricate post-fetch | |
21 // decisions about whether to use a particular default service. | |
22 struct DefaultWebIntentService { | |
23 | |
24 // Intents are matched to services using two defferent matching | |
25 // strategies. | |
26 // 1) |action| + |type|. Examples: | |
27 // action = "webintents.org/share", type = "mydomain.com/mytype" | |
28 // action = "intents.w3c.org/action/view", type = "image/png" | |
29 // 2) |scheme| e.g., "mailto", or "web+poodle". | |
30 // Type for intent service matching. This can be any arbitray type, | |
31 // including commonly recognized types such as mime-types. | |
32 string16 action; | |
33 string16 type; | |
34 string16 scheme; | |
35 | |
36 URLPattern url_pattern; | |
37 | |
38 // |user_date| holds the offset time when a user set the default. | |
39 // If the user did not set the default explicitly, is <= 0. | |
40 int user_date; | |
41 | |
42 // Currently unused. | |
43 int64 suppression; | |
44 | |
45 std::string service_url; | |
46 | |
47 DefaultWebIntentService(); | |
48 DefaultWebIntentService( | |
49 const string16& action, | |
50 const string16& type, | |
51 const std::string& service_url); | |
52 DefaultWebIntentService( | |
53 const string16& scheme, | |
54 const std::string& service_url); | |
55 ~DefaultWebIntentService(); | |
56 | |
57 std::string ToString() const; | |
58 bool operator==(const DefaultWebIntentService& other) const; | |
59 }; | |
60 | |
61 #endif // CHROME_BROWSER_INTENTS_DEFAULT_WEB_INTENT_SERVICE_H_ | |
OLD | NEW |