summaryrefslogtreecommitdiffstats
path: root/content/browser/webui
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-05 21:18:04 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-05 21:18:04 +0000
commitb8192877c5720ca2d294bfcf7187e2b9654d3016 (patch)
tree0569a07477cabb164fbd9a9d14fbce94b6456298 /content/browser/webui
parenta73f755fefe0ab2e709b6fa3c1ae7ad42775a42b (diff)
downloadchromium_src-b8192877c5720ca2d294bfcf7187e2b9654d3016.zip
chromium_src-b8192877c5720ca2d294bfcf7187e2b9654d3016.tar.gz
chromium_src-b8192877c5720ca2d294bfcf7187e2b9654d3016.tar.bz2
Relanding - https://codereview.chromium.org/20565006/
The CL was reverted due to this error, c:\b\build\slave\google-chrome-rel-win\build\src\chrome/browser/feedback/feedback_util.h(13): fatal error C1083: Cannot open include file: 'chrome/browser/feedback/proto/common.pb.h': No such file or directory This CL neither changes line 13 in feedback_util.h (which includes the generated protobuf file), nor does it change common.proto, which is used to generate common.ph.h; so it seems very probable that this build error is a flake. TBR=rkc@chromium.org BUG=None. Review URL: https://codereview.chromium.org/22253004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215683 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/webui')
-rw-r--r--content/browser/webui/shared_resources_data_source.cc30
1 files changed, 29 insertions, 1 deletions
diff --git a/content/browser/webui/shared_resources_data_source.cc b/content/browser/webui/shared_resources_data_source.cc
index 23cdc3d..42d0d11 100644
--- a/content/browser/webui/shared_resources_data_source.cc
+++ b/content/browser/webui/shared_resources_data_source.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/memory/ref_counted_memory.h"
+#include "base/strings/string_util.h"
#include "base/threading/thread_restrictions.h"
#include "content/public/common/content_client.h"
#include "content/public/common/url_constants.h"
@@ -14,10 +15,37 @@
namespace {
+const char kAppImagesPath[] = "images/apps/";
+const char kAppImagesPath2x[] = "images/2x/apps/";
+
+const char kReplacement[] = "../../resources/default_100_percent/common/";
+const char kReplacement2x[] = "../../resources/default_200_percent/common/";
+
+// This entire method is a hack introduced to be able to handle apps images
+// that exist in the ui/resources directory. From JS/CSS, we still load the
+// image as if it were chrome://resources/images/apps/myappimage.png, if that
+// path doesn't exist, we check to see if it that image exists in the relative
+// path to ui/resources instead.
+// TODO(rkc): Once we have a separate source for apps, remove this code.
+bool AppsRelativePathMatch(const std::string& path,
+ const std::string& compareto) {
+ if (StartsWithASCII(path, kAppImagesPath, false)) {
+ if (compareto ==
+ (kReplacement + path.substr(arraysize(kAppImagesPath) - 1)))
+ return true;
+ } else if (StartsWithASCII(path, kAppImagesPath2x, false)) {
+ if (compareto ==
+ (kReplacement2x + path.substr(arraysize(kAppImagesPath) - 1)))
+ return true;
+ }
+ return false;
+}
+
int PathToIDR(const std::string& path) {
int idr = -1;
for (size_t i = 0; i < kWebuiResourcesSize; ++i) {
- if (kWebuiResources[i].name == path) {
+ if ((path == kWebuiResources[i].name) ||
+ AppsRelativePathMatch(path, kWebuiResources[i].name)) {
idr = kWebuiResources[i].value;
break;
}