summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-25 20:52:06 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-25 20:52:06 +0000
commit9076b7d8c5f81be0d8d146a598b6b60ab49691fb (patch)
tree0c3679eed4f401ede44435015e26ae1ea9fe3f4c /chrome/browser
parent4cc2c750a655252227c6fbbe4da417e491033065 (diff)
downloadchromium_src-9076b7d8c5f81be0d8d146a598b6b60ab49691fb.zip
chromium_src-9076b7d8c5f81be0d8d146a598b6b60ab49691fb.tar.gz
chromium_src-9076b7d8c5f81be0d8d146a598b6b60ab49691fb.tar.bz2
[Mac] Makes the tab strip left-side indent changeable. Prereq for fullscreen.
(Changes really made by viettrungluu@chromium.org.) BUG=31638 TEST=Tab strip should still draw with the proper indent. Review URL: http://codereview.chromium.org/551145 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37038 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.h11
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm22
2 files changed, 24 insertions, 9 deletions
diff --git a/chrome/browser/cocoa/tab_strip_controller.h b/chrome/browser/cocoa/tab_strip_controller.h
index 8bc3b00..3341cd1 100644
--- a/chrome/browser/cocoa/tab_strip_controller.h
+++ b/chrome/browser/cocoa/tab_strip_controller.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -102,6 +102,10 @@ class ToolbarModel;
// The default favicon, so we can use one copy for all buttons.
scoped_nsobject<NSImage> defaultFavIcon_;
+ // The amount by which to indent the tabs on the left (to make room for the
+ // red/yellow/green buttons).
+ CGFloat indentForControls_;
+
// Manages per-tab sheets.
scoped_nsobject<GTMWindowSheetController> sheetController_;
@@ -109,6 +113,8 @@ class ToolbarModel;
BOOL mouseInside_;
}
+@property(nonatomic) CGFloat indentForControls;
+
// Initialize the controller with a view and browser that contains
// everything else we'll need. |switchView| is the view whose contents get
// "switched" every time the user switches tabs. The children of this view
@@ -176,6 +182,9 @@ class ToolbarModel;
// Default height for tabs.
+ (CGFloat)defaultTabHeight;
+// Default indentation for tabs (see |indentForControls_|).
++ (CGFloat)defaultIndentForControls;
+
// Returns the (lazily created) window sheet controller of this window. Used
// for the per-tab sheets.
- (GTMWindowSheetController*)sheetController;
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index f50e7c8..2ee7d55 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -54,10 +54,6 @@ NSString* const kNewTabPressedImage = @"newtab_p.pdf";
// view.
const CGFloat kUseFullAvailableWidth = -1.0;
-// Left-side indent for tab layout so tabs don't overlap with the window
-// controls.
-const CGFloat kIndentLeavingSpaceForControls = 64.0;
-
// The amount by which tabs overlap.
const CGFloat kTabOverlap = 20.0;
@@ -270,6 +266,8 @@ private:
@implementation TabStripController
+@synthesize indentForControls = indentForControls_;
+
- (id)initWithView:(TabStripView*)view
switchView:(NSView*)switchView
browser:(Browser*)browser {
@@ -290,6 +288,8 @@ private:
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
defaultFavIcon_.reset([rb.GetNSImageNamed(IDR_DEFAULT_FAVICON) retain]);
+ [self setIndentForControls:[[self class] defaultIndentForControls]];
+
// TODO(viettrungluu): WTF? "For some reason, if the view is present in the
// nib a priori, it draws correctly. If we create it in code and add it to
// the tab view, it draws with all sorts of crazy artifacts."
@@ -381,6 +381,12 @@ private:
return 24.0;
}
++ (CGFloat)defaultIndentForControls {
+ // Default indentation leaves enough room so tabs don't overlap with the
+ // window controls.
+ return 64.0;
+}
+
// Finds the TabContentsController associated with the given index into the tab
// model and swaps out the sole child of the contentArea to display its
// contents.
@@ -619,7 +625,7 @@ private:
- (BOOL)isTabFullyVisible:(TabView*)tab {
NSRect frame = [tab frame];
- return NSMinX(frame) >= kIndentLeavingSpaceForControls &&
+ return NSMinX(frame) >= [self indentForControls] &&
NSMaxX(frame) <= NSMaxX([tabStripView_ frame]);
}
@@ -668,7 +674,7 @@ private:
availableWidth = NSWidth([tabStripView_ frame]);
availableWidth -= NSWidth([newTabButton_ frame]) + kNewTabButtonOffset;
}
- availableWidth -= kIndentLeavingSpaceForControls;
+ availableWidth -= [self indentForControls];
// This may be negative, but that's okay (taken care of by |MAX()| when
// calculating tab sizes).
@@ -693,7 +699,7 @@ private:
const CGFloat minX = NSMinX(placeholderFrame_);
BOOL visible = [[tabStripView_ window] isVisible];
- CGFloat offset = kIndentLeavingSpaceForControls;
+ CGFloat offset = [self indentForControls];
NSUInteger i = 0;
bool hasPlaceholderGap = false;
for (TabController* tab in tabArray_.get()) {