summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglen@google.com <glen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-01 23:38:52 +0000
committerglen@google.com <glen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-01 23:38:52 +0000
commit9f1ecd437a6ce651f2e5783ce988ffa6aae4f922 (patch)
tree2af26fed3fdcc303909722a6e9e92e6b3d42e72c
parentc0d3966ae1febdbc51a4527c6914c29ba4ccc4a2 (diff)
downloadchromium_src-9f1ecd437a6ce651f2e5783ce988ffa6aae4f922.zip
chromium_src-9f1ecd437a6ce651f2e5783ce988ffa6aae4f922.tar.gz
chromium_src-9f1ecd437a6ce651f2e5783ce988ffa6aae4f922.tar.bz2
Add a non-interactive distributor logo to the window frame. This logo disappears in maximized view to avoid taking away from the tab strip.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/theme/distributor_logo.pngbin0 -> 1508 bytes
-rw-r--r--chrome/app/theme/theme_resources.h1
-rw-r--r--chrome/app/theme/theme_resources.rc1
-rw-r--r--chrome/browser/vista_frame.cc46
-rw-r--r--chrome/browser/vista_frame.h3
-rw-r--r--chrome/browser/xp_frame.cc39
-rw-r--r--chrome/browser/xp_frame.h3
7 files changed, 72 insertions, 21 deletions
diff --git a/chrome/app/theme/distributor_logo.png b/chrome/app/theme/distributor_logo.png
new file mode 100644
index 0000000..ebe8ad0
--- /dev/null
+++ b/chrome/app/theme/distributor_logo.png
Binary files differ
diff --git a/chrome/app/theme/theme_resources.h b/chrome/app/theme/theme_resources.h
index cb86080..f828eeb 100644
--- a/chrome/app/theme/theme_resources.h
+++ b/chrome/app/theme/theme_resources.h
@@ -310,3 +310,4 @@
#define IDR_THROBBER_LIGHT 9379
#define IDR_OTR_ICON_STANDALONE 9380
#define IDR_PRODUCT_LOGO 9381
+#define IDR_DISTRIBUTOR_LOGO 9382
diff --git a/chrome/app/theme/theme_resources.rc b/chrome/app/theme/theme_resources.rc
index eddcb11..7ff522a 100644
--- a/chrome/app/theme/theme_resources.rc
+++ b/chrome/app/theme/theme_resources.rc
@@ -306,3 +306,4 @@ 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"
diff --git a/chrome/browser/vista_frame.cc b/chrome/browser/vista_frame.cc
index f4b7aa4..9d164ac 100644
--- a/chrome/browser/vista_frame.cc
+++ b/chrome/browser/vista_frame.cc
@@ -86,6 +86,9 @@ static const int kSeparationLineHeight = 1;
static const int kOTRImageHorizMargin = 2;
static const int kOTRImageVertMargin = 2;
+// Distributor logo offsets.
+static const int kDistributorLogoVerticalOffset = 3;
+
// The DWM puts a light border around the client area - we need to
// take this border size into account when we reduce its size so that
// we don't draw our content border dropshadow images over the top.
@@ -151,6 +154,7 @@ VistaFrame::VistaFrame(Browser* browser)
info_bar_view_(NULL),
is_off_the_record_(false),
off_the_record_image_(NULL),
+ distributor_logo_(NULL),
ignore_ncactivate_(false),
should_save_window_placement_(browser->GetType() != BrowserType::BROWSER),
browser_view_(NULL) {
@@ -231,24 +235,42 @@ void VistaFrame::Layout() {
}
+ // Figure out where the minimize button is for layout purposes.
+ TITLEBARINFOEX titlebar_info;
+ titlebar_info.cbSize = sizeof(TITLEBARINFOEX);
+ SendMessage(WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info);
+
+ // rgrect[2] refers to the minimize button. min_offset will
+ // be the distance between the right side of the window
+ // and the minimize button.
+ CRect window_rect;
+ GetWindowRect(&window_rect);
+ int min_offset = window_rect.right - titlebar_info.rgrect[2].left;
+
// 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 controls_offset = 0;
+ int zoomed_offset = 0;
if(IsZoomed()) {
- TITLEBARINFOEX titlebar_info;
- titlebar_info.cbSize = sizeof(TITLEBARINFOEX);
- SendMessage(WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info);
+ zoomed_offset = std::max(min_offset, kWindowControlsMinOffset);
- // rgrect[2] refers to the minimize button.
- controls_offset = client_rect.right - titlebar_info.rgrect[2].left;
- controls_offset = std::max(controls_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);
+ distributor_logo_->SetVisible(true);
+ distributor_logo_->SetBounds(width - min_offset -
+ distributor_logo_size.cx,
+ kDistributorLogoVerticalOffset,
+ distributor_logo_size.cx,
+ distributor_logo_size.cy);
}
gfx::Rect tabstrip_bounds(tabstrip_x,
kResizeBorder + (IsZoomed() ?
kDwmBorderSize : kTitlebarHeight),
width - tabstrip_x - kTabStripRightHorizOffset -
- controls_offset,
+ zoomed_offset,
tabstrip_->GetPreferredHeight());
if (frame_view_->UILayoutIsRightToLeft() &&
(IsZoomed() || is_off_the_record_))
@@ -405,8 +427,9 @@ void VistaFrame::Init() {
tabstrip_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TABSTRIP));
frame_view_->AddChildView(tabstrip_);
+ ResourceBundle &rb = ResourceBundle::GetSharedInstance();
+
if (is_off_the_record_) {
- ResourceBundle &rb = ResourceBundle::GetSharedInstance();
off_the_record_image_ = new ChromeViews::ImageView();
frame_view_->AddViewToDropList(off_the_record_image_);
SkBitmap* otr_icon = rb.GetBitmapNamed(IDR_OTR_ICON);
@@ -418,6 +441,11 @@ 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_);
+
tab_contents_container_ = new TabContentsContainerView();
frame_view_->AddChildView(tab_contents_container_);
diff --git a/chrome/browser/vista_frame.h b/chrome/browser/vista_frame.h
index 40a1dc2..ac406b5 100644
--- a/chrome/browser/vista_frame.h
+++ b/chrome/browser/vista_frame.h
@@ -367,6 +367,9 @@ class VistaFrame : public BrowserWindow,
// The optional container for the off the record icon.
ChromeViews::ImageView* off_the_record_image_;
+ // The container for the distributor logo.
+ ChromeViews::ImageView* distributor_logo_;
+
// The view that contains the tabs and any associated controls.
TabStrip* tabstrip_;
diff --git a/chrome/browser/xp_frame.cc b/chrome/browser/xp_frame.cc
index 79cd852..22f132f 100644
--- a/chrome/browser/xp_frame.cc
+++ b/chrome/browser/xp_frame.cc
@@ -82,6 +82,9 @@ static const int kContentBorderVertBottomOffset = 2;
static const int kToolbarOverlapVertOffset = 3;
static const int kTabShadowSize = 2;
+static const int kDistributorLogoHorizontalOffset = 7;
+static const int kDistributorLogoVerticalOffset = 4;
+
// Size of a corner. We use this when drawing a black background in maximized
// mode
static const int kCornerSize = 4;
@@ -119,7 +122,7 @@ static const int kSeparationLineHeight = 1;
static const SkColor kSeparationLineColor = SkColorSetRGB(178, 178, 178);
// Padding between the tab strip and the window controls in maximized mode.
-static const int kZoomedStripPadding = 32;
+static const int kZoomedStripPadding = 16;
using ChromeViews::Accelerator;
using ChromeViews::FocusManager;
@@ -359,6 +362,7 @@ XPFrame::XPFrame(Browser* browser)
is_off_the_record_(false),
title_bar_height_(0),
off_the_record_image_(NULL),
+ distributor_logo_(NULL),
ignore_ncactivate_(false),
paint_as_active_(false),
browser_view_(NULL) {
@@ -456,6 +460,11 @@ 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));
+ frame_view_->AddChildView(distributor_logo_);
+
min_button_ = new ChromeViews::Button();
min_button_->SetListener(this, MINIATURIZE_TAG);
min_button_->SetImage(ChromeViews::Button::BS_NORMAL,
@@ -692,6 +701,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);
+ }
+
tabstrip_->SetBounds(tab_strip_x, top_margin - 1,
right_limit - tab_strip_x - right_margin,
tabstrip_->GetPreferredHeight());
@@ -1358,16 +1381,6 @@ LRESULT XPFrame::OnNCHitTest(const CPoint& pt) {
return HTCAPTION;
}
- // If the OTR image exists and the mouse is above it, let's move the window.
- if (off_the_record_image_) {
- CPoint otr_p(p);
- otr_p.x -= off_the_record_image_->GetX(
- ChromeViews::View::APPLY_MIRRORING_TRANSFORMATION);
- otr_p.y -= off_the_record_image_->GetY();
- if (off_the_record_image_->HitTest(otr_p))
- return HTCAPTION;
- }
-
CPoint tsp(p);
ChromeViews::View::ConvertPointToView(&root_view_, tabstrip_, &tsp);
@@ -1395,7 +1408,9 @@ LRESULT XPFrame::OnNCHitTest(const CPoint& pt) {
// The mouse is not above the tab strip. If there is no control under it,
// let's move the window.
if (ComputeResizeMode(p.x, p.y, r.Width(), r.Height()) == RM_UNDEFINED) {
- if (root_view_.GetViewForPoint(p) == frame_view_) {
+ ChromeViews::View* v = root_view_.GetViewForPoint(p);
+ if (v == frame_view_ || v == off_the_record_image_ ||
+ v == distributor_logo_) {
return HTCAPTION;
}
}
diff --git a/chrome/browser/xp_frame.h b/chrome/browser/xp_frame.h
index 6a443e4..6c29efc 100644
--- a/chrome/browser/xp_frame.h
+++ b/chrome/browser/xp_frame.h
@@ -502,6 +502,9 @@ class XPFrame : public BrowserWindow,
// The optional container for the off the record icon.
ChromeViews::ImageView* off_the_record_image_;
+ // The container for the distributor logo.
+ ChromeViews::ImageView* distributor_logo_;
+
// We need to own the text of the menu, the Windows API does not copy it.
std::wstring task_manager_label_text_;