diff options
author | erg <erg@chromium.org> | 2015-03-26 11:21:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-26 18:22:48 +0000 |
commit | db167e36fd2b1a4b4492c70ee246c1ff795bfcb4 (patch) | |
tree | 966c7de71f22576b4ff83c0a8184f2e884941636 /mojo | |
parent | 0096addf2b43be672d04cbe8ac55644fdad9d3ff (diff) | |
download | chromium_src-db167e36fd2b1a4b4492c70ee246c1ff795bfcb4.zip chromium_src-db167e36fd2b1a4b4492c70ee246c1ff795bfcb4.tar.gz chromium_src-db167e36fd2b1a4b4492c70ee246c1ff795bfcb4.tar.bz2 |
Reland part 3 of 4: Modify blink users so they use blink images.
Now that the image resources that blink depends on are in the blink
repository, we depend on the blink resources directly, delete the ones
in the chrome tree, and use these resources in the html_viewer.
[This reland also contains a fix to the generate_blink_resource_map.py
file so that its generated code uses unsigned chars, which should
hopefully fix the Win8 gn bot.]
BUG=467176
First Review URL: https://codereview.chromium.org/1033733004
Review URL: https://codereview.chromium.org/1038723002
Cr-Commit-Position: refs/heads/master@{#322427}
Diffstat (limited to 'mojo')
-rw-r--r-- | mojo/services/html_viewer/BUILD.gn | 3 | ||||
-rw-r--r-- | mojo/services/html_viewer/blink_platform_impl.cc | 4 | ||||
-rw-r--r-- | mojo/services/html_viewer/blink_resource_constants.h | 56 | ||||
-rw-r--r-- | mojo/services/html_viewer/generate_blink_resource_map.py | 15 |
4 files changed, 65 insertions, 13 deletions
diff --git a/mojo/services/html_viewer/BUILD.gn b/mojo/services/html_viewer/BUILD.gn index b776d38..e470e51 100644 --- a/mojo/services/html_viewer/BUILD.gn +++ b/mojo/services/html_viewer/BUILD.gn @@ -10,7 +10,8 @@ action("generate_blink_resource_map") { script = "//mojo/services/html_viewer/generate_blink_resource_map.py" args = [ "--pak-file", - rebase_path("$root_out_dir/gen/blink/public/resources/blink_resources.pak"), + rebase_path( + "$root_out_dir/gen/blink/public/resources/blink_resources_100_percent.pak"), "--header", rebase_path("$target_gen_dir/blink_resource_map.h"), "--cpp", diff --git a/mojo/services/html_viewer/blink_platform_impl.cc b/mojo/services/html_viewer/blink_platform_impl.cc index bf920d7..048fdfe 100644 --- a/mojo/services/html_viewer/blink_platform_impl.cc +++ b/mojo/services/html_viewer/blink_platform_impl.cc @@ -157,10 +157,10 @@ blink::WebData BlinkPlatformImpl::loadResource(const char* resource) { for (size_t i = 0; i < arraysize(kDataResources); ++i) { if (!strcmp(resource, kDataResources[i].name)) { int length; - const char* data = + const unsigned char* data = blink_resource_map_.GetResource(kDataResources[i].id, &length); CHECK(data != nullptr && length > 0); - return blink::WebData(data, length); + return blink::WebData(reinterpret_cast<const char*>(data), length); } } NOTREACHED() << "Requested resource is unavailable: " << resource; diff --git a/mojo/services/html_viewer/blink_resource_constants.h b/mojo/services/html_viewer/blink_resource_constants.h index c51afdf..0091b03 100644 --- a/mojo/services/html_viewer/blink_resource_constants.h +++ b/mojo/services/html_viewer/blink_resource_constants.h @@ -15,6 +15,62 @@ struct DataResource { }; const DataResource kDataResources[] = { + {"missingImage", IDR_BROKENIMAGE}, + // Skipping missingImage@2x + {"mediaplayerPause", IDR_MEDIAPLAYER_PAUSE_BUTTON}, + {"mediaplayerPauseHover", IDR_MEDIAPLAYER_PAUSE_BUTTON_HOVER}, + {"mediaplayerPauseDown", IDR_MEDIAPLAYER_PAUSE_BUTTON_DOWN}, + {"mediaplayerPlay", IDR_MEDIAPLAYER_PLAY_BUTTON}, + {"mediaplayerPlayHover", IDR_MEDIAPLAYER_PLAY_BUTTON_HOVER}, + {"mediaplayerPlayDown", IDR_MEDIAPLAYER_PLAY_BUTTON_DOWN}, + {"mediaplayerPlayDisabled", IDR_MEDIAPLAYER_PLAY_BUTTON_DISABLED}, + {"mediaplayerSoundLevel3", IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON}, + {"mediaplayerSoundLevel3Hover", IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON_HOVER}, + {"mediaplayerSoundLevel3Down", IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON_DOWN}, + {"mediaplayerSoundLevel2", IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON}, + {"mediaplayerSoundLevel2Hover", IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON_HOVER}, + {"mediaplayerSoundLevel2Down", IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON_DOWN}, + {"mediaplayerSoundLevel1", IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON}, + {"mediaplayerSoundLevel1Hover", IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON_HOVER}, + {"mediaplayerSoundLevel1Down", IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON_DOWN}, + {"mediaplayerSoundLevel0", IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON}, + {"mediaplayerSoundLevel0Hover", IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON_HOVER}, + {"mediaplayerSoundLevel0Down", IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON_DOWN}, + {"mediaplayerSoundDisabled", IDR_MEDIAPLAYER_SOUND_DISABLED}, + {"mediaplayerSliderThumb", IDR_MEDIAPLAYER_SLIDER_THUMB}, + {"mediaplayerSliderThumbHover", IDR_MEDIAPLAYER_SLIDER_THUMB_HOVER}, + {"mediaplayerSliderThumbDown", IDR_MEDIAPLAYER_SLIDER_THUMB_DOWN}, + {"mediaplayerVolumeSliderThumb", IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB}, + {"mediaplayerVolumeSliderThumbHover", + IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_HOVER}, + {"mediaplayerVolumeSliderThumbDown", + IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_DOWN}, + {"mediaplayerVolumeSliderThumbDisabled", + IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_DISABLED}, + {"mediaplayerClosedCaption", IDR_MEDIAPLAYER_CLOSEDCAPTION_BUTTON}, + {"mediaplayerClosedCaptionHover", + IDR_MEDIAPLAYER_CLOSEDCAPTION_BUTTON_HOVER}, + {"mediaplayerClosedCaptionDown", IDR_MEDIAPLAYER_CLOSEDCAPTION_BUTTON_DOWN}, + {"mediaplayerClosedCaptionDisabled", + IDR_MEDIAPLAYER_CLOSEDCAPTION_BUTTON_DISABLED}, + {"mediaplayerFullscreen", IDR_MEDIAPLAYER_FULLSCREEN_BUTTON}, + {"mediaplayerFullscreenHover", IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_HOVER}, + {"mediaplayerFullscreenDown", IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_DOWN}, + {"mediaplayerCastOff", IDR_MEDIAPLAYER_CAST_BUTTON_OFF}, + {"mediaplayerCastOn", IDR_MEDIAPLAYER_CAST_BUTTON_ON}, + {"mediaplayerFullscreenDisabled", + IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_DISABLED}, + {"mediaplayerOverlayCastOff", IDR_MEDIAPLAYER_OVERLAY_CAST_BUTTON_OFF}, + {"mediaplayerOverlayPlay", IDR_MEDIAPLAYER_OVERLAY_PLAY_BUTTON}, + {"panIcon", IDR_PAN_SCROLL_ICON}, + {"searchCancel", IDR_SEARCH_CANCEL}, + {"searchCancelPressed", IDR_SEARCH_CANCEL_PRESSED}, + {"searchMagnifier", IDR_SEARCH_MAGNIFIER}, + {"searchMagnifierResults", IDR_SEARCH_MAGNIFIER_RESULTS}, + {"textAreaResizeCorner", IDR_TEXTAREA_RESIZER}, + // Skipping "textAreaResizeCorner@2x" + {"generatePassword", IDR_PASSWORD_GENERATION_ICON}, + {"generatePasswordHover", IDR_PASSWORD_GENERATION_ICON_HOVER}, {"html.css", IDR_UASTYLE_HTML_CSS}, {"quirks.css", IDR_UASTYLE_QUIRKS_CSS}, {"view-source.css", IDR_UASTYLE_VIEW_SOURCE_CSS}, diff --git a/mojo/services/html_viewer/generate_blink_resource_map.py b/mojo/services/html_viewer/generate_blink_resource_map.py index 4044154..0fdee71 100644 --- a/mojo/services/html_viewer/generate_blink_resource_map.py +++ b/mojo/services/html_viewer/generate_blink_resource_map.py @@ -17,9 +17,6 @@ except ImportError, e: print 'ImportError: ', e sys.exit(-1) -def is_ascii(s): - return all(ord(c) < 128 for c in s) - header_template = \ """// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -35,11 +32,11 @@ namespace html_viewer { class BlinkResourceMap { public: BlinkResourceMap(); - const char* GetResource(int id, int* length); + const unsigned char* GetResource(int id, int* length); private: struct ResourceEntry { - const char* data; + const unsigned char* data; int length; ResourceEntry() @@ -47,7 +44,7 @@ class BlinkResourceMap { , length(0) { } - ResourceEntry(const char* data, int length) + ResourceEntry(const unsigned char* data, int length) : data(data) , length(length) { } @@ -77,7 +74,7 @@ BlinkResourceMap::BlinkResourceMap() $map_initializer } -const char* BlinkResourceMap::GetResource(int id, int* length) +const unsigned char* BlinkResourceMap::GetResource(int id, int* length) { ResourceMap::iterator it = resources_.find(id); if (it == resources_.end()) { @@ -117,14 +114,12 @@ def main(): definitions = [] for (resId, data) in pak_contents.resources.iteritems(): - if not is_ascii(data): - continue resourceIds.append(resId) hex_values = ['0x{0:02x}'.format(ord(char)) for char in data] f = lambda A, n=12: [A[i:i+n] for i in range(0, len(A), n)] hex_values_string = ',\n '.join(', '.join(x) for x in f(hex_values)) cpp_definition = \ - 'const char kResource%s[%d] = {\n %s \n};' % \ + 'const unsigned char kResource%s[%d] = {\n %s \n};' % \ (str(resId), len(hex_values), hex_values_string) definitions.append(cpp_definition) |