OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/location_bar/autocomplete_text_field_cell.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/mac_logging.h" |
8 #import "chrome/browser/ui/cocoa/image_utils.h" | 9 #import "chrome/browser/ui/cocoa/image_utils.h" |
9 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
10 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" | 11 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" |
11 #import "third_party/mozilla/NSPasteboard+Utils.h" | 12 #import "third_party/mozilla/NSPasteboard+Utils.h" |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 const CGFloat kBaselineAdjust = 3.0; | 16 const CGFloat kBaselineAdjust = 3.0; |
16 | 17 |
17 // Matches the clipping radius of |GradientButtonCell|. | 18 // Matches the clipping radius of |GradientButtonCell|. |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 NSDictionary* attr = [NSDictionary dictionaryWithObjectsAndKeys: | 527 NSDictionary* attr = [NSDictionary dictionaryWithObjectsAndKeys: |
527 [NSNumber numberWithBool:YES], NSFileExtensionHidden, | 528 [NSNumber numberWithBool:YES], NSFileExtensionHidden, |
528 [NSNumber numberWithUnsignedLong:'ilht'], NSFileHFSTypeCode, | 529 [NSNumber numberWithUnsignedLong:'ilht'], NSFileHFSTypeCode, |
529 [NSNumber numberWithUnsignedLong:'MACS'], NSFileHFSCreatorCode, | 530 [NSNumber numberWithUnsignedLong:'MACS'], NSFileHFSCreatorCode, |
530 nil]; | 531 nil]; |
531 [fileManager setAttributes:attr | 532 [fileManager setAttributes:attr |
532 ofItemAtPath:[outputURL path] | 533 ofItemAtPath:[outputURL path] |
533 error:nil]; | 534 error:nil]; |
534 // Add resource data. | 535 // Add resource data. |
535 OSErr resStatus = WriteURLToNewWebLocFileResourceFork(outputURL, urlStr); | 536 OSErr resStatus = WriteURLToNewWebLocFileResourceFork(outputURL, urlStr); |
536 DCHECK(resStatus == noErr); | 537 OSSTATUS_DCHECK(resStatus == noErr, resStatus); |
537 | 538 |
538 return [NSArray arrayWithObject:nameWithExtensionStr]; | 539 return [NSArray arrayWithObject:nameWithExtensionStr]; |
539 } | 540 } |
540 | 541 |
541 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal { | 542 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal { |
542 return NSDragOperationCopy; | 543 return NSDragOperationCopy; |
543 } | 544 } |
544 | 545 |
545 - (void)updateToolTipsInRect:(NSRect)cellFrame | 546 - (void)updateToolTipsInRect:(NSRect)cellFrame |
546 ofView:(AutocompleteTextField*)controlView { | 547 ofView:(AutocompleteTextField*)controlView { |
547 std::vector<LocationBarDecoration*> decorations; | 548 std::vector<LocationBarDecoration*> decorations; |
548 std::vector<NSRect> decorationFrames; | 549 std::vector<NSRect> decorationFrames; |
549 NSRect textFrame; | 550 NSRect textFrame; |
550 CalculatePositionsInFrame(cellFrame, leftDecorations_, rightDecorations_, | 551 CalculatePositionsInFrame(cellFrame, leftDecorations_, rightDecorations_, |
551 &decorations, &decorationFrames, &textFrame); | 552 &decorations, &decorationFrames, &textFrame); |
552 | 553 |
553 for (size_t i = 0; i < decorations.size(); ++i) { | 554 for (size_t i = 0; i < decorations.size(); ++i) { |
554 NSString* tooltip = decorations[i]->GetToolTip(); | 555 NSString* tooltip = decorations[i]->GetToolTip(); |
555 if ([tooltip length] > 0) | 556 if ([tooltip length] > 0) |
556 [controlView addToolTip:tooltip forRect:decorationFrames[i]]; | 557 [controlView addToolTip:tooltip forRect:decorationFrames[i]]; |
557 } | 558 } |
558 } | 559 } |
559 | 560 |
560 @end | 561 @end |
OLD | NEW |