summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 19:33:13 +0000
committerrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 19:33:13 +0000
commit945c16c976d14eb0944ffaaadae040cad4262c0c (patch)
tree4c44a9abaebf7436c89ceeb7bb1f096f18333784 /chrome
parent9638a0712a9a1f7fe7404f0f6b1bb6d6c0cfa13a (diff)
downloadchromium_src-945c16c976d14eb0944ffaaadae040cad4262c0c.zip
chromium_src-945c16c976d14eb0944ffaaadae040cad4262c0c.tar.gz
chromium_src-945c16c976d14eb0944ffaaadae040cad4262c0c.tar.bz2
Unrollback r1158.
BUG=1296800 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1170 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/theme/google_theme_resources.rc15
-rw-r--r--chrome/app/theme/theme_dll.vcproj4
-rw-r--r--chrome/app/theme/theme_resources.rc4
-rw-r--r--chrome/browser/views/frame/aero_glass_non_client_view.cc14
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.cc13
-rw-r--r--chrome/browser/vista_frame.cc55
-rw-r--r--chrome/browser/xp_frame.cc37
-rw-r--r--chrome/common/resource_bundle.cc5
8 files changed, 92 insertions, 55 deletions
diff --git a/chrome/app/theme/google_theme_resources.rc b/chrome/app/theme/google_theme_resources.rc
new file mode 100644
index 0000000..5c16eeb
--- /dev/null
+++ b/chrome/app/theme/google_theme_resources.rc
@@ -0,0 +1,15 @@
+// Resources used by common/*.
+//
+// Paths in this file are relative to the current file.
+
+#include "theme_resources.h"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// data resources
+//
+
+#if defined(GOOGLE_CHROME_BUILD)
+IDR_DISTRIBUTOR_LOGO BINDATA "distributor_logo.png"
+IDR_DISTRIBUTOR_LOGO_LIGHT BINDATA "distributor_logo_light.png"
+#endif
diff --git a/chrome/app/theme/theme_dll.vcproj b/chrome/app/theme/theme_dll.vcproj
index ea1904d..66c7925 100644
--- a/chrome/app/theme/theme_dll.vcproj
+++ b/chrome/app/theme/theme_dll.vcproj
@@ -147,6 +147,10 @@
RelativePath="theme_resources.rc"
>
</File>
+ <File
+ RelativePath="google_theme_resources.rc"
+ >
+ </File>
</Files>
<Globals>
</Globals>
diff --git a/chrome/app/theme/theme_resources.rc b/chrome/app/theme/theme_resources.rc
index 5560c7f..a55f83a 100644
--- a/chrome/app/theme/theme_resources.rc
+++ b/chrome/app/theme/theme_resources.rc
@@ -1,6 +1,6 @@
// Resources used by common/*.
//
-// Paths in this file are relative to SolutionDir.
+// Paths in this file are relative to current file.
#include "theme_resources.h"
@@ -306,5 +306,3 @@ IDR_FIND_DLG_MIDDLE_BB_BACKGROUND BINDATA "find_dlg_middle_bb_bg.png"
IDR_THROBBER_LIGHT BINDATA "throbber_light.png"
IDR_OTR_ICON_STANDALONE BINDATA "otr_icon_standalone.png"
IDR_PRODUCT_LOGO BINDATA "product_logo.png"
-IDR_DISTRIBUTOR_LOGO BINDATA "distributor_logo.png"
-IDR_DISTRIBUTOR_LOGO_LIGHT BINDATA "distributor_logo_light.png"
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 0e05ab9..d5d8472 100644
--- a/chrome/browser/views/frame/aero_glass_non_client_view.cc
+++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc
@@ -248,8 +248,10 @@ int AeroGlassNonClientView::CalculateNonClientTopHeight() const {
}
void AeroGlassNonClientView::PaintDistributorLogo(ChromeCanvas* canvas) {
- // The distributor logo is only painted when the frame is not maximized.
- if (!frame_->IsMaximized() && !frame_->IsMinimized()) {
+ // The distributor logo is only painted when the frame is not maximized and
+ // when we actually have a logo.
+ if (!frame_->IsMaximized() && !frame_->IsMinimized() &&
+ !distributor_logo_.empty()) {
canvas->DrawBitmapInt(distributor_logo_, logo_bounds_.x(),
logo_bounds_.y());
}
@@ -319,6 +321,9 @@ void AeroGlassNonClientView::PaintClientEdge(ChromeCanvas* canvas) {
}
void AeroGlassNonClientView::LayoutDistributorLogo() {
+ if (distributor_logo_.empty())
+ return;
+
int logo_w = distributor_logo_.width();
int logo_h = distributor_logo_.height();
@@ -342,7 +347,10 @@ void AeroGlassNonClientView::InitClass() {
if (!initialized) {
resources_ = new AeroGlassWindowResources;
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- distributor_logo_ = *rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO);
+ SkBitmap* image = rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO);
+ if (!image->isNull())
+ distributor_logo_ = *image;
+
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 74ee8b1..116b9cb 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.cc
+++ b/chrome/browser/views/frame/opaque_non_client_view.cc
@@ -812,8 +812,10 @@ void OpaqueNonClientView::PaintOTRAvatar(ChromeCanvas* canvas) {
}
void OpaqueNonClientView::PaintDistributorLogo(ChromeCanvas* canvas) {
- // The distributor logo is only painted when the frame is not maximized.
- if (!frame_->IsMaximized() && !frame_->IsMinimized()) {
+ // The distributor logo is only painted when the frame is not maximized and
+ // when we actually have a logo.
+ if (!frame_->IsMaximized() && !frame_->IsMinimized() &&
+ !distributor_logo_.empty()) {
canvas->DrawBitmapInt(distributor_logo_, logo_bounds_.x(),
logo_bounds_.y());
}
@@ -1007,6 +1009,9 @@ void OpaqueNonClientView::LayoutOTRAvatar() {
}
void OpaqueNonClientView::LayoutDistributorLogo() {
+ if (distributor_logo_.empty())
+ return;
+
int logo_w = distributor_logo_.width();
int logo_h = distributor_logo_.height();
@@ -1063,7 +1068,9 @@ void OpaqueNonClientView::InitClass() {
inactive_resources_ = new InactiveWindowResources;
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- distributor_logo_ = *rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO_LIGHT);
+ SkBitmap* image = rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO_LIGHT);
+ if (!image->isNull())
+ distributor_logo_ = *image;
initialized = true;
}
diff --git a/chrome/browser/vista_frame.cc b/chrome/browser/vista_frame.cc
index bdd3dbbd..18e3340 100644
--- a/chrome/browser/vista_frame.cc
+++ b/chrome/browser/vista_frame.cc
@@ -249,28 +249,30 @@ void VistaFrame::Layout() {
// If we are maxmized, the tab strip will be in line with the window
// controls, so we need to make sure they don't overlap.
int zoomed_offset = 0;
- if(IsZoomed()) {
- zoomed_offset = std::max(min_offset, kWindowControlsMinOffset);
+ if (distributor_logo_) {
+ if(IsZoomed()) {
+ zoomed_offset = std::max(min_offset, kWindowControlsMinOffset);
- // Hide the distributor logo if we're zoomed.
- distributor_logo_->SetVisible(false);
- } else {
- CSize distributor_logo_size;
- distributor_logo_->GetPreferredSize(&distributor_logo_size);
-
- int logo_x;
- // Because of Bug 1128173, our Window controls aren't actually flipped
- // on Vista, yet all our math and layout presumes that they are.
- if (frame_view_->UILayoutIsRightToLeft())
- logo_x = width - distributor_logo_size.cx;
- else
- logo_x = width - min_offset - distributor_logo_size.cx;
-
- distributor_logo_->SetVisible(true);
- distributor_logo_->SetBounds(logo_x,
- kDistributorLogoVerticalOffset,
- distributor_logo_size.cx,
- distributor_logo_size.cy);
+ // Hide the distributor logo if we're zoomed.
+ distributor_logo_->SetVisible(false);
+ } else {
+ CSize distributor_logo_size;
+ distributor_logo_->GetPreferredSize(&distributor_logo_size);
+
+ int logo_x;
+ // Because of Bug 1128173, our Window controls aren't actually flipped
+ // on Vista, yet all our math and layout presumes that they are.
+ if (frame_view_->UILayoutIsRightToLeft())
+ logo_x = width - distributor_logo_size.cx;
+ else
+ logo_x = width - min_offset - distributor_logo_size.cx;
+
+ distributor_logo_->SetVisible(true);
+ distributor_logo_->SetBounds(logo_x,
+ kDistributorLogoVerticalOffset,
+ distributor_logo_size.cx,
+ distributor_logo_size.cy);
+ }
}
gfx::Rect tabstrip_bounds(tabstrip_x,
@@ -448,10 +450,13 @@ void VistaFrame::Init() {
frame_view_->AddChildView(off_the_record_image_);
}
- distributor_logo_ = new ChromeViews::ImageView();
- frame_view_->AddViewToDropList(distributor_logo_);
- distributor_logo_->SetImage(rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO));
- frame_view_->AddChildView(distributor_logo_);
+ SkBitmap* image = rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO);
+ if (!image->isNull()) {
+ distributor_logo_ = new ChromeViews::ImageView();
+ frame_view_->AddViewToDropList(distributor_logo_);
+ distributor_logo_->SetImage(image);
+ frame_view_->AddChildView(distributor_logo_);
+ }
tab_contents_container_ = new TabContentsContainerView();
frame_view_->AddChildView(tab_contents_container_);
diff --git a/chrome/browser/xp_frame.cc b/chrome/browser/xp_frame.cc
index bb2aefe..666d94b 100644
--- a/chrome/browser/xp_frame.cc
+++ b/chrome/browser/xp_frame.cc
@@ -476,10 +476,13 @@ void XPFrame::Init() {
frame_view_->AddViewToDropList(off_the_record_image_);
}
- distributor_logo_ = new ChromeViews::ImageView();
- frame_view_->AddViewToDropList(distributor_logo_);
- distributor_logo_->SetImage(rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO_LIGHT));
- frame_view_->AddChildView(distributor_logo_);
+ SkBitmap* image = rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO_LIGHT);
+ if (!image->isNull()) {
+ distributor_logo_ = new ChromeViews::ImageView();
+ frame_view_->AddViewToDropList(distributor_logo_);
+ distributor_logo_->SetImage(image);
+ frame_view_->AddChildView(distributor_logo_);
+ }
min_button_ = new ChromeViews::Button();
min_button_->SetListener(this, MINIATURIZE_TAG);
@@ -717,18 +720,20 @@ void XPFrame::Layout() {
}
}
- if (IsZoomed()) {
- distributor_logo_->SetVisible(false);
- } else {
- CSize distributor_logo_size;
- distributor_logo_->GetPreferredSize(&distributor_logo_size);
- distributor_logo_->SetVisible(true);
- distributor_logo_->SetBounds(min_button_->GetX() -
- distributor_logo_size.cx -
- kDistributorLogoHorizontalOffset,
- kDistributorLogoVerticalOffset,
- distributor_logo_size.cx,
- distributor_logo_size.cy);
+ if (distributor_logo_) {
+ if (IsZoomed()) {
+ distributor_logo_->SetVisible(false);
+ } else {
+ CSize distributor_logo_size;
+ distributor_logo_->GetPreferredSize(&distributor_logo_size);
+ distributor_logo_->SetVisible(true);
+ distributor_logo_->SetBounds(min_button_->GetX() -
+ distributor_logo_size.cx -
+ kDistributorLogoHorizontalOffset,
+ kDistributorLogoVerticalOffset,
+ distributor_logo_size.cx,
+ distributor_logo_size.cy);
+ }
}
tabstrip_->SetBounds(tab_strip_x, top_margin - 1,
diff --git a/chrome/common/resource_bundle.cc b/chrome/common/resource_bundle.cc
index 3beccb4..09dbf19 100644
--- a/chrome/common/resource_bundle.cc
+++ b/chrome/common/resource_bundle.cc
@@ -195,13 +195,8 @@ 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) {
- // 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;
}