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

Unified Diff: chrome/common/extensions/extension_file_util.cc

Issue 6378009: Only allow extension pages to be displayed in the sidebar to be consistent... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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: chrome/common/extensions/extension_file_util.cc
===================================================================
--- chrome/common/extensions/extension_file_util.cc (revision 72219)
+++ chrome/common/extensions/extension_file_util.cc (working copy)
@@ -21,6 +21,7 @@
#include "chrome/common/extensions/extension_l10n_util.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_resource.h"
+#include "chrome/common/extensions/extension_sidebar_defaults.h"
#include "chrome/common/json_value_serializer.h"
#include "grit/generated_resources.h"
#include "net/base/escape.h"
@@ -269,6 +270,21 @@
}
}
+ // Validate sidebar default page location.
+ ExtensionSidebarDefaults* sidebar_defaults = extension->sidebar_defaults();
+ if (sidebar_defaults && sidebar_defaults->default_page().is_valid()) {
+ FilePath page_path = ExtensionURLToRelativeFilePath(
+ sidebar_defaults->default_page());
+ const FilePath path = extension->GetResource(page_path).GetFilePath();
+ if (path.empty() || !file_util::PathExists(path)) {
+ *error =
+ l10n_util::GetStringFUTF8(
+ IDS_EXTENSION_LOAD_SIDEBAR_PAGE_FAILED,
+ WideToUTF16(page_path.ToWStringHack()));
+ return false;
+ }
+ }
+
// Validate locale info.
if (!ValidateLocaleInfo(*extension, error))
return false;
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | chrome/common/extensions/extension_manifests_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698