forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1799332: Add a macOS Framework to replace the use of channel-pref…
…s.js on macOS. r=glandium,mstange,KrisWright,bytesized Differential Revision: https://phabricator.services.mozilla.com/D184711
- Loading branch information
Stephen A Pohl
committed
Feb 21, 2024
1 parent
be58cf7
commit e755967
Showing
14 changed files
with
190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
toolkit/mozapps/macos-frameworks/ChannelPrefs/ChannelPrefs.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef ChannelPrefs_h_ | ||
#define ChannelPrefs_h_ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
extern "C" { | ||
|
||
// Returns the channel name, as an autoreleased string. | ||
extern NSString* ChannelPrefsGetChannel(void) __attribute__((weak_import)) | ||
__attribute__((visibility("default"))); | ||
} | ||
|
||
#endif // ChannelPrefs_h_ |
12 changes: 12 additions & 0 deletions
12
toolkit/mozapps/macos-frameworks/ChannelPrefs/ChannelPrefs.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "ChannelPrefs.h" | ||
|
||
#include "mozilla/HelperMacros.h" | ||
|
||
NSString* ChannelPrefsGetChannel() { | ||
return [NSString stringWithCString:MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL) | ||
encoding:NSUTF8StringEncoding]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>ChannelPrefs</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>org.mozilla.channelprefs</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>ChannelPrefs</string> | ||
<key>CFBundlePackageType</key> | ||
<string>FMWK</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# vim:set ts=8 sw=8 sts=8 noet: | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
include $(topsrcdir)/config/rules.mk | ||
|
||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) | ||
libs:: | ||
rm -rf $(DIST)/bin/ChannelPrefs.framework | ||
|
||
$(NSINSTALL) $(DIST)/bin/ChannelPrefs $(DIST)/bin/ChannelPrefs.framework | ||
$(NSINSTALL) $(srcdir)/Info.plist $(DIST)/bin/ChannelPrefs.framework/Resources | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- | ||
# vim: set filetype=python: | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
with Files("**"): | ||
BUG_COMPONENT = ("Toolkit", "Application Update") | ||
|
||
Framework("ChannelPrefs") | ||
|
||
EXPORTS += [ | ||
"ChannelPrefs.h", | ||
] | ||
|
||
UNIFIED_SOURCES += [ | ||
"ChannelPrefs.mm", | ||
] | ||
|
||
OS_LIBS += [ | ||
"-framework Foundation", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef ChannelPrefsUtil_h_ | ||
#define ChannelPrefsUtil_h_ | ||
|
||
#include "Units.h" | ||
|
||
class ChannelPrefsUtil { | ||
public: | ||
static bool GetChannelPrefValue(nsACString& aValue); | ||
}; | ||
|
||
#endif // ChannelPrefsUtil_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: | ||
* 2 -*- */ | ||
/* vim: set ts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#import <ChannelPrefs/ChannelPrefs.h> | ||
|
||
#include "ChannelPrefsUtil.h" | ||
|
||
#include "nsCocoaUtils.h" | ||
|
||
/* static */ | ||
bool ChannelPrefsUtil::GetChannelPrefValue(nsACString& aValue) { | ||
// `ChannelPrefsGetChannel` is resolved at runtime and requires | ||
// the ChannelPrefs framework to be loaded. | ||
if (ChannelPrefsGetChannel) { | ||
nsAutoString value; | ||
nsCocoaUtils::GetStringForNSString(ChannelPrefsGetChannel(), value); | ||
CopyUTF16toUTF8(value, aValue); | ||
return true; | ||
} | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- | ||
# vim: set filetype=python: | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
with Files("**"): | ||
BUG_COMPONENT = ("Toolkit", "Application Update") | ||
|
||
FINAL_LIBRARY = "xul" | ||
|
||
DIRS += [ | ||
"ChannelPrefs", | ||
] | ||
|
||
EXPORTS += [ | ||
"ChannelPrefsUtil.h", | ||
] | ||
|
||
UNIFIED_SOURCES += [ | ||
"ChannelPrefsUtil.mm", | ||
] |