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

Side by Side Diff: chrome/browser/intents/web_intents_util.h

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

Powered by Google App Engine
This is Rietveld 408576698