| OLD | NEW |
| 1 // Copyright (c) 2012 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/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "base/mac/mac_logging.h" | 9 #include "base/mac/mac_logging.h" |
| 10 #include "chrome/browser/search/search.h" | 10 #include "chrome/browser/search/search.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // bounds. | 30 // bounds. |
| 31 const CGFloat kLeftDecorationXOffset = 5.0; | 31 const CGFloat kLeftDecorationXOffset = 5.0; |
| 32 const CGFloat kRightDecorationXOffset = 5.0; | 32 const CGFloat kRightDecorationXOffset = 5.0; |
| 33 | 33 |
| 34 // The amount of padding on either side reserved for drawing | 34 // The amount of padding on either side reserved for drawing |
| 35 // decorations. [Views has |kItemPadding| == 3.] | 35 // decorations. [Views has |kItemPadding| == 3.] |
| 36 const CGFloat kDecorationHorizontalPad = 3.0; | 36 const CGFloat kDecorationHorizontalPad = 3.0; |
| 37 | 37 |
| 38 NSString* const kButtonDecorationKey = @"ButtonDecoration"; | 38 NSString* const kButtonDecorationKey = @"ButtonDecoration"; |
| 39 | 39 |
| 40 const ui::NinePartImageIds kPopupBorderImageIds = { | 40 const ui::NinePartImageIds kPopupBorderImageIds = |
| 41 IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW_TOP_LEFT, | 41 IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW); |
| 42 IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW_TOP, | |
| 43 IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW_TOP_RIGHT, | |
| 44 IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW_LEFT, | |
| 45 IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW_CENTER, | |
| 46 IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW_RIGHT, | |
| 47 IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW_BOTTOM_LEFT, | |
| 48 IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW_BOTTOM, | |
| 49 IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW_BOTTOM_RIGHT | |
| 50 }; | |
| 51 | 42 |
| 52 const ui::NinePartImageIds kNormalBorderImageIds = { | 43 const ui::NinePartImageIds kNormalBorderImageIds = |
| 53 IDR_OMNIBOX_BORDER_AND_SHADOW_TOP_LEFT, | 44 IMAGE_GRID(IDR_OMNIBOX_BORDER_AND_SHADOW); |
| 54 IDR_OMNIBOX_BORDER_AND_SHADOW_TOP, | |
| 55 IDR_OMNIBOX_BORDER_AND_SHADOW_TOP_RIGHT, | |
| 56 IDR_OMNIBOX_BORDER_AND_SHADOW_LEFT, | |
| 57 IDR_OMNIBOX_BORDER_AND_SHADOW_CENTER, | |
| 58 IDR_OMNIBOX_BORDER_AND_SHADOW_RIGHT, | |
| 59 IDR_OMNIBOX_BORDER_AND_SHADOW_BOTTOM_LEFT, | |
| 60 IDR_OMNIBOX_BORDER_AND_SHADOW_BOTTOM, | |
| 61 IDR_OMNIBOX_BORDER_AND_SHADOW_BOTTOM_RIGHT | |
| 62 }; | |
| 63 | 45 |
| 64 // How long to wait for mouse-up on the location icon before assuming | 46 // How long to wait for mouse-up on the location icon before assuming |
| 65 // that the user wants to drag. | 47 // that the user wants to drag. |
| 66 const NSTimeInterval kLocationIconDragTimeout = 0.25; | 48 const NSTimeInterval kLocationIconDragTimeout = 0.25; |
| 67 | 49 |
| 68 // Calculate the positions for a set of decorations. |frame| is the | 50 // Calculate the positions for a set of decorations. |frame| is the |
| 69 // overall frame to do layout in, |remaining_frame| will get the | 51 // overall frame to do layout in, |remaining_frame| will get the |
| 70 // left-over space. |all_decorations| is the set of decorations to | 52 // left-over space. |all_decorations| is the set of decorations to |
| 71 // lay out, |decorations| will be set to the decorations which are | 53 // lay out, |decorations| will be set to the decorations which are |
| 72 // visible and which fit, in the same order as |all_decorations|, | 54 // visible and which fit, in the same order as |all_decorations|, |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 NSTextView* fieldEditor = | 800 NSTextView* fieldEditor = |
| 819 base::mac::ObjCCastStrict<NSTextView>([controlView currentEditor]); | 801 base::mac::ObjCCastStrict<NSTextView>([controlView currentEditor]); |
| 820 [fieldEditor updateInsertionPointStateAndRestartTimer:YES]; | 802 [fieldEditor updateInsertionPointStateAndRestartTimer:YES]; |
| 821 } | 803 } |
| 822 | 804 |
| 823 - (BOOL)showsFirstResponder { | 805 - (BOOL)showsFirstResponder { |
| 824 return [super showsFirstResponder] && !hideFocusState_; | 806 return [super showsFirstResponder] && !hideFocusState_; |
| 825 } | 807 } |
| 826 | 808 |
| 827 @end | 809 @end |
| OLD | NEW |