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 #include "chrome/browser/intents/web_intents_util.h" | 5 #include "chrome/browser/intents/web_intents_util.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 const char kActionSave[] = "http://webintents.org/save"; | 52 const char kActionSave[] = "http://webintents.org/save"; |
53 const char kActionShare[] = "http://webintents.org/share"; | 53 const char kActionShare[] = "http://webintents.org/share"; |
54 const char kActionSubscribe[] = "http://webintents.org/subscribe"; | 54 const char kActionSubscribe[] = "http://webintents.org/subscribe"; |
55 const char kActionView[] = "http://webintents.org/view"; | 55 const char kActionView[] = "http://webintents.org/view"; |
56 const char kActionCrosEcho[] = "https://crosecho.com/startEcho"; | 56 const char kActionCrosEcho[] = "https://crosecho.com/startEcho"; |
57 const char kQuickOfficeViewerServiceURL[] = | 57 const char kQuickOfficeViewerServiceURL[] = |
58 "chrome-extension://gbkeegbaiigmenfmjfclcdgdpimamgkj/views/appViewer.html"; | 58 "chrome-extension://gbkeegbaiigmenfmjfclcdgdpimamgkj/views/appViewer.html"; |
59 const char kQuickOfficeViewerDevServiceURL[] = | 59 const char kQuickOfficeViewerDevServiceURL[] = |
60 "chrome-extension://ionpfmkccalenbmnddpbmocokhaknphg/views/appEditor.html"; | 60 "chrome-extension://ionpfmkccalenbmnddpbmocokhaknphg/views/appEditor.html"; |
61 | 61 |
62 void RegisterUserPrefs(PrefService* user_prefs) { | 62 void RegisterUserPrefs(PrefServiceSyncable* user_prefs) { |
63 user_prefs->RegisterBooleanPref(prefs::kWebIntentsEnabled, true, | 63 user_prefs->RegisterBooleanPref(prefs::kWebIntentsEnabled, true, |
64 PrefService::SYNCABLE_PREF); | 64 PrefServiceSyncable::SYNCABLE_PREF); |
65 } | 65 } |
66 | 66 |
67 bool IsWebIntentsEnabled(PrefService* prefs) { | 67 bool IsWebIntentsEnabled(PrefService* prefs) { |
68 return CommandLine::ForCurrentProcess()->HasSwitch( | 68 return CommandLine::ForCurrentProcess()->HasSwitch( |
69 switches::kWebIntentsInvocationEnabled); | 69 switches::kWebIntentsInvocationEnabled); |
70 } | 70 } |
71 | 71 |
72 bool IsWebIntentsEnabledForProfile(Profile* profile) { | 72 bool IsWebIntentsEnabledForProfile(Profile* profile) { |
73 return IsWebIntentsEnabled(profile->GetPrefs()); | 73 return IsWebIntentsEnabled(profile->GetPrefs()); |
74 } | 74 } |
(...skipping 26 matching lines...) Expand all Loading... |
101 // If either side is _all_ wildcard, it's a match! | 101 // If either side is _all_ wildcard, it's a match! |
102 if (t1 == "*" || t1 == "*/*" || t2 == "*" || t2 == "*/*") | 102 if (t1 == "*" || t1 == "*/*" || t2 == "*" || t2 == "*/*") |
103 return true; | 103 return true; |
104 | 104 |
105 StringToLowerASCII(&t1); | 105 StringToLowerASCII(&t1); |
106 StringToLowerASCII(&t2); | 106 StringToLowerASCII(&t2); |
107 return (net::MatchesMimeType(t1, t2)) || net::MatchesMimeType(t2, t1); | 107 return (net::MatchesMimeType(t1, t2)) || net::MatchesMimeType(t2, t1); |
108 } | 108 } |
109 | 109 |
110 } // namespace web_intents | 110 } // namespace web_intents |
OLD | NEW |