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

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

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again; base::File changes conflicted. Created 7 years, 10 months 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
« no previous file with comments | « chrome/browser/intents/web_intents_util.h ('k') | chrome/browser/managed_mode/managed_mode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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_registry_syncable.h"
10 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_finder.h" 14 #include "chrome/browser/ui/browser_finder.h"
14 #include "chrome/browser/ui/host_desktop.h" 15 #include "chrome/browser/ui/host_desktop.h"
15 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
17 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
18 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
19 #include "net/base/mime_util.h" 20 #include "net/base/mime_util.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 const char kActionSave[] = "http://webintents.org/save"; 53 const char kActionSave[] = "http://webintents.org/save";
53 const char kActionShare[] = "http://webintents.org/share"; 54 const char kActionShare[] = "http://webintents.org/share";
54 const char kActionSubscribe[] = "http://webintents.org/subscribe"; 55 const char kActionSubscribe[] = "http://webintents.org/subscribe";
55 const char kActionView[] = "http://webintents.org/view"; 56 const char kActionView[] = "http://webintents.org/view";
56 const char kActionCrosEcho[] = "https://crosecho.com/startEcho"; 57 const char kActionCrosEcho[] = "https://crosecho.com/startEcho";
57 const char kQuickOfficeViewerServiceURL[] = 58 const char kQuickOfficeViewerServiceURL[] =
58 "chrome-extension://gbkeegbaiigmenfmjfclcdgdpimamgkj/views/appViewer.html"; 59 "chrome-extension://gbkeegbaiigmenfmjfclcdgdpimamgkj/views/appViewer.html";
59 const char kQuickOfficeViewerDevServiceURL[] = 60 const char kQuickOfficeViewerDevServiceURL[] =
60 "chrome-extension://ionpfmkccalenbmnddpbmocokhaknphg/views/appEditor.html"; 61 "chrome-extension://ionpfmkccalenbmnddpbmocokhaknphg/views/appEditor.html";
61 62
62 void RegisterUserPrefs(PrefServiceSyncable* user_prefs) { 63 void RegisterUserPrefs(PrefRegistrySyncable* registry) {
63 user_prefs->RegisterBooleanPref(prefs::kWebIntentsEnabled, true, 64 registry->RegisterBooleanPref(prefs::kWebIntentsEnabled, true,
64 PrefServiceSyncable::SYNCABLE_PREF); 65 PrefRegistrySyncable::SYNCABLE_PREF);
65 } 66 }
66 67
67 bool IsWebIntentsEnabled(PrefService* prefs) { 68 bool IsWebIntentsEnabled(PrefService* prefs) {
68 return CommandLine::ForCurrentProcess()->HasSwitch( 69 return CommandLine::ForCurrentProcess()->HasSwitch(
69 switches::kWebIntentsInvocationEnabled); 70 switches::kWebIntentsInvocationEnabled);
70 } 71 }
71 72
72 bool IsWebIntentsEnabledForProfile(Profile* profile) { 73 bool IsWebIntentsEnabledForProfile(Profile* profile) {
73 return IsWebIntentsEnabled(profile->GetPrefs()); 74 return IsWebIntentsEnabled(profile->GetPrefs());
74 } 75 }
(...skipping 26 matching lines...) Expand all
101 // If either side is _all_ wildcard, it's a match! 102 // If either side is _all_ wildcard, it's a match!
102 if (t1 == "*" || t1 == "*/*" || t2 == "*" || t2 == "*/*") 103 if (t1 == "*" || t1 == "*/*" || t2 == "*" || t2 == "*/*")
103 return true; 104 return true;
104 105
105 StringToLowerASCII(&t1); 106 StringToLowerASCII(&t1);
106 StringToLowerASCII(&t2); 107 StringToLowerASCII(&t2);
107 return (net::MatchesMimeType(t1, t2)) || net::MatchesMimeType(t2, t1); 108 return (net::MatchesMimeType(t1, t2)) || net::MatchesMimeType(t2, t1);
108 } 109 }
109 110
110 } // namespace web_intents 111 } // namespace web_intents
OLDNEW
« no previous file with comments | « chrome/browser/intents/web_intents_util.h ('k') | chrome/browser/managed_mode/managed_mode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698