OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 void AfterShutdown() { | 39 void AfterShutdown() { |
40 } | 40 } |
41 | 41 |
42 } // namespace webkit_support | 42 } // namespace webkit_support |
43 | 43 |
44 string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { | 44 string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { |
45 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); | 45 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); |
46 } | 46 } |
47 | 47 |
48 base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) { | 48 base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) { |
| 49 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); |
| 50 } |
| 51 |
| 52 base::StringPiece TestWebKitPlatformSupport::GetImageResource( |
| 53 int resource_id, |
| 54 float scale_factor) { |
49 FilePath resources_path; | 55 FilePath resources_path; |
50 PathService::Get(base::DIR_EXE, &resources_path); | 56 PathService::Get(base::DIR_EXE, &resources_path); |
51 resources_path = resources_path.Append("DumpRenderTree_resources"); | 57 resources_path = resources_path.Append("DumpRenderTree_resources"); |
52 switch (resource_id) { | 58 switch (resource_id) { |
53 case IDR_BROKENIMAGE: { | 59 case IDR_BROKENIMAGE: { |
54 CR_DEFINE_STATIC_LOCAL(std::string, broken_image_data, ()); | 60 CR_DEFINE_STATIC_LOCAL(std::string, broken_image_data, ()); |
55 if (broken_image_data.empty()) { | 61 if (broken_image_data.empty()) { |
56 FilePath path = resources_path.Append("missingImage.gif"); | 62 FilePath path = resources_path.Append("missingImage.gif"); |
57 bool success = file_util::ReadFileToString(path, &broken_image_data); | 63 bool success = file_util::ReadFileToString(path, &broken_image_data); |
58 if (!success) | 64 if (!success) |
59 LOG(FATAL) << "Failed reading: " << path.value(); | 65 LOG(FATAL) << "Failed reading: " << path.value(); |
60 } | 66 } |
61 return broken_image_data; | 67 return broken_image_data; |
62 } | 68 } |
63 case IDR_TEXTAREA_RESIZER: { | 69 case IDR_TEXTAREA_RESIZER: { |
64 CR_DEFINE_STATIC_LOCAL(std::string, resize_corner_data, ()); | 70 CR_DEFINE_STATIC_LOCAL(std::string, resize_corner_data, ()); |
65 if (resize_corner_data.empty()) { | 71 if (resize_corner_data.empty()) { |
66 FilePath path = resources_path.Append("textAreaResizeCorner.png"); | 72 FilePath path = resources_path.Append("textAreaResizeCorner.png"); |
67 bool success = file_util::ReadFileToString(path, &resize_corner_data); | 73 bool success = file_util::ReadFileToString(path, &resize_corner_data); |
68 if (!success) | 74 if (!success) |
69 LOG(FATAL) << "Failed reading: " << path.value(); | 75 LOG(FATAL) << "Failed reading: " << path.value(); |
70 } | 76 } |
71 return resize_corner_data; | 77 return resize_corner_data; |
72 } | 78 } |
73 } | 79 } |
74 | 80 |
| 81 // TODO(flackr): Pass scale_factor to ResourceBundle. |
75 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); | 82 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); |
76 } | 83 } |
OLD | NEW |