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/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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 string16 GetLocalizedString(int message_id) { | 45 string16 GetLocalizedString(int message_id) { |
46 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); | 46 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); |
47 } | 47 } |
48 | 48 |
49 base::StringPiece GetDataResource(int resource_id) { | 49 base::StringPiece GetDataResource(int resource_id) { |
50 FilePath resources_path; | 50 FilePath resources_path; |
51 PathService::Get(base::DIR_EXE, &resources_path); | 51 PathService::Get(base::DIR_EXE, &resources_path); |
52 resources_path = resources_path.Append("DumpRenderTree_resources"); | 52 resources_path = resources_path.Append("DumpRenderTree_resources"); |
53 switch (resource_id) { | 53 switch (resource_id) { |
54 case IDR_BROKENIMAGE: { | 54 case IDR_BROKENIMAGE: { |
55 static std::string broken_image_data; | 55 CR_DEFINE_STATIC_LOCAL(std::string, broken_image_data, ()); |
56 if (broken_image_data.empty()) { | 56 if (broken_image_data.empty()) { |
57 FilePath path = resources_path.Append("missingImage.gif"); | 57 FilePath path = resources_path.Append("missingImage.gif"); |
58 bool success = file_util::ReadFileToString(path, &broken_image_data); | 58 bool success = file_util::ReadFileToString(path, &broken_image_data); |
59 if (!success) | 59 if (!success) |
60 LOG(FATAL) << "Failed reading: " << path.value(); | 60 LOG(FATAL) << "Failed reading: " << path.value(); |
61 } | 61 } |
62 return broken_image_data; | 62 return broken_image_data; |
63 } | 63 } |
64 case IDR_TEXTAREA_RESIZER: { | 64 case IDR_TEXTAREA_RESIZER: { |
65 static std::string resize_corner_data; | 65 CR_DEFINE_STATIC_LOCAL(std::string, resize_corner_data, ()); |
66 if (resize_corner_data.empty()) { | 66 if (resize_corner_data.empty()) { |
67 FilePath path = resources_path.Append("textAreaResizeCorner.png"); | 67 FilePath path = resources_path.Append("textAreaResizeCorner.png"); |
68 bool success = file_util::ReadFileToString(path, &resize_corner_data); | 68 bool success = file_util::ReadFileToString(path, &resize_corner_data); |
69 if (!success) | 69 if (!success) |
70 LOG(FATAL) << "Failed reading: " << path.value(); | 70 LOG(FATAL) << "Failed reading: " << path.value(); |
71 } | 71 } |
72 return resize_corner_data; | 72 return resize_corner_data; |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); | 76 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); |
77 } | 77 } |
78 | 78 |
79 } // namespace webkit_glue | 79 } // namespace webkit_glue |
OLD | NEW |