| 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 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 #include <AvailabilityMacros.h> | 8 #include <AvailabilityMacros.h> |
| 9 #import <Foundation/Foundation.h> | 9 #import <Foundation/Foundation.h> |
| 10 #import <objc/objc-runtime.h> | 10 #import <objc/objc-runtime.h> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 ui::ScaleFactor scale_factor) { | 218 ui::ScaleFactor scale_factor) { |
| 219 switch (resource_id) { | 219 switch (resource_id) { |
| 220 case IDR_BROKENIMAGE: { | 220 case IDR_BROKENIMAGE: { |
| 221 // Use webkit's broken image icon (16x16) | 221 // Use webkit's broken image icon (16x16) |
| 222 CR_DEFINE_STATIC_LOCAL(std::string, broken_image_data, ()); | 222 CR_DEFINE_STATIC_LOCAL(std::string, broken_image_data, ()); |
| 223 if (broken_image_data.empty()) { | 223 if (broken_image_data.empty()) { |
| 224 base::FilePath path = GetResourcesFilePath(); | 224 base::FilePath path = GetResourcesFilePath(); |
| 225 // In order to match WebKit's colors for the missing image, we have to | 225 // In order to match WebKit's colors for the missing image, we have to |
| 226 // use a PNG. The GIF doesn't have the color range needed to correctly | 226 // use a PNG. The GIF doesn't have the color range needed to correctly |
| 227 // match the TIFF they use in Safari. | 227 // match the TIFF they use in Safari. |
| 228 path = path.AppendASCII("missingImage.png"); | 228 path = base::MakeAbsoluteFilePath(path.AppendASCII("missingImage.png")); |
| 229 file_util::AbsolutePath(&path); | |
| 230 bool success = file_util::ReadFileToString(path, &broken_image_data); | 229 bool success = file_util::ReadFileToString(path, &broken_image_data); |
| 231 if (!success) { | 230 if (!success) { |
| 232 LOG(FATAL) << "Failed reading: " << path.value(); | 231 LOG(FATAL) << "Failed reading: " << path.value(); |
| 233 } | 232 } |
| 234 } | 233 } |
| 235 return broken_image_data; | 234 return broken_image_data; |
| 236 } | 235 } |
| 237 case IDR_TEXTAREA_RESIZER: { | 236 case IDR_TEXTAREA_RESIZER: { |
| 238 // Use webkit's text area resizer image. | 237 // Use webkit's text area resizer image. |
| 239 CR_DEFINE_STATIC_LOCAL(std::string, resize_corner_data, ()); | 238 CR_DEFINE_STATIC_LOCAL(std::string, resize_corner_data, ()); |
| 240 if (resize_corner_data.empty()) { | 239 if (resize_corner_data.empty()) { |
| 241 base::FilePath path = GetResourcesFilePath(); | 240 base::FilePath path = GetResourcesFilePath(); |
| 242 path = path.AppendASCII("textAreaResizeCorner.png"); | 241 path = base::MakeAbsoluteFilePath( |
| 243 file_util::AbsolutePath(&path); | 242 path.AppendASCII("textAreaResizeCorner.png")); |
| 244 bool success = file_util::ReadFileToString(path, &resize_corner_data); | 243 bool success = file_util::ReadFileToString(path, &resize_corner_data); |
| 245 if (!success) { | 244 if (!success) { |
| 246 LOG(FATAL) << "Failed reading: " << path.value(); | 245 LOG(FATAL) << "Failed reading: " << path.value(); |
| 247 } | 246 } |
| 248 } | 247 } |
| 249 return resize_corner_data; | 248 return resize_corner_data; |
| 250 } | 249 } |
| 251 } | 250 } |
| 252 base::StringPiece res; | 251 base::StringPiece res; |
| 253 if (g_resource_data_pack) | 252 if (g_resource_data_pack) |
| 254 g_resource_data_pack->GetStringPiece(resource_id, &res); | 253 g_resource_data_pack->GetStringPiece(resource_id, &res); |
| 255 return res; | 254 return res; |
| 256 } | 255 } |
| OLD | NEW |