summaryrefslogtreecommitdiffstats
path: root/webkit/support/platform_support_linux.cc
diff options
context:
space:
mode:
authorsaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-04 22:58:08 +0000
committersaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-04 22:58:08 +0000
commitcfbe37cf3fc6f35c356b6ab11ec9af540f8481aa (patch)
tree2659d226e10e454df2bb8f29decc81dcba79ac42 /webkit/support/platform_support_linux.cc
parent6cd5d5098b1559611c4ac667b3a1067231ddfb55 (diff)
downloadchromium_src-cfbe37cf3fc6f35c356b6ab11ec9af540f8481aa.zip
chromium_src-cfbe37cf3fc6f35c356b6ab11ec9af540f8481aa.tar.gz
chromium_src-cfbe37cf3fc6f35c356b6ab11ec9af540f8481aa.tar.bz2
These changes are requires to build Aura without relying on GTK.
The CL rename webkit/support/platform_support_gtk.cc which was really non GTK specific. TBR=tony@chromium.org BUG=97131 TEST=none Review URL: http://codereview.chromium.org/8093011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104013 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support/platform_support_linux.cc')
-rw-r--r--webkit/support/platform_support_linux.cc79
1 files changed, 79 insertions, 0 deletions
diff --git a/webkit/support/platform_support_linux.cc b/webkit/support/platform_support_linux.cc
new file mode 100644
index 0000000..b315958
--- /dev/null
+++ b/webkit/support/platform_support_linux.cc
@@ -0,0 +1,79 @@
+// 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 "webkit/support/platform_support.h"
+
+#include "base/file_path.h"
+#include "base/file_util.h"
+#include "base/logging.h"
+#include "base/path_service.h"
+#include "base/string16.h"
+#include "base/string_piece.h"
+#include "grit/webkit_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace webkit_support {
+
+// TODO(tkent): Implement some of the followings for platform-dependent tasks
+// such as loading resource.
+
+void BeforeInitialize(bool unit_test_mode) {
+}
+
+void AfterInitialize(bool unit_test_mode) {
+ if (unit_test_mode)
+ return; // We don't have a resource pack when running the unit-tests.
+
+ FilePath data_path;
+ PathService::Get(base::DIR_EXE, &data_path);
+ data_path = data_path.Append("DumpRenderTree.pak");
+ ResourceBundle::InitSharedInstanceForTest(data_path);
+}
+
+void BeforeShutdown() {
+ ResourceBundle::CleanupSharedInstance();
+}
+
+void AfterShutdown() {
+}
+
+} // namespace webkit_support
+
+namespace webkit_glue {
+
+string16 GetLocalizedString(int message_id) {
+ return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id);
+}
+
+base::StringPiece GetDataResource(int resource_id) {
+ FilePath resources_path;
+ PathService::Get(base::DIR_EXE, &resources_path);
+ resources_path = resources_path.Append("DumpRenderTree_resources");
+ switch (resource_id) {
+ case IDR_BROKENIMAGE: {
+ static std::string broken_image_data;
+ if (broken_image_data.empty()) {
+ FilePath path = resources_path.Append("missingImage.gif");
+ bool success = file_util::ReadFileToString(path, &broken_image_data);
+ if (!success)
+ LOG(FATAL) << "Failed reading: " << path.value();
+ }
+ return broken_image_data;
+ }
+ case IDR_TEXTAREA_RESIZER: {
+ static std::string resize_corner_data;
+ if (resize_corner_data.empty()) {
+ FilePath path = resources_path.Append("textAreaResizeCorner.png");
+ bool success = file_util::ReadFileToString(path, &resize_corner_data);
+ if (!success)
+ LOG(FATAL) << "Failed reading: " << path.value();
+ }
+ return resize_corner_data;
+ }
+ }
+
+ return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
+}
+
+} // namespace webkit_glue