| 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_WEB_INTENTS_UTIL_H_ | |
| 6 #define CHROME_BROWSER_INTENTS_WEB_INTENTS_UTIL_H_ | |
| 7 | |
| 8 #include "base/string16.h" | |
| 9 | |
| 10 class Browser; | |
| 11 class Profile; | |
| 12 class PrefService; | |
| 13 class PrefServiceSyncable; | |
| 14 | |
| 15 namespace web_intents { | |
| 16 | |
| 17 enum ActionId { | |
| 18 ACTION_ID_CUSTOM = 1, // for all unrecognized types | |
| 19 ACTION_ID_EDIT, | |
| 20 ACTION_ID_PICK, | |
| 21 ACTION_ID_SAVE, | |
| 22 ACTION_ID_SHARE, | |
| 23 ACTION_ID_SUBSCRIBE, | |
| 24 ACTION_ID_VIEW, | |
| 25 }; | |
| 26 | |
| 27 // "Recognized" action strings. These are basically the | |
| 28 // actions we're reporting via UMA. | |
| 29 extern const char kActionEdit[]; | |
| 30 extern const char kActionPick[]; | |
| 31 extern const char kActionSave[]; | |
| 32 extern const char kActionShare[]; | |
| 33 extern const char kActionSubscribe[]; | |
| 34 extern const char kActionView[]; | |
| 35 extern const char kActionCrosEcho[]; | |
| 36 | |
| 37 extern const char kQuickOfficeViewerServiceURL[]; | |
| 38 extern const char kQuickOfficeViewerDevServiceURL[]; | |
| 39 | |
| 40 // Registers the preferences related to Web Intents. | |
| 41 void RegisterUserPrefs(PrefServiceSyncable* user_prefs); | |
| 42 | |
| 43 // Returns true if WebIntents are enabled in preferences. | |
| 44 bool IsWebIntentsEnabled(PrefService* prefs); | |
| 45 | |
| 46 // Returns true if WebIntents are enabled due to various factors. |profile| is | |
| 47 // the Profile to check that WebIntents are enabled for. | |
| 48 bool IsWebIntentsEnabledForProfile(Profile* profile); | |
| 49 | |
| 50 // In a context where we are generating a web intent based on internal events, | |
| 51 // or from an extension background page, get the browser in which to show the | |
| 52 // intent picker to the user. | |
| 53 Browser* GetBrowserForBackgroundWebIntentDelivery(Profile* profile); | |
| 54 | |
| 55 // Returns the recognized action (the one described at | |
| 56 // webintents.org) or an empty string if the action is not recognized. | |
| 57 bool IsRecognizedAction(const string16& action); | |
| 58 | |
| 59 // Returns the action::Id corresponding to |action| or ACTION_ID_CUSTOM | |
| 60 // if |action| is not recognized. | |
| 61 ActionId ToActionId(const string16& action); | |
| 62 | |
| 63 // Returns true if |type1| and |type2| "match". Supports wild cards in both | |
| 64 // |type1| and |type2|. Wild cards are of the form '<type>/*', '*/*', and '*'. | |
| 65 bool MimeTypesMatch(const string16& type1, const string16& type2); | |
| 66 | |
| 67 } // namespace web_intents | |
| 68 | |
| 69 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_UTIL_H_ | |
| OLD | NEW |