Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(793)

Side by Side Diff: webkit/support/platform_support_linux.cc

Issue 10383006: Add scale factor and 2x resources from webkit and plumb through to ContentClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add more test class GetImageResource methods. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/support/platform_support_android.cc ('k') | webkit/support/platform_support_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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 28 matching lines...) Expand all
39 void AfterShutdown() { 39 void AfterShutdown() {
40 } 40 }
41 41
42 } // namespace webkit_support 42 } // namespace webkit_support
43 43
44 string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { 44 string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) {
45 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); 45 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id);
46 } 46 }
47 47
48 base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) { 48 base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) {
49 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
50 }
51
52 base::StringPiece TestWebKitPlatformSupport::GetImageResource(
53 int resource_id,
54 float scale_factor) {
49 FilePath resources_path; 55 FilePath resources_path;
50 PathService::Get(base::DIR_EXE, &resources_path); 56 PathService::Get(base::DIR_EXE, &resources_path);
51 resources_path = resources_path.Append("DumpRenderTree_resources"); 57 resources_path = resources_path.Append("DumpRenderTree_resources");
52 switch (resource_id) { 58 switch (resource_id) {
53 case IDR_BROKENIMAGE: { 59 case IDR_BROKENIMAGE: {
54 CR_DEFINE_STATIC_LOCAL(std::string, broken_image_data, ()); 60 CR_DEFINE_STATIC_LOCAL(std::string, broken_image_data, ());
55 if (broken_image_data.empty()) { 61 if (broken_image_data.empty()) {
56 FilePath path = resources_path.Append("missingImage.gif"); 62 FilePath path = resources_path.Append("missingImage.gif");
57 bool success = file_util::ReadFileToString(path, &broken_image_data); 63 bool success = file_util::ReadFileToString(path, &broken_image_data);
58 if (!success) 64 if (!success)
59 LOG(FATAL) << "Failed reading: " << path.value(); 65 LOG(FATAL) << "Failed reading: " << path.value();
60 } 66 }
61 return broken_image_data; 67 return broken_image_data;
62 } 68 }
63 case IDR_TEXTAREA_RESIZER: { 69 case IDR_TEXTAREA_RESIZER: {
64 CR_DEFINE_STATIC_LOCAL(std::string, resize_corner_data, ()); 70 CR_DEFINE_STATIC_LOCAL(std::string, resize_corner_data, ());
65 if (resize_corner_data.empty()) { 71 if (resize_corner_data.empty()) {
66 FilePath path = resources_path.Append("textAreaResizeCorner.png"); 72 FilePath path = resources_path.Append("textAreaResizeCorner.png");
67 bool success = file_util::ReadFileToString(path, &resize_corner_data); 73 bool success = file_util::ReadFileToString(path, &resize_corner_data);
68 if (!success) 74 if (!success)
69 LOG(FATAL) << "Failed reading: " << path.value(); 75 LOG(FATAL) << "Failed reading: " << path.value();
70 } 76 }
71 return resize_corner_data; 77 return resize_corner_data;
72 } 78 }
73 } 79 }
74 80
81 // TODO(flackr): Pass scale_factor to ResourceBundle.
75 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); 82 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
76 } 83 }
OLDNEW
« no previous file with comments | « webkit/support/platform_support_android.cc ('k') | webkit/support/platform_support_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698