OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/blink_platform_impl.h" | 5 #include "content/child/blink_platform_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
17 #include "base/metrics/user_metrics_action.h" | 17 #include "base/metrics/user_metrics_action.h" |
18 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "base/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
24 #include "base/synchronization/waitable_event.h" | 24 #include "base/synchronization/waitable_event.h" |
25 #include "base/sys_info.h" | 25 #include "base/sys_info.h" |
26 #include "base/thread_task_runner_handle.h" | 26 #include "base/thread_task_runner_handle.h" |
27 #include "base/threading/platform_thread.h" | 27 #include "base/threading/platform_thread.h" |
28 #include "base/threading/thread.h" | 28 #include "base/threading/thread.h" |
29 #include "base/time/time.h" | 29 #include "base/time/time.h" |
30 #include "base/trace_event/memory_allocator_dump_guid.h" | 30 #include "base/trace_event/memory_allocator_dump_guid.h" |
31 #include "base/trace_event/memory_dump_manager.h" | 31 #include "base/trace_event/memory_dump_manager.h" |
32 #include "base/trace_event/trace_event.h" | 32 #include "base/trace_event/trace_event.h" |
33 #include "blink/public/resources/grit/blink_image_resources.h" | 33 #include "blink/public/resources/grit/blink_image_resources.h" |
34 #include "blink/public/resources/grit/blink_resources.h" | 34 #include "blink/public/resources/grit/blink_resources.h" |
35 #include "build/build_config.h" | 35 #include "build/build_config.h" |
36 #include "components/mime_util/mime_util.h" | 36 #include "components/mime_util/mime_util.h" |
37 #include "components/scheduler/child/web_task_runner_impl.h" | 37 #include "components/scheduler/child/web_task_runner_impl.h" |
38 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" | 38 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" |
39 #include "content/app/resources/grit/content_resources.h" | 39 #include "content/app/resources/grit/content_resources.h" |
40 #include "content/app/strings/grit/content_strings.h" | 40 #include "content/app/strings/grit/content_strings.h" |
41 #include "content/child/background_sync/background_sync_provider.h" | 41 #include "content/child/background_sync/background_sync_provider.h" |
42 #include "content/child/child_thread_impl.h" | 42 #include "content/child/child_thread_impl.h" |
43 #include "content/child/content_child_helpers.h" | 43 #include "content/child/content_child_helpers.h" |
44 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 44 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
45 #include "content/child/navigator_connect/service_port_provider.h" | 45 #include "content/child/navigator_connect/service_port_provider.h" |
46 #include "content/child/notifications/notification_dispatcher.h" | 46 #include "content/child/notifications/notification_dispatcher.h" |
47 #include "content/child/notifications/notification_manager.h" | 47 #include "content/child/notifications/notification_manager.h" |
48 #include "content/child/permissions/permission_dispatcher.h" | 48 #include "content/child/permissions/permission_dispatcher.h" |
49 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" | 49 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" |
50 #include "content/child/push_messaging/push_dispatcher.h" | 50 #include "content/child/push_messaging/push_dispatcher.h" |
51 #include "content/child/push_messaging/push_provider.h" | 51 #include "content/child/push_messaging/push_provider.h" |
52 #include "content/child/thread_safe_sender.h" | 52 #include "content/child/thread_safe_sender.h" |
53 #include "content/child/web_discardable_memory_impl.h" | 53 #include "content/child/web_discardable_memory_impl.h" |
54 #include "content/child/web_url_loader_impl.h" | 54 #include "content/child/web_memory_dump_provider_adapter.h" |
55 #include "content/child/web_url_request_util.h" | 55 #include "content/child/web_process_memory_dump_impl.h" |
56 #include "content/child/websocket_bridge.h" | 56 #include "content/child/web_url_loader_impl.h" |
57 #include "content/child/worker_thread_registry.h" | 57 #include "content/child/web_url_request_util.h" |
58 #include "content/public/common/content_client.h" | 58 #include "content/child/websocket_bridge.h" |
59 #include "net/base/data_url.h" | 59 #include "content/child/worker_thread_registry.h" |
60 #include "net/base/ip_address_number.h" | 60 #include "content/public/common/content_client.h" |
61 #include "net/base/net_errors.h" | 61 #include "net/base/data_url.h" |
62 #include "net/base/port_util.h" | 62 #include "net/base/ip_address_number.h" |
63 #include "third_party/WebKit/public/platform/WebData.h" | 63 #include "net/base/net_errors.h" |
64 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 64 #include "net/base/port_util.h" |
65 #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h" | 65 #include "third_party/WebKit/public/platform/WebData.h" |
66 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 66 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
67 #include "third_party/WebKit/public/platform/WebString.h" | 67 #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h" |
68 #include "third_party/WebKit/public/platform/WebURL.h" | 68 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
69 #include "ui/base/layout.h" | 69 #include "third_party/WebKit/public/platform/WebString.h" |
70 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" | 70 #include "third_party/WebKit/public/platform/WebURL.h" |
71 #include "ui/events/keycodes/dom/keycode_converter.h" | 71 #include "ui/base/layout.h" |
72 | 72 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
73 using blink::WebData; | 73 #include "ui/events/keycodes/dom/keycode_converter.h" |
74 using blink::WebFallbackThemeEngine; | 74 |
75 using blink::WebLocalizedString; | 75 using blink::WebData; |
76 using blink::WebString; | 76 using blink::WebFallbackThemeEngine; |
77 using blink::WebThemeEngine; | 77 using blink::WebLocalizedString; |
78 using blink::WebURL; | 78 using blink::WebString; |
79 using blink::WebURLError; | 79 using blink::WebThemeEngine; |
80 using blink::WebURLLoader; | 80 using blink::WebURL; |
81 using scheduler::WebThreadImplForWorkerScheduler; | 81 using blink::WebURLError; |
82 | 82 using blink::WebURLLoader; |
83 namespace content { | 83 using scheduler::WebThreadImplForWorkerScheduler; |
84 | 84 |
85 namespace { | 85 namespace content { |
86 | 86 |
87 | 87 namespace { |
88 } // namespace | 88 |
89 | 89 |
90 static int ToMessageID(WebLocalizedString::Name name) { | 90 } // namespace |
91 switch (name) { | 91 |
92 case WebLocalizedString::AXAMPMFieldText: | 92 static int ToMessageID(WebLocalizedString::Name name) { |
93 return IDS_AX_AM_PM_FIELD_TEXT; | 93 switch (name) { |
94 case WebLocalizedString::AXButtonActionVerb: | 94 case WebLocalizedString::AXAMPMFieldText: |
95 return IDS_AX_BUTTON_ACTION_VERB; | 95 return IDS_AX_AM_PM_FIELD_TEXT; |
96 case WebLocalizedString::AXCalendarShowMonthSelector: | 96 case WebLocalizedString::AXButtonActionVerb: |
97 return IDS_AX_CALENDAR_SHOW_MONTH_SELECTOR; | 97 return IDS_AX_BUTTON_ACTION_VERB; |
98 case WebLocalizedString::AXCalendarShowNextMonth: | 98 case WebLocalizedString::AXCalendarShowMonthSelector: |
99 return IDS_AX_CALENDAR_SHOW_NEXT_MONTH; | 99 return IDS_AX_CALENDAR_SHOW_MONTH_SELECTOR; |
100 case WebLocalizedString::AXCalendarShowPreviousMonth: | 100 case WebLocalizedString::AXCalendarShowNextMonth: |
101 return IDS_AX_CALENDAR_SHOW_PREVIOUS_MONTH; | 101 return IDS_AX_CALENDAR_SHOW_NEXT_MONTH; |
102 case WebLocalizedString::AXCalendarWeekDescription: | 102 case WebLocalizedString::AXCalendarShowPreviousMonth: |
103 return IDS_AX_CALENDAR_WEEK_DESCRIPTION; | 103 return IDS_AX_CALENDAR_SHOW_PREVIOUS_MONTH; |
104 case WebLocalizedString::AXCheckedCheckBoxActionVerb: | 104 case WebLocalizedString::AXCalendarWeekDescription: |
105 return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB; | 105 return IDS_AX_CALENDAR_WEEK_DESCRIPTION; |
106 case WebLocalizedString::AXDateTimeFieldEmptyValueText: | 106 case WebLocalizedString::AXCheckedCheckBoxActionVerb: |
107 return IDS_AX_DATE_TIME_FIELD_EMPTY_VALUE_TEXT; | 107 return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB; |
108 case WebLocalizedString::AXDayOfMonthFieldText: | 108 case WebLocalizedString::AXDateTimeFieldEmptyValueText: |
109 return IDS_AX_DAY_OF_MONTH_FIELD_TEXT; | 109 return IDS_AX_DATE_TIME_FIELD_EMPTY_VALUE_TEXT; |
110 case WebLocalizedString::AXHeadingText: | 110 case WebLocalizedString::AXDayOfMonthFieldText: |
111 return IDS_AX_ROLE_HEADING; | 111 return IDS_AX_DAY_OF_MONTH_FIELD_TEXT; |
112 case WebLocalizedString::AXHourFieldText: | 112 case WebLocalizedString::AXHeadingText: |
113 return IDS_AX_HOUR_FIELD_TEXT; | 113 return IDS_AX_ROLE_HEADING; |
114 case WebLocalizedString::AXImageMapText: | 114 case WebLocalizedString::AXHourFieldText: |
115 return IDS_AX_ROLE_IMAGE_MAP; | 115 return IDS_AX_HOUR_FIELD_TEXT; |
116 case WebLocalizedString::AXLinkActionVerb: | 116 case WebLocalizedString::AXImageMapText: |
117 return IDS_AX_LINK_ACTION_VERB; | 117 return IDS_AX_ROLE_IMAGE_MAP; |
118 case WebLocalizedString::AXLinkText: | 118 case WebLocalizedString::AXLinkActionVerb: |
119 return IDS_AX_ROLE_LINK; | 119 return IDS_AX_LINK_ACTION_VERB; |
120 case WebLocalizedString::AXListMarkerText: | 120 case WebLocalizedString::AXLinkText: |
121 return IDS_AX_ROLE_LIST_MARKER; | 121 return IDS_AX_ROLE_LINK; |
122 case WebLocalizedString::AXMediaDefault: | 122 case WebLocalizedString::AXListMarkerText: |
123 return IDS_AX_MEDIA_DEFAULT; | 123 return IDS_AX_ROLE_LIST_MARKER; |
124 case WebLocalizedString::AXMediaAudioElement: | 124 case WebLocalizedString::AXMediaDefault: |
125 return IDS_AX_MEDIA_AUDIO_ELEMENT; | 125 return IDS_AX_MEDIA_DEFAULT; |
126 case WebLocalizedString::AXMediaVideoElement: | 126 case WebLocalizedString::AXMediaAudioElement: |
127 return IDS_AX_MEDIA_VIDEO_ELEMENT; | 127 return IDS_AX_MEDIA_AUDIO_ELEMENT; |
128 case WebLocalizedString::AXMediaMuteButton: | 128 case WebLocalizedString::AXMediaVideoElement: |
129 return IDS_AX_MEDIA_MUTE_BUTTON; | 129 return IDS_AX_MEDIA_VIDEO_ELEMENT; |
130 case WebLocalizedString::AXMediaUnMuteButton: | 130 case WebLocalizedString::AXMediaMuteButton: |
131 return IDS_AX_MEDIA_UNMUTE_BUTTON; | 131 return IDS_AX_MEDIA_MUTE_BUTTON; |
132 case WebLocalizedString::AXMediaPlayButton: | 132 case WebLocalizedString::AXMediaUnMuteButton: |
133 return IDS_AX_MEDIA_PLAY_BUTTON; | 133 return IDS_AX_MEDIA_UNMUTE_BUTTON; |
134 case WebLocalizedString::AXMediaPauseButton: | 134 case WebLocalizedString::AXMediaPlayButton: |
135 return IDS_AX_MEDIA_PAUSE_BUTTON; | 135 return IDS_AX_MEDIA_PLAY_BUTTON; |
136 case WebLocalizedString::AXMediaSlider: | 136 case WebLocalizedString::AXMediaPauseButton: |
137 return IDS_AX_MEDIA_SLIDER; | 137 return IDS_AX_MEDIA_PAUSE_BUTTON; |
138 case WebLocalizedString::AXMediaSliderThumb: | 138 case WebLocalizedString::AXMediaSlider: |
139 return IDS_AX_MEDIA_SLIDER_THUMB; | 139 return IDS_AX_MEDIA_SLIDER; |
140 case WebLocalizedString::AXMediaCurrentTimeDisplay: | 140 case WebLocalizedString::AXMediaSliderThumb: |
141 return IDS_AX_MEDIA_CURRENT_TIME_DISPLAY; | 141 return IDS_AX_MEDIA_SLIDER_THUMB; |
142 case WebLocalizedString::AXMediaTimeRemainingDisplay: | 142 case WebLocalizedString::AXMediaCurrentTimeDisplay: |
143 return IDS_AX_MEDIA_TIME_REMAINING_DISPLAY; | 143 return IDS_AX_MEDIA_CURRENT_TIME_DISPLAY; |
144 case WebLocalizedString::AXMediaStatusDisplay: | 144 case WebLocalizedString::AXMediaTimeRemainingDisplay: |
145 return IDS_AX_MEDIA_STATUS_DISPLAY; | 145 return IDS_AX_MEDIA_TIME_REMAINING_DISPLAY; |
146 case WebLocalizedString::AXMediaEnterFullscreenButton: | 146 case WebLocalizedString::AXMediaStatusDisplay: |
147 return IDS_AX_MEDIA_ENTER_FULL_SCREEN_BUTTON; | 147 return IDS_AX_MEDIA_STATUS_DISPLAY; |
148 case WebLocalizedString::AXMediaExitFullscreenButton: | 148 case WebLocalizedString::AXMediaEnterFullscreenButton: |
149 return IDS_AX_MEDIA_EXIT_FULL_SCREEN_BUTTON; | 149 return IDS_AX_MEDIA_ENTER_FULL_SCREEN_BUTTON; |
150 case WebLocalizedString::AXMediaShowClosedCaptionsButton: | 150 case WebLocalizedString::AXMediaExitFullscreenButton: |
151 return IDS_AX_MEDIA_SHOW_CLOSED_CAPTIONS_BUTTON; | 151 return IDS_AX_MEDIA_EXIT_FULL_SCREEN_BUTTON; |
152 case WebLocalizedString::AXMediaHideClosedCaptionsButton: | 152 case WebLocalizedString::AXMediaShowClosedCaptionsButton: |
153 return IDS_AX_MEDIA_HIDE_CLOSED_CAPTIONS_BUTTON; | 153 return IDS_AX_MEDIA_SHOW_CLOSED_CAPTIONS_BUTTON; |
154 case WebLocalizedString::AxMediaCastOffButton: | 154 case WebLocalizedString::AXMediaHideClosedCaptionsButton: |
155 return IDS_AX_MEDIA_CAST_OFF_BUTTON; | 155 return IDS_AX_MEDIA_HIDE_CLOSED_CAPTIONS_BUTTON; |
156 case WebLocalizedString::AxMediaCastOnButton: | 156 case WebLocalizedString::AxMediaCastOffButton: |
157 return IDS_AX_MEDIA_CAST_ON_BUTTON; | 157 return IDS_AX_MEDIA_CAST_OFF_BUTTON; |
158 case WebLocalizedString::AXMediaAudioElementHelp: | 158 case WebLocalizedString::AxMediaCastOnButton: |
159 return IDS_AX_MEDIA_AUDIO_ELEMENT_HELP; | 159 return IDS_AX_MEDIA_CAST_ON_BUTTON; |
160 case WebLocalizedString::AXMediaVideoElementHelp: | 160 case WebLocalizedString::AXMediaAudioElementHelp: |
161 return IDS_AX_MEDIA_VIDEO_ELEMENT_HELP; | 161 return IDS_AX_MEDIA_AUDIO_ELEMENT_HELP; |
162 case WebLocalizedString::AXMediaMuteButtonHelp: | 162 case WebLocalizedString::AXMediaVideoElementHelp: |
163 return IDS_AX_MEDIA_MUTE_BUTTON_HELP; | 163 return IDS_AX_MEDIA_VIDEO_ELEMENT_HELP; |
164 case WebLocalizedString::AXMediaUnMuteButtonHelp: | 164 case WebLocalizedString::AXMediaMuteButtonHelp: |
165 return IDS_AX_MEDIA_UNMUTE_BUTTON_HELP; | 165 return IDS_AX_MEDIA_MUTE_BUTTON_HELP; |
166 case WebLocalizedString::AXMediaPlayButtonHelp: | 166 case WebLocalizedString::AXMediaUnMuteButtonHelp: |
167 return IDS_AX_MEDIA_PLAY_BUTTON_HELP; | 167 return IDS_AX_MEDIA_UNMUTE_BUTTON_HELP; |
168 case WebLocalizedString::AXMediaPauseButtonHelp: | 168 case WebLocalizedString::AXMediaPlayButtonHelp: |
169 return IDS_AX_MEDIA_PAUSE_BUTTON_HELP; | 169 return IDS_AX_MEDIA_PLAY_BUTTON_HELP; |
170 case WebLocalizedString::AXMediaAudioSliderHelp: | 170 case WebLocalizedString::AXMediaPauseButtonHelp: |
171 return IDS_AX_MEDIA_AUDIO_SLIDER_HELP; | 171 return IDS_AX_MEDIA_PAUSE_BUTTON_HELP; |
172 case WebLocalizedString::AXMediaVideoSliderHelp: | 172 case WebLocalizedString::AXMediaAudioSliderHelp: |
173 return IDS_AX_MEDIA_VIDEO_SLIDER_HELP; | 173 return IDS_AX_MEDIA_AUDIO_SLIDER_HELP; |
174 case WebLocalizedString::AXMediaSliderThumbHelp: | 174 case WebLocalizedString::AXMediaVideoSliderHelp: |
175 return IDS_AX_MEDIA_SLIDER_THUMB_HELP; | 175 return IDS_AX_MEDIA_VIDEO_SLIDER_HELP; |
176 case WebLocalizedString::AXMediaCurrentTimeDisplayHelp: | 176 case WebLocalizedString::AXMediaSliderThumbHelp: |
177 return IDS_AX_MEDIA_CURRENT_TIME_DISPLAY_HELP; | 177 return IDS_AX_MEDIA_SLIDER_THUMB_HELP; |
178 case WebLocalizedString::AXMediaTimeRemainingDisplayHelp: | 178 case WebLocalizedString::AXMediaCurrentTimeDisplayHelp: |
179 return IDS_AX_MEDIA_TIME_REMAINING_DISPLAY_HELP; | 179 return IDS_AX_MEDIA_CURRENT_TIME_DISPLAY_HELP; |
180 case WebLocalizedString::AXMediaStatusDisplayHelp: | 180 case WebLocalizedString::AXMediaTimeRemainingDisplayHelp: |
181 return IDS_AX_MEDIA_STATUS_DISPLAY_HELP; | 181 return IDS_AX_MEDIA_TIME_REMAINING_DISPLAY_HELP; |
182 case WebLocalizedString::AXMediaEnterFullscreenButtonHelp: | 182 case WebLocalizedString::AXMediaStatusDisplayHelp: |
183 return IDS_AX_MEDIA_ENTER_FULL_SCREEN_BUTTON_HELP; | 183 return IDS_AX_MEDIA_STATUS_DISPLAY_HELP; |
184 case WebLocalizedString::AXMediaExitFullscreenButtonHelp: | 184 case WebLocalizedString::AXMediaEnterFullscreenButtonHelp: |
185 return IDS_AX_MEDIA_EXIT_FULL_SCREEN_BUTTON_HELP; | 185 return IDS_AX_MEDIA_ENTER_FULL_SCREEN_BUTTON_HELP; |
186 case WebLocalizedString::AXMediaShowClosedCaptionsButtonHelp: | 186 case WebLocalizedString::AXMediaExitFullscreenButtonHelp: |
187 return IDS_AX_MEDIA_SHOW_CLOSED_CAPTIONS_BUTTON_HELP; | 187 return IDS_AX_MEDIA_EXIT_FULL_SCREEN_BUTTON_HELP; |
188 case WebLocalizedString::AXMediaHideClosedCaptionsButtonHelp: | 188 case WebLocalizedString::AXMediaShowClosedCaptionsButtonHelp: |
189 return IDS_AX_MEDIA_HIDE_CLOSED_CAPTIONS_BUTTON_HELP; | 189 return IDS_AX_MEDIA_SHOW_CLOSED_CAPTIONS_BUTTON_HELP; |
190 case WebLocalizedString::AxMediaCastOffButtonHelp: | 190 case WebLocalizedString::AXMediaHideClosedCaptionsButtonHelp: |
191 return IDS_AX_MEDIA_CAST_OFF_BUTTON_HELP; | 191 return IDS_AX_MEDIA_HIDE_CLOSED_CAPTIONS_BUTTON_HELP; |
192 case WebLocalizedString::AxMediaCastOnButtonHelp: | 192 case WebLocalizedString::AxMediaCastOffButtonHelp: |
193 return IDS_AX_MEDIA_CAST_ON_BUTTON_HELP; | 193 return IDS_AX_MEDIA_CAST_OFF_BUTTON_HELP; |
194 case WebLocalizedString::AXMillisecondFieldText: | 194 case WebLocalizedString::AxMediaCastOnButtonHelp: |
195 return IDS_AX_MILLISECOND_FIELD_TEXT; | 195 return IDS_AX_MEDIA_CAST_ON_BUTTON_HELP; |
196 case WebLocalizedString::AXMinuteFieldText: | 196 case WebLocalizedString::AXMillisecondFieldText: |
197 return IDS_AX_MINUTE_FIELD_TEXT; | 197 return IDS_AX_MILLISECOND_FIELD_TEXT; |
198 case WebLocalizedString::AXMonthFieldText: | 198 case WebLocalizedString::AXMinuteFieldText: |
199 return IDS_AX_MONTH_FIELD_TEXT; | 199 return IDS_AX_MINUTE_FIELD_TEXT; |
200 case WebLocalizedString::AXRadioButtonActionVerb: | 200 case WebLocalizedString::AXMonthFieldText: |
201 return IDS_AX_RADIO_BUTTON_ACTION_VERB; | 201 return IDS_AX_MONTH_FIELD_TEXT; |
202 case WebLocalizedString::AXSecondFieldText: | 202 case WebLocalizedString::AXRadioButtonActionVerb: |
203 return IDS_AX_SECOND_FIELD_TEXT; | 203 return IDS_AX_RADIO_BUTTON_ACTION_VERB; |
204 case WebLocalizedString::AXTextFieldActionVerb: | 204 case WebLocalizedString::AXSecondFieldText: |
205 return IDS_AX_TEXT_FIELD_ACTION_VERB; | 205 return IDS_AX_SECOND_FIELD_TEXT; |
206 case WebLocalizedString::AXUncheckedCheckBoxActionVerb: | 206 case WebLocalizedString::AXTextFieldActionVerb: |
207 return IDS_AX_UNCHECKED_CHECK_BOX_ACTION_VERB; | 207 return IDS_AX_TEXT_FIELD_ACTION_VERB; |
208 case WebLocalizedString::AXWebAreaText: | 208 case WebLocalizedString::AXUncheckedCheckBoxActionVerb: |
209 return IDS_AX_ROLE_WEB_AREA; | 209 return IDS_AX_UNCHECKED_CHECK_BOX_ACTION_VERB; |
210 case WebLocalizedString::AXWeekOfYearFieldText: | 210 case WebLocalizedString::AXWebAreaText: |
211 return IDS_AX_WEEK_OF_YEAR_FIELD_TEXT; | 211 return IDS_AX_ROLE_WEB_AREA; |
212 case WebLocalizedString::AXYearFieldText: | 212 case WebLocalizedString::AXWeekOfYearFieldText: |
213 return IDS_AX_YEAR_FIELD_TEXT; | 213 return IDS_AX_WEEK_OF_YEAR_FIELD_TEXT; |
214 case WebLocalizedString::CalendarClear: | 214 case WebLocalizedString::AXYearFieldText: |
215 return IDS_FORM_CALENDAR_CLEAR; | 215 return IDS_AX_YEAR_FIELD_TEXT; |
216 case WebLocalizedString::CalendarToday: | 216 case WebLocalizedString::CalendarClear: |
217 return IDS_FORM_CALENDAR_TODAY; | 217 return IDS_FORM_CALENDAR_CLEAR; |
218 case WebLocalizedString::DateFormatDayInMonthLabel: | 218 case WebLocalizedString::CalendarToday: |
219 return IDS_FORM_DATE_FORMAT_DAY_IN_MONTH; | 219 return IDS_FORM_CALENDAR_TODAY; |
220 case WebLocalizedString::DateFormatMonthLabel: | 220 case WebLocalizedString::DateFormatDayInMonthLabel: |
221 return IDS_FORM_DATE_FORMAT_MONTH; | 221 return IDS_FORM_DATE_FORMAT_DAY_IN_MONTH; |
222 case WebLocalizedString::DateFormatYearLabel: | 222 case WebLocalizedString::DateFormatMonthLabel: |
223 return IDS_FORM_DATE_FORMAT_YEAR; | 223 return IDS_FORM_DATE_FORMAT_MONTH; |
224 case WebLocalizedString::DetailsLabel: | 224 case WebLocalizedString::DateFormatYearLabel: |
225 return IDS_DETAILS_WITHOUT_SUMMARY_LABEL; | 225 return IDS_FORM_DATE_FORMAT_YEAR; |
226 case WebLocalizedString::FileButtonChooseFileLabel: | 226 case WebLocalizedString::DetailsLabel: |
227 return IDS_FORM_FILE_BUTTON_LABEL; | 227 return IDS_DETAILS_WITHOUT_SUMMARY_LABEL; |
228 case WebLocalizedString::FileButtonChooseMultipleFilesLabel: | 228 case WebLocalizedString::FileButtonChooseFileLabel: |
229 return IDS_FORM_MULTIPLE_FILES_BUTTON_LABEL; | 229 return IDS_FORM_FILE_BUTTON_LABEL; |
230 case WebLocalizedString::FileButtonNoFileSelectedLabel: | 230 case WebLocalizedString::FileButtonChooseMultipleFilesLabel: |
231 return IDS_FORM_FILE_NO_FILE_LABEL; | 231 return IDS_FORM_MULTIPLE_FILES_BUTTON_LABEL; |
232 case WebLocalizedString::InputElementAltText: | 232 case WebLocalizedString::FileButtonNoFileSelectedLabel: |
233 return IDS_FORM_INPUT_ALT; | 233 return IDS_FORM_FILE_NO_FILE_LABEL; |
234 case WebLocalizedString::KeygenMenuHighGradeKeySize: | 234 case WebLocalizedString::InputElementAltText: |
235 return IDS_KEYGEN_HIGH_GRADE_KEY; | 235 return IDS_FORM_INPUT_ALT; |
236 case WebLocalizedString::KeygenMenuMediumGradeKeySize: | 236 case WebLocalizedString::KeygenMenuHighGradeKeySize: |
237 return IDS_KEYGEN_MED_GRADE_KEY; | 237 return IDS_KEYGEN_HIGH_GRADE_KEY; |
238 case WebLocalizedString::MissingPluginText: | 238 case WebLocalizedString::KeygenMenuMediumGradeKeySize: |
239 return IDS_PLUGIN_INITIALIZATION_ERROR; | 239 return IDS_KEYGEN_MED_GRADE_KEY; |
240 case WebLocalizedString::MultipleFileUploadText: | 240 case WebLocalizedString::MissingPluginText: |
241 return IDS_FORM_FILE_MULTIPLE_UPLOAD; | 241 return IDS_PLUGIN_INITIALIZATION_ERROR; |
242 case WebLocalizedString::OtherColorLabel: | 242 case WebLocalizedString::MultipleFileUploadText: |
243 return IDS_FORM_OTHER_COLOR_LABEL; | 243 return IDS_FORM_FILE_MULTIPLE_UPLOAD; |
244 case WebLocalizedString::OtherDateLabel: | 244 case WebLocalizedString::OtherColorLabel: |
245 return IDS_FORM_OTHER_DATE_LABEL; | 245 return IDS_FORM_OTHER_COLOR_LABEL; |
246 case WebLocalizedString::OtherMonthLabel: | 246 case WebLocalizedString::OtherDateLabel: |
247 return IDS_FORM_OTHER_MONTH_LABEL; | 247 return IDS_FORM_OTHER_DATE_LABEL; |
248 case WebLocalizedString::OtherTimeLabel: | 248 case WebLocalizedString::OtherMonthLabel: |
249 return IDS_FORM_OTHER_TIME_LABEL; | 249 return IDS_FORM_OTHER_MONTH_LABEL; |
250 case WebLocalizedString::OtherWeekLabel: | 250 case WebLocalizedString::OtherTimeLabel: |
251 return IDS_FORM_OTHER_WEEK_LABEL; | 251 return IDS_FORM_OTHER_TIME_LABEL; |
252 case WebLocalizedString::PlaceholderForDayOfMonthField: | 252 case WebLocalizedString::OtherWeekLabel: |
253 return IDS_FORM_PLACEHOLDER_FOR_DAY_OF_MONTH_FIELD; | 253 return IDS_FORM_OTHER_WEEK_LABEL; |
254 case WebLocalizedString::PlaceholderForMonthField: | 254 case WebLocalizedString::PlaceholderForDayOfMonthField: |
255 return IDS_FORM_PLACEHOLDER_FOR_MONTH_FIELD; | 255 return IDS_FORM_PLACEHOLDER_FOR_DAY_OF_MONTH_FIELD; |
256 case WebLocalizedString::PlaceholderForYearField: | 256 case WebLocalizedString::PlaceholderForMonthField: |
257 return IDS_FORM_PLACEHOLDER_FOR_YEAR_FIELD; | 257 return IDS_FORM_PLACEHOLDER_FOR_MONTH_FIELD; |
258 case WebLocalizedString::ResetButtonDefaultLabel: | 258 case WebLocalizedString::PlaceholderForYearField: |
259 return IDS_FORM_RESET_LABEL; | 259 return IDS_FORM_PLACEHOLDER_FOR_YEAR_FIELD; |
260 case WebLocalizedString::SearchableIndexIntroduction: | 260 case WebLocalizedString::ResetButtonDefaultLabel: |
261 return IDS_SEARCHABLE_INDEX_INTRO; | 261 return IDS_FORM_RESET_LABEL; |
262 case WebLocalizedString::SearchMenuClearRecentSearchesText: | 262 case WebLocalizedString::SearchableIndexIntroduction: |
263 return IDS_RECENT_SEARCHES_CLEAR; | 263 return IDS_SEARCHABLE_INDEX_INTRO; |
264 case WebLocalizedString::SearchMenuNoRecentSearchesText: | 264 case WebLocalizedString::SearchMenuClearRecentSearchesText: |
265 return IDS_RECENT_SEARCHES_NONE; | 265 return IDS_RECENT_SEARCHES_CLEAR; |
266 case WebLocalizedString::SearchMenuRecentSearchesText: | 266 case WebLocalizedString::SearchMenuNoRecentSearchesText: |
267 return IDS_RECENT_SEARCHES; | 267 return IDS_RECENT_SEARCHES_NONE; |
268 case WebLocalizedString::SelectMenuListText: | 268 case WebLocalizedString::SearchMenuRecentSearchesText: |
269 return IDS_FORM_SELECT_MENU_LIST_TEXT; | 269 return IDS_RECENT_SEARCHES; |
270 case WebLocalizedString::SubmitButtonDefaultLabel: | 270 case WebLocalizedString::SelectMenuListText: |
271 return IDS_FORM_SUBMIT_LABEL; | 271 return IDS_FORM_SELECT_MENU_LIST_TEXT; |
272 case WebLocalizedString::ThisMonthButtonLabel: | 272 case WebLocalizedString::SubmitButtonDefaultLabel: |
273 return IDS_FORM_THIS_MONTH_LABEL; | 273 return IDS_FORM_SUBMIT_LABEL; |
274 case WebLocalizedString::ThisWeekButtonLabel: | 274 case WebLocalizedString::ThisMonthButtonLabel: |
275 return IDS_FORM_THIS_WEEK_LABEL; | 275 return IDS_FORM_THIS_MONTH_LABEL; |
276 case WebLocalizedString::ValidationBadInputForDateTime: | 276 case WebLocalizedString::ThisWeekButtonLabel: |
277 return IDS_FORM_VALIDATION_BAD_INPUT_DATETIME; | 277 return IDS_FORM_THIS_WEEK_LABEL; |
278 case WebLocalizedString::ValidationBadInputForNumber: | 278 case WebLocalizedString::ValidationBadInputForDateTime: |
279 return IDS_FORM_VALIDATION_BAD_INPUT_NUMBER; | 279 return IDS_FORM_VALIDATION_BAD_INPUT_DATETIME; |
280 case WebLocalizedString::ValidationPatternMismatch: | 280 case WebLocalizedString::ValidationBadInputForNumber: |
281 return IDS_FORM_VALIDATION_PATTERN_MISMATCH; | 281 return IDS_FORM_VALIDATION_BAD_INPUT_NUMBER; |
282 case WebLocalizedString::ValidationRangeOverflow: | 282 case WebLocalizedString::ValidationPatternMismatch: |
283 return IDS_FORM_VALIDATION_RANGE_OVERFLOW; | 283 return IDS_FORM_VALIDATION_PATTERN_MISMATCH; |
284 case WebLocalizedString::ValidationRangeOverflowDateTime: | 284 case WebLocalizedString::ValidationRangeOverflow: |
285 return IDS_FORM_VALIDATION_RANGE_OVERFLOW_DATETIME; | 285 return IDS_FORM_VALIDATION_RANGE_OVERFLOW; |
286 case WebLocalizedString::ValidationRangeUnderflow: | 286 case WebLocalizedString::ValidationRangeOverflowDateTime: |
287 return IDS_FORM_VALIDATION_RANGE_UNDERFLOW; | 287 return IDS_FORM_VALIDATION_RANGE_OVERFLOW_DATETIME; |
288 case WebLocalizedString::ValidationRangeUnderflowDateTime: | 288 case WebLocalizedString::ValidationRangeUnderflow: |
289 return IDS_FORM_VALIDATION_RANGE_UNDERFLOW_DATETIME; | 289 return IDS_FORM_VALIDATION_RANGE_UNDERFLOW; |
290 case WebLocalizedString::ValidationStepMismatch: | 290 case WebLocalizedString::ValidationRangeUnderflowDateTime: |
291 return IDS_FORM_VALIDATION_STEP_MISMATCH; | 291 return IDS_FORM_VALIDATION_RANGE_UNDERFLOW_DATETIME; |
292 case WebLocalizedString::ValidationStepMismatchCloseToLimit: | 292 case WebLocalizedString::ValidationStepMismatch: |
293 return IDS_FORM_VALIDATION_STEP_MISMATCH_CLOSE_TO_LIMIT; | 293 return IDS_FORM_VALIDATION_STEP_MISMATCH; |
294 case WebLocalizedString::ValidationTooLong: | 294 case WebLocalizedString::ValidationStepMismatchCloseToLimit: |
295 return IDS_FORM_VALIDATION_TOO_LONG; | 295 return IDS_FORM_VALIDATION_STEP_MISMATCH_CLOSE_TO_LIMIT; |
296 case WebLocalizedString::ValidationTooShort: | 296 case WebLocalizedString::ValidationTooLong: |
297 return IDS_FORM_VALIDATION_TOO_SHORT; | 297 return IDS_FORM_VALIDATION_TOO_LONG; |
298 case WebLocalizedString::ValidationTypeMismatch: | 298 case WebLocalizedString::ValidationTooShort: |
299 return IDS_FORM_VALIDATION_TYPE_MISMATCH; | 299 return IDS_FORM_VALIDATION_TOO_SHORT; |
300 case WebLocalizedString::ValidationTypeMismatchForEmail: | 300 case WebLocalizedString::ValidationTypeMismatch: |
301 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL; | 301 return IDS_FORM_VALIDATION_TYPE_MISMATCH; |
302 case WebLocalizedString::ValidationTypeMismatchForEmailEmpty: | 302 case WebLocalizedString::ValidationTypeMismatchForEmail: |
303 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY; | 303 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL; |
304 case WebLocalizedString::ValidationTypeMismatchForEmailEmptyDomain: | 304 case WebLocalizedString::ValidationTypeMismatchForEmailEmpty: |
305 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_DOMAIN; | 305 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY; |
306 case WebLocalizedString::ValidationTypeMismatchForEmailEmptyLocal: | 306 case WebLocalizedString::ValidationTypeMismatchForEmailEmptyDomain: |
307 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_LOCAL; | 307 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_DOMAIN; |
308 case WebLocalizedString::ValidationTypeMismatchForEmailInvalidDomain: | 308 case WebLocalizedString::ValidationTypeMismatchForEmailEmptyLocal: |
309 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOMAIN; | 309 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_LOCAL; |
310 case WebLocalizedString::ValidationTypeMismatchForEmailInvalidDots: | 310 case WebLocalizedString::ValidationTypeMismatchForEmailInvalidDomain: |
311 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOTS; | 311 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOMAIN; |
312 case WebLocalizedString::ValidationTypeMismatchForEmailInvalidLocal: | 312 case WebLocalizedString::ValidationTypeMismatchForEmailInvalidDots: |
313 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_LOCAL; | 313 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOTS; |
314 case WebLocalizedString::ValidationTypeMismatchForEmailNoAtSign: | 314 case WebLocalizedString::ValidationTypeMismatchForEmailInvalidLocal: |
315 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_NO_AT_SIGN; | 315 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_LOCAL; |
316 case WebLocalizedString::ValidationTypeMismatchForMultipleEmail: | 316 case WebLocalizedString::ValidationTypeMismatchForEmailNoAtSign: |
317 return IDS_FORM_VALIDATION_TYPE_MISMATCH_MULTIPLE_EMAIL; | 317 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_NO_AT_SIGN; |
318 case WebLocalizedString::ValidationTypeMismatchForURL: | 318 case WebLocalizedString::ValidationTypeMismatchForMultipleEmail: |
319 return IDS_FORM_VALIDATION_TYPE_MISMATCH_URL; | 319 return IDS_FORM_VALIDATION_TYPE_MISMATCH_MULTIPLE_EMAIL; |
320 case WebLocalizedString::ValidationValueMissing: | 320 case WebLocalizedString::ValidationTypeMismatchForURL: |
321 return IDS_FORM_VALIDATION_VALUE_MISSING; | 321 return IDS_FORM_VALIDATION_TYPE_MISMATCH_URL; |
322 case WebLocalizedString::ValidationValueMissingForCheckbox: | 322 case WebLocalizedString::ValidationValueMissing: |
323 return IDS_FORM_VALIDATION_VALUE_MISSING_CHECKBOX; | 323 return IDS_FORM_VALIDATION_VALUE_MISSING; |
324 case WebLocalizedString::ValidationValueMissingForFile: | 324 case WebLocalizedString::ValidationValueMissingForCheckbox: |
325 return IDS_FORM_VALIDATION_VALUE_MISSING_FILE; | 325 return IDS_FORM_VALIDATION_VALUE_MISSING_CHECKBOX; |
326 case WebLocalizedString::ValidationValueMissingForMultipleFile: | 326 case WebLocalizedString::ValidationValueMissingForFile: |
327 return IDS_FORM_VALIDATION_VALUE_MISSING_MULTIPLE_FILE; | 327 return IDS_FORM_VALIDATION_VALUE_MISSING_FILE; |
328 case WebLocalizedString::ValidationValueMissingForRadio: | 328 case WebLocalizedString::ValidationValueMissingForMultipleFile: |
329 return IDS_FORM_VALIDATION_VALUE_MISSING_RADIO; | 329 return IDS_FORM_VALIDATION_VALUE_MISSING_MULTIPLE_FILE; |
330 case WebLocalizedString::ValidationValueMissingForSelect: | 330 case WebLocalizedString::ValidationValueMissingForRadio: |
331 return IDS_FORM_VALIDATION_VALUE_MISSING_SELECT; | 331 return IDS_FORM_VALIDATION_VALUE_MISSING_RADIO; |
332 case WebLocalizedString::WeekFormatTemplate: | 332 case WebLocalizedString::ValidationValueMissingForSelect: |
333 return IDS_FORM_INPUT_WEEK_TEMPLATE; | 333 return IDS_FORM_VALIDATION_VALUE_MISSING_SELECT; |
334 case WebLocalizedString::WeekNumberLabel: | 334 case WebLocalizedString::WeekFormatTemplate: |
335 return IDS_FORM_WEEK_NUMBER_LABEL; | 335 return IDS_FORM_INPUT_WEEK_TEMPLATE; |
336 // This "default:" line exists to avoid compile warnings about enum | 336 case WebLocalizedString::WeekNumberLabel: |
337 // coverage when we add a new symbol to WebLocalizedString.h in WebKit. | 337 return IDS_FORM_WEEK_NUMBER_LABEL; |
338 // After a planned WebKit patch is landed, we need to add a case statement | 338 // This "default:" line exists to avoid compile warnings about enum |
339 // for the added symbol here. | 339 // coverage when we add a new symbol to WebLocalizedString.h in WebKit. |
340 default: | 340 // After a planned WebKit patch is landed, we need to add a case statement |
341 break; | 341 // for the added symbol here. |
342 } | 342 default: |
343 return -1; | 343 break; |
344 } | 344 } |
345 | 345 return -1; |
346 class TraceLogObserverAdapter | 346 } |
347 : public base::trace_event::TraceLog::EnabledStateObserver { | 347 |
348 public: | 348 class TraceLogObserverAdapter |
349 TraceLogObserverAdapter( | 349 : public base::trace_event::TraceLog::EnabledStateObserver { |
350 blink::Platform::TraceLogEnabledStateObserver* observer) | 350 public: |
351 : observer_(observer) {} | 351 TraceLogObserverAdapter( |
352 | 352 blink::Platform::TraceLogEnabledStateObserver* observer) |
353 void OnTraceLogEnabled() override { observer_->onTraceLogEnabled(); } | 353 : observer_(observer) {} |
354 | 354 |
355 void OnTraceLogDisabled() override { observer_->onTraceLogDisabled(); } | 355 void OnTraceLogEnabled() override { observer_->onTraceLogEnabled(); } |
356 | 356 |
357 private: | 357 void OnTraceLogDisabled() override { observer_->onTraceLogDisabled(); } |
358 blink::Platform::TraceLogEnabledStateObserver* observer_; | 358 |
359 DISALLOW_COPY_AND_ASSIGN(TraceLogObserverAdapter); | 359 private: |
360 }; | 360 blink::Platform::TraceLogEnabledStateObserver* observer_; |
361 | 361 DISALLOW_COPY_AND_ASSIGN(TraceLogObserverAdapter); |
362 // TODO(skyostil): Ensure that we always have an active task runner when | 362 }; |
363 // constructing the platform. | 363 |
364 BlinkPlatformImpl::BlinkPlatformImpl() | 364 // TODO(skyostil): Ensure that we always have an active task runner when |
365 : BlinkPlatformImpl(base::ThreadTaskRunnerHandle::IsSet() | 365 // constructing the platform. |
366 ? base::ThreadTaskRunnerHandle::Get() | 366 BlinkPlatformImpl::BlinkPlatformImpl() |
367 : nullptr) { | 367 : BlinkPlatformImpl(base::ThreadTaskRunnerHandle::IsSet() |
368 } | 368 ? base::ThreadTaskRunnerHandle::Get() |
369 | 369 : nullptr) { |
370 BlinkPlatformImpl::BlinkPlatformImpl( | 370 } |
371 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) | 371 |
372 : main_thread_task_runner_(main_thread_task_runner), | 372 BlinkPlatformImpl::BlinkPlatformImpl( |
373 compositor_thread_(nullptr) { | 373 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) |
374 InternalInit(); | 374 : main_thread_task_runner_(main_thread_task_runner), |
375 } | 375 compositor_thread_(nullptr) { |
376 | 376 InternalInit(); |
377 void BlinkPlatformImpl::InternalInit() { | 377 } |
378 // ChildThread may not exist in some tests. | 378 |
379 if (ChildThreadImpl::current()) { | 379 void BlinkPlatformImpl::InternalInit() { |
380 geofencing_provider_.reset(new WebGeofencingProviderImpl( | 380 // ChildThread may not exist in some tests. |
381 ChildThreadImpl::current()->thread_safe_sender())); | 381 if (ChildThreadImpl::current()) { |
382 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); | 382 geofencing_provider_.reset(new WebGeofencingProviderImpl( |
383 notification_dispatcher_ = | 383 ChildThreadImpl::current()->thread_safe_sender())); |
384 ChildThreadImpl::current()->notification_dispatcher(); | 384 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); |
385 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); | 385 notification_dispatcher_ = |
386 permission_client_.reset(new PermissionDispatcher( | 386 ChildThreadImpl::current()->notification_dispatcher(); |
387 ChildThreadImpl::current()->service_registry())); | 387 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); |
388 main_thread_sync_provider_.reset( | 388 permission_client_.reset(new PermissionDispatcher( |
389 new BackgroundSyncProvider(main_thread_task_runner_.get())); | 389 ChildThreadImpl::current()->service_registry())); |
390 } | 390 main_thread_sync_provider_.reset( |
391 } | 391 new BackgroundSyncProvider(main_thread_task_runner_.get())); |
392 | 392 } |
393 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate( | 393 } |
394 scheduler::WebThreadBase* thread) { | 394 |
395 base::WaitableEvent event(false, false); | 395 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate( |
396 thread->TaskRunner()->PostTask( | 396 scheduler::WebThreadBase* thread) { |
397 FROM_HERE, | 397 base::WaitableEvent event(false, false); |
398 base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this), | 398 thread->TaskRunner()->PostTask( |
399 base::Unretained(thread), base::Unretained(&event))); | 399 FROM_HERE, |
400 event.Wait(); | 400 base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this
), |
401 } | 401 base::Unretained(thread), base::Unretained(&event))); |
402 | 402 event.Wait(); |
403 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread, | 403 } |
404 base::WaitableEvent* event) { | 404 |
405 DCHECK(!current_thread_slot_.Get()); | 405 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread, |
406 current_thread_slot_.Set(thread); | 406 base::WaitableEvent* event) { |
407 event->Signal(); | 407 DCHECK(!current_thread_slot_.Get()); |
408 } | 408 current_thread_slot_.Set(thread); |
409 | 409 event->Signal(); |
410 BlinkPlatformImpl::~BlinkPlatformImpl() { | 410 } |
411 } | 411 |
412 | 412 BlinkPlatformImpl::~BlinkPlatformImpl() { |
413 WebURLLoader* BlinkPlatformImpl::createURLLoader() { | 413 } |
414 ChildThreadImpl* child_thread = ChildThreadImpl::current(); | 414 |
415 // There may be no child thread in RenderViewTests. These tests can still use | 415 WebURLLoader* BlinkPlatformImpl::createURLLoader() { |
416 // data URLs to bypass the ResourceDispatcher. | 416 ChildThreadImpl* child_thread = ChildThreadImpl::current(); |
417 return new WebURLLoaderImpl( | 417 // There may be no child thread in RenderViewTests. These tests can still u
se |
418 child_thread ? child_thread->resource_dispatcher() : NULL, | 418 // data URLs to bypass the ResourceDispatcher. |
419 make_scoped_ptr(currentThread()->taskRunner()->clone())); | 419 return new WebURLLoaderImpl( |
420 } | 420 child_thread ? child_thread->resource_dispatcher() : NULL, |
421 | 421 make_scoped_ptr(currentThread()->taskRunner()->clone())); |
422 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { | 422 } |
423 return new WebSocketBridge; | 423 |
424 } | 424 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { |
425 | 425 return new WebSocketBridge; |
426 WebString BlinkPlatformImpl::userAgent() { | 426 } |
427 CR_DEFINE_STATIC_LOCAL( | 427 |
428 blink::WebString, user_agent, | 428 WebString BlinkPlatformImpl::userAgent() { |
429 (blink::WebString::fromUTF8(GetContentClient()->GetUserAgent()))); | 429 CR_DEFINE_STATIC_LOCAL( |
430 DCHECK(user_agent == | 430 blink::WebString, user_agent, |
431 blink::WebString::fromUTF8(GetContentClient()->GetUserAgent())); | 431 (blink::WebString::fromUTF8(GetContentClient()->GetUserAgent()))); |
432 return user_agent; | 432 DCHECK(user_agent == |
433 } | 433 blink::WebString::fromUTF8(GetContentClient()->GetUserAgent())); |
434 | 434 return user_agent; |
435 WebData BlinkPlatformImpl::parseDataURL(const WebURL& url, | 435 } |
436 WebString& mimetype_out, | 436 |
437 WebString& charset_out) { | 437 WebData BlinkPlatformImpl::parseDataURL(const WebURL& url, |
438 std::string mime_type, char_set, data; | 438 WebString& mimetype_out, |
439 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && | 439 WebString& charset_out) { |
440 mime_util::IsSupportedMimeType(mime_type)) { | 440 std::string mime_type, char_set, data; |
441 mimetype_out = WebString::fromUTF8(mime_type); | 441 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && |
442 charset_out = WebString::fromUTF8(char_set); | 442 mime_util::IsSupportedMimeType(mime_type)) { |
443 return data; | 443 mimetype_out = WebString::fromUTF8(mime_type); |
444 } | 444 charset_out = WebString::fromUTF8(char_set); |
445 return WebData(); | 445 return data; |
446 } | 446 } |
447 | 447 return WebData(); |
448 WebURLError BlinkPlatformImpl::cancelledError( | 448 } |
449 const WebURL& unreachableURL) const { | 449 |
450 return CreateWebURLError(unreachableURL, false, net::ERR_ABORTED); | 450 WebURLError BlinkPlatformImpl::cancelledError( |
451 } | 451 const WebURL& unreachableURL) const { |
452 | 452 return CreateWebURLError(unreachableURL, false, net::ERR_ABORTED); |
453 bool BlinkPlatformImpl::isReservedIPAddress( | 453 } |
454 const blink::WebString& host) const { | 454 |
455 net::IPAddressNumber address; | 455 bool BlinkPlatformImpl::isReservedIPAddress( |
456 if (!net::ParseURLHostnameToNumber(host.utf8(), &address)) | 456 const blink::WebString& host) const { |
457 return false; | 457 net::IPAddressNumber address; |
458 return net::IsIPAddressReserved(address); | 458 if (!net::ParseURLHostnameToNumber(host.utf8(), &address)) |
459 } | 459 return false; |
460 | 460 return net::IsIPAddressReserved(address); |
461 bool BlinkPlatformImpl::portAllowed(const blink::WebURL& url) const { | 461 } |
462 GURL gurl = GURL(url); | 462 |
463 // Return true for URLs without a port specified. This is needed to let | 463 bool BlinkPlatformImpl::portAllowed(const blink::WebURL& url) const { |
464 // through non-network schemes that don't go over the network. | 464 GURL gurl = GURL(url); |
465 if (!gurl.has_port()) | 465 // Return true for URLs without a port specified. This is needed to let |
466 return true; | 466 // through non-network schemes that don't go over the network. |
467 return net::IsPortAllowedForScheme(gurl.EffectiveIntPort(), gurl.scheme()); | 467 if (!gurl.has_port()) |
468 } | 468 return true; |
469 | 469 return net::IsPortAllowedForScheme(gurl.EffectiveIntPort(), gurl.scheme()); |
470 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) { | 470 } |
471 scoped_ptr<WebThreadImplForWorkerScheduler> thread( | 471 |
472 new WebThreadImplForWorkerScheduler(name)); | 472 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) { |
473 thread->Init(); | 473 scoped_ptr<WebThreadImplForWorkerScheduler> thread( |
474 WaitUntilWebThreadTLSUpdate(thread.get()); | 474 new WebThreadImplForWorkerScheduler(name)); |
475 return thread.release(); | 475 thread->Init(); |
476 } | 476 WaitUntilWebThreadTLSUpdate(thread.get()); |
477 | 477 return thread.release(); |
478 void BlinkPlatformImpl::SetCompositorThread( | 478 } |
479 scheduler::WebThreadBase* compositor_thread) { | 479 |
480 compositor_thread_ = compositor_thread; | 480 void BlinkPlatformImpl::SetCompositorThread( |
481 if (compositor_thread_) | 481 scheduler::WebThreadBase* compositor_thread) { |
482 WaitUntilWebThreadTLSUpdate(compositor_thread_); | 482 compositor_thread_ = compositor_thread; |
483 } | 483 if (compositor_thread_) |
484 | 484 WaitUntilWebThreadTLSUpdate(compositor_thread_); |
485 blink::WebThread* BlinkPlatformImpl::currentThread() { | 485 } |
486 return static_cast<blink::WebThread*>(current_thread_slot_.Get()); | 486 |
487 } | 487 blink::WebThread* BlinkPlatformImpl::currentThread() { |
488 | 488 return static_cast<blink::WebThread*>(current_thread_slot_.Get()); |
489 void BlinkPlatformImpl::recordAction(const blink::UserMetricsAction& name) { | 489 } |
490 if (ChildThread* child_thread = ChildThread::Get()) | 490 |
491 child_thread->RecordComputedAction(name.action()); | 491 void BlinkPlatformImpl::recordAction(const blink::UserMetricsAction& name) { |
492 } | 492 if (ChildThread* child_thread = ChildThread::Get()) |
| 493 child_thread->RecordComputedAction(name.action()); |
| 494 } |
| 495 |
| 496 void BlinkPlatformImpl::registerMemoryDumpProvider( |
| 497 blink::WebMemoryDumpProvider* wmdp, const char* name) { |
| 498 WebMemoryDumpProviderAdapter* wmdp_adapter = |
| 499 new WebMemoryDumpProviderAdapter(wmdp); |
| 500 bool did_insert = |
| 501 memory_dump_providers_.add(wmdp, make_scoped_ptr(wmdp_adapter)).second; |
| 502 if (!did_insert) |
| 503 return; |
| 504 wmdp_adapter->set_is_registered(true); |
| 505 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 506 wmdp_adapter, name, base::ThreadTaskRunnerHandle::Get()); |
| 507 } |
| 508 |
| 509 void BlinkPlatformImpl::unregisterMemoryDumpProvider( |
| 510 blink::WebMemoryDumpProvider* wmdp) { |
| 511 scoped_ptr<WebMemoryDumpProviderAdapter> wmdp_adapter = |
| 512 memory_dump_providers_.take_and_erase(wmdp); |
| 513 if (!wmdp_adapter) |
| 514 return; |
| 515 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( |
| 516 wmdp_adapter.get()); |
| 517 wmdp_adapter->set_is_registered(false); |
| 518 } |
| 519 |
| 520 blink::WebProcessMemoryDump* BlinkPlatformImpl::createProcessMemoryDump() { |
| 521 return new WebProcessMemoryDumpImpl(); |
| 522 } |
493 | 523 |
494 blink::Platform::WebMemoryAllocatorDumpGuid | 524 blink::Platform::WebMemoryAllocatorDumpGuid |
495 BlinkPlatformImpl::createWebMemoryAllocatorDumpGuid( | 525 BlinkPlatformImpl::createWebMemoryAllocatorDumpGuid( |
496 const blink::WebString& guidStr) { | 526 const blink::WebString& guidStr) { |
497 return base::trace_event::MemoryAllocatorDumpGuid(guidStr.utf8()).ToUint64(); | 527 return base::trace_event::MemoryAllocatorDumpGuid(guidStr.utf8()).ToUint64(); |
498 } | 528 } |
499 | 529 |
500 void BlinkPlatformImpl::addTraceLogEnabledStateObserver( | 530 void BlinkPlatformImpl::addTraceLogEnabledStateObserver( |
501 TraceLogEnabledStateObserver* observer) { | 531 TraceLogEnabledStateObserver* observer) { |
502 TraceLogObserverAdapter* adapter = new TraceLogObserverAdapter(observer); | 532 TraceLogObserverAdapter* adapter = new TraceLogObserverAdapter(observer); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 1047 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
1018 static_cast<ui::DomKey>(dom_key))); | 1048 static_cast<ui::DomKey>(dom_key))); |
1019 } | 1049 } |
1020 | 1050 |
1021 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1051 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
1022 return static_cast<int>( | 1052 return static_cast<int>( |
1023 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 1053 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
1024 } | 1054 } |
1025 | 1055 |
1026 } // namespace content | 1056 } // namespace content |
OLD | NEW |