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

Unified Diff: extensions/renderer/resources/binding.js

Issue 2967443004: [Extensions Bindings] Fix getPlatform() method (Closed)
Patch Set: Rebase Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/renderer/process_info_native_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/binding.js
diff --git a/extensions/renderer/resources/binding.js b/extensions/renderer/resources/binding.js
index d0b7e61b5e587c70d03056fce6cd79a72bfa13b6..920345526fdf2cf18bcca46d53691c504c1c9b68 100644
--- a/extensions/renderer/resources/binding.js
+++ b/extensions/renderer/resources/binding.js
@@ -20,6 +20,7 @@ var sendRequestHandler = require('sendRequest');
var contextType = process.GetContextType();
var extensionId = process.GetExtensionId();
var manifestVersion = process.GetManifestVersion();
+var platform = process.GetPlatform();
var sendRequest = sendRequestHandler.sendRequest;
// Stores the name and definition of each API function, with methods to
@@ -87,24 +88,6 @@ APIFunctions.prototype.setCustomCallback =
return this.setHook_(apiName, 'customCallback', customizedFunction);
};
-// Get the platform from navigator.appVersion.
-function getPlatform() {
- var platforms = [
- [/CrOS Touch/, "chromeos touch"],
lazyboy 2017/07/07 23:09:26 You're also removing "chromeos touch", which is un
Devlin 2017/07/10 18:35:31 Good idea; done.
- [/CrOS/, "chromeos"],
- [/Linux/, "linux"],
- [/Mac/, "mac"],
- [/Win/, "win"],
- ];
-
- for (var i = 0; i < platforms.length; i++) {
- if ($RegExp.exec(platforms[i][0], navigator.appVersion)) {
- return platforms[i][1];
- }
- }
- return "unknown";
-}
-
function isPlatformSupported(schemaNode, platform) {
return !schemaNode.platforms ||
$Array.indexOf(schemaNode.platforms, platform) > -1;
@@ -145,8 +128,6 @@ function createCustomType(type) {
return customType;
}
-var platform = getPlatform();
-
function Binding(apiName) {
this.apiName_ = apiName;
this.apiFunctions_ = new APIFunctions(apiName);
« no previous file with comments | « extensions/renderer/process_info_native_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698