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 "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" |
6 | 6 |
7 #import "base/mac/mac_util.h" | 7 #import "base/mac/mac_util.h" |
8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
9 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" | 9 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" |
10 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h" | 10 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h" |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 NULL, reinterpret_cast<const void **>(&windowID), 1, NULL)); | 531 NULL, reinterpret_cast<const void **>(&windowID), 1, NULL)); |
532 base::mac::ScopedCFTypeRef<CFArrayRef> descriptions( | 532 base::mac::ScopedCFTypeRef<CFArrayRef> descriptions( |
533 CGWindowListCreateDescriptionFromArray(windowIDs)); | 533 CGWindowListCreateDescriptionFromArray(windowIDs)); |
534 DCHECK(CFArrayGetCount(descriptions.get()) <= 1); | 534 DCHECK(CFArrayGetCount(descriptions.get()) <= 1); |
535 if (CFArrayGetCount(descriptions.get()) > 0) { | 535 if (CFArrayGetCount(descriptions.get()) > 0) { |
536 CFDictionaryRef dict = static_cast<CFDictionaryRef>( | 536 CFDictionaryRef dict = static_cast<CFDictionaryRef>( |
537 CFArrayGetValueAtIndex(descriptions.get(), 0)); | 537 CFArrayGetValueAtIndex(descriptions.get(), 0)); |
538 DCHECK(CFGetTypeID(dict) == CFDictionaryGetTypeID()); | 538 DCHECK(CFGetTypeID(dict) == CFDictionaryGetTypeID()); |
539 | 539 |
540 // Sanity check the ID. | 540 // Sanity check the ID. |
541 CFNumberRef otherIDRef = (CFNumberRef)base::mac::GetValueFromDictionary( | 541 CFNumberRef otherIDRef = |
542 dict, kCGWindowNumber, CFNumberGetTypeID()); | 542 base::mac::GetValueFromDictionary<CFNumberRef>(dict, kCGWindowNumber); |
543 CGWindowID otherID; | 543 CGWindowID otherID; |
544 if (otherIDRef && | 544 if (otherIDRef && |
545 CFNumberGetValue(otherIDRef, kCGWindowIDCFNumberType, &otherID) && | 545 CFNumberGetValue(otherIDRef, kCGWindowIDCFNumberType, &otherID) && |
546 otherID == windowID) { | 546 otherID == windowID) { |
547 // And then get the workspace. | 547 // And then get the workspace. |
548 CFNumberRef workspaceRef = (CFNumberRef)base::mac::GetValueFromDictionary( | 548 CFNumberRef workspaceRef = |
549 dict, kCGWindowWorkspace, CFNumberGetTypeID()); | 549 base::mac::GetValueFromDictionary<CFNumberRef>(dict, |
| 550 kCGWindowWorkspace); |
550 if (!workspaceRef || | 551 if (!workspaceRef || |
551 !CFNumberGetValue(workspaceRef, kCFNumberIntType, &workspace)) { | 552 !CFNumberGetValue(workspaceRef, kCFNumberIntType, &workspace)) { |
552 workspace = -1; | 553 workspace = -1; |
553 } | 554 } |
554 } else { | 555 } else { |
555 NOTREACHED(); | 556 NOTREACHED(); |
556 } | 557 } |
557 } | 558 } |
558 if (useCache) { | 559 if (useCache) { |
559 workspaceIDCache_[windowID] = workspace; | 560 workspaceIDCache_[windowID] = workspace; |
560 } | 561 } |
561 return workspace; | 562 return workspace; |
562 } | 563 } |
563 | 564 |
564 @end | 565 @end |
OLD | NEW |