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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/tabs/tab_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 8
9 #include "app/mac/scoped_nsdisable_screen_updates.h" 9 #include "app/mac/scoped_nsdisable_screen_updates.h"
10 #include "app/mac/nsimage_cache.h" 10 #include "app/mac/nsimage_cache.h"
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 [self removePlaceholder]; 1210 [self removePlaceholder];
1211 } 1211 }
1212 1212
1213 // Tells the tab strip to forget about this tab in preparation for it being 1213 // Tells the tab strip to forget about this tab in preparation for it being
1214 // put into a different tab strip, such as during a drop on another window. 1214 // put into a different tab strip, such as during a drop on another window.
1215 - (void)detachTabView:(NSView*)view { 1215 - (void)detachTabView:(NSView*)view {
1216 int index = [tabStripController_ modelIndexForTabView:view]; 1216 int index = [tabStripController_ modelIndexForTabView:view];
1217 browser_->tabstrip_model()->DetachTabContentsAt(index); 1217 browser_->tabstrip_model()->DetachTabContentsAt(index);
1218 } 1218 }
1219 1219
1220 - (NSView*)selectedTabView { 1220 - (NSView*)activeTabView {
1221 return [tabStripController_ selectedTabView]; 1221 return [tabStripController_ activeTabView];
1222 } 1222 }
1223 1223
1224 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force { 1224 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force {
1225 [toolbarController_ setIsLoading:isLoading force:force]; 1225 [toolbarController_ setIsLoading:isLoading force:force];
1226 } 1226 }
1227 1227
1228 // Make the location bar the first responder, if possible. 1228 // Make the location bar the first responder, if possible.
1229 - (void)focusLocationBar:(BOOL)selectAll { 1229 - (void)focusLocationBar:(BOOL)selectAll {
1230 [toolbarController_ focusLocationBar:selectAll]; 1230 [toolbarController_ focusLocationBar:selectAll];
1231 } 1231 }
1232 1232
1233 - (void)focusTabContents { 1233 - (void)focusTabContents {
1234 [[self window] makeFirstResponder:[tabStripController_ selectedTabView]]; 1234 [[self window] makeFirstResponder:[tabStripController_ activeTabView]];
1235 } 1235 }
1236 1236
1237 - (void)layoutTabs { 1237 - (void)layoutTabs {
1238 [tabStripController_ layoutTabs]; 1238 [tabStripController_ layoutTabs];
1239 } 1239 }
1240 1240
1241 - (TabWindowController*)detachTabToNewWindow:(TabView*)tabView { 1241 - (TabWindowController*)detachTabToNewWindow:(TabView*)tabView {
1242 // Disable screen updates so that this appears as a single visual change. 1242 // Disable screen updates so that this appears as a single visual change.
1243 app::mac::ScopedNSDisableScreenUpdates disabler; 1243 app::mac::ScopedNSDisableScreenUpdates disabler;
1244 1244
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 // Get the new controller by asking the new window for its delegate. 1290 // Get the new controller by asking the new window for its delegate.
1291 BrowserWindowController* controller = 1291 BrowserWindowController* controller =
1292 reinterpret_cast<BrowserWindowController*>( 1292 reinterpret_cast<BrowserWindowController*>(
1293 [newBrowser->window()->GetNativeHandle() delegate]); 1293 [newBrowser->window()->GetNativeHandle() delegate]);
1294 DCHECK(controller && [controller isKindOfClass:[TabWindowController class]]); 1294 DCHECK(controller && [controller isKindOfClass:[TabWindowController class]]);
1295 1295
1296 // Force the added tab to the right size (remove stretching.) 1296 // Force the added tab to the right size (remove stretching.)
1297 tabRect.size.height = [TabStripController defaultTabHeight]; 1297 tabRect.size.height = [TabStripController defaultTabHeight];
1298 1298
1299 // And make sure we use the correct frame in the new view. 1299 // And make sure we use the correct frame in the new view.
1300 [[controller tabStripController] setFrameOfSelectedTab:tabRect]; 1300 [[controller tabStripController] setFrameOfActiveTab:tabRect];
1301 return controller; 1301 return controller;
1302 } 1302 }
1303 1303
1304 - (void)insertPlaceholderForTab:(TabView*)tab 1304 - (void)insertPlaceholderForTab:(TabView*)tab
1305 frame:(NSRect)frame 1305 frame:(NSRect)frame
1306 yStretchiness:(CGFloat)yStretchiness { 1306 yStretchiness:(CGFloat)yStretchiness {
1307 [super insertPlaceholderForTab:tab frame:frame yStretchiness:yStretchiness]; 1307 [super insertPlaceholderForTab:tab frame:frame yStretchiness:yStretchiness];
1308 [tabStripController_ insertPlaceholderForTab:tab 1308 [tabStripController_ insertPlaceholderForTab:tab
1309 frame:frame 1309 frame:frame
1310 yStretchiness:yStretchiness]; 1310 yStretchiness:yStretchiness];
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 1405
1406 - (NSInteger)numberOfTabs { 1406 - (NSInteger)numberOfTabs {
1407 // count() includes pinned tabs. 1407 // count() includes pinned tabs.
1408 return browser_->tabstrip_model()->count(); 1408 return browser_->tabstrip_model()->count();
1409 } 1409 }
1410 1410
1411 - (BOOL)hasLiveTabs { 1411 - (BOOL)hasLiveTabs {
1412 return !browser_->tabstrip_model()->empty(); 1412 return !browser_->tabstrip_model()->empty();
1413 } 1413 }
1414 1414
1415 - (NSString*)selectedTabTitle { 1415 - (NSString*)activeTabTitle {
1416 TabContents* contents = browser_->GetSelectedTabContents(); 1416 TabContents* contents = browser_->GetSelectedTabContents();
1417 return base::SysUTF16ToNSString(contents->GetTitle()); 1417 return base::SysUTF16ToNSString(contents->GetTitle());
1418 } 1418 }
1419 1419
1420 - (NSRect)regularWindowFrame { 1420 - (NSRect)regularWindowFrame {
1421 return [self isFullscreen] ? [savedRegularWindow_ frame] : 1421 return [self isFullscreen] ? [savedRegularWindow_ frame] :
1422 [[self window] frame]; 1422 [[self window] frame];
1423 } 1423 }
1424 1424
1425 // (Override of |TabWindowController| method.) 1425 // (Override of |TabWindowController| method.)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 gfx::Rect(growBoxRect.origin.x, growBoxRect.origin.y, 1462 gfx::Rect(growBoxRect.origin.x, growBoxRect.origin.y,
1463 growBoxRect.size.width, growBoxRect.size.height); 1463 growBoxRect.size.width, growBoxRect.size.height);
1464 } 1464 }
1465 } 1465 }
1466 } 1466 }
1467 1467
1468 render_widget_host_view->set_reserved_contents_rect(reserved_rect); 1468 render_widget_host_view->set_reserved_contents_rect(reserved_rect);
1469 } 1469 }
1470 1470
1471 // TabStripControllerDelegate protocol. 1471 // TabStripControllerDelegate protocol.
1472 - (void)onSelectTabWithContents:(TabContents*)contents { 1472 - (void)onActivateTabWithContents:(TabContents*)contents {
1473 // Update various elements that are interested in knowing the current 1473 // Update various elements that are interested in knowing the current
1474 // TabContents. 1474 // TabContents.
1475 1475
1476 // Update all the UI bits. 1476 // Update all the UI bits.
1477 windowShim_->UpdateTitleBar(); 1477 windowShim_->UpdateTitleBar();
1478 1478
1479 [sidebarController_ updateSidebarForTabContents:contents]; 1479 [sidebarController_ updateSidebarForTabContents:contents];
1480 [devToolsController_ updateDevToolsForTabContents:contents 1480 [devToolsController_ updateDevToolsForTabContents:contents
1481 withProfile:browser_->profile()]; 1481 withProfile:browser_->profile()];
1482 1482
(...skipping 12 matching lines...) Expand all
1495 } 1495 }
1496 1496
1497 - (void)onReplaceTabWithContents:(TabContents*)contents { 1497 - (void)onReplaceTabWithContents:(TabContents*)contents {
1498 // This is only called when instant results are committed. Simply remove the 1498 // This is only called when instant results are committed. Simply remove the
1499 // preview view; the tab strip controller will reinstall the view as the 1499 // preview view; the tab strip controller will reinstall the view as the
1500 // active view. 1500 // active view.
1501 [previewableContentsController_ hidePreview]; 1501 [previewableContentsController_ hidePreview];
1502 [self updateBookmarkBarVisibilityWithAnimation:NO]; 1502 [self updateBookmarkBarVisibilityWithAnimation:NO];
1503 } 1503 }
1504 1504
1505 - (void)onSelectedTabChange:(TabStripModelObserver::TabChangeType)change { 1505 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change
1506 withContents:(TabContents*)contents {
1506 // Update titles if this is the currently selected tab and if it isn't just 1507 // Update titles if this is the currently selected tab and if it isn't just
1507 // the loading state which changed. 1508 // the loading state which changed.
1508 if (change != TabStripModelObserver::LOADING_ONLY) 1509 if (change != TabStripModelObserver::LOADING_ONLY)
1509 windowShim_->UpdateTitleBar(); 1510 windowShim_->UpdateTitleBar();
1510 1511
1511 // Update the bookmark bar if this is the currently selected tab and if it 1512 // Update the bookmark bar if this is the currently selected tab and if it
1512 // isn't just the title which changed. This for transitions between the NTP 1513 // isn't just the title which changed. This for transitions between the NTP
1513 // (showing its floating bookmark bar) and normal web pages (showing no 1514 // (showing its floating bookmark bar) and normal web pages (showing no
1514 // bookmark bar). 1515 // bookmark bar).
1515 // TODO(viettrungluu): perhaps update to not terminate running animations? 1516 // TODO(viettrungluu): perhaps update to not terminate running animations?
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2185 2186
2186 - (BOOL)supportsBookmarkBar { 2187 - (BOOL)supportsBookmarkBar {
2187 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2188 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2188 } 2189 }
2189 2190
2190 - (BOOL)isNormalWindow { 2191 - (BOOL)isNormalWindow {
2191 return browser_->type() == Browser::TYPE_NORMAL; 2192 return browser_->type() == Browser::TYPE_NORMAL;
2192 } 2193 }
2193 2194
2194 @end // @implementation BrowserWindowController(WindowType) 2195 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/tabs/tab_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698