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 #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 |
11 #include "base/base_paths.h" | 11 #include "base/base_paths.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/mac/bundle_locations.h" | 14 #include "base/mac/bundle_locations.h" |
15 #include "base/mac/mac_util.h" | 15 #include "base/mac/mac_util.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/string16.h" | 17 #include "base/string16.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "grit/webkit_resources.h" | 19 #include "grit/webkit_resources.h" |
20 #include "third_party/WebKit/Source/WebKit/mac/WebCoreSupport/WebSystemInterface
.h" | |
21 #include "ui/base/resource/data_pack.h" | 20 #include "ui/base/resource/data_pack.h" |
22 #include "webkit/plugins/npapi/plugin_list.h" | 21 #include "webkit/plugins/npapi/plugin_list.h" |
23 #include "webkit/support/test_webkit_platform_support.h" | 22 #include "webkit/support/test_webkit_platform_support.h" |
24 #import "webkit/support/drt_application_mac.h" | 23 #import "webkit/support/drt_application_mac.h" |
25 #import "webkit/tools/test_shell/mac/DumpRenderTreePasteboard.h" | 24 #import "webkit/tools/test_shell/mac/DumpRenderTreePasteboard.h" |
26 | 25 |
27 static ui::DataPack* g_resource_data_pack = NULL; | 26 static ui::DataPack* g_resource_data_pack = NULL; |
28 | 27 |
29 namespace webkit_support { | 28 namespace webkit_support { |
30 | 29 |
31 static NSAutoreleasePool* autorelease_pool; | 30 static NSAutoreleasePool* autorelease_pool; |
32 | 31 |
33 void BeforeInitialize(bool unit_test_mode) { | 32 void BeforeInitialize(bool unit_test_mode) { |
34 [CrDrtApplication sharedApplication]; | 33 [CrDrtApplication sharedApplication]; |
35 // Need to initialize NSAutoreleasePool before InitWebCoreSystemInterface(). | |
36 autorelease_pool = [[NSAutoreleasePool alloc] init]; | 34 autorelease_pool = [[NSAutoreleasePool alloc] init]; |
37 DCHECK(autorelease_pool); | 35 DCHECK(autorelease_pool); |
38 InitWebCoreSystemInterface(); | |
39 } | 36 } |
40 | 37 |
41 #if OBJC_API_VERSION == 2 | 38 #if OBJC_API_VERSION == 2 |
42 static void SwizzleAllMethods(Class imposter, Class original) { | 39 static void SwizzleAllMethods(Class imposter, Class original) { |
43 unsigned int imposterMethodCount = 0; | 40 unsigned int imposterMethodCount = 0; |
44 Method* imposterMethods = | 41 Method* imposterMethods = |
45 class_copyMethodList(imposter, &imposterMethodCount); | 42 class_copyMethodList(imposter, &imposterMethodCount); |
46 | 43 |
47 unsigned int originalMethodCount = 0; | 44 unsigned int originalMethodCount = 0; |
48 Method* originalMethods = | 45 Method* originalMethods = |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 221 } |
225 } | 222 } |
226 return resize_corner_data; | 223 return resize_corner_data; |
227 } | 224 } |
228 } | 225 } |
229 base::StringPiece res; | 226 base::StringPiece res; |
230 if (g_resource_data_pack) | 227 if (g_resource_data_pack) |
231 g_resource_data_pack->GetStringPiece(resource_id, &res); | 228 g_resource_data_pack->GetStringPiece(resource_id, &res); |
232 return res; | 229 return res; |
233 } | 230 } |
OLD | NEW |