30 #include <nsIPrefBranch2.h>
31 #include <nsIObserverService.h>
32 #include <nsServiceManagerUtils.h>
34 #include <nsStringAPI.h>
42 : mShouldExportTracks(PR_FALSE)
43 , mShouldExportPlaylists(PR_FALSE)
44 , mShouldExportSmartPlaylists(PR_FALSE)
45 , mShouldStartExportAgent(PR_FALSE)
58 TRACE(
"%s: Initializing the mediaexport pref controller", __FUNCTION__);
61 nsCOMPtr<nsIPrefBranch2> prefBranch =
62 do_GetService(
"@mozilla.org/preferences-service;1", &rv);
63 NS_ENSURE_SUCCESS(rv, rv);
69 NS_ENSURE_SUCCESS(rv, rv);
73 NS_ENSURE_SUCCESS(rv, rv);
77 NS_ENSURE_SUCCESS(rv, rv);
81 NS_ENSURE_SUCCESS(rv, rv);
86 mListener = aListener;
93 LOG(
"%s: Shutting down the mediaexport pref controller", __FUNCTION__);
96 nsCOMPtr<nsIPrefBranch2> prefBranch =
97 do_GetService(
"@mozilla.org/preferences-service;1", &rv);
98 NS_ENSURE_SUCCESS(rv, rv);
102 NS_ENSURE_SUCCESS(rv, rv);
104 NS_ENSURE_SUCCESS(rv, rv);
106 NS_ENSURE_SUCCESS(rv, rv);
108 NS_ENSURE_SUCCESS(rv, rv);
115 sbMediaExportPrefController::Observe(
nsISupports *aSubject,
117 const PRUnichar *
aData)
124 nsCOMPtr<nsIPrefBranch2> prefBranch = do_QueryInterface(aSubject, &rv);
125 NS_ENSURE_SUCCESS(rv, rv);
127 nsString modifiedPref(aData);
129 PRBool modifiedValue = PR_FALSE;
130 rv = prefBranch->GetBoolPref(NS_ConvertUTF16toUTF8(modifiedPref).
get(),
132 NS_ENSURE_SUCCESS(rv, rv);
134 LOG(
"%s: %s pref changed to %s",
136 NS_ConvertUTF16toUTF8(modifiedPref).
get(),
137 (modifiedValue ?
"true" :
"false"));
140 mShouldExportTracks = modifiedValue;
143 mShouldExportPlaylists = modifiedValue;
146 mShouldExportSmartPlaylists = modifiedValue;
149 mShouldStartExportAgent = modifiedValue;
154 NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
155 "Could not notify of mediaexport pref change!");
164 return mShouldExportTracks ||
165 mShouldExportPlaylists ||
166 mShouldExportSmartPlaylists;
172 return mShouldExportPlaylists || mShouldExportSmartPlaylists;
178 return mShouldStartExportAgent;
184 return mShouldExportTracks;
190 return mShouldExportPlaylists;
196 return mShouldExportSmartPlaylists;
#define SB_PRLOG_SETUP(x)
NS_IMPL_ISUPPORTS1(sbDeviceCapabilitiesUtils, sbIDeviceCapabilitiesUtils) sbDeviceCapabilitiesUtils
const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID
_updateTextAndScrollDataForFrame aData