Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(690)

Side by Side Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 2586373003: MacViews: Allow toolkit-views for "Global Error" bubbles. (Closed)
Patch Set: addObserverForName Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 [locationBar_ animateToFrame:locationFrame]; 958 [locationBar_ animateToFrame:locationFrame];
959 else 959 else
960 [locationBar_ setFrame:locationFrame]; 960 [locationBar_ setFrame:locationFrame];
961 } 961 }
962 962
963 - (NSPoint)bookmarkBubblePoint { 963 - (NSPoint)bookmarkBubblePoint {
964 if (locationBarView_->IsStarEnabled()) 964 if (locationBarView_->IsStarEnabled())
965 return locationBarView_->GetBubblePointForDecoration( 965 return locationBarView_->GetBubblePointForDecoration(
966 locationBarView_->star_decoration()); 966 locationBarView_->star_decoration());
967 967
968 // Grab bottom middle of hotdogs. 968 return [self appMenuBubblePoint];
969 NSRect frame = appMenuButton_.frame;
970 NSPoint point = NSMakePoint(NSMidX(frame), NSMinY(frame));
971 // Inset to account for the whitespace around the hotdogs.
972 point.y += app_menu_controller::kAppMenuBubblePointOffsetY;
973 return [self.view convertPoint:point toView:nil];
974 } 969 }
975 970
976 - (NSPoint)saveCreditCardBubblePoint { 971 - (NSPoint)saveCreditCardBubblePoint {
977 return locationBarView_->GetSaveCreditCardBubblePoint(); 972 return locationBarView_->GetSaveCreditCardBubblePoint();
978 } 973 }
979 974
975 - (NSPoint)appMenuBubblePoint {
976 NSRect frame = appMenuButton_.frame;
977 NSPoint point;
978 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
979 // Use the bottom right for MD-style anchoring (no arrow).
980 point = NSMakePoint(NSMaxX(frame), NSMinY(frame));
981 } else {
982 // Grab bottom middle of hotdogs.
983 point = NSMakePoint(NSMidX(frame), NSMinY(frame));
984 // Inset to account for the whitespace around the hotdogs.
985 point.y += app_menu_controller::kAppMenuBubblePointOffsetY;
986 }
987 return [self.view convertPoint:point toView:nil];
988 }
989
980 - (CGFloat)baseToolbarHeight { 990 - (CGFloat)baseToolbarHeight {
981 // Height of the toolbar in pixels when the bookmark bar is closed. 991 // Height of the toolbar in pixels when the bookmark bar is closed.
982 const CGFloat kBaseToolbarHeightNormal = 37; 992 const CGFloat kBaseToolbarHeightNormal = 37;
983 return kBaseToolbarHeightNormal; 993 return kBaseToolbarHeightNormal;
984 } 994 }
985 995
986 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight { 996 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight {
987 // With no toolbar, just ignore the compression. 997 // With no toolbar, just ignore the compression.
988 if (!hasToolbar_) 998 if (!hasToolbar_)
989 return NSHeight([locationBar_ frame]); 999 return NSHeight([locationBar_ frame]);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 - (void)hideDropURLsIndicatorInView:(NSView*)view { 1092 - (void)hideDropURLsIndicatorInView:(NSView*)view {
1083 // Do nothing. 1093 // Do nothing.
1084 } 1094 }
1085 1095
1086 // (URLDropTargetController protocol) 1096 // (URLDropTargetController protocol)
1087 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 1097 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
1088 return drag_util::IsUnsupportedDropData(profile_, info); 1098 return drag_util::IsUnsupportedDropData(profile_, info);
1089 } 1099 }
1090 1100
1091 @end 1101 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/toolbar/toolbar_controller.h ('k') | chrome/browser/ui/views/global_error_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698