| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/cocoa/tab_strip_controller.h" | 5 #import "chrome/browser/cocoa/tab_strip_controller.h" |
| 6 | 6 |
| 7 #import "base/sys_string_conversions.h" | 7 #import "base/sys_string_conversions.h" |
| 8 #import "chrome/app/chrome_dll_resource.h" | 8 #import "chrome/app/chrome_dll_resource.h" |
| 9 #import "chrome/browser/cocoa/tab_strip_view.h" | 9 #import "chrome/browser/cocoa/tab_strip_view.h" |
| 10 #import "chrome/browser/cocoa/tab_cell.h" | 10 #import "chrome/browser/cocoa/tab_cell.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 [controller updateToolbarWithContents:shouldRestore ? tab : nil]; | 327 [controller updateToolbarWithContents:shouldRestore ? tab : nil]; |
| 328 } | 328 } |
| 329 | 329 |
| 330 - (void)setStarredState:(BOOL)isStarred { | 330 - (void)setStarredState:(BOOL)isStarred { |
| 331 TabContents* selectedContents = model_->GetSelectedTabContents(); | 331 TabContents* selectedContents = model_->GetSelectedTabContents(); |
| 332 TabContentsController* selectedController = | 332 TabContentsController* selectedController = |
| 333 [self controllerWithContents:selectedContents]; | 333 [self controllerWithContents:selectedContents]; |
| 334 [selectedController setStarredState:isStarred]; | 334 [selectedController setStarredState:isStarred]; |
| 335 } | 335 } |
| 336 | 336 |
| 337 // Return the rect, in WebKit coordinates (flipped), of the window's grow box |
| 338 // in the coordinate system of the content area of the currently selected tab. |
| 339 // |windowGrowBox| needs to be in the window's coordinate system. |
| 340 - (NSRect)selectedTabGrowBoxFromWindowGrowBox:(NSRect)windowGrowBox { |
| 341 TabContents* selectedContents = model_->GetSelectedTabContents(); |
| 342 if (!selectedContents) { |
| 343 // When the window is initially being constructed, there may be no currently |
| 344 // selected tab, so pick the first one. If there aren't any, just bail with |
| 345 // an empty rect. |
| 346 selectedContents = model_->GetTabContentsAt(0); |
| 347 if (!selectedContents) |
| 348 return NSMakeRect(0, 0, 0, 0); |
| 349 } |
| 350 TabContentsController* selectedController = |
| 351 [self controllerWithContents:selectedContents]; |
| 352 return [selectedController growBoxFromWindowGrowBox:windowGrowBox]; |
| 353 } |
| 354 |
| 337 @end | 355 @end |
| 338 | 356 |
| 339 //-------------------------------------------------------------------------- | 357 //-------------------------------------------------------------------------- |
| 340 | 358 |
| 341 TabStripBridge::TabStripBridge(TabStripModel* model, | 359 TabStripBridge::TabStripBridge(TabStripModel* model, |
| 342 TabStripController* controller) | 360 TabStripController* controller) |
| 343 : controller_(controller), model_(model) { | 361 : controller_(controller), model_(model) { |
| 344 // Register to be a listener on the model so we can get updates and tell | 362 // Register to be a listener on the model so we can get updates and tell |
| 345 // the TabStripController about them. | 363 // the TabStripController about them. |
| 346 model_->AddObserver(this); | 364 model_->AddObserver(this); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 NOTIMPLEMENTED(); | 397 NOTIMPLEMENTED(); |
| 380 } | 398 } |
| 381 | 399 |
| 382 void TabStripBridge::TabChangedAt(TabContents* contents, int index) { | 400 void TabStripBridge::TabChangedAt(TabContents* contents, int index) { |
| 383 [controller_ tabChangedWithContents:contents atIndex:index]; | 401 [controller_ tabChangedWithContents:contents atIndex:index]; |
| 384 } | 402 } |
| 385 | 403 |
| 386 void TabStripBridge::TabStripEmpty() { | 404 void TabStripBridge::TabStripEmpty() { |
| 387 NOTIMPLEMENTED(); | 405 NOTIMPLEMENTED(); |
| 388 } | 406 } |
| OLD | NEW |