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

Unified Diff: ui/base/resource/resource_bundle_android.cc

Issue 8497054: Upstream: ui implementation in Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments and sync Created 9 years, 1 month 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
« no previous file with comments | « no previous file | ui/base/theme_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/resource/resource_bundle_android.cc
diff --git a/ui/base/resource/resource_bundle_android.cc b/ui/base/resource/resource_bundle_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..dbb671d9565652bcf89db0ae3730bd6f4c909c97
--- /dev/null
+++ b/ui/base/resource/resource_bundle_android.cc
@@ -0,0 +1,54 @@
+// Copyright (c) 2011 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 "ui/base/resource/resource_bundle.h"
+
+#include <string>
+
+#include "base/file_path.h"
+#include "base/file_util.h"
+#include "base/logging.h"
+#include "base/path_service.h"
+#include "base/stringprintf.h"
+
+// We use a trick where we bundle the resource files in the apk
+// as fake shared libraries. We should stop doing this as soon as either the
+// resource files come pre-installed on the platform or there is a supported
+// way to include additional files in the APK that get unpacked at install
+// time.
+
+namespace ui {
+
+// static
+FilePath ResourceBundle::GetResourcesFilePath() {
+ FilePath data_path;
+ PathService::Get(base::DIR_MODULE, &data_path);
+ DCHECK(!data_path.empty());
+ return data_path.Append("lib_chrome.pak.so");
+}
+
+// static
+FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) {
+ FilePath locale_path;
+ PathService::Get(base::DIR_MODULE, &locale_path);
+ DCHECK(!locale_path.empty());
+ const std::string locale_name =
+ StringPrintf("lib_%s.pak.so", app_locale.c_str());
+ locale_path = locale_path.Append(locale_name);
+ if (!file_util::PathExists(locale_path))
+ return FilePath();
+ return locale_path;
+}
+
+gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) {
+ return GetImageNamed(resource_id);
+}
+
+// static
+FilePath ResourceBundle::GetLargeIconResourcesFilePath() {
+ // Not supported.
+ return FilePath();
+}
+
+}
« no previous file with comments | « no previous file | ui/base/theme_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698