diff options
Diffstat (limited to 'chrome/common/extensions/extension_sidebar_utils.cc')
-rw-r--r-- | chrome/common/extensions/extension_sidebar_utils.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/chrome/common/extensions/extension_sidebar_utils.cc b/chrome/common/extensions/extension_sidebar_utils.cc new file mode 100644 index 0000000..7a419cf --- /dev/null +++ b/chrome/common/extensions/extension_sidebar_utils.cc @@ -0,0 +1,37 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/extensions/extension_sidebar_utils.h" + +#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_error_utils.h" +#include "googleurl/src/gurl.h" + +namespace { + +// Errors. +const char kInvalidPathError[] = "Invalid path: \"*\"."; + +} // namespace + +namespace extension_sidebar_utils { + +std::string GetExtensionIdByContentId(const std::string& content_id) { + // At the moment, content_id == extension_id. + return content_id; +} + +GURL ResolveRelativePath(const std::string& relative_path, + const Extension* extension, + std::string* error) { + GURL url(extension->GetResourceURL(relative_path)); + if (!url.is_valid()) { + *error = ExtensionErrorUtils::FormatErrorMessage(kInvalidPathError, + relative_path); + return GURL(); + } + return url; +} + +} // namespace extension_sidebar_utils |