| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 void AfterShutdown() { | 55 void AfterShutdown() { |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace webkit_support | 58 } // namespace webkit_support |
| 59 | 59 |
| 60 string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { | 60 string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { |
| 61 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); | 61 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); |
| 62 } | 62 } |
| 63 | 63 |
| 64 base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) { | 64 base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) { |
| 65 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); |
| 66 } |
| 67 |
| 68 base::StringPiece TestWebKitPlatformSupport::GetImageResource( |
| 69 int resource_id, |
| 70 float scale_factor) { |
| 65 FilePath resources_path; | 71 FilePath resources_path; |
| 66 PathService::Get(base::DIR_EXE, &resources_path); | 72 PathService::Get(base::DIR_EXE, &resources_path); |
| 67 resources_path = resources_path.Append("DumpRenderTree_resources"); | 73 resources_path = resources_path.Append("DumpRenderTree_resources"); |
| 68 switch (resource_id) { | 74 switch (resource_id) { |
| 69 case IDR_BROKENIMAGE: { | 75 case IDR_BROKENIMAGE: { |
| 70 static std::string broken_image_data; | 76 static std::string broken_image_data; |
| 71 if (broken_image_data.empty()) { | 77 if (broken_image_data.empty()) { |
| 72 FilePath path = resources_path.Append("missingImage.gif"); | 78 FilePath path = resources_path.Append("missingImage.gif"); |
| 73 bool success = file_util::ReadFileToString(path, &broken_image_data); | 79 bool success = file_util::ReadFileToString(path, &broken_image_data); |
| 74 if (!success) | 80 if (!success) |
| 75 LOG(FATAL) << "Failed reading: " << path.value(); | 81 LOG(FATAL) << "Failed reading: " << path.value(); |
| 76 } | 82 } |
| 77 return broken_image_data; | 83 return broken_image_data; |
| 78 } | 84 } |
| 79 case IDR_TEXTAREA_RESIZER: { | 85 case IDR_TEXTAREA_RESIZER: { |
| 80 static std::string resize_corner_data; | 86 static std::string resize_corner_data; |
| 81 if (resize_corner_data.empty()) { | 87 if (resize_corner_data.empty()) { |
| 82 FilePath path = resources_path.Append("textAreaResizeCorner.png"); | 88 FilePath path = resources_path.Append("textAreaResizeCorner.png"); |
| 83 bool success = file_util::ReadFileToString(path, &resize_corner_data); | 89 bool success = file_util::ReadFileToString(path, &resize_corner_data); |
| 84 if (!success) | 90 if (!success) |
| 85 LOG(FATAL) << "Failed reading: " << path.value(); | 91 LOG(FATAL) << "Failed reading: " << path.value(); |
| 86 } | 92 } |
| 87 return resize_corner_data; | 93 return resize_corner_data; |
| 88 } | 94 } |
| 89 } | 95 } |
| 90 | 96 |
| 97 // TODO(flackr): Pass scale_factor to ResourceBundle. |
| 91 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); | 98 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); |
| 92 } | 99 } |
| OLD | NEW |