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

Side by Side Diff: chrome/browser/ui/cocoa/download/download_shelf_controller.mm

Issue 615663002: Mac: Remove download shelf from AX hierarchy when not visible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test Created 6 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/download/download_shelf_controller_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/download/download_shelf_controller.h" 5 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/browser/download/download_stats.h" 10 #include "chrome/browser/download/download_stats.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 RecordDownloadShelfClose( 245 RecordDownloadShelfClose(
246 [downloadItemControllers_ count], numInProgress, !isUserAction); 246 [downloadItemControllers_ count], numInProgress, !isUserAction);
247 } 247 }
248 248
249 // Animate the shelf out, but not in. 249 // Animate the shelf out, but not in.
250 // TODO(rohitrao): We do not animate on the way in because Cocoa is already 250 // TODO(rohitrao): We do not animate on the way in because Cocoa is already
251 // doing a lot of work to set up the download arrow animation. I've chosen to 251 // doing a lot of work to set up the download arrow animation. I've chosen to
252 // do no animation over janky animation. Find a way to make animating in 252 // do no animation over janky animation. Find a way to make animating in
253 // smoother. 253 // smoother.
254 AnimatableView* view = [self animatableView]; 254 AnimatableView* view = [self animatableView];
255 if (show) 255 if (show) {
256 [view setHeight:maxShelfHeight_]; 256 [view setHeight:maxShelfHeight_];
257 else 257 [view setHidden:NO];
258 } else {
258 [view animateToNewHeight:0 duration:kDownloadShelfCloseDuration]; 259 [view animateToNewHeight:0 duration:kDownloadShelfCloseDuration];
260 }
259 261
260 barIsVisible_ = show; 262 barIsVisible_ = show;
261 [self updateCloseButton]; 263 [self updateCloseButton];
262 } 264 }
263 265
264 - (DownloadShelf*)bridge { 266 - (DownloadShelf*)bridge {
265 return bridge_.get(); 267 return bridge_.get();
266 } 268 }
267 269
268 - (BOOL)isVisible { 270 - (BOOL)isVisible {
269 return barIsVisible_; 271 return barIsVisible_;
270 } 272 }
271 273
272 - (void)animationDidEnd:(NSAnimation*)animation { 274 - (void)animationDidEnd:(NSAnimation*)animation {
273 if (![self isVisible]) 275 if (![self isVisible]) {
274 [self closed]; 276 [self closed];
277 [[self view] setHidden:YES]; // So that it doesn't appear in AX hierarchy.
278 }
275 } 279 }
276 280
277 - (float)height { 281 - (float)height {
278 return maxShelfHeight_; 282 return maxShelfHeight_;
279 } 283 }
280 284
281 // If |skipFirst| is true, the frame of the leftmost item is not set. 285 // If |skipFirst| is true, the frame of the leftmost item is not set.
282 - (void)layoutItems:(BOOL)skipFirst { 286 - (void)layoutItems:(BOOL)skipFirst {
283 CGFloat currentX = 0; 287 CGFloat currentX = 0;
284 for (DownloadItemController* itemController 288 for (DownloadItemController* itemController
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 505 }
502 506
503 // Set the tracking off to create a new tracking area for the control. 507 // Set the tracking off to create a new tracking area for the control.
504 // When changing the bounds/frame on a HoverButton, the tracking isn't updated 508 // When changing the bounds/frame on a HoverButton, the tracking isn't updated
505 // correctly, it needs to be turned off and back on. 509 // correctly, it needs to be turned off and back on.
506 [hoverCloseButton_ setTrackingEnabled:NO]; 510 [hoverCloseButton_ setTrackingEnabled:NO];
507 [hoverCloseButton_ setFrame:bounds]; 511 [hoverCloseButton_ setFrame:bounds];
508 [hoverCloseButton_ setTrackingEnabled:YES]; 512 [hoverCloseButton_ setTrackingEnabled:YES];
509 } 513 }
510 @end 514 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/download/download_shelf_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698