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

Unified Diff: extensions/renderer/bindings/api_binding.cc

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
Index: extensions/renderer/bindings/api_binding.cc
diff --git a/extensions/renderer/bindings/api_binding.cc b/extensions/renderer/bindings/api_binding.cc
index d5ee62f9c6a8a96aad011e315b1d69bb75a2cc5e..fc45071bfecd111d89c2802acd6940d8aa87c51d 100644
--- a/extensions/renderer/bindings/api_binding.cc
+++ b/extensions/renderer/bindings/api_binding.cc
@@ -14,6 +14,7 @@
#include "base/values.h"
#include "extensions/renderer/bindings/api_binding_hooks.h"
#include "extensions/renderer/bindings/api_binding_types.h"
+#include "extensions/renderer/bindings/api_binding_util.h"
#include "extensions/renderer/bindings/api_event_handler.h"
#include "extensions/renderer/bindings/api_invocation_errors.h"
#include "extensions/renderer/bindings/api_request_handler.h"
@@ -30,21 +31,6 @@ namespace extensions {
namespace {
-std::string GetPlatformString() {
-#if defined(OS_CHROMEOS)
- return "chromeos";
-#elif defined(OS_LINUX)
- return "linux";
-#elif defined(OS_MACOSX)
- return "mac";
-#elif defined(OS_WIN)
- return "win";
-#else
- NOTREACHED();
- return std::string();
-#endif
-}
-
// Returns the name of the enum value for use in JavaScript; JS enum entries use
// SCREAMING_STYLE.
std::string GetJSEnumEntryName(const std::string& original) {
@@ -452,7 +438,7 @@ void APIBinding::DecorateTemplateWithProperties(
// this check here. If this becomes more common, we should really find a
// way of moving these checks to the features files.
if (dict->GetList("platforms", &platforms)) {
- std::string this_platform = GetPlatformString();
+ std::string this_platform = binding::GetPlatformString();
auto is_this_platform = [&this_platform](const base::Value& platform) {
return platform.is_string() && platform.GetString() == this_platform;
};

Powered by Google App Engine
This is Rietveld 408576698