From c9c4cc8c91f50175f5434c97142a9539bf3624f6 Mon Sep 17 00:00:00 2001 From: "kuchhal@chromium.org" Date: Fri, 24 Oct 2008 17:37:06 +0000 Subject: Make resource bundle return red square box again instead of empty bitmap as it looks like some users get NULL when they ask for bitmap resource. BUG=1432071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3922 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/views/frame/aero_glass_non_client_view.cc | 6 +++--- chrome/browser/views/frame/opaque_non_client_view.cc | 6 +++--- chrome/browser/views/old_frames/vista_frame.cc | 7 +++---- chrome/browser/views/old_frames/xp_frame.cc | 13 ++++++------- chrome/common/resource_bundle.cc | 7 ++++++- 5 files changed, 21 insertions(+), 18 deletions(-) (limited to 'chrome') diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.cc b/chrome/browser/views/frame/aero_glass_non_client_view.cc index 3311c7b..210cdb1 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.cc +++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc @@ -424,9 +424,9 @@ void AeroGlassNonClientView::InitClass() { if (!initialized) { resources_ = new AeroGlassWindowResources; ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - SkBitmap* image = rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); - if (!image->isNull()) - distributor_logo_ = *image; +#if defined(GOOGLE_CHROME_BUILD) + distributor_logo_ = *rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); +#endif initialized = true; } diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index 2033abb..cef4f8b 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -1024,9 +1024,9 @@ void OpaqueNonClientView::InitClass() { inactive_resources_ = new InactiveWindowResources; ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - SkBitmap* image = rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO_LIGHT); - if (!image->isNull()) - distributor_logo_ = *image; +#if defined(GOOGLE_CHROME_BUILD) + distributor_logo_ = *rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO_LIGHT); +#endif app_top_left_ = *rb.GetBitmapNamed(IDR_APP_TOP_LEFT); app_top_center_ = *rb.GetBitmapNamed(IDR_APP_TOP_CENTER); diff --git a/chrome/browser/views/old_frames/vista_frame.cc b/chrome/browser/views/old_frames/vista_frame.cc index d671eee..0bc1714 100644 --- a/chrome/browser/views/old_frames/vista_frame.cc +++ b/chrome/browser/views/old_frames/vista_frame.cc @@ -426,13 +426,12 @@ void VistaFrame::Init() { frame_view_->AddChildView(off_the_record_image_); } - SkBitmap* image = rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); - if (!image->isNull()) { +#if defined(GOOGLE_CHROME_BUILD) distributor_logo_ = new views::ImageView(); frame_view_->AddViewToDropList(distributor_logo_); - distributor_logo_->SetImage(image); + distributor_logo_->SetImage(rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO)); frame_view_->AddChildView(distributor_logo_); - } +#endif tab_contents_container_ = new TabContentsContainerView(); frame_view_->AddChildView(tab_contents_container_); diff --git a/chrome/browser/views/old_frames/xp_frame.cc b/chrome/browser/views/old_frames/xp_frame.cc index 5720782..ca365b2 100644 --- a/chrome/browser/views/old_frames/xp_frame.cc +++ b/chrome/browser/views/old_frames/xp_frame.cc @@ -450,13 +450,12 @@ void XPFrame::Init() { frame_view_->AddViewToDropList(off_the_record_image_); } - SkBitmap* image = rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO_LIGHT); - if (!image->isNull()) { - distributor_logo_ = new views::ImageView(); - frame_view_->AddViewToDropList(distributor_logo_); - distributor_logo_->SetImage(image); - frame_view_->AddChildView(distributor_logo_); - } +#if defined(GOOGLE_CHROME_BUILD) + distributor_logo_ = new views::ImageView(); + frame_view_->AddViewToDropList(distributor_logo_); + distributor_logo_->SetImage(rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO_LIGHT)); + frame_view_->AddChildView(distributor_logo_); +#endif min_button_ = new views::Button(); min_button_->SetListener(this, MINIATURIZE_TAG); diff --git a/chrome/common/resource_bundle.cc b/chrome/common/resource_bundle.cc index f6a47b8..2676bd6 100644 --- a/chrome/common/resource_bundle.cc +++ b/chrome/common/resource_bundle.cc @@ -171,8 +171,13 @@ SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { // Handle the case where loading the bitmap failed. if (!bitmap) { LOG(WARNING) << "Unable to load bitmap with id " << resource_id; + NOTREACHED(); // Want to assert in debug mode. if (!empty_bitmap) { - empty_bitmap = new SkBitmap(); + // The placeholder bitmap is bright red so people notice the problem. + empty_bitmap = new SkBitmap(); + empty_bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); + empty_bitmap->allocPixels(); + empty_bitmap->eraseARGB(255, 255, 0, 0); } return empty_bitmap; } -- cgit v1.1