| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/support/platform_support.h" | 5 #include "webkit/support/platform_support.h" |
| 6 | 6 |
| 7 #include "base/data_pack.h" | 7 #include "app/data_pack.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "base/string_piece.h" | 13 #include "base/string_piece.h" |
| 14 #include "grit/webkit_resources.h" | 14 #include "grit/webkit_resources.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // Data resources on linux. This is a pointer to the mmapped resources file. | 18 // Data resources on linux. This is a pointer to the mmapped resources file. |
| 19 base::DataPack* g_resource_data_pack = NULL; | 19 app::DataPack* g_resource_data_pack = NULL; |
| 20 | 20 |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace webkit_support { | 23 namespace webkit_support { |
| 24 | 24 |
| 25 // TODO(tkent): Implement some of the followings for platform-dependent tasks | 25 // TODO(tkent): Implement some of the followings for platform-dependent tasks |
| 26 // such as loading resource. | 26 // such as loading resource. |
| 27 | 27 |
| 28 void BeforeInitialize(bool unit_test_mode) { | 28 void BeforeInitialize(bool unit_test_mode) { |
| 29 } | 29 } |
| 30 | 30 |
| 31 void AfterInitialize(bool unit_test_mode) { | 31 void AfterInitialize(bool unit_test_mode) { |
| 32 if (unit_test_mode) | 32 if (unit_test_mode) |
| 33 return; // We don't have a resource pack when running the unit-tests. | 33 return; // We don't have a resource pack when running the unit-tests. |
| 34 g_resource_data_pack = new base::DataPack; | 34 g_resource_data_pack = new app::DataPack; |
| 35 FilePath data_path; | 35 FilePath data_path; |
| 36 PathService::Get(base::DIR_EXE, &data_path); | 36 PathService::Get(base::DIR_EXE, &data_path); |
| 37 data_path = data_path.Append("DumpRenderTree.pak"); | 37 data_path = data_path.Append("DumpRenderTree.pak"); |
| 38 if (!g_resource_data_pack->Load(data_path)) | 38 if (!g_resource_data_pack->Load(data_path)) |
| 39 LOG(FATAL) << "failed to load DumpRenderTree.pak"; | 39 LOG(FATAL) << "failed to load DumpRenderTree.pak"; |
| 40 } | 40 } |
| 41 | 41 |
| 42 void BeforeShutdown() { | 42 void BeforeShutdown() { |
| 43 } | 43 } |
| 44 | 44 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 return resize_corner_data; | 84 return resize_corner_data; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 base::StringPiece res; | 87 base::StringPiece res; |
| 88 g_resource_data_pack->GetStringPiece(resource_id, &res); | 88 g_resource_data_pack->GetStringPiece(resource_id, &res); |
| 89 return res; | 89 return res; |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace webkit_glue | 92 } // namespace webkit_glue |
| OLD | NEW |