summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-12 23:17:01 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-12 23:17:01 +0000
commitdf525d57099d57caf49f6ac13fc3c65d9e869f1c (patch)
tree18f699030d10d1b72a91daf61532333da35e900d /chrome/browser
parent51133f91c7f0e35e302eabcfcfed105310fdd898 (diff)
downloadchromium_src-df525d57099d57caf49f6ac13fc3c65d9e869f1c.zip
chromium_src-df525d57099d57caf49f6ac13fc3c65d9e869f1c.tar.gz
chromium_src-df525d57099d57caf49f6ac13fc3c65d9e869f1c.tar.bz2
Makes the new tab button extend to the top of the tab strip on chromeos.
CROS_BUG=310 TEST=see bug Review URL: http://codereview.chromium.org/550020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36058 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/defaults.cc3
-rw-r--r--chrome/browser/defaults.h3
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc19
3 files changed, 21 insertions, 4 deletions
diff --git a/chrome/browser/defaults.cc b/chrome/browser/defaults.cc
index 65f5802..dee5bc5 100644
--- a/chrome/browser/defaults.cc
+++ b/chrome/browser/defaults.cc
@@ -22,6 +22,8 @@ const bool kShowExitMenuItem = false;
const bool kShowAboutMenuItem = true;
const bool kOSSupportsOtherBrowsers = false;
const bool kDownloadPageHasShowInFolder = false;
+const bool kSizeTabButtonToTopOfTabStrip = true;
+
#elif defined(OS_LINUX)
// 13.4px = 10pt @ 96dpi.
@@ -58,6 +60,7 @@ const bool kShowExitMenuItem = true;
const bool kShowAboutMenuItem = true;
#endif
const bool kOSSupportsOtherBrowsers = true;
+const bool kSizeTabButtonToTopOfTabStrip = false;
#endif
diff --git a/chrome/browser/defaults.h b/chrome/browser/defaults.h
index 6478e14..7ab2b64 100644
--- a/chrome/browser/defaults.h
+++ b/chrome/browser/defaults.h
@@ -57,6 +57,9 @@ extern const bool kOSSupportsOtherBrowsers;
// Does the download page have the show in folder option?
extern const bool kDownloadPageHasShowInFolder;
+// Should the tab strip be sized to the top of the tab strip?
+extern const bool kSizeTabButtonToTopOfTabStrip;
+
} // namespace browser_defaults
#endif // CHROME_BROWSER_DEFAULTS_H_
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index 9a419db..6587a78 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -14,6 +14,7 @@
#include "base/gfx/size.h"
#include "base/stl_util-inl.h"
#include "chrome/browser/browser_theme_provider.h"
+#include "chrome/browser/defaults.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -84,7 +85,10 @@ class NewTabButton : public views::ImageButton {
protected:
// Overridden from views::View:
virtual bool HasHitTestMask() const {
- return true;
+ // When the button is sized to the top of the tab strip we want the user to
+ // be able to click on complete bounds, and so don't return a custom hit
+ // mask.
+ return !browser_defaults::kSizeTabButtonToTopOfTabStrip;
}
virtual void GetHitTestMask(gfx::Path* path) const {
DCHECK(path);
@@ -793,6 +797,10 @@ Tab* TabStrip::GetSelectedTab() const {
void TabStrip::InitTabStripButtons() {
newtab_button_ = new NewTabButton(this);
+ if (browser_defaults::kSizeTabButtonToTopOfTabStrip) {
+ newtab_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT,
+ views::ImageButton::ALIGN_BOTTOM);
+ }
LoadNewTabButtonImage();
newtab_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_NEWTAB));
AddChildView(newtab_button_);
@@ -1394,6 +1402,8 @@ void TabStrip::Init() {
SetID(VIEW_ID_TAB_STRIP);
model_->AddObserver(this);
newtab_button_size_.SetSize(kNewTabButtonWidth, kNewTabButtonHeight);
+ if (browser_defaults::kSizeTabButtonToTopOfTabStrip)
+ newtab_button_size_.set_height(kNewTabButtonHeight + kNewTabButtonVOffset);
if (drop_indicator_width == 0) {
// Direction doesn't matter, both images are the same size.
SkBitmap* drop_image = GetDropArrowImage(true);
@@ -1802,19 +1812,20 @@ void TabStrip::GenerateIdealBounds() {
void TabStrip::LayoutNewTabButton(double last_tab_right,
double unselected_width) {
int delta = abs(Round(unselected_width) - Tab::GetStandardSize().width());
+ int v_offset = browser_defaults::kSizeTabButtonToTopOfTabStrip ?
+ 0 : kNewTabButtonHOffset;
if (delta > 1 && !needs_resize_layout_) {
// We're shrinking tabs, so we need to anchor the New Tab button to the
// right edge of the TabStrip's bounds, rather than the right edge of the
// right-most Tab, otherwise it'll bounce when animating.
newtab_button_->SetBounds(width() - newtab_button_size_.width(),
- kNewTabButtonVOffset,
+ v_offset,
newtab_button_size_.width(),
newtab_button_size_.height());
} else {
newtab_button_->SetBounds(
Round(last_tab_right - kTabHOffset) + kNewTabButtonHOffset,
- kNewTabButtonVOffset, newtab_button_size_.width(),
- newtab_button_size_.height());
+ v_offset, newtab_button_size_.width(), newtab_button_size_.height());
}
}