| 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/toolbar/toolbar_controller.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
| 30 #import "chrome/browser/ui/cocoa/app_menu/app_menu_controller.h" | 30 #import "chrome/browser/ui/cocoa/app_menu/app_menu_controller.h" |
| 31 #import "chrome/browser/ui/cocoa/background_gradient_view.h" | 31 #import "chrome/browser/ui/cocoa/background_gradient_view.h" |
| 32 #include "chrome/browser/ui/cocoa/drag_util.h" | 32 #include "chrome/browser/ui/cocoa/drag_util.h" |
| 33 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" | 33 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" |
| 34 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" | 34 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" |
| 35 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" | 35 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
| 36 #import "chrome/browser/ui/cocoa/gradient_button_cell.h" | 36 #import "chrome/browser/ui/cocoa/gradient_button_cell.h" |
| 37 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 37 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
| 38 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" | 38 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" |
| 39 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" |
| 39 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 40 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 41 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h" |
| 42 #import "chrome/browser/ui/cocoa/location_bar/translate_decoration.h" |
| 40 #import "chrome/browser/ui/cocoa/menu_button.h" | 43 #import "chrome/browser/ui/cocoa/menu_button.h" |
| 41 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button.h" | 44 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button.h" |
| 42 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button_cell.h" | 45 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button_cell.h" |
| 43 #import "chrome/browser/ui/cocoa/toolbar/back_forward_menu_controller.h" | 46 #import "chrome/browser/ui/cocoa/toolbar/back_forward_menu_controller.h" |
| 44 #import "chrome/browser/ui/cocoa/toolbar/reload_button_cocoa.h" | 47 #import "chrome/browser/ui/cocoa/toolbar/reload_button_cocoa.h" |
| 45 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.h" | 48 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.h" |
| 46 #import "chrome/browser/ui/cocoa/toolbar/toolbar_view_cocoa.h" | 49 #import "chrome/browser/ui/cocoa/toolbar/toolbar_view_cocoa.h" |
| 47 #import "chrome/browser/ui/cocoa/view_id_util.h" | 50 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 48 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 51 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 49 #include "chrome/browser/ui/toolbar/app_menu_icon_controller.h" | 52 #include "chrome/browser/ui/toolbar/app_menu_icon_controller.h" |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 [locationBar_ stopAnimation]; | 954 [locationBar_ stopAnimation]; |
| 952 | 955 |
| 953 if (animate) | 956 if (animate) |
| 954 [locationBar_ animateToFrame:locationFrame]; | 957 [locationBar_ animateToFrame:locationFrame]; |
| 955 else | 958 else |
| 956 [locationBar_ setFrame:locationFrame]; | 959 [locationBar_ setFrame:locationFrame]; |
| 957 } | 960 } |
| 958 | 961 |
| 959 - (NSPoint)bookmarkBubblePoint { | 962 - (NSPoint)bookmarkBubblePoint { |
| 960 if (locationBarView_->IsStarEnabled()) | 963 if (locationBarView_->IsStarEnabled()) |
| 961 return locationBarView_->GetBookmarkBubblePoint(); | 964 return locationBarView_->GetBubblePointForDecoration( |
| 965 locationBarView_->star_decoration()); |
| 962 | 966 |
| 963 // Grab bottom middle of hotdogs. | 967 // Grab bottom middle of hotdogs. |
| 964 NSRect frame = appMenuButton_.frame; | 968 NSRect frame = appMenuButton_.frame; |
| 965 NSPoint point = NSMakePoint(NSMidX(frame), NSMinY(frame)); | 969 NSPoint point = NSMakePoint(NSMidX(frame), NSMinY(frame)); |
| 966 // Inset to account for the whitespace around the hotdogs. | 970 // Inset to account for the whitespace around the hotdogs. |
| 967 point.y += app_menu_controller::kAppMenuBubblePointOffsetY; | 971 point.y += app_menu_controller::kAppMenuBubblePointOffsetY; |
| 968 return [self.view convertPoint:point toView:nil]; | 972 return [self.view convertPoint:point toView:nil]; |
| 969 } | 973 } |
| 970 | 974 |
| 971 - (NSPoint)managePasswordsBubblePoint { | |
| 972 return locationBarView_->GetManagePasswordsBubblePoint(); | |
| 973 } | |
| 974 | |
| 975 - (NSPoint)saveCreditCardBubblePoint { | 975 - (NSPoint)saveCreditCardBubblePoint { |
| 976 return locationBarView_->GetSaveCreditCardBubblePoint(); | 976 return locationBarView_->GetSaveCreditCardBubblePoint(); |
| 977 } | 977 } |
| 978 | 978 |
| 979 - (NSPoint)translateBubblePoint { | 979 - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration { |
| 980 return locationBarView_->GetTranslateBubblePoint(); | 980 // |-bookmarkBubblePoint| should be used for the bookmark decoration. |
| 981 DCHECK(decoration != locationBarView_->star_decoration()); |
| 982 |
| 983 return locationBarView_->GetBubblePointForDecoration(decoration); |
| 984 } |
| 985 |
| 986 - (LocationBarDecoration*)bookmarkDecoration { |
| 987 return locationBarView_->star_decoration(); |
| 988 } |
| 989 |
| 990 - (LocationBarDecoration*)translateDecoration { |
| 991 return locationBarView_->translate_decoration(); |
| 981 } | 992 } |
| 982 | 993 |
| 983 - (CGFloat)baseToolbarHeight { | 994 - (CGFloat)baseToolbarHeight { |
| 984 // Height of the toolbar in pixels when the bookmark bar is closed. | 995 // Height of the toolbar in pixels when the bookmark bar is closed. |
| 985 const CGFloat kBaseToolbarHeightNormal = 37; | 996 const CGFloat kBaseToolbarHeightNormal = 37; |
| 986 return kBaseToolbarHeightNormal; | 997 return kBaseToolbarHeightNormal; |
| 987 } | 998 } |
| 988 | 999 |
| 989 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight { | 1000 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight { |
| 990 // With no toolbar, just ignore the compression. | 1001 // With no toolbar, just ignore the compression. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 1090 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 1080 // Do nothing. | 1091 // Do nothing. |
| 1081 } | 1092 } |
| 1082 | 1093 |
| 1083 // (URLDropTargetController protocol) | 1094 // (URLDropTargetController protocol) |
| 1084 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 1095 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
| 1085 return drag_util::IsUnsupportedDropData(profile_, info); | 1096 return drag_util::IsUnsupportedDropData(profile_, info); |
| 1086 } | 1097 } |
| 1087 | 1098 |
| 1088 @end | 1099 @end |
| OLD | NEW |