Created
May 29, 2013 01:15
-
-
Save anonymous/5667331 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
namespace { | |
const char kAlarms[] = "<schema here>"; | |
const char kAppRuntime[] = "..."; | |
const char kAppWindow[] = "..."; | |
... | |
} | |
namespace extensions { | |
namespace api { | |
struct Static { | |
Static() { | |
schemas["alarms"] = kAlarms; | |
schemas["app.currentWindowInternal"] = kAppCurrentWindowInternal; | |
schemas["app.runtime"] = kAppRuntime; | |
... | |
} | |
std::map<std::string, const char*> schemas; | |
}; | |
base::LazyInstance<Static> g_lazy_instance; | |
// static | |
base::StringPiece GeneratedSchemas::Get(const std::string& name) { | |
return IsGenerated(name) ? g_lazy_instance.Get().schemas[name] : ""; | |
} | |
// static | |
bool GeneratedSchemas::IsGenerated(std::string name) { | |
return g_lazy_instance.Get().schemas.count(name) > 0; | |
} | |
} // namespace api | |
} // namespace extensions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment