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 "app/data_pack.h" | |
8 #include "base/file_path.h" | 7 #include "base/file_path.h" |
9 #include "base/file_util.h" | 8 #include "base/file_util.h" |
10 #include "base/logging.h" | 9 #include "base/logging.h" |
11 #include "base/path_service.h" | 10 #include "base/path_service.h" |
12 #include "base/string16.h" | 11 #include "base/string16.h" |
13 #include "base/string_piece.h" | 12 #include "base/string_piece.h" |
14 #include "gfx/gfx_module.h" | 13 #include "gfx/gfx_module.h" |
15 #include "grit/webkit_resources.h" | 14 #include "grit/webkit_resources.h" |
| 15 #include "ui/base/resource/data_pack.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // Data resources on linux. This is a pointer to the mmapped resources file. | 19 // Data resources on linux. This is a pointer to the mmapped resources file. |
20 app::DataPack* g_resource_data_pack = NULL; | 20 ui::DataPack* g_resource_data_pack = NULL; |
21 | 21 |
22 base::StringPiece TestResourceProvider(int resource_id) { | 22 base::StringPiece TestResourceProvider(int resource_id) { |
23 base::StringPiece res; | 23 base::StringPiece res; |
24 if (g_resource_data_pack) | 24 if (g_resource_data_pack) |
25 g_resource_data_pack->GetStringPiece(resource_id, &res); | 25 g_resource_data_pack->GetStringPiece(resource_id, &res); |
26 return res; | 26 return res; |
27 } | 27 } |
28 | 28 |
29 } | 29 } |
30 | 30 |
31 namespace webkit_support { | 31 namespace webkit_support { |
32 | 32 |
33 // TODO(tkent): Implement some of the followings for platform-dependent tasks | 33 // TODO(tkent): Implement some of the followings for platform-dependent tasks |
34 // such as loading resource. | 34 // such as loading resource. |
35 | 35 |
36 void BeforeInitialize(bool unit_test_mode) { | 36 void BeforeInitialize(bool unit_test_mode) { |
37 } | 37 } |
38 | 38 |
39 void AfterInitialize(bool unit_test_mode) { | 39 void AfterInitialize(bool unit_test_mode) { |
40 if (unit_test_mode) | 40 if (unit_test_mode) |
41 return; // We don't have a resource pack when running the unit-tests. | 41 return; // We don't have a resource pack when running the unit-tests. |
42 g_resource_data_pack = new app::DataPack; | 42 g_resource_data_pack = new ui::DataPack; |
43 FilePath data_path; | 43 FilePath data_path; |
44 PathService::Get(base::DIR_EXE, &data_path); | 44 PathService::Get(base::DIR_EXE, &data_path); |
45 data_path = data_path.Append("DumpRenderTree.pak"); | 45 data_path = data_path.Append("DumpRenderTree.pak"); |
46 if (!g_resource_data_pack->Load(data_path)) | 46 if (!g_resource_data_pack->Load(data_path)) |
47 LOG(FATAL) << "failed to load DumpRenderTree.pak"; | 47 LOG(FATAL) << "failed to load DumpRenderTree.pak"; |
48 | 48 |
49 // Config the modules that need access to a limited set of resources. | 49 // Config the modules that need access to a limited set of resources. |
50 gfx::GfxModule::SetResourceProvider(TestResourceProvider); | 50 gfx::GfxModule::SetResourceProvider(TestResourceProvider); |
51 } | 51 } |
52 | 52 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 return resize_corner_data; | 95 return resize_corner_data; |
96 } | 96 } |
97 } | 97 } |
98 base::StringPiece res; | 98 base::StringPiece res; |
99 g_resource_data_pack->GetStringPiece(resource_id, &res); | 99 g_resource_data_pack->GetStringPiece(resource_id, &res); |
100 return res; | 100 return res; |
101 } | 101 } |
102 | 102 |
103 } // namespace webkit_glue | 103 } // namespace webkit_glue |
OLD | NEW |