本文整理汇总了C++中nsCString::get方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCString::get方法的具体用法?C++ nsCString::get怎么用?C++ nsCString::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCString
的用法示例。
在下文中一共展示了nsCString::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
NS_IMETHODIMP GnomeKeyring::Init()
#endif
{
nsresult ret;
nsCOMPtr<nsIServiceManager> servMan;
nsCOMPtr<nsIPrefService> prefService;
nsCOMPtr<nsIPrefBranch> pref;
#ifdef PR_LOGGING
gGnomeKeyringLog = PR_NewLogModule("GnomeKeyringLog");
#endif
keyringName.AssignLiteral(kDefaultKeyring);
ret = NS_GetServiceManager(getter_AddRefs(servMan));
if (ret != NS_OK) { return ret; }
ret = servMan->GetServiceByContractID("@mozilla.org/preferences-service;1",
NS_GET_IID(nsIPrefService),
getter_AddRefs(prefService));
if (ret != NS_OK) { return ret; }
ret = prefService->ReadUserPrefs(nullptr);
if (ret != NS_OK) { return ret; }
ret = prefService->GetBranch(kPrefsBranch, getter_AddRefs(pref));
if (ret != NS_OK) { return ret; }
PRInt32 prefType;
ret = pref->GetPrefType(kPrefsKeyring, &prefType);
if (ret != NS_OK) { return ret; }
if (prefType == 32) {
char* tempKeyringName;
pref->GetCharPref(kPrefsKeyring, &tempKeyringName);
keyringName = tempKeyringName;
if ( keyringName.IsVoid() || keyringName.IsEmpty() ) keyringName.AssignLiteral(kDefaultKeyring);
}
/* Create the password keyring, it doesn't hurt if it already exists */
GnomeKeyringResult result = gnome_keyring_create_sync(keyringName.get(), NULL);
if ((result != GNOME_KEYRING_RESULT_OK) &&
(result != GNOME_KEYRING_RESULT_KEYRING_ALREADY_EXISTS)) {
NS_ERROR("Can't open or create password keyring!");
return NS_ERROR_FAILURE;
}
return ret;
}
示例2:
bool
ExternalHelperAppParent::RecvOnDataAvailable(const nsCString& data,
const uint64_t& offset,
const uint32_t& count)
{
if (NS_FAILED(mStatus))
return true;
MOZ_ASSERT(!mDiverted, "child forwarding callbacks after request was diverted");
MOZ_ASSERT(mPending, "must be pending!");
nsCOMPtr<nsIInputStream> stringStream;
DebugOnly<nsresult> rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data.get(), count, NS_ASSIGNMENT_DEPEND);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create dependent string!");
mStatus = mListener->OnDataAvailable(this, nullptr, stringStream, offset, count);
return true;
}
示例3: EnsurePrefService
bool
ContentParent::RecvGetChildList(const nsCString& domain,
nsTArray<nsCString>* list, nsresult* rv)
{
EnsurePrefService();
PRUint32 count;
char **childArray;
*rv = mPrefService->GetChildList(domain.get(), &count, &childArray);
if (NS_SUCCEEDED(*rv)) {
list->SetCapacity(count);
for (PRUint32 i = 0; i < count; ++i)
*(list->AppendElement()) = childArray[i];
}
return true;
}
示例4: BadImage
/* static */ already_AddRefed<Image>
ImageFactory::CreateAnonymousImage(const nsCString& aMimeType)
{
nsresult rv;
nsRefPtr<RasterImage> newImage = new RasterImage();
nsRefPtr<ProgressTracker> newTracker = new ProgressTracker();
newTracker->SetImage(newImage);
newImage->SetProgressTracker(newTracker);
rv = newImage->Init(aMimeType.get(), Image::INIT_FLAG_SYNC_LOAD);
if (NS_FAILED(rv)) {
return BadImage("RasterImage::Init failed", newImage);
}
return newImage.forget();
}
示例5:
/* static */ void
CommonElementAnimationData::LogAsyncAnimationFailure(nsCString& aMessage,
const nsIContent* aContent)
{
if (aContent) {
aMessage.AppendLiteral(" [");
aMessage.Append(nsAtomCString(aContent->Tag()));
nsIAtom* id = aContent->GetID();
if (id) {
aMessage.AppendLiteral(" with id '");
aMessage.Append(nsAtomCString(aContent->GetID()));
aMessage.AppendLiteral("'");
}
aMessage.AppendLiteral("]");
}
printf_stderr(aMessage.get());
}
示例6: GetBaseDomain
// Determine if aFirstDomain is a different base domain to aSecondURI; or, if
// the concept of base domain does not apply, determine if the two hosts are not
// string-identical.
nsresult
ThirdPartyUtil::IsThirdPartyInternal(const nsCString& aFirstDomain,
nsIURI* aSecondURI,
bool* aResult)
{
NS_ENSURE_ARG(aSecondURI);
// Get the base domain for aSecondURI.
nsCString secondDomain;
nsresult rv = GetBaseDomain(aSecondURI, secondDomain);
LOG(("ThirdPartyUtil::IsThirdPartyInternal %s =? %s", aFirstDomain.get(), secondDomain.get()));
if (NS_FAILED(rv))
return rv;
// Check strict equality.
*aResult = aFirstDomain != secondDomain;
return NS_OK;
}
示例7: name
// Given the freetype face corresponding to an entryName and face index,
// add the face to the available font list and to the faceList string
void
gfxFT2FontList::AddFaceToList(const nsCString& aEntryName, uint32_t aIndex,
bool aStdFile, FT_Face aFace,
nsCString& aFaceList)
{
if (FT_Err_Ok != FT_Select_Charmap(aFace, FT_ENCODING_UNICODE)) {
// ignore faces that don't support a Unicode charmap
return;
}
// build the font entry name and create an FT2FontEntry,
// but do -not- keep a reference to the FT_Face
FT2FontEntry* fe =
CreateNamedFontEntry(aFace, aEntryName.get(), aIndex);
if (fe) {
NS_ConvertUTF8toUTF16 name(aFace->family_name);
BuildKeyNameFromFontName(name);
gfxFontFamily *family = mFontFamilies.GetWeak(name);
if (!family) {
family = new FT2FontFamily(name);
mFontFamilies.Put(name, family);
if (mBadUnderlineFamilyNames.Contains(name)) {
family->SetBadUnderlineFamily();
}
}
fe->mStandardFace = aStdFile;
family->AddFontEntry(fe);
fe->CheckForBrokenFont(family);
AppendToFaceList(aFaceList, name, fe);
#ifdef PR_LOGGING
if (LOG_ENABLED()) {
LOG(("(fontinit) added (%s) to family (%s)"
" with style: %s weight: %d stretch: %d",
NS_ConvertUTF16toUTF8(fe->Name()).get(),
NS_ConvertUTF16toUTF8(family->Name()).get(),
fe->IsItalic() ? "italic" : "normal",
fe->Weight(), fe->Stretch()));
}
#endif
}
}
示例8: AssertPluginThread
bool
BrowserStreamChild::RecvNPP_StreamAsFile(const nsCString& fname)
{
PLUGIN_LOG_DEBUG(("%s (fname=%s)", FULLFUNCTION, fname.get()));
AssertPluginThread();
if (ALIVE != mState)
NS_RUNTIMEABORT("Unexpected state: received file after NPP_DestroyStream?");
if (kStreamOpen != mStreamStatus)
return true;
mStreamAsFilePending = true;
mStreamAsFileName = fname;
EnsureDeliveryPending();
return true;
}
示例9: IPC_OK
mozilla::ipc::IPCResult
BrowserStreamChild::RecvNPP_StreamAsFile(const nsCString& fname)
{
PLUGIN_LOG_DEBUG(("%s (fname=%s)", FULLFUNCTION, fname.get()));
AssertPluginThread();
if (ALIVE != mState)
MOZ_CRASH("Unexpected state: received file after NPP_DestroyStream?");
if (kStreamOpen != mStreamStatus)
return IPC_OK();
mStreamAsFilePending = true;
mStreamAsFileName = fname;
EnsureDeliveryPending();
return IPC_OK();
}
示例10:
nsresult
rdf_MakeAbsoluteURI(nsIURI* aBase, nsCString& aURI)
{
nsresult rv;
nsXPIDLCString result;
rv = NS_MakeAbsoluteURI(getter_Copies(result), aURI.get(), aBase);
if (NS_SUCCEEDED(rv)) {
aURI.Assign(result);
}
else {
// There are some ugly URIs (e.g., "NC:Foo") that netlib can't
// parse. If NS_MakeAbsoluteURL fails, then just punt and
// assume that aURI was already absolute.
}
return NS_OK;
}
示例11:
/* static */ void
AnimationUtils::LogAsyncAnimationFailure(nsCString& aMessage,
const nsIContent* aContent)
{
if (aContent) {
aMessage.AppendLiteral(" [");
aMessage.Append(nsAtomCString(aContent->NodeInfo()->NameAtom()));
nsIAtom* id = aContent->GetID();
if (id) {
aMessage.AppendLiteral(" with id '");
aMessage.Append(nsAtomCString(aContent->GetID()));
aMessage.Append('\'');
}
aMessage.Append(']');
}
aMessage.Append('\n');
printf_stderr("%s", aMessage.get());
}
示例12: LOG
bool
HttpChannelParent::RecvDivertOnDataAvailable(const nsCString& data,
const uint64_t& offset,
const uint32_t& count)
{
LOG(("HttpChannelParent::RecvDivertOnDataAvailable [this=%p]\n", this));
MOZ_ASSERT(mParentListener);
if (NS_WARN_IF(!mDivertingFromChild)) {
MOZ_ASSERT(mDivertingFromChild,
"Cannot RecvDivertOnDataAvailable if diverting is not set!");
FailDiversion(NS_ERROR_UNEXPECTED);
return false;
}
// Drop OnDataAvailables if the parent was canceled already.
if (NS_FAILED(mStatus)) {
return true;
}
nsCOMPtr<nsIInputStream> stringStream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data.get(),
count, NS_ASSIGNMENT_DEPEND);
if (NS_FAILED(rv)) {
if (mChannel) {
mChannel->Cancel(rv);
}
mStatus = rv;
return true;
}
rv = mParentListener->OnDataAvailable(mChannel, nullptr, stringStream,
offset, count);
stringStream->Close();
if (NS_FAILED(rv)) {
if (mChannel) {
mChannel->Cancel(rv);
}
mStatus = rv;
return true;
}
return true;
}
示例13: CacheFileInfo
virtual void
CacheFileInfo(nsCString& aFileName, nsCString& aFaceList,
PRUint32 aTimestamp, PRUint32 aFilesize)
{
if (!mMap.ops) {
return;
}
FNCMapEntry* entry =
static_cast<FNCMapEntry*>
(PL_DHashTableOperate(&mMap, aFileName.get(), PL_DHASH_ADD));
if (entry) {
entry->mFilename.Assign(aFileName);
entry->mTimestamp = aTimestamp;
entry->mFilesize = aFilesize;
entry->mFaces.Assign(aFaceList);
entry->mFileExists = true;
}
mWriteNeeded = true;
}
示例14: ToLowerCase
void
nsGIOProtocolHandler::InitSupportedProtocolsPref(nsIPrefBranch *prefs)
{
// Get user preferences to determine which protocol is supported.
// Gvfs/GIO has a set of supported protocols like obex, network, archive,
// computer, dav, cdda, gphoto2, trash, etc. Some of these seems to be
// irrelevant to process by browser. By default accept only smb and sftp
// protocols so far.
nsresult rv = prefs->GetCharPref(MOZ_GIO_SUPPORTED_PROTOCOLS,
getter_Copies(mSupportedProtocols));
if (NS_SUCCEEDED(rv)) {
mSupportedProtocols.StripWhitespace();
ToLowerCase(mSupportedProtocols);
}
else
mSupportedProtocols.AssignLiteral("smb:,sftp:"); // use defaults
LOG(("gio: supported protocols \"%s\"\n", mSupportedProtocols.get()));
}
示例15:
bool
GMPDecryptorChild::RecvCreateSession(const uint32_t& aPromiseId,
const nsCString& aInitDataType,
const nsTArray<uint8_t>& aInitData,
const GMPSessionType& aSessionType)
{
if (!mSession) {
return false;
}
mSession->CreateSession(aPromiseId,
aInitDataType.get(),
aInitDataType.Length(),
aInitData.Elements(),
aInitData.Length(),
aSessionType);
return true;
}