Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Side by Side Diff: webkit/glue/webkitclient_impl.cc

Issue 7316019: Restore NOTREACHED() in WebKitClientImpl::loadResource() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a comment Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/glue/webkitclient_impl.h" 5 #include "webkit/glue/webkitclient_impl.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <malloc.h> 8 #include <malloc.h>
9 #endif 9 #endif
10 10
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 base::StringPiece resource = 339 base::StringPiece resource =
340 GetDataResource(kFirstAudioResourceIndex + resource_index); 340 GetDataResource(kFirstAudioResourceIndex + resource_index);
341 return WebData(resource.data(), resource.size()); 341 return WebData(resource.data(), resource.size());
342 } 342 }
343 #endif // IDR_AUDIO_SPATIALIZATION_T000_P000 343 #endif // IDR_AUDIO_SPATIALIZATION_T000_P000
344 344
345 NOTREACHED(); 345 NOTREACHED();
346 return WebData(); 346 return WebData();
347 } 347 }
348 348
349 struct DataResource {
350 const char* name;
351 int id;
352 };
353
354 const DataResource kDataResources[] = {
355 { "missingImage", IDR_BROKENIMAGE },
356 { "mediaPause", IDR_MEDIA_PAUSE_BUTTON },
357 { "mediaPlay", IDR_MEDIA_PLAY_BUTTON },
358 { "mediaPlayDisabled", IDR_MEDIA_PLAY_BUTTON_DISABLED },
359 { "mediaSoundDisabled", IDR_MEDIA_SOUND_DISABLED },
360 { "mediaSoundFull", IDR_MEDIA_SOUND_FULL_BUTTON },
361 { "mediaSoundNone", IDR_MEDIA_SOUND_NONE_BUTTON },
362 { "mediaSliderThumb", IDR_MEDIA_SLIDER_THUMB },
363 { "mediaVolumeSliderThumb", IDR_MEDIA_VOLUME_SLIDER_THUMB },
364 { "panIcon", IDR_PAN_SCROLL_ICON },
365 { "searchCancel", IDR_SEARCH_CANCEL },
366 { "searchCancelPressed", IDR_SEARCH_CANCEL_PRESSED },
367 { "searchMagnifier", IDR_SEARCH_MAGNIFIER },
368 { "searchMagnifierResults", IDR_SEARCH_MAGNIFIER_RESULTS },
369 { "textAreaResizeCorner", IDR_TEXTAREA_RESIZER },
370 { "tickmarkDash", IDR_TICKMARK_DASH },
371 { "inputSpeech", IDR_INPUT_SPEECH },
372 { "inputSpeechRecording", IDR_INPUT_SPEECH_RECORDING },
373 { "inputSpeechWaiting", IDR_INPUT_SPEECH_WAITING },
374 { "americanExpressCC", IDR_AUTOFILL_CC_AMEX },
375 { "dinersCC", IDR_AUTOFILL_CC_DINERS },
376 { "discoverCC", IDR_AUTOFILL_CC_DISCOVER },
377 { "genericCC", IDR_AUTOFILL_CC_GENERIC },
378 { "jcbCC", IDR_AUTOFILL_CC_JCB },
379 { "masterCardCC", IDR_AUTOFILL_CC_MASTERCARD },
380 { "soloCC", IDR_AUTOFILL_CC_SOLO },
381 { "visaCC", IDR_AUTOFILL_CC_VISA },
382 };
383
349 } // namespace 384 } // namespace
350 385
351 WebData WebKitClientImpl::loadResource(const char* name) { 386 WebData WebKitClientImpl::loadResource(const char* name) {
352 struct { 387 // Some clients will call into this method with an empty |name| when they have
353 const char* name; 388 // optional resources. For example, the PopupMenuChromium code can have icons
354 int id; 389 // for some Autofill items but not for others.
355 } resources[] = { 390 if (!strlen(name))
356 { "missingImage", IDR_BROKENIMAGE }, 391 return WebData();
357 { "mediaPause", IDR_MEDIA_PAUSE_BUTTON },
358 { "mediaPlay", IDR_MEDIA_PLAY_BUTTON },
359 { "mediaPlayDisabled", IDR_MEDIA_PLAY_BUTTON_DISABLED },
360 { "mediaSoundDisabled", IDR_MEDIA_SOUND_DISABLED },
361 { "mediaSoundFull", IDR_MEDIA_SOUND_FULL_BUTTON },
362 { "mediaSoundNone", IDR_MEDIA_SOUND_NONE_BUTTON },
363 { "mediaSliderThumb", IDR_MEDIA_SLIDER_THUMB },
364 { "mediaVolumeSliderThumb", IDR_MEDIA_VOLUME_SLIDER_THUMB },
365 { "panIcon", IDR_PAN_SCROLL_ICON },
366 { "searchCancel", IDR_SEARCH_CANCEL },
367 { "searchCancelPressed", IDR_SEARCH_CANCEL_PRESSED },
368 { "searchMagnifier", IDR_SEARCH_MAGNIFIER },
369 { "searchMagnifierResults", IDR_SEARCH_MAGNIFIER_RESULTS },
370 { "textAreaResizeCorner", IDR_TEXTAREA_RESIZER },
371 { "tickmarkDash", IDR_TICKMARK_DASH },
372 { "inputSpeech", IDR_INPUT_SPEECH },
373 { "inputSpeechRecording", IDR_INPUT_SPEECH_RECORDING },
374 { "inputSpeechWaiting", IDR_INPUT_SPEECH_WAITING },
375 { "americanExpressCC", IDR_AUTOFILL_CC_AMEX },
376 { "dinersCC", IDR_AUTOFILL_CC_DINERS },
377 { "discoverCC", IDR_AUTOFILL_CC_DISCOVER },
378 { "genericCC", IDR_AUTOFILL_CC_GENERIC },
379 { "jcbCC", IDR_AUTOFILL_CC_JCB },
380 { "masterCardCC", IDR_AUTOFILL_CC_MASTERCARD },
381 { "soloCC", IDR_AUTOFILL_CC_SOLO },
382 { "visaCC", IDR_AUTOFILL_CC_VISA },
383 };
384 392
385 // Check the name prefix to see if it's an audio resource. 393 // Check the name prefix to see if it's an audio resource.
386 if (StartsWithASCII(name, "IRC_Composite", true)) { 394 if (StartsWithASCII(name, "IRC_Composite", true))
387 return loadAudioSpatializationResource(name); 395 return loadAudioSpatializationResource(name);
388 } else { 396
389 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) { 397 for (size_t i = 0; i < arraysize(kDataResources); ++i) {
390 if (!strcmp(name, resources[i].name)) { 398 if (!strcmp(name, kDataResources[i].name)) {
391 base::StringPiece resource = GetDataResource(resources[i].id); 399 base::StringPiece resource = GetDataResource(kDataResources[i].id);
392 return WebData(resource.data(), resource.size()); 400 return WebData(resource.data(), resource.size());
393 }
394 } 401 }
395 } 402 }
396 // TODO(jhawkins): Restore this NOTREACHED once WK stops sending in empty 403
397 // strings. http://crbug.com/50675. 404 NOTREACHED() << "Unknown image resource " << name;
398 //NOTREACHED() << "Unknown image resource " << name;
399 return WebData(); 405 return WebData();
400 } 406 }
401 407
402 bool WebKitClientImpl::loadAudioResource( 408 bool WebKitClientImpl::loadAudioResource(
403 WebKit::WebAudioBus* destination_bus, const char* audio_file_data, 409 WebKit::WebAudioBus* destination_bus, const char* audio_file_data,
404 size_t data_size, double sample_rate) { 410 size_t data_size, double sample_rate) {
405 return DecodeAudioFileData(destination_bus, 411 return DecodeAudioFileData(destination_bus,
406 audio_file_data, 412 audio_file_data,
407 data_size, 413 data_size,
408 sample_rate); 414 sample_rate);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 ++shared_timer_suspended_; 605 ++shared_timer_suspended_;
600 } 606 }
601 607
602 void WebKitClientImpl::ResumeSharedTimer() { 608 void WebKitClientImpl::ResumeSharedTimer() {
603 // The shared timer may have fired or been adjusted while we were suspended. 609 // The shared timer may have fired or been adjusted while we were suspended.
604 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) 610 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning())
605 setSharedTimerFireTime(shared_timer_fire_time_); 611 setSharedTimerFireTime(shared_timer_fire_time_);
606 } 612 }
607 613
608 } // namespace webkit_glue 614 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698