Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3825)

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_controller.mm

Issue 6821003: [Mac] First pass at multiple selection in the tabstrip. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase ToT Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_controller.h ('k') | chrome/browser/ui/cocoa/tabs/tab_controller_target.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tabs/tab_controller.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_controller.mm
index 7a00bb503b844f33f839ba1eee542b2f515fb5bd..87a2391d0382a2c1feaa876b72f3e042c59106e3 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_controller.mm
@@ -98,15 +98,15 @@ class MenuDelegate : public ui::SimpleMenuModel::Delegate {
[super dealloc];
}
-// The internals of |-setSelected:| but doesn't check if we're already set
-// to |selected|. Pass the selection change to the subviews that need it and
-// mark ourselves as needing a redraw.
+// The internals of |-setSelected:| and |-setActive:| but doesn't set the
+// backing variables. This updates the drawing state and marks self as needing
+// a re-draw.
- (void)internalSetSelected:(BOOL)selected {
- selected_ = selected;
TabView* tabView = static_cast<TabView*>([self view]);
DCHECK([tabView isKindOfClass:[TabView class]]);
[tabView setState:selected];
- [tabView cancelAlert];
+ if ([self active])
+ [tabView cancelAlert];
[self updateVisibility];
[self updateTitleColor];
}
@@ -135,8 +135,9 @@ class MenuDelegate : public ui::SimpleMenuModel::Delegate {
- (NSMenu*)menu {
contextMenuDelegate_.reset(
new TabControllerInternal::MenuDelegate(target_, self));
- contextMenuModel_.reset(new TabMenuModel(contextMenuDelegate_.get(),
- [self pinned]));
+ contextMenuModel_.reset(
+ [target_ contextMenuModelForController:self
+ menuDelegate:contextMenuDelegate_.get()]);
contextMenuController_.reset(
[[MenuController alloc] initWithModel:contextMenuModel_.get()
useWithPopUpButtonCell:NO]);
@@ -160,13 +161,26 @@ class MenuDelegate : public ui::SimpleMenuModel::Delegate {
[super setTitle:title];
}
+- (void)setActive:(BOOL)active {
+ if (active != active_) {
+ active_ = active;
+ [self internalSetSelected:[self selected]];
+ }
+}
+
+- (BOOL)active {
+ return active_;
+}
+
- (void)setSelected:(BOOL)selected {
- if (selected_ != selected)
- [self internalSetSelected:selected];
+ if (selected_ != selected) {
+ selected_ = selected;
+ [self internalSetSelected:[self selected]];
+ }
}
- (BOOL)selected {
- return selected_;
+ return selected_ || active_;
}
- (void)setIconView:(NSView*)iconView {
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_controller.h ('k') | chrome/browser/ui/cocoa/tabs/tab_controller_target.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698