OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base_paths.h" | 7 #include "base/base_paths.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" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 int length = ::LoadString(::GetModuleHandle(NULL), message_id, | 66 int length = ::LoadString(::GetModuleHandle(NULL), message_id, |
67 localized, MAX_LOADSTRING); | 67 localized, MAX_LOADSTRING); |
68 if (!length && ::GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND) { | 68 if (!length && ::GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND) { |
69 NOTREACHED(); | 69 NOTREACHED(); |
70 return L"No string for this identifier!"; | 70 return L"No string for this identifier!"; |
71 } | 71 } |
72 return string16(localized, length); | 72 return string16(localized, length); |
73 } | 73 } |
74 | 74 |
75 base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) { | 75 base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) { |
| 76 return ResourceProvider(resource_id); |
| 77 } |
| 78 |
| 79 base::StringPiece TestWebKitPlatformSupport::GetImageResource( |
| 80 int resource_id, |
| 81 float scale_factor) { |
76 switch (resource_id) { | 82 switch (resource_id) { |
77 case IDR_BROKENIMAGE: { | 83 case IDR_BROKENIMAGE: { |
78 // Use webkit's broken image icon (16x16) | 84 // Use webkit's broken image icon (16x16) |
79 static std::string broken_image_data; | 85 static std::string broken_image_data; |
80 if (broken_image_data.empty()) { | 86 if (broken_image_data.empty()) { |
81 FilePath path = GetResourceFilePath("missingImage.gif"); | 87 FilePath path = GetResourceFilePath("missingImage.gif"); |
82 bool success = file_util::ReadFileToString(path, &broken_image_data); | 88 bool success = file_util::ReadFileToString(path, &broken_image_data); |
83 if (!success) { | 89 if (!success) { |
84 LOG(FATAL) << "Failed reading: " << path.value(); | 90 LOG(FATAL) << "Failed reading: " << path.value(); |
85 } | 91 } |
86 } | 92 } |
87 return broken_image_data; | 93 return broken_image_data; |
88 } | 94 } |
89 case IDR_TEXTAREA_RESIZER: { | 95 case IDR_TEXTAREA_RESIZER: { |
90 // Use webkit's text area resizer image. | 96 // Use webkit's text area resizer image. |
91 static std::string resize_corner_data; | 97 static std::string resize_corner_data; |
92 if (resize_corner_data.empty()) { | 98 if (resize_corner_data.empty()) { |
93 FilePath path = GetResourceFilePath("textAreaResizeCorner.png"); | 99 FilePath path = GetResourceFilePath("textAreaResizeCorner.png"); |
94 bool success = file_util::ReadFileToString(path, &resize_corner_data); | 100 bool success = file_util::ReadFileToString(path, &resize_corner_data); |
95 if (!success) { | 101 if (!success) { |
96 LOG(FATAL) << "Failed reading: " << path.value(); | 102 LOG(FATAL) << "Failed reading: " << path.value(); |
97 } | 103 } |
98 } | 104 } |
99 return resize_corner_data; | 105 return resize_corner_data; |
100 } | 106 } |
101 } | 107 } |
102 | 108 |
| 109 // TODO(flackr): Pass scale_factor to ResourceProvider. |
103 return ResourceProvider(resource_id); | 110 return ResourceProvider(resource_id); |
104 } | 111 } |
OLD | NEW |