This source file includes following definitions.
- GetTerminalExtension
- GetCroshExtensionURL
#include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "extensions/common/extension.h"
namespace {
const char kCroshExtensionEntryPoint[] = "/html/crosh.html";
const extensions::Extension* GetTerminalExtension(Profile* profile) {
static const char* kPossibleAppIds[] = {
extension_misc::kHTermDevAppId,
extension_misc::kHTermAppId,
extension_misc::kCroshBuiltinAppId,
};
DCHECK_EQ(kPossibleAppIds[0], extension_misc::kHTermDevAppId);
ExtensionService* service = profile->GetExtensionService();
for (size_t x = 0; x < arraysize(kPossibleAppIds); ++x) {
const extensions::Extension* extension = service->GetExtensionById(
kPossibleAppIds[x], false);
if (extension)
return extension;
}
return NULL;
}
}
namespace extensions {
GURL TerminalExtensionHelper::GetCroshExtensionURL(Profile* profile) {
const extensions::Extension* extension = GetTerminalExtension(profile);
if (!extension)
return GURL();
return extension->GetResourceURL(kCroshExtensionEntryPoint);
}
}