| 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 "chrome/browser/cocoa/autocomplete_text_field.h" | 5 #include "chrome/browser/cocoa/autocomplete_text_field.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/cocoa/autocomplete_text_field_cell.h" | 8 #include "chrome/browser/cocoa/autocomplete_text_field_cell.h" |
| 9 | 9 |
| 10 @implementation AutocompleteTextField | 10 @implementation AutocompleteTextField |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 NSEvent* currentEvent = [NSApp currentEvent]; | 136 NSEvent* currentEvent = [NSApp currentEvent]; |
| 137 if ([currentEvent type] == NSLeftMouseUp && | 137 if ([currentEvent type] == NSLeftMouseUp && |
| 138 ![editor selectedRange].length) { | 138 ![editor selectedRange].length) { |
| 139 [editor selectAll:nil]; | 139 [editor selectAll:nil]; |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 | 145 |
| 146 // Check to see if the user clicked the hint icon in the cell. If so, we need | 146 // Check to see if the user clicked the security hint icon in the cell. If so, |
| 147 // to display the page info window. | 147 // we need to display the page info window. |
| 148 const NSRect hintIconFrame = [cell hintImageFrameForFrame:[self bounds]]; | 148 const NSRect hintIconFrame = [cell securityImageFrameForFrame:[self bounds]]; |
| 149 if (NSMouseInRect(location, hintIconFrame, [self isFlipped])) { | 149 if (NSMouseInRect(location, hintIconFrame, [self isFlipped])) { |
| 150 observer_->OnSecurityIconClicked(); | 150 [cell onSecurityIconMousePressed]; |
| 151 return; | 151 return; |
| 152 } | 152 } |
| 153 | 153 |
| 154 NSText* editor = [self currentEditor]; | 154 NSText* editor = [self currentEditor]; |
| 155 | 155 |
| 156 // We should only be here if we accepted first-responder status and | 156 // We should only be here if we accepted first-responder status and |
| 157 // have a field editor. If one of these fires, it means some | 157 // have a field editor. If one of these fires, it means some |
| 158 // assumptions are being broken. | 158 // assumptions are being broken. |
| 159 DCHECK(editor != nil); | 159 DCHECK(editor != nil); |
| 160 DCHECK([editor isDescendantOf:self]); | 160 DCHECK([editor isDescendantOf:self]); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // assumptions still hold, here. | 202 // assumptions still hold, here. |
| 203 DCHECK([editor isKindOfClass:[NSTextView class]]); | 203 DCHECK([editor isKindOfClass:[NSTextView class]]); |
| 204 | 204 |
| 205 NSTextStorage* textStorage = [editor textStorage]; | 205 NSTextStorage* textStorage = [editor textStorage]; |
| 206 DCHECK(textStorage); | 206 DCHECK(textStorage); |
| 207 [textStorage setAttributedString:aString]; | 207 [textStorage setAttributedString:aString]; |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 @end | 211 @end |
| OLD | NEW |