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/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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 wchar_t localized[MAX_LOADSTRING]; | 65 wchar_t localized[MAX_LOADSTRING]; |
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( |
76 return ResourceProvider(resource_id); | |
77 } | |
78 | |
79 base::StringPiece TestWebKitPlatformSupport::GetImageResource( | |
80 int resource_id, | 76 int resource_id, |
81 float scale_factor) { | 77 ui::ScaleFactor scale_factor) { |
82 switch (resource_id) { | 78 switch (resource_id) { |
83 case IDR_BROKENIMAGE: { | 79 case IDR_BROKENIMAGE: { |
84 // Use webkit's broken image icon (16x16) | 80 // Use webkit's broken image icon (16x16) |
85 static std::string broken_image_data; | 81 static std::string broken_image_data; |
86 if (broken_image_data.empty()) { | 82 if (broken_image_data.empty()) { |
87 FilePath path = GetResourceFilePath("missingImage.gif"); | 83 FilePath path = GetResourceFilePath("missingImage.gif"); |
88 bool success = file_util::ReadFileToString(path, &broken_image_data); | 84 bool success = file_util::ReadFileToString(path, &broken_image_data); |
89 if (!success) { | 85 if (!success) { |
90 LOG(FATAL) << "Failed reading: " << path.value(); | 86 LOG(FATAL) << "Failed reading: " << path.value(); |
91 } | 87 } |
(...skipping 10 matching lines...) Expand all Loading... |
102 LOG(FATAL) << "Failed reading: " << path.value(); | 98 LOG(FATAL) << "Failed reading: " << path.value(); |
103 } | 99 } |
104 } | 100 } |
105 return resize_corner_data; | 101 return resize_corner_data; |
106 } | 102 } |
107 } | 103 } |
108 | 104 |
109 // TODO(flackr): Pass scale_factor to ResourceProvider. | 105 // TODO(flackr): Pass scale_factor to ResourceProvider. |
110 return ResourceProvider(resource_id); | 106 return ResourceProvider(resource_id); |
111 } | 107 } |
OLD | NEW |