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 #include <Carbon/Carbon.h> | 5 #include <Carbon/Carbon.h> |
6 | 6 |
7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
8 #include "base/scoped_nsdisable_screen_updates.h" | 8 #include "base/scoped_nsdisable_screen_updates.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/app/chrome_dll_resource.h" // IDC_* | 10 #include "chrome/app/chrome_dll_resource.h" // IDC_* |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 if (![source isKindOfClass:[BrowserWindowController class]]) { | 415 if (![source isKindOfClass:[BrowserWindowController class]]) { |
416 return NO; | 416 return NO; |
417 } | 417 } |
418 | 418 |
419 BrowserWindowController* realSource = | 419 BrowserWindowController* realSource = |
420 static_cast<BrowserWindowController*>(source); | 420 static_cast<BrowserWindowController*>(source); |
421 if (browser_->profile() != realSource->browser_->profile()) { | 421 if (browser_->profile() != realSource->browser_->profile()) { |
422 return NO; | 422 return NO; |
423 } | 423 } |
424 | 424 |
| 425 // Can't drag a tab from a normal browser to a pop-up |
| 426 if (browser_->type() != realSource->browser_->type()) { |
| 427 return NO; |
| 428 } |
| 429 |
425 return YES; | 430 return YES; |
426 } | 431 } |
427 | 432 |
428 // Move a given tab view to the location of the current placeholder. If there is | 433 // Move a given tab view to the location of the current placeholder. If there is |
429 // no placeholder, it will go at the end. |controller| is the window controller | 434 // no placeholder, it will go at the end. |controller| is the window controller |
430 // of a tab being dropped from a different window. It will be nil if the drag is | 435 // of a tab being dropped from a different window. It will be nil if the drag is |
431 // within the window, otherwise the tab is removed from that window before being | 436 // within the window, otherwise the tab is removed from that window before being |
432 // placed into this one. The implementation will call |-removePlaceholder| since | 437 // placed into this one. The implementation will call |-removePlaceholder| since |
433 // the drag is now complete. This also calls |-layoutTabs| internally so | 438 // the drag is now complete. This also calls |-layoutTabs| internally so |
434 // clients do not need to call it again. | 439 // clients do not need to call it again. |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 | 682 |
678 - (NSInteger)numberOfTabs { | 683 - (NSInteger)numberOfTabs { |
679 return browser_->tabstrip_model()->count(); | 684 return browser_->tabstrip_model()->count(); |
680 } | 685 } |
681 | 686 |
682 - (NSString*)selectedTabTitle { | 687 - (NSString*)selectedTabTitle { |
683 TabContents* contents = browser_->tabstrip_model()->GetSelectedTabContents(); | 688 TabContents* contents = browser_->tabstrip_model()->GetSelectedTabContents(); |
684 return base::SysUTF16ToNSString(contents->GetTitle()); | 689 return base::SysUTF16ToNSString(contents->GetTitle()); |
685 } | 690 } |
686 | 691 |
| 692 // TYPE_POPUP is not normal (e.g. no tab strip) |
| 693 - (BOOL)isNormalWindow { |
| 694 if (browser_->type() == Browser::TYPE_NORMAL) |
| 695 return YES; |
| 696 return NO; |
| 697 } |
| 698 |
687 - (void)selectTabWithContents:(TabContents*)newContents | 699 - (void)selectTabWithContents:(TabContents*)newContents |
688 previousContents:(TabContents*)oldContents | 700 previousContents:(TabContents*)oldContents |
689 atIndex:(NSInteger)index | 701 atIndex:(NSInteger)index |
690 userGesture:(bool)wasUserGesture { | 702 userGesture:(bool)wasUserGesture { |
691 DCHECK(oldContents != newContents); | 703 DCHECK(oldContents != newContents); |
692 | 704 |
693 // Update various elements that are interested in knowing the current | 705 // Update various elements that are interested in knowing the current |
694 // TabContents. | 706 // TabContents. |
695 #if 0 | 707 #if 0 |
696 // TODO(pinkerton):Update as more things become window-specific | 708 // TODO(pinkerton):Update as more things become window-specific |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 browser_->ExecuteCommand(command); | 895 browser_->ExecuteCommand(command); |
884 } | 896 } |
885 | 897 |
886 - (id)windowWillReturnFieldEditor:(NSWindow*)sender toObject:(id)obj { | 898 - (id)windowWillReturnFieldEditor:(NSWindow*)sender toObject:(id)obj { |
887 // Ask the toolbar controller if it wants to return a custom field editor | 899 // Ask the toolbar controller if it wants to return a custom field editor |
888 // for the specific object. | 900 // for the specific object. |
889 return [toolbarController_ customFieldEditorForObject:obj]; | 901 return [toolbarController_ customFieldEditorForObject:obj]; |
890 } | 902 } |
891 | 903 |
892 @end | 904 @end |
OLD | NEW |