| 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 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #import <objc/objc-runtime.h> | 9 #import <objc/objc-runtime.h> |
| 10 | 10 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 switch (resource_id) { | 175 switch (resource_id) { |
| 176 case IDR_BROKENIMAGE: { | 176 case IDR_BROKENIMAGE: { |
| 177 // Use webkit's broken image icon (16x16) | 177 // Use webkit's broken image icon (16x16) |
| 178 static std::string broken_image_data; | 178 static std::string broken_image_data; |
| 179 if (broken_image_data.empty()) { | 179 if (broken_image_data.empty()) { |
| 180 FilePath path = GetResourcesFilePath(); | 180 FilePath path = GetResourcesFilePath(); |
| 181 // In order to match WebKit's colors for the missing image, we have to | 181 // In order to match WebKit's colors for the missing image, we have to |
| 182 // use a PNG. The GIF doesn't have the color range needed to correctly | 182 // use a PNG. The GIF doesn't have the color range needed to correctly |
| 183 // match the TIFF they use in Safari. | 183 // match the TIFF they use in Safari. |
| 184 path = path.AppendASCII("missingImage.png"); | 184 path = path.AppendASCII("missingImage.png"); |
| 185 bool success = file_util::ReadFileToString(path.ToWStringHack(), | 185 bool success = file_util::ReadFileToString(path, &broken_image_data); |
| 186 &broken_image_data); | |
| 187 if (!success) { | 186 if (!success) { |
| 188 LOG(FATAL) << "Failed reading: " << path.value(); | 187 LOG(FATAL) << "Failed reading: " << path.value(); |
| 189 } | 188 } |
| 190 } | 189 } |
| 191 return broken_image_data; | 190 return broken_image_data; |
| 192 } | 191 } |
| 193 case IDR_TEXTAREA_RESIZER: { | 192 case IDR_TEXTAREA_RESIZER: { |
| 194 // Use webkit's text area resizer image. | 193 // Use webkit's text area resizer image. |
| 195 static std::string resize_corner_data; | 194 static std::string resize_corner_data; |
| 196 if (resize_corner_data.empty()) { | 195 if (resize_corner_data.empty()) { |
| 197 FilePath path = GetResourcesFilePath(); | 196 FilePath path = GetResourcesFilePath(); |
| 198 path = path.AppendASCII("textAreaResizeCorner.png"); | 197 path = path.AppendASCII("textAreaResizeCorner.png"); |
| 199 bool success = file_util::ReadFileToString(path.ToWStringHack(), | 198 bool success = file_util::ReadFileToString(path, &resize_corner_data); |
| 200 &resize_corner_data); | |
| 201 if (!success) { | 199 if (!success) { |
| 202 LOG(FATAL) << "Failed reading: " << path.value(); | 200 LOG(FATAL) << "Failed reading: " << path.value(); |
| 203 } | 201 } |
| 204 } | 202 } |
| 205 return resize_corner_data; | 203 return resize_corner_data; |
| 206 } | 204 } |
| 207 | 205 |
| 208 case IDR_SEARCH_CANCEL: | 206 case IDR_SEARCH_CANCEL: |
| 209 case IDR_SEARCH_CANCEL_PRESSED: | 207 case IDR_SEARCH_CANCEL_PRESSED: |
| 210 case IDR_SEARCH_MAGNIFIER: | 208 case IDR_SEARCH_MAGNIFIER: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 222 return res; | 220 return res; |
| 223 } | 221 } |
| 224 | 222 |
| 225 default: | 223 default: |
| 226 break; | 224 break; |
| 227 } | 225 } |
| 228 return base::StringPiece(); | 226 return base::StringPiece(); |
| 229 } | 227 } |
| 230 | 228 |
| 231 } // namespace webkit_glue | 229 } // namespace webkit_glue |
| OLD | NEW |