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/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" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "base/string_piece.h" | 12 #include "base/string_piece.h" |
13 #include "grit/webkit_resources.h" | 13 #include "grit/webkit_resources.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 #include "webkit/support/test_webkit_platform_support.h" | 15 #include "webkit/support/test_webkit_platform_support.h" |
16 | 16 |
17 namespace webkit_support { | 17 namespace webkit_support { |
18 | 18 |
19 // TODO(tkent): Implement some of the followings for platform-dependent tasks | 19 // TODO(tkent): Implement some of the followings for platform-dependent tasks |
20 // such as loading resource. | 20 // such as loading resource. |
21 | 21 |
22 void BeforeInitialize(bool unit_test_mode) { | 22 void BeforeInitialize(bool unit_test_mode) { |
23 } | 23 } |
24 | 24 |
25 void AfterInitialize(bool unit_test_mode) { | 25 void AfterInitialize(bool unit_test_mode) { |
26 if (unit_test_mode) | |
27 return; // We don't have a resource pack when running the unit-tests. | |
28 | |
29 FilePath data_path; | 26 FilePath data_path; |
30 PathService::Get(base::DIR_EXE, &data_path); | 27 PathService::Get(base::DIR_EXE, &data_path); |
31 data_path = data_path.Append("DumpRenderTree.pak"); | 28 data_path = data_path.Append("DumpRenderTree.pak"); |
32 ResourceBundle::InitSharedInstanceWithPakPath(data_path); | 29 ResourceBundle::InitSharedInstanceWithPakPath(data_path); |
33 } | 30 } |
34 | 31 |
35 void BeforeShutdown() { | 32 void BeforeShutdown() { |
36 ResourceBundle::CleanupSharedInstance(); | 33 ResourceBundle::CleanupSharedInstance(); |
37 } | 34 } |
38 | 35 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 if (!success) | 67 if (!success) |
71 LOG(FATAL) << "Failed reading: " << path.value(); | 68 LOG(FATAL) << "Failed reading: " << path.value(); |
72 } | 69 } |
73 return resize_corner_data; | 70 return resize_corner_data; |
74 } | 71 } |
75 } | 72 } |
76 | 73 |
77 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 74 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
78 resource_id, scale_factor); | 75 resource_id, scale_factor); |
79 } | 76 } |
OLD | NEW |