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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm

Issue 2355413007: [Mac] Refactor the Fullscreen Toolbar (Closed)
Patch Set: Nits and grits Created 4 years, 2 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/bookmarks/bookmark_button.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // the stack. 190 // the stack.
191 [self retain]; 191 [self retain];
192 192
193 // Lock bar visibility, forcing the overlay to stay visible if we are in 193 // Lock bar visibility, forcing the overlay to stay visible if we are in
194 // fullscreen mode. 194 // fullscreen mode.
195 if ([[self delegate] dragShouldLockBarVisibility]) { 195 if ([[self delegate] dragShouldLockBarVisibility]) {
196 DCHECK(!visibilityDelegate_); 196 DCHECK(!visibilityDelegate_);
197 NSWindow* window = [[self delegate] browserWindow]; 197 NSWindow* window = [[self delegate] browserWindow];
198 visibilityDelegate_ = 198 visibilityDelegate_ =
199 [BrowserWindowController browserWindowControllerForWindow:window]; 199 [BrowserWindowController browserWindowControllerForWindow:window];
200 [visibilityDelegate_ lockBarVisibilityForOwner:self withAnimation:NO]; 200 [visibilityDelegate_ lockToolbarVisibilityForOwner:self withAnimation:NO];
201 } 201 }
202 const BookmarkNode* node = [self bookmarkNode]; 202 const BookmarkNode* node = [self bookmarkNode];
203 const BookmarkNode* parent = node->parent(); 203 const BookmarkNode* parent = node->parent();
204 if (parent && parent->type() == BookmarkNode::FOLDER) { 204 if (parent && parent->type() == BookmarkNode::FOLDER) {
205 content::RecordAction(UserMetricsAction("BookmarkBarFolder_DragStart")); 205 content::RecordAction(UserMetricsAction("BookmarkBarFolder_DragStart"));
206 } else { 206 } else {
207 content::RecordAction(UserMetricsAction("BookmarkBar_DragStart")); 207 content::RecordAction(UserMetricsAction("BookmarkBar_DragStart"));
208 } 208 }
209 209
210 dragMouseOffset_ = [self convertPoint:[event locationInWindow] fromView:nil]; 210 dragMouseOffset_ = [self convertPoint:[event locationInWindow] fromView:nil];
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 operation |= NSDragOperationDelete; 249 operation |= NSDragOperationDelete;
250 250
251 return operation; 251 return operation;
252 } 252 }
253 253
254 // Overridden to release bar visibility. 254 // Overridden to release bar visibility.
255 - (DraggableButtonResult)endDrag { 255 - (DraggableButtonResult)endDrag {
256 gDraggedButton = nil; 256 gDraggedButton = nil;
257 257
258 // visibilityDelegate_ can be nil if we're detached, and that's fine. 258 // visibilityDelegate_ can be nil if we're detached, and that's fine.
259 [visibilityDelegate_ releaseBarVisibilityForOwner:self withAnimation:YES]; 259 [visibilityDelegate_ releaseToolbarVisibilityForOwner:self withAnimation:YES];
260 visibilityDelegate_ = nil; 260 visibilityDelegate_ = nil;
261 261
262 return kDraggableButtonImplUseBase; 262 return kDraggableButtonImplUseBase;
263 } 263 }
264 264
265 - (void)draggingSession:(NSDraggingSession*)session 265 - (void)draggingSession:(NSDraggingSession*)session
266 endedAtPoint:(NSPoint)aPoint 266 endedAtPoint:(NSPoint)aPoint
267 operation:(NSDragOperation)operation { 267 operation:(NSDragOperation)operation {
268 gDraggedButton = nil; 268 gDraggedButton = nil;
269 // Inform delegate of drag source that we're finished dragging, 269 // Inform delegate of drag source that we're finished dragging,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 [[cell clipPathForFrame:bounds inView:self] setClip]; 518 [[cell clipPathForFrame:bounds inView:self] setClip];
519 [cell drawWithFrame:bounds inView:self]; 519 [cell drawWithFrame:bounds inView:self];
520 520
521 CGContextEndTransparencyLayer(cgContext); 521 CGContextEndTransparencyLayer(cgContext);
522 [image unlockFocus]; 522 [image unlockFocus];
523 523
524 return image.autorelease(); 524 return image.autorelease();
525 } 525 }
526 526
527 @end 527 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698