| Index: content/child/blink_platform_impl.cc
|
| diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
|
| index 6474a7f8741570ee5ae6e789be4967cf5af72759..7f24dfa258398a1d2719e7ddfacd57f6f2a74e36 100644
|
| --- a/content/child/blink_platform_impl.cc
|
| +++ b/content/child/blink_platform_impl.cc
|
| @@ -1,495 +1,525 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -#include "content/child/blink_platform_impl.h"
|
| -
|
| -#include <math.h>
|
| -
|
| -#include <vector>
|
| -
|
| -#include "base/bind.h"
|
| -#include "base/files/file_path.h"
|
| -#include "base/location.h"
|
| -#include "base/macros.h"
|
| -#include "base/memory/scoped_ptr.h"
|
| -#include "base/memory/singleton.h"
|
| -#include "base/metrics/user_metrics_action.h"
|
| -#include "base/rand_util.h"
|
| -#include "base/single_thread_task_runner.h"
|
| -#include "base/strings/string_number_conversions.h"
|
| -#include "base/strings/string_util.h"
|
| -#include "base/strings/utf_string_conversions.h"
|
| -#include "base/synchronization/lock.h"
|
| -#include "base/synchronization/waitable_event.h"
|
| -#include "base/sys_info.h"
|
| -#include "base/thread_task_runner_handle.h"
|
| -#include "base/threading/platform_thread.h"
|
| -#include "base/threading/thread.h"
|
| -#include "base/time/time.h"
|
| -#include "base/trace_event/memory_allocator_dump_guid.h"
|
| -#include "base/trace_event/memory_dump_manager.h"
|
| -#include "base/trace_event/trace_event.h"
|
| -#include "blink/public/resources/grit/blink_image_resources.h"
|
| -#include "blink/public/resources/grit/blink_resources.h"
|
| -#include "build/build_config.h"
|
| -#include "components/mime_util/mime_util.h"
|
| -#include "components/scheduler/child/web_task_runner_impl.h"
|
| -#include "components/scheduler/child/webthread_impl_for_worker_scheduler.h"
|
| -#include "content/app/resources/grit/content_resources.h"
|
| -#include "content/app/strings/grit/content_strings.h"
|
| -#include "content/child/background_sync/background_sync_provider.h"
|
| -#include "content/child/child_thread_impl.h"
|
| -#include "content/child/content_child_helpers.h"
|
| -#include "content/child/geofencing/web_geofencing_provider_impl.h"
|
| -#include "content/child/navigator_connect/service_port_provider.h"
|
| -#include "content/child/notifications/notification_dispatcher.h"
|
| -#include "content/child/notifications/notification_manager.h"
|
| -#include "content/child/permissions/permission_dispatcher.h"
|
| -#include "content/child/permissions/permission_dispatcher_thread_proxy.h"
|
| -#include "content/child/push_messaging/push_dispatcher.h"
|
| -#include "content/child/push_messaging/push_provider.h"
|
| -#include "content/child/thread_safe_sender.h"
|
| -#include "content/child/web_discardable_memory_impl.h"
|
| -#include "content/child/web_url_loader_impl.h"
|
| -#include "content/child/web_url_request_util.h"
|
| -#include "content/child/websocket_bridge.h"
|
| -#include "content/child/worker_thread_registry.h"
|
| -#include "content/public/common/content_client.h"
|
| -#include "net/base/data_url.h"
|
| -#include "net/base/ip_address_number.h"
|
| -#include "net/base/net_errors.h"
|
| -#include "net/base/port_util.h"
|
| -#include "third_party/WebKit/public/platform/WebData.h"
|
| -#include "third_party/WebKit/public/platform/WebFloatPoint.h"
|
| -#include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h"
|
| -#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
|
| -#include "third_party/WebKit/public/platform/WebString.h"
|
| -#include "third_party/WebKit/public/platform/WebURL.h"
|
| -#include "ui/base/layout.h"
|
| -#include "ui/events/gestures/blink/web_gesture_curve_impl.h"
|
| -#include "ui/events/keycodes/dom/keycode_converter.h"
|
| -
|
| -using blink::WebData;
|
| -using blink::WebFallbackThemeEngine;
|
| -using blink::WebLocalizedString;
|
| -using blink::WebString;
|
| -using blink::WebThemeEngine;
|
| -using blink::WebURL;
|
| -using blink::WebURLError;
|
| -using blink::WebURLLoader;
|
| -using scheduler::WebThreadImplForWorkerScheduler;
|
| -
|
| -namespace content {
|
| -
|
| -namespace {
|
| + // Copyright 2014 The Chromium Authors. All rights reserved.
|
| + // Use of this source code is governed by a BSD-style license that can be
|
| + // found in the LICENSE file.
|
| +
|
| + #include "content/child/blink_platform_impl.h"
|
| +
|
| + #include <math.h>
|
| +
|
| + #include <vector>
|
| +
|
| + #include "base/bind.h"
|
| + #include "base/files/file_path.h"
|
| + #include "base/location.h"
|
| + #include "base/macros.h"
|
| + #include "base/memory/scoped_ptr.h"
|
| + #include "base/memory/singleton.h"
|
| + #include "base/metrics/user_metrics_action.h"
|
| + #include "base/rand_util.h"
|
| + #include "base/single_thread_task_runner.h"
|
| + #include "base/strings/string_number_conversions.h"
|
| + #include "base/strings/string_util.h"
|
| + #include "base/strings/utf_string_conversions.h"
|
| + #include "base/synchronization/lock.h"
|
| + #include "base/synchronization/waitable_event.h"
|
| + #include "base/sys_info.h"
|
| + #include "base/thread_task_runner_handle.h"
|
| + #include "base/threading/platform_thread.h"
|
| + #include "base/threading/thread.h"
|
| + #include "base/time/time.h"
|
| + #include "base/trace_event/memory_allocator_dump_guid.h"
|
| + #include "base/trace_event/memory_dump_manager.h"
|
| + #include "base/trace_event/trace_event.h"
|
| + #include "blink/public/resources/grit/blink_image_resources.h"
|
| + #include "blink/public/resources/grit/blink_resources.h"
|
| + #include "build/build_config.h"
|
| + #include "components/mime_util/mime_util.h"
|
| + #include "components/scheduler/child/web_task_runner_impl.h"
|
| + #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h"
|
| + #include "content/app/resources/grit/content_resources.h"
|
| + #include "content/app/strings/grit/content_strings.h"
|
| + #include "content/child/background_sync/background_sync_provider.h"
|
| + #include "content/child/child_thread_impl.h"
|
| + #include "content/child/content_child_helpers.h"
|
| + #include "content/child/geofencing/web_geofencing_provider_impl.h"
|
| + #include "content/child/navigator_connect/service_port_provider.h"
|
| + #include "content/child/notifications/notification_dispatcher.h"
|
| + #include "content/child/notifications/notification_manager.h"
|
| + #include "content/child/permissions/permission_dispatcher.h"
|
| + #include "content/child/permissions/permission_dispatcher_thread_proxy.h"
|
| + #include "content/child/push_messaging/push_dispatcher.h"
|
| + #include "content/child/push_messaging/push_provider.h"
|
| + #include "content/child/thread_safe_sender.h"
|
| + #include "content/child/web_discardable_memory_impl.h"
|
| + #include "content/child/web_memory_dump_provider_adapter.h"
|
| + #include "content/child/web_process_memory_dump_impl.h"
|
| + #include "content/child/web_url_loader_impl.h"
|
| + #include "content/child/web_url_request_util.h"
|
| + #include "content/child/websocket_bridge.h"
|
| + #include "content/child/worker_thread_registry.h"
|
| + #include "content/public/common/content_client.h"
|
| + #include "net/base/data_url.h"
|
| + #include "net/base/ip_address_number.h"
|
| + #include "net/base/net_errors.h"
|
| + #include "net/base/port_util.h"
|
| + #include "third_party/WebKit/public/platform/WebData.h"
|
| + #include "third_party/WebKit/public/platform/WebFloatPoint.h"
|
| + #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h"
|
| + #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
|
| + #include "third_party/WebKit/public/platform/WebString.h"
|
| + #include "third_party/WebKit/public/platform/WebURL.h"
|
| + #include "ui/base/layout.h"
|
| + #include "ui/events/gestures/blink/web_gesture_curve_impl.h"
|
| + #include "ui/events/keycodes/dom/keycode_converter.h"
|
| +
|
| + using blink::WebData;
|
| + using blink::WebFallbackThemeEngine;
|
| + using blink::WebLocalizedString;
|
| + using blink::WebString;
|
| + using blink::WebThemeEngine;
|
| + using blink::WebURL;
|
| + using blink::WebURLError;
|
| + using blink::WebURLLoader;
|
| + using scheduler::WebThreadImplForWorkerScheduler;
|
| +
|
| + namespace content {
|
| +
|
| + namespace {
|
| +
|
| +
|
| + } // namespace
|
| +
|
| + static int ToMessageID(WebLocalizedString::Name name) {
|
| + switch (name) {
|
| + case WebLocalizedString::AXAMPMFieldText:
|
| + return IDS_AX_AM_PM_FIELD_TEXT;
|
| + case WebLocalizedString::AXButtonActionVerb:
|
| + return IDS_AX_BUTTON_ACTION_VERB;
|
| + case WebLocalizedString::AXCalendarShowMonthSelector:
|
| + return IDS_AX_CALENDAR_SHOW_MONTH_SELECTOR;
|
| + case WebLocalizedString::AXCalendarShowNextMonth:
|
| + return IDS_AX_CALENDAR_SHOW_NEXT_MONTH;
|
| + case WebLocalizedString::AXCalendarShowPreviousMonth:
|
| + return IDS_AX_CALENDAR_SHOW_PREVIOUS_MONTH;
|
| + case WebLocalizedString::AXCalendarWeekDescription:
|
| + return IDS_AX_CALENDAR_WEEK_DESCRIPTION;
|
| + case WebLocalizedString::AXCheckedCheckBoxActionVerb:
|
| + return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB;
|
| + case WebLocalizedString::AXDateTimeFieldEmptyValueText:
|
| + return IDS_AX_DATE_TIME_FIELD_EMPTY_VALUE_TEXT;
|
| + case WebLocalizedString::AXDayOfMonthFieldText:
|
| + return IDS_AX_DAY_OF_MONTH_FIELD_TEXT;
|
| + case WebLocalizedString::AXHeadingText:
|
| + return IDS_AX_ROLE_HEADING;
|
| + case WebLocalizedString::AXHourFieldText:
|
| + return IDS_AX_HOUR_FIELD_TEXT;
|
| + case WebLocalizedString::AXImageMapText:
|
| + return IDS_AX_ROLE_IMAGE_MAP;
|
| + case WebLocalizedString::AXLinkActionVerb:
|
| + return IDS_AX_LINK_ACTION_VERB;
|
| + case WebLocalizedString::AXLinkText:
|
| + return IDS_AX_ROLE_LINK;
|
| + case WebLocalizedString::AXListMarkerText:
|
| + return IDS_AX_ROLE_LIST_MARKER;
|
| + case WebLocalizedString::AXMediaDefault:
|
| + return IDS_AX_MEDIA_DEFAULT;
|
| + case WebLocalizedString::AXMediaAudioElement:
|
| + return IDS_AX_MEDIA_AUDIO_ELEMENT;
|
| + case WebLocalizedString::AXMediaVideoElement:
|
| + return IDS_AX_MEDIA_VIDEO_ELEMENT;
|
| + case WebLocalizedString::AXMediaMuteButton:
|
| + return IDS_AX_MEDIA_MUTE_BUTTON;
|
| + case WebLocalizedString::AXMediaUnMuteButton:
|
| + return IDS_AX_MEDIA_UNMUTE_BUTTON;
|
| + case WebLocalizedString::AXMediaPlayButton:
|
| + return IDS_AX_MEDIA_PLAY_BUTTON;
|
| + case WebLocalizedString::AXMediaPauseButton:
|
| + return IDS_AX_MEDIA_PAUSE_BUTTON;
|
| + case WebLocalizedString::AXMediaSlider:
|
| + return IDS_AX_MEDIA_SLIDER;
|
| + case WebLocalizedString::AXMediaSliderThumb:
|
| + return IDS_AX_MEDIA_SLIDER_THUMB;
|
| + case WebLocalizedString::AXMediaCurrentTimeDisplay:
|
| + return IDS_AX_MEDIA_CURRENT_TIME_DISPLAY;
|
| + case WebLocalizedString::AXMediaTimeRemainingDisplay:
|
| + return IDS_AX_MEDIA_TIME_REMAINING_DISPLAY;
|
| + case WebLocalizedString::AXMediaStatusDisplay:
|
| + return IDS_AX_MEDIA_STATUS_DISPLAY;
|
| + case WebLocalizedString::AXMediaEnterFullscreenButton:
|
| + return IDS_AX_MEDIA_ENTER_FULL_SCREEN_BUTTON;
|
| + case WebLocalizedString::AXMediaExitFullscreenButton:
|
| + return IDS_AX_MEDIA_EXIT_FULL_SCREEN_BUTTON;
|
| + case WebLocalizedString::AXMediaShowClosedCaptionsButton:
|
| + return IDS_AX_MEDIA_SHOW_CLOSED_CAPTIONS_BUTTON;
|
| + case WebLocalizedString::AXMediaHideClosedCaptionsButton:
|
| + return IDS_AX_MEDIA_HIDE_CLOSED_CAPTIONS_BUTTON;
|
| + case WebLocalizedString::AxMediaCastOffButton:
|
| + return IDS_AX_MEDIA_CAST_OFF_BUTTON;
|
| + case WebLocalizedString::AxMediaCastOnButton:
|
| + return IDS_AX_MEDIA_CAST_ON_BUTTON;
|
| + case WebLocalizedString::AXMediaAudioElementHelp:
|
| + return IDS_AX_MEDIA_AUDIO_ELEMENT_HELP;
|
| + case WebLocalizedString::AXMediaVideoElementHelp:
|
| + return IDS_AX_MEDIA_VIDEO_ELEMENT_HELP;
|
| + case WebLocalizedString::AXMediaMuteButtonHelp:
|
| + return IDS_AX_MEDIA_MUTE_BUTTON_HELP;
|
| + case WebLocalizedString::AXMediaUnMuteButtonHelp:
|
| + return IDS_AX_MEDIA_UNMUTE_BUTTON_HELP;
|
| + case WebLocalizedString::AXMediaPlayButtonHelp:
|
| + return IDS_AX_MEDIA_PLAY_BUTTON_HELP;
|
| + case WebLocalizedString::AXMediaPauseButtonHelp:
|
| + return IDS_AX_MEDIA_PAUSE_BUTTON_HELP;
|
| + case WebLocalizedString::AXMediaAudioSliderHelp:
|
| + return IDS_AX_MEDIA_AUDIO_SLIDER_HELP;
|
| + case WebLocalizedString::AXMediaVideoSliderHelp:
|
| + return IDS_AX_MEDIA_VIDEO_SLIDER_HELP;
|
| + case WebLocalizedString::AXMediaSliderThumbHelp:
|
| + return IDS_AX_MEDIA_SLIDER_THUMB_HELP;
|
| + case WebLocalizedString::AXMediaCurrentTimeDisplayHelp:
|
| + return IDS_AX_MEDIA_CURRENT_TIME_DISPLAY_HELP;
|
| + case WebLocalizedString::AXMediaTimeRemainingDisplayHelp:
|
| + return IDS_AX_MEDIA_TIME_REMAINING_DISPLAY_HELP;
|
| + case WebLocalizedString::AXMediaStatusDisplayHelp:
|
| + return IDS_AX_MEDIA_STATUS_DISPLAY_HELP;
|
| + case WebLocalizedString::AXMediaEnterFullscreenButtonHelp:
|
| + return IDS_AX_MEDIA_ENTER_FULL_SCREEN_BUTTON_HELP;
|
| + case WebLocalizedString::AXMediaExitFullscreenButtonHelp:
|
| + return IDS_AX_MEDIA_EXIT_FULL_SCREEN_BUTTON_HELP;
|
| + case WebLocalizedString::AXMediaShowClosedCaptionsButtonHelp:
|
| + return IDS_AX_MEDIA_SHOW_CLOSED_CAPTIONS_BUTTON_HELP;
|
| + case WebLocalizedString::AXMediaHideClosedCaptionsButtonHelp:
|
| + return IDS_AX_MEDIA_HIDE_CLOSED_CAPTIONS_BUTTON_HELP;
|
| + case WebLocalizedString::AxMediaCastOffButtonHelp:
|
| + return IDS_AX_MEDIA_CAST_OFF_BUTTON_HELP;
|
| + case WebLocalizedString::AxMediaCastOnButtonHelp:
|
| + return IDS_AX_MEDIA_CAST_ON_BUTTON_HELP;
|
| + case WebLocalizedString::AXMillisecondFieldText:
|
| + return IDS_AX_MILLISECOND_FIELD_TEXT;
|
| + case WebLocalizedString::AXMinuteFieldText:
|
| + return IDS_AX_MINUTE_FIELD_TEXT;
|
| + case WebLocalizedString::AXMonthFieldText:
|
| + return IDS_AX_MONTH_FIELD_TEXT;
|
| + case WebLocalizedString::AXRadioButtonActionVerb:
|
| + return IDS_AX_RADIO_BUTTON_ACTION_VERB;
|
| + case WebLocalizedString::AXSecondFieldText:
|
| + return IDS_AX_SECOND_FIELD_TEXT;
|
| + case WebLocalizedString::AXTextFieldActionVerb:
|
| + return IDS_AX_TEXT_FIELD_ACTION_VERB;
|
| + case WebLocalizedString::AXUncheckedCheckBoxActionVerb:
|
| + return IDS_AX_UNCHECKED_CHECK_BOX_ACTION_VERB;
|
| + case WebLocalizedString::AXWebAreaText:
|
| + return IDS_AX_ROLE_WEB_AREA;
|
| + case WebLocalizedString::AXWeekOfYearFieldText:
|
| + return IDS_AX_WEEK_OF_YEAR_FIELD_TEXT;
|
| + case WebLocalizedString::AXYearFieldText:
|
| + return IDS_AX_YEAR_FIELD_TEXT;
|
| + case WebLocalizedString::CalendarClear:
|
| + return IDS_FORM_CALENDAR_CLEAR;
|
| + case WebLocalizedString::CalendarToday:
|
| + return IDS_FORM_CALENDAR_TODAY;
|
| + case WebLocalizedString::DateFormatDayInMonthLabel:
|
| + return IDS_FORM_DATE_FORMAT_DAY_IN_MONTH;
|
| + case WebLocalizedString::DateFormatMonthLabel:
|
| + return IDS_FORM_DATE_FORMAT_MONTH;
|
| + case WebLocalizedString::DateFormatYearLabel:
|
| + return IDS_FORM_DATE_FORMAT_YEAR;
|
| + case WebLocalizedString::DetailsLabel:
|
| + return IDS_DETAILS_WITHOUT_SUMMARY_LABEL;
|
| + case WebLocalizedString::FileButtonChooseFileLabel:
|
| + return IDS_FORM_FILE_BUTTON_LABEL;
|
| + case WebLocalizedString::FileButtonChooseMultipleFilesLabel:
|
| + return IDS_FORM_MULTIPLE_FILES_BUTTON_LABEL;
|
| + case WebLocalizedString::FileButtonNoFileSelectedLabel:
|
| + return IDS_FORM_FILE_NO_FILE_LABEL;
|
| + case WebLocalizedString::InputElementAltText:
|
| + return IDS_FORM_INPUT_ALT;
|
| + case WebLocalizedString::KeygenMenuHighGradeKeySize:
|
| + return IDS_KEYGEN_HIGH_GRADE_KEY;
|
| + case WebLocalizedString::KeygenMenuMediumGradeKeySize:
|
| + return IDS_KEYGEN_MED_GRADE_KEY;
|
| + case WebLocalizedString::MissingPluginText:
|
| + return IDS_PLUGIN_INITIALIZATION_ERROR;
|
| + case WebLocalizedString::MultipleFileUploadText:
|
| + return IDS_FORM_FILE_MULTIPLE_UPLOAD;
|
| + case WebLocalizedString::OtherColorLabel:
|
| + return IDS_FORM_OTHER_COLOR_LABEL;
|
| + case WebLocalizedString::OtherDateLabel:
|
| + return IDS_FORM_OTHER_DATE_LABEL;
|
| + case WebLocalizedString::OtherMonthLabel:
|
| + return IDS_FORM_OTHER_MONTH_LABEL;
|
| + case WebLocalizedString::OtherTimeLabel:
|
| + return IDS_FORM_OTHER_TIME_LABEL;
|
| + case WebLocalizedString::OtherWeekLabel:
|
| + return IDS_FORM_OTHER_WEEK_LABEL;
|
| + case WebLocalizedString::PlaceholderForDayOfMonthField:
|
| + return IDS_FORM_PLACEHOLDER_FOR_DAY_OF_MONTH_FIELD;
|
| + case WebLocalizedString::PlaceholderForMonthField:
|
| + return IDS_FORM_PLACEHOLDER_FOR_MONTH_FIELD;
|
| + case WebLocalizedString::PlaceholderForYearField:
|
| + return IDS_FORM_PLACEHOLDER_FOR_YEAR_FIELD;
|
| + case WebLocalizedString::ResetButtonDefaultLabel:
|
| + return IDS_FORM_RESET_LABEL;
|
| + case WebLocalizedString::SearchableIndexIntroduction:
|
| + return IDS_SEARCHABLE_INDEX_INTRO;
|
| + case WebLocalizedString::SearchMenuClearRecentSearchesText:
|
| + return IDS_RECENT_SEARCHES_CLEAR;
|
| + case WebLocalizedString::SearchMenuNoRecentSearchesText:
|
| + return IDS_RECENT_SEARCHES_NONE;
|
| + case WebLocalizedString::SearchMenuRecentSearchesText:
|
| + return IDS_RECENT_SEARCHES;
|
| + case WebLocalizedString::SelectMenuListText:
|
| + return IDS_FORM_SELECT_MENU_LIST_TEXT;
|
| + case WebLocalizedString::SubmitButtonDefaultLabel:
|
| + return IDS_FORM_SUBMIT_LABEL;
|
| + case WebLocalizedString::ThisMonthButtonLabel:
|
| + return IDS_FORM_THIS_MONTH_LABEL;
|
| + case WebLocalizedString::ThisWeekButtonLabel:
|
| + return IDS_FORM_THIS_WEEK_LABEL;
|
| + case WebLocalizedString::ValidationBadInputForDateTime:
|
| + return IDS_FORM_VALIDATION_BAD_INPUT_DATETIME;
|
| + case WebLocalizedString::ValidationBadInputForNumber:
|
| + return IDS_FORM_VALIDATION_BAD_INPUT_NUMBER;
|
| + case WebLocalizedString::ValidationPatternMismatch:
|
| + return IDS_FORM_VALIDATION_PATTERN_MISMATCH;
|
| + case WebLocalizedString::ValidationRangeOverflow:
|
| + return IDS_FORM_VALIDATION_RANGE_OVERFLOW;
|
| + case WebLocalizedString::ValidationRangeOverflowDateTime:
|
| + return IDS_FORM_VALIDATION_RANGE_OVERFLOW_DATETIME;
|
| + case WebLocalizedString::ValidationRangeUnderflow:
|
| + return IDS_FORM_VALIDATION_RANGE_UNDERFLOW;
|
| + case WebLocalizedString::ValidationRangeUnderflowDateTime:
|
| + return IDS_FORM_VALIDATION_RANGE_UNDERFLOW_DATETIME;
|
| + case WebLocalizedString::ValidationStepMismatch:
|
| + return IDS_FORM_VALIDATION_STEP_MISMATCH;
|
| + case WebLocalizedString::ValidationStepMismatchCloseToLimit:
|
| + return IDS_FORM_VALIDATION_STEP_MISMATCH_CLOSE_TO_LIMIT;
|
| + case WebLocalizedString::ValidationTooLong:
|
| + return IDS_FORM_VALIDATION_TOO_LONG;
|
| + case WebLocalizedString::ValidationTooShort:
|
| + return IDS_FORM_VALIDATION_TOO_SHORT;
|
| + case WebLocalizedString::ValidationTypeMismatch:
|
| + return IDS_FORM_VALIDATION_TYPE_MISMATCH;
|
| + case WebLocalizedString::ValidationTypeMismatchForEmail:
|
| + return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL;
|
| + case WebLocalizedString::ValidationTypeMismatchForEmailEmpty:
|
| + return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY;
|
| + case WebLocalizedString::ValidationTypeMismatchForEmailEmptyDomain:
|
| + return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_DOMAIN;
|
| + case WebLocalizedString::ValidationTypeMismatchForEmailEmptyLocal:
|
| + return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_LOCAL;
|
| + case WebLocalizedString::ValidationTypeMismatchForEmailInvalidDomain:
|
| + return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOMAIN;
|
| + case WebLocalizedString::ValidationTypeMismatchForEmailInvalidDots:
|
| + return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOTS;
|
| + case WebLocalizedString::ValidationTypeMismatchForEmailInvalidLocal:
|
| + return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_LOCAL;
|
| + case WebLocalizedString::ValidationTypeMismatchForEmailNoAtSign:
|
| + return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_NO_AT_SIGN;
|
| + case WebLocalizedString::ValidationTypeMismatchForMultipleEmail:
|
| + return IDS_FORM_VALIDATION_TYPE_MISMATCH_MULTIPLE_EMAIL;
|
| + case WebLocalizedString::ValidationTypeMismatchForURL:
|
| + return IDS_FORM_VALIDATION_TYPE_MISMATCH_URL;
|
| + case WebLocalizedString::ValidationValueMissing:
|
| + return IDS_FORM_VALIDATION_VALUE_MISSING;
|
| + case WebLocalizedString::ValidationValueMissingForCheckbox:
|
| + return IDS_FORM_VALIDATION_VALUE_MISSING_CHECKBOX;
|
| + case WebLocalizedString::ValidationValueMissingForFile:
|
| + return IDS_FORM_VALIDATION_VALUE_MISSING_FILE;
|
| + case WebLocalizedString::ValidationValueMissingForMultipleFile:
|
| + return IDS_FORM_VALIDATION_VALUE_MISSING_MULTIPLE_FILE;
|
| + case WebLocalizedString::ValidationValueMissingForRadio:
|
| + return IDS_FORM_VALIDATION_VALUE_MISSING_RADIO;
|
| + case WebLocalizedString::ValidationValueMissingForSelect:
|
| + return IDS_FORM_VALIDATION_VALUE_MISSING_SELECT;
|
| + case WebLocalizedString::WeekFormatTemplate:
|
| + return IDS_FORM_INPUT_WEEK_TEMPLATE;
|
| + case WebLocalizedString::WeekNumberLabel:
|
| + return IDS_FORM_WEEK_NUMBER_LABEL;
|
| + // This "default:" line exists to avoid compile warnings about enum
|
| + // coverage when we add a new symbol to WebLocalizedString.h in WebKit.
|
| + // After a planned WebKit patch is landed, we need to add a case statement
|
| + // for the added symbol here.
|
| + default:
|
| + break;
|
| + }
|
| + return -1;
|
| + }
|
|
|
| + class TraceLogObserverAdapter
|
| + : public base::trace_event::TraceLog::EnabledStateObserver {
|
| + public:
|
| + TraceLogObserverAdapter(
|
| + blink::Platform::TraceLogEnabledStateObserver* observer)
|
| + : observer_(observer) {}
|
|
|
| -} // namespace
|
| + void OnTraceLogEnabled() override { observer_->onTraceLogEnabled(); }
|
|
|
| -static int ToMessageID(WebLocalizedString::Name name) {
|
| - switch (name) {
|
| - case WebLocalizedString::AXAMPMFieldText:
|
| - return IDS_AX_AM_PM_FIELD_TEXT;
|
| - case WebLocalizedString::AXButtonActionVerb:
|
| - return IDS_AX_BUTTON_ACTION_VERB;
|
| - case WebLocalizedString::AXCalendarShowMonthSelector:
|
| - return IDS_AX_CALENDAR_SHOW_MONTH_SELECTOR;
|
| - case WebLocalizedString::AXCalendarShowNextMonth:
|
| - return IDS_AX_CALENDAR_SHOW_NEXT_MONTH;
|
| - case WebLocalizedString::AXCalendarShowPreviousMonth:
|
| - return IDS_AX_CALENDAR_SHOW_PREVIOUS_MONTH;
|
| - case WebLocalizedString::AXCalendarWeekDescription:
|
| - return IDS_AX_CALENDAR_WEEK_DESCRIPTION;
|
| - case WebLocalizedString::AXCheckedCheckBoxActionVerb:
|
| - return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB;
|
| - case WebLocalizedString::AXDateTimeFieldEmptyValueText:
|
| - return IDS_AX_DATE_TIME_FIELD_EMPTY_VALUE_TEXT;
|
| - case WebLocalizedString::AXDayOfMonthFieldText:
|
| - return IDS_AX_DAY_OF_MONTH_FIELD_TEXT;
|
| - case WebLocalizedString::AXHeadingText:
|
| - return IDS_AX_ROLE_HEADING;
|
| - case WebLocalizedString::AXHourFieldText:
|
| - return IDS_AX_HOUR_FIELD_TEXT;
|
| - case WebLocalizedString::AXImageMapText:
|
| - return IDS_AX_ROLE_IMAGE_MAP;
|
| - case WebLocalizedString::AXLinkActionVerb:
|
| - return IDS_AX_LINK_ACTION_VERB;
|
| - case WebLocalizedString::AXLinkText:
|
| - return IDS_AX_ROLE_LINK;
|
| - case WebLocalizedString::AXListMarkerText:
|
| - return IDS_AX_ROLE_LIST_MARKER;
|
| - case WebLocalizedString::AXMediaDefault:
|
| - return IDS_AX_MEDIA_DEFAULT;
|
| - case WebLocalizedString::AXMediaAudioElement:
|
| - return IDS_AX_MEDIA_AUDIO_ELEMENT;
|
| - case WebLocalizedString::AXMediaVideoElement:
|
| - return IDS_AX_MEDIA_VIDEO_ELEMENT;
|
| - case WebLocalizedString::AXMediaMuteButton:
|
| - return IDS_AX_MEDIA_MUTE_BUTTON;
|
| - case WebLocalizedString::AXMediaUnMuteButton:
|
| - return IDS_AX_MEDIA_UNMUTE_BUTTON;
|
| - case WebLocalizedString::AXMediaPlayButton:
|
| - return IDS_AX_MEDIA_PLAY_BUTTON;
|
| - case WebLocalizedString::AXMediaPauseButton:
|
| - return IDS_AX_MEDIA_PAUSE_BUTTON;
|
| - case WebLocalizedString::AXMediaSlider:
|
| - return IDS_AX_MEDIA_SLIDER;
|
| - case WebLocalizedString::AXMediaSliderThumb:
|
| - return IDS_AX_MEDIA_SLIDER_THUMB;
|
| - case WebLocalizedString::AXMediaCurrentTimeDisplay:
|
| - return IDS_AX_MEDIA_CURRENT_TIME_DISPLAY;
|
| - case WebLocalizedString::AXMediaTimeRemainingDisplay:
|
| - return IDS_AX_MEDIA_TIME_REMAINING_DISPLAY;
|
| - case WebLocalizedString::AXMediaStatusDisplay:
|
| - return IDS_AX_MEDIA_STATUS_DISPLAY;
|
| - case WebLocalizedString::AXMediaEnterFullscreenButton:
|
| - return IDS_AX_MEDIA_ENTER_FULL_SCREEN_BUTTON;
|
| - case WebLocalizedString::AXMediaExitFullscreenButton:
|
| - return IDS_AX_MEDIA_EXIT_FULL_SCREEN_BUTTON;
|
| - case WebLocalizedString::AXMediaShowClosedCaptionsButton:
|
| - return IDS_AX_MEDIA_SHOW_CLOSED_CAPTIONS_BUTTON;
|
| - case WebLocalizedString::AXMediaHideClosedCaptionsButton:
|
| - return IDS_AX_MEDIA_HIDE_CLOSED_CAPTIONS_BUTTON;
|
| - case WebLocalizedString::AxMediaCastOffButton:
|
| - return IDS_AX_MEDIA_CAST_OFF_BUTTON;
|
| - case WebLocalizedString::AxMediaCastOnButton:
|
| - return IDS_AX_MEDIA_CAST_ON_BUTTON;
|
| - case WebLocalizedString::AXMediaAudioElementHelp:
|
| - return IDS_AX_MEDIA_AUDIO_ELEMENT_HELP;
|
| - case WebLocalizedString::AXMediaVideoElementHelp:
|
| - return IDS_AX_MEDIA_VIDEO_ELEMENT_HELP;
|
| - case WebLocalizedString::AXMediaMuteButtonHelp:
|
| - return IDS_AX_MEDIA_MUTE_BUTTON_HELP;
|
| - case WebLocalizedString::AXMediaUnMuteButtonHelp:
|
| - return IDS_AX_MEDIA_UNMUTE_BUTTON_HELP;
|
| - case WebLocalizedString::AXMediaPlayButtonHelp:
|
| - return IDS_AX_MEDIA_PLAY_BUTTON_HELP;
|
| - case WebLocalizedString::AXMediaPauseButtonHelp:
|
| - return IDS_AX_MEDIA_PAUSE_BUTTON_HELP;
|
| - case WebLocalizedString::AXMediaAudioSliderHelp:
|
| - return IDS_AX_MEDIA_AUDIO_SLIDER_HELP;
|
| - case WebLocalizedString::AXMediaVideoSliderHelp:
|
| - return IDS_AX_MEDIA_VIDEO_SLIDER_HELP;
|
| - case WebLocalizedString::AXMediaSliderThumbHelp:
|
| - return IDS_AX_MEDIA_SLIDER_THUMB_HELP;
|
| - case WebLocalizedString::AXMediaCurrentTimeDisplayHelp:
|
| - return IDS_AX_MEDIA_CURRENT_TIME_DISPLAY_HELP;
|
| - case WebLocalizedString::AXMediaTimeRemainingDisplayHelp:
|
| - return IDS_AX_MEDIA_TIME_REMAINING_DISPLAY_HELP;
|
| - case WebLocalizedString::AXMediaStatusDisplayHelp:
|
| - return IDS_AX_MEDIA_STATUS_DISPLAY_HELP;
|
| - case WebLocalizedString::AXMediaEnterFullscreenButtonHelp:
|
| - return IDS_AX_MEDIA_ENTER_FULL_SCREEN_BUTTON_HELP;
|
| - case WebLocalizedString::AXMediaExitFullscreenButtonHelp:
|
| - return IDS_AX_MEDIA_EXIT_FULL_SCREEN_BUTTON_HELP;
|
| - case WebLocalizedString::AXMediaShowClosedCaptionsButtonHelp:
|
| - return IDS_AX_MEDIA_SHOW_CLOSED_CAPTIONS_BUTTON_HELP;
|
| - case WebLocalizedString::AXMediaHideClosedCaptionsButtonHelp:
|
| - return IDS_AX_MEDIA_HIDE_CLOSED_CAPTIONS_BUTTON_HELP;
|
| - case WebLocalizedString::AxMediaCastOffButtonHelp:
|
| - return IDS_AX_MEDIA_CAST_OFF_BUTTON_HELP;
|
| - case WebLocalizedString::AxMediaCastOnButtonHelp:
|
| - return IDS_AX_MEDIA_CAST_ON_BUTTON_HELP;
|
| - case WebLocalizedString::AXMillisecondFieldText:
|
| - return IDS_AX_MILLISECOND_FIELD_TEXT;
|
| - case WebLocalizedString::AXMinuteFieldText:
|
| - return IDS_AX_MINUTE_FIELD_TEXT;
|
| - case WebLocalizedString::AXMonthFieldText:
|
| - return IDS_AX_MONTH_FIELD_TEXT;
|
| - case WebLocalizedString::AXRadioButtonActionVerb:
|
| - return IDS_AX_RADIO_BUTTON_ACTION_VERB;
|
| - case WebLocalizedString::AXSecondFieldText:
|
| - return IDS_AX_SECOND_FIELD_TEXT;
|
| - case WebLocalizedString::AXTextFieldActionVerb:
|
| - return IDS_AX_TEXT_FIELD_ACTION_VERB;
|
| - case WebLocalizedString::AXUncheckedCheckBoxActionVerb:
|
| - return IDS_AX_UNCHECKED_CHECK_BOX_ACTION_VERB;
|
| - case WebLocalizedString::AXWebAreaText:
|
| - return IDS_AX_ROLE_WEB_AREA;
|
| - case WebLocalizedString::AXWeekOfYearFieldText:
|
| - return IDS_AX_WEEK_OF_YEAR_FIELD_TEXT;
|
| - case WebLocalizedString::AXYearFieldText:
|
| - return IDS_AX_YEAR_FIELD_TEXT;
|
| - case WebLocalizedString::CalendarClear:
|
| - return IDS_FORM_CALENDAR_CLEAR;
|
| - case WebLocalizedString::CalendarToday:
|
| - return IDS_FORM_CALENDAR_TODAY;
|
| - case WebLocalizedString::DateFormatDayInMonthLabel:
|
| - return IDS_FORM_DATE_FORMAT_DAY_IN_MONTH;
|
| - case WebLocalizedString::DateFormatMonthLabel:
|
| - return IDS_FORM_DATE_FORMAT_MONTH;
|
| - case WebLocalizedString::DateFormatYearLabel:
|
| - return IDS_FORM_DATE_FORMAT_YEAR;
|
| - case WebLocalizedString::DetailsLabel:
|
| - return IDS_DETAILS_WITHOUT_SUMMARY_LABEL;
|
| - case WebLocalizedString::FileButtonChooseFileLabel:
|
| - return IDS_FORM_FILE_BUTTON_LABEL;
|
| - case WebLocalizedString::FileButtonChooseMultipleFilesLabel:
|
| - return IDS_FORM_MULTIPLE_FILES_BUTTON_LABEL;
|
| - case WebLocalizedString::FileButtonNoFileSelectedLabel:
|
| - return IDS_FORM_FILE_NO_FILE_LABEL;
|
| - case WebLocalizedString::InputElementAltText:
|
| - return IDS_FORM_INPUT_ALT;
|
| - case WebLocalizedString::KeygenMenuHighGradeKeySize:
|
| - return IDS_KEYGEN_HIGH_GRADE_KEY;
|
| - case WebLocalizedString::KeygenMenuMediumGradeKeySize:
|
| - return IDS_KEYGEN_MED_GRADE_KEY;
|
| - case WebLocalizedString::MissingPluginText:
|
| - return IDS_PLUGIN_INITIALIZATION_ERROR;
|
| - case WebLocalizedString::MultipleFileUploadText:
|
| - return IDS_FORM_FILE_MULTIPLE_UPLOAD;
|
| - case WebLocalizedString::OtherColorLabel:
|
| - return IDS_FORM_OTHER_COLOR_LABEL;
|
| - case WebLocalizedString::OtherDateLabel:
|
| - return IDS_FORM_OTHER_DATE_LABEL;
|
| - case WebLocalizedString::OtherMonthLabel:
|
| - return IDS_FORM_OTHER_MONTH_LABEL;
|
| - case WebLocalizedString::OtherTimeLabel:
|
| - return IDS_FORM_OTHER_TIME_LABEL;
|
| - case WebLocalizedString::OtherWeekLabel:
|
| - return IDS_FORM_OTHER_WEEK_LABEL;
|
| - case WebLocalizedString::PlaceholderForDayOfMonthField:
|
| - return IDS_FORM_PLACEHOLDER_FOR_DAY_OF_MONTH_FIELD;
|
| - case WebLocalizedString::PlaceholderForMonthField:
|
| - return IDS_FORM_PLACEHOLDER_FOR_MONTH_FIELD;
|
| - case WebLocalizedString::PlaceholderForYearField:
|
| - return IDS_FORM_PLACEHOLDER_FOR_YEAR_FIELD;
|
| - case WebLocalizedString::ResetButtonDefaultLabel:
|
| - return IDS_FORM_RESET_LABEL;
|
| - case WebLocalizedString::SearchableIndexIntroduction:
|
| - return IDS_SEARCHABLE_INDEX_INTRO;
|
| - case WebLocalizedString::SearchMenuClearRecentSearchesText:
|
| - return IDS_RECENT_SEARCHES_CLEAR;
|
| - case WebLocalizedString::SearchMenuNoRecentSearchesText:
|
| - return IDS_RECENT_SEARCHES_NONE;
|
| - case WebLocalizedString::SearchMenuRecentSearchesText:
|
| - return IDS_RECENT_SEARCHES;
|
| - case WebLocalizedString::SelectMenuListText:
|
| - return IDS_FORM_SELECT_MENU_LIST_TEXT;
|
| - case WebLocalizedString::SubmitButtonDefaultLabel:
|
| - return IDS_FORM_SUBMIT_LABEL;
|
| - case WebLocalizedString::ThisMonthButtonLabel:
|
| - return IDS_FORM_THIS_MONTH_LABEL;
|
| - case WebLocalizedString::ThisWeekButtonLabel:
|
| - return IDS_FORM_THIS_WEEK_LABEL;
|
| - case WebLocalizedString::ValidationBadInputForDateTime:
|
| - return IDS_FORM_VALIDATION_BAD_INPUT_DATETIME;
|
| - case WebLocalizedString::ValidationBadInputForNumber:
|
| - return IDS_FORM_VALIDATION_BAD_INPUT_NUMBER;
|
| - case WebLocalizedString::ValidationPatternMismatch:
|
| - return IDS_FORM_VALIDATION_PATTERN_MISMATCH;
|
| - case WebLocalizedString::ValidationRangeOverflow:
|
| - return IDS_FORM_VALIDATION_RANGE_OVERFLOW;
|
| - case WebLocalizedString::ValidationRangeOverflowDateTime:
|
| - return IDS_FORM_VALIDATION_RANGE_OVERFLOW_DATETIME;
|
| - case WebLocalizedString::ValidationRangeUnderflow:
|
| - return IDS_FORM_VALIDATION_RANGE_UNDERFLOW;
|
| - case WebLocalizedString::ValidationRangeUnderflowDateTime:
|
| - return IDS_FORM_VALIDATION_RANGE_UNDERFLOW_DATETIME;
|
| - case WebLocalizedString::ValidationStepMismatch:
|
| - return IDS_FORM_VALIDATION_STEP_MISMATCH;
|
| - case WebLocalizedString::ValidationStepMismatchCloseToLimit:
|
| - return IDS_FORM_VALIDATION_STEP_MISMATCH_CLOSE_TO_LIMIT;
|
| - case WebLocalizedString::ValidationTooLong:
|
| - return IDS_FORM_VALIDATION_TOO_LONG;
|
| - case WebLocalizedString::ValidationTooShort:
|
| - return IDS_FORM_VALIDATION_TOO_SHORT;
|
| - case WebLocalizedString::ValidationTypeMismatch:
|
| - return IDS_FORM_VALIDATION_TYPE_MISMATCH;
|
| - case WebLocalizedString::ValidationTypeMismatchForEmail:
|
| - return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL;
|
| - case WebLocalizedString::ValidationTypeMismatchForEmailEmpty:
|
| - return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY;
|
| - case WebLocalizedString::ValidationTypeMismatchForEmailEmptyDomain:
|
| - return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_DOMAIN;
|
| - case WebLocalizedString::ValidationTypeMismatchForEmailEmptyLocal:
|
| - return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_LOCAL;
|
| - case WebLocalizedString::ValidationTypeMismatchForEmailInvalidDomain:
|
| - return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOMAIN;
|
| - case WebLocalizedString::ValidationTypeMismatchForEmailInvalidDots:
|
| - return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOTS;
|
| - case WebLocalizedString::ValidationTypeMismatchForEmailInvalidLocal:
|
| - return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_LOCAL;
|
| - case WebLocalizedString::ValidationTypeMismatchForEmailNoAtSign:
|
| - return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_NO_AT_SIGN;
|
| - case WebLocalizedString::ValidationTypeMismatchForMultipleEmail:
|
| - return IDS_FORM_VALIDATION_TYPE_MISMATCH_MULTIPLE_EMAIL;
|
| - case WebLocalizedString::ValidationTypeMismatchForURL:
|
| - return IDS_FORM_VALIDATION_TYPE_MISMATCH_URL;
|
| - case WebLocalizedString::ValidationValueMissing:
|
| - return IDS_FORM_VALIDATION_VALUE_MISSING;
|
| - case WebLocalizedString::ValidationValueMissingForCheckbox:
|
| - return IDS_FORM_VALIDATION_VALUE_MISSING_CHECKBOX;
|
| - case WebLocalizedString::ValidationValueMissingForFile:
|
| - return IDS_FORM_VALIDATION_VALUE_MISSING_FILE;
|
| - case WebLocalizedString::ValidationValueMissingForMultipleFile:
|
| - return IDS_FORM_VALIDATION_VALUE_MISSING_MULTIPLE_FILE;
|
| - case WebLocalizedString::ValidationValueMissingForRadio:
|
| - return IDS_FORM_VALIDATION_VALUE_MISSING_RADIO;
|
| - case WebLocalizedString::ValidationValueMissingForSelect:
|
| - return IDS_FORM_VALIDATION_VALUE_MISSING_SELECT;
|
| - case WebLocalizedString::WeekFormatTemplate:
|
| - return IDS_FORM_INPUT_WEEK_TEMPLATE;
|
| - case WebLocalizedString::WeekNumberLabel:
|
| - return IDS_FORM_WEEK_NUMBER_LABEL;
|
| - // This "default:" line exists to avoid compile warnings about enum
|
| - // coverage when we add a new symbol to WebLocalizedString.h in WebKit.
|
| - // After a planned WebKit patch is landed, we need to add a case statement
|
| - // for the added symbol here.
|
| - default:
|
| - break;
|
| - }
|
| - return -1;
|
| -}
|
| + void OnTraceLogDisabled() override { observer_->onTraceLogDisabled(); }
|
|
|
| -class TraceLogObserverAdapter
|
| - : public base::trace_event::TraceLog::EnabledStateObserver {
|
| - public:
|
| - TraceLogObserverAdapter(
|
| - blink::Platform::TraceLogEnabledStateObserver* observer)
|
| - : observer_(observer) {}
|
| + private:
|
| + blink::Platform::TraceLogEnabledStateObserver* observer_;
|
| + DISALLOW_COPY_AND_ASSIGN(TraceLogObserverAdapter);
|
| + };
|
|
|
| - void OnTraceLogEnabled() override { observer_->onTraceLogEnabled(); }
|
| + // TODO(skyostil): Ensure that we always have an active task runner when
|
| + // constructing the platform.
|
| + BlinkPlatformImpl::BlinkPlatformImpl()
|
| + : BlinkPlatformImpl(base::ThreadTaskRunnerHandle::IsSet()
|
| + ? base::ThreadTaskRunnerHandle::Get()
|
| + : nullptr) {
|
| + }
|
|
|
| - void OnTraceLogDisabled() override { observer_->onTraceLogDisabled(); }
|
| + BlinkPlatformImpl::BlinkPlatformImpl(
|
| + scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner)
|
| + : main_thread_task_runner_(main_thread_task_runner),
|
| + compositor_thread_(nullptr) {
|
| + InternalInit();
|
| + }
|
|
|
| - private:
|
| - blink::Platform::TraceLogEnabledStateObserver* observer_;
|
| - DISALLOW_COPY_AND_ASSIGN(TraceLogObserverAdapter);
|
| -};
|
| + void BlinkPlatformImpl::InternalInit() {
|
| + // ChildThread may not exist in some tests.
|
| + if (ChildThreadImpl::current()) {
|
| + geofencing_provider_.reset(new WebGeofencingProviderImpl(
|
| + ChildThreadImpl::current()->thread_safe_sender()));
|
| + thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender();
|
| + notification_dispatcher_ =
|
| + ChildThreadImpl::current()->notification_dispatcher();
|
| + push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher();
|
| + permission_client_.reset(new PermissionDispatcher(
|
| + ChildThreadImpl::current()->service_registry()));
|
| + main_thread_sync_provider_.reset(
|
| + new BackgroundSyncProvider(main_thread_task_runner_.get()));
|
| + }
|
| + }
|
|
|
| -// TODO(skyostil): Ensure that we always have an active task runner when
|
| -// constructing the platform.
|
| -BlinkPlatformImpl::BlinkPlatformImpl()
|
| - : BlinkPlatformImpl(base::ThreadTaskRunnerHandle::IsSet()
|
| - ? base::ThreadTaskRunnerHandle::Get()
|
| - : nullptr) {
|
| -}
|
| + void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate(
|
| + scheduler::WebThreadBase* thread) {
|
| + base::WaitableEvent event(false, false);
|
| + thread->TaskRunner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this),
|
| + base::Unretained(thread), base::Unretained(&event)));
|
| + event.Wait();
|
| + }
|
|
|
| -BlinkPlatformImpl::BlinkPlatformImpl(
|
| - scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner)
|
| - : main_thread_task_runner_(main_thread_task_runner),
|
| - compositor_thread_(nullptr) {
|
| - InternalInit();
|
| -}
|
| + void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread,
|
| + base::WaitableEvent* event) {
|
| + DCHECK(!current_thread_slot_.Get());
|
| + current_thread_slot_.Set(thread);
|
| + event->Signal();
|
| + }
|
|
|
| -void BlinkPlatformImpl::InternalInit() {
|
| - // ChildThread may not exist in some tests.
|
| - if (ChildThreadImpl::current()) {
|
| - geofencing_provider_.reset(new WebGeofencingProviderImpl(
|
| - ChildThreadImpl::current()->thread_safe_sender()));
|
| - thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender();
|
| - notification_dispatcher_ =
|
| - ChildThreadImpl::current()->notification_dispatcher();
|
| - push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher();
|
| - permission_client_.reset(new PermissionDispatcher(
|
| - ChildThreadImpl::current()->service_registry()));
|
| - main_thread_sync_provider_.reset(
|
| - new BackgroundSyncProvider(main_thread_task_runner_.get()));
|
| + BlinkPlatformImpl::~BlinkPlatformImpl() {
|
| }
|
| -}
|
|
|
| -void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate(
|
| - scheduler::WebThreadBase* thread) {
|
| - base::WaitableEvent event(false, false);
|
| - thread->TaskRunner()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this),
|
| - base::Unretained(thread), base::Unretained(&event)));
|
| - event.Wait();
|
| -}
|
| + WebURLLoader* BlinkPlatformImpl::createURLLoader() {
|
| + ChildThreadImpl* child_thread = ChildThreadImpl::current();
|
| + // There may be no child thread in RenderViewTests. These tests can still use
|
| + // data URLs to bypass the ResourceDispatcher.
|
| + return new WebURLLoaderImpl(
|
| + child_thread ? child_thread->resource_dispatcher() : NULL,
|
| + make_scoped_ptr(currentThread()->taskRunner()->clone()));
|
| + }
|
|
|
| -void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread,
|
| - base::WaitableEvent* event) {
|
| - DCHECK(!current_thread_slot_.Get());
|
| - current_thread_slot_.Set(thread);
|
| - event->Signal();
|
| -}
|
| + blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() {
|
| + return new WebSocketBridge;
|
| + }
|
|
|
| -BlinkPlatformImpl::~BlinkPlatformImpl() {
|
| -}
|
| + WebString BlinkPlatformImpl::userAgent() {
|
| + CR_DEFINE_STATIC_LOCAL(
|
| + blink::WebString, user_agent,
|
| + (blink::WebString::fromUTF8(GetContentClient()->GetUserAgent())));
|
| + DCHECK(user_agent ==
|
| + blink::WebString::fromUTF8(GetContentClient()->GetUserAgent()));
|
| + return user_agent;
|
| + }
|
|
|
| -WebURLLoader* BlinkPlatformImpl::createURLLoader() {
|
| - ChildThreadImpl* child_thread = ChildThreadImpl::current();
|
| - // There may be no child thread in RenderViewTests. These tests can still use
|
| - // data URLs to bypass the ResourceDispatcher.
|
| - return new WebURLLoaderImpl(
|
| - child_thread ? child_thread->resource_dispatcher() : NULL,
|
| - make_scoped_ptr(currentThread()->taskRunner()->clone()));
|
| -}
|
| + WebData BlinkPlatformImpl::parseDataURL(const WebURL& url,
|
| + WebString& mimetype_out,
|
| + WebString& charset_out) {
|
| + std::string mime_type, char_set, data;
|
| + if (net::DataURL::Parse(url, &mime_type, &char_set, &data) &&
|
| + mime_util::IsSupportedMimeType(mime_type)) {
|
| + mimetype_out = WebString::fromUTF8(mime_type);
|
| + charset_out = WebString::fromUTF8(char_set);
|
| + return data;
|
| + }
|
| + return WebData();
|
| + }
|
|
|
| -blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() {
|
| - return new WebSocketBridge;
|
| -}
|
| + WebURLError BlinkPlatformImpl::cancelledError(
|
| + const WebURL& unreachableURL) const {
|
| + return CreateWebURLError(unreachableURL, false, net::ERR_ABORTED);
|
| + }
|
|
|
| -WebString BlinkPlatformImpl::userAgent() {
|
| - CR_DEFINE_STATIC_LOCAL(
|
| - blink::WebString, user_agent,
|
| - (blink::WebString::fromUTF8(GetContentClient()->GetUserAgent())));
|
| - DCHECK(user_agent ==
|
| - blink::WebString::fromUTF8(GetContentClient()->GetUserAgent()));
|
| - return user_agent;
|
| -}
|
| + bool BlinkPlatformImpl::isReservedIPAddress(
|
| + const blink::WebString& host) const {
|
| + net::IPAddressNumber address;
|
| + if (!net::ParseURLHostnameToNumber(host.utf8(), &address))
|
| + return false;
|
| + return net::IsIPAddressReserved(address);
|
| + }
|
|
|
| -WebData BlinkPlatformImpl::parseDataURL(const WebURL& url,
|
| - WebString& mimetype_out,
|
| - WebString& charset_out) {
|
| - std::string mime_type, char_set, data;
|
| - if (net::DataURL::Parse(url, &mime_type, &char_set, &data) &&
|
| - mime_util::IsSupportedMimeType(mime_type)) {
|
| - mimetype_out = WebString::fromUTF8(mime_type);
|
| - charset_out = WebString::fromUTF8(char_set);
|
| - return data;
|
| + bool BlinkPlatformImpl::portAllowed(const blink::WebURL& url) const {
|
| + GURL gurl = GURL(url);
|
| + // Return true for URLs without a port specified. This is needed to let
|
| + // through non-network schemes that don't go over the network.
|
| + if (!gurl.has_port())
|
| + return true;
|
| + return net::IsPortAllowedForScheme(gurl.EffectiveIntPort(), gurl.scheme());
|
| }
|
| - return WebData();
|
| -}
|
|
|
| -WebURLError BlinkPlatformImpl::cancelledError(
|
| - const WebURL& unreachableURL) const {
|
| - return CreateWebURLError(unreachableURL, false, net::ERR_ABORTED);
|
| -}
|
| + blink::WebThread* BlinkPlatformImpl::createThread(const char* name) {
|
| + scoped_ptr<WebThreadImplForWorkerScheduler> thread(
|
| + new WebThreadImplForWorkerScheduler(name));
|
| + thread->Init();
|
| + WaitUntilWebThreadTLSUpdate(thread.get());
|
| + return thread.release();
|
| + }
|
|
|
| -bool BlinkPlatformImpl::isReservedIPAddress(
|
| - const blink::WebString& host) const {
|
| - net::IPAddressNumber address;
|
| - if (!net::ParseURLHostnameToNumber(host.utf8(), &address))
|
| - return false;
|
| - return net::IsIPAddressReserved(address);
|
| -}
|
| + void BlinkPlatformImpl::SetCompositorThread(
|
| + scheduler::WebThreadBase* compositor_thread) {
|
| + compositor_thread_ = compositor_thread;
|
| + if (compositor_thread_)
|
| + WaitUntilWebThreadTLSUpdate(compositor_thread_);
|
| + }
|
|
|
| -bool BlinkPlatformImpl::portAllowed(const blink::WebURL& url) const {
|
| - GURL gurl = GURL(url);
|
| - // Return true for URLs without a port specified. This is needed to let
|
| - // through non-network schemes that don't go over the network.
|
| - if (!gurl.has_port())
|
| - return true;
|
| - return net::IsPortAllowedForScheme(gurl.EffectiveIntPort(), gurl.scheme());
|
| -}
|
| + blink::WebThread* BlinkPlatformImpl::currentThread() {
|
| + return static_cast<blink::WebThread*>(current_thread_slot_.Get());
|
| + }
|
|
|
| -blink::WebThread* BlinkPlatformImpl::createThread(const char* name) {
|
| - scoped_ptr<WebThreadImplForWorkerScheduler> thread(
|
| - new WebThreadImplForWorkerScheduler(name));
|
| - thread->Init();
|
| - WaitUntilWebThreadTLSUpdate(thread.get());
|
| - return thread.release();
|
| -}
|
| + void BlinkPlatformImpl::recordAction(const blink::UserMetricsAction& name) {
|
| + if (ChildThread* child_thread = ChildThread::Get())
|
| + child_thread->RecordComputedAction(name.action());
|
| + }
|
|
|
| -void BlinkPlatformImpl::SetCompositorThread(
|
| - scheduler::WebThreadBase* compositor_thread) {
|
| - compositor_thread_ = compositor_thread;
|
| - if (compositor_thread_)
|
| - WaitUntilWebThreadTLSUpdate(compositor_thread_);
|
| -}
|
| + void BlinkPlatformImpl::registerMemoryDumpProvider(
|
| + blink::WebMemoryDumpProvider* wmdp, const char* name) {
|
| + WebMemoryDumpProviderAdapter* wmdp_adapter =
|
| + new WebMemoryDumpProviderAdapter(wmdp);
|
| + bool did_insert =
|
| + memory_dump_providers_.add(wmdp, make_scoped_ptr(wmdp_adapter)).second;
|
| + if (!did_insert)
|
| + return;
|
| + wmdp_adapter->set_is_registered(true);
|
| + base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
|
| + wmdp_adapter, name, base::ThreadTaskRunnerHandle::Get());
|
| + }
|
|
|
| -blink::WebThread* BlinkPlatformImpl::currentThread() {
|
| - return static_cast<blink::WebThread*>(current_thread_slot_.Get());
|
| -}
|
| + void BlinkPlatformImpl::unregisterMemoryDumpProvider(
|
| + blink::WebMemoryDumpProvider* wmdp) {
|
| + scoped_ptr<WebMemoryDumpProviderAdapter> wmdp_adapter =
|
| + memory_dump_providers_.take_and_erase(wmdp);
|
| + if (!wmdp_adapter)
|
| + return;
|
| + base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
|
| + wmdp_adapter.get());
|
| + wmdp_adapter->set_is_registered(false);
|
| + }
|
|
|
| -void BlinkPlatformImpl::recordAction(const blink::UserMetricsAction& name) {
|
| - if (ChildThread* child_thread = ChildThread::Get())
|
| - child_thread->RecordComputedAction(name.action());
|
| -}
|
| + blink::WebProcessMemoryDump* BlinkPlatformImpl::createProcessMemoryDump() {
|
| + return new WebProcessMemoryDumpImpl();
|
| + }
|
|
|
| blink::Platform::WebMemoryAllocatorDumpGuid
|
| BlinkPlatformImpl::createWebMemoryAllocatorDumpGuid(
|
|
|