| OLD | NEW |
| 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 <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 @end | 62 @end |
| 63 | 63 |
| 64 // static | 64 // static |
| 65 TabContentsView* TabContentsView::Create(TabContents* tab_contents) { | 65 TabContentsView* TabContentsView::Create(TabContents* tab_contents) { |
| 66 return new TabContentsViewMac(tab_contents); | 66 return new TabContentsViewMac(tab_contents); |
| 67 } | 67 } |
| 68 | 68 |
| 69 TabContentsViewMac::TabContentsViewMac(TabContents* tab_contents) | 69 TabContentsViewMac::TabContentsViewMac(TabContents* tab_contents) |
| 70 : TabContentsView(tab_contents), | 70 : TabContentsView(tab_contents), |
| 71 preferred_width_(0) { | 71 preferred_width_(0) { |
| 72 registrar_.Add(this, NotificationType::TAB_CONTENTS_CONNECTED, | 72 registrar_.Add(this, chrome::TAB_CONTENTS_CONNECTED, |
| 73 Source<TabContents>(tab_contents)); | 73 Source<TabContents>(tab_contents)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 TabContentsViewMac::~TabContentsViewMac() { | 76 TabContentsViewMac::~TabContentsViewMac() { |
| 77 // This handles the case where a renderer close call was deferred | 77 // This handles the case where a renderer close call was deferred |
| 78 // while the user was operating a UI control which resulted in a | 78 // while the user was operating a UI control which resulted in a |
| 79 // close. In that case, the Cocoa view outlives the | 79 // close. In that case, the Cocoa view outlives the |
| 80 // TabContentsViewMac instance due to Cocoa retain count. | 80 // TabContentsViewMac instance due to Cocoa retain count. |
| 81 [cocoa_view_ cancelDeferredClose]; | 81 [cocoa_view_ cancelDeferredClose]; |
| 82 } | 82 } |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 } | 355 } |
| 356 | 356 |
| 357 void TabContentsViewMac::CloseTab() { | 357 void TabContentsViewMac::CloseTab() { |
| 358 tab_contents()->Close(tab_contents()->render_view_host()); | 358 tab_contents()->Close(tab_contents()->render_view_host()); |
| 359 } | 359 } |
| 360 | 360 |
| 361 void TabContentsViewMac::Observe(NotificationType type, | 361 void TabContentsViewMac::Observe(NotificationType type, |
| 362 const NotificationSource& source, | 362 const NotificationSource& source, |
| 363 const NotificationDetails& details) { | 363 const NotificationDetails& details) { |
| 364 switch (type.value) { | 364 switch (type.value) { |
| 365 case NotificationType::TAB_CONTENTS_CONNECTED: { | 365 case chrome::TAB_CONTENTS_CONNECTED: { |
| 366 sad_tab_.reset(); | 366 sad_tab_.reset(); |
| 367 break; | 367 break; |
| 368 } | 368 } |
| 369 default: | 369 default: |
| 370 NOTREACHED() << "Got a notification we didn't register for."; | 370 NOTREACHED() << "Got a notification we didn't register for."; |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 | 373 |
| 374 @implementation TabContentsViewCocoa | 374 @implementation TabContentsViewCocoa |
| 375 | 375 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 [[[notification userInfo] objectForKey:kSelectionDirection] | 544 [[[notification userInfo] objectForKey:kSelectionDirection] |
| 545 unsignedIntegerValue]; | 545 unsignedIntegerValue]; |
| 546 if (direction == NSDirectSelection) | 546 if (direction == NSDirectSelection) |
| 547 return; | 547 return; |
| 548 | 548 |
| 549 [self tabContents]-> | 549 [self tabContents]-> |
| 550 FocusThroughTabTraversal(direction == NSSelectingPrevious); | 550 FocusThroughTabTraversal(direction == NSSelectingPrevious); |
| 551 } | 551 } |
| 552 | 552 |
| 553 @end | 553 @end |
| OLD | NEW |