| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "app/l10n_util_mac.h" | 5 #include "app/l10n_util_mac.h" |
| 6 #include "app/resource_bundle.h" | 6 #include "app/resource_bundle.h" |
| 7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_editor.h" | 9 #include "chrome/browser/bookmarks/bookmark_editor.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 [[self backgroundGradientView] setShowsDivider:YES]; | 353 [[self backgroundGradientView] setShowsDivider:YES]; |
| 354 [[self view] setHidden:NO]; | 354 [[self view] setHidden:NO]; |
| 355 AnimatableView* view = [self animatableView]; | 355 AnimatableView* view = [self animatableView]; |
| 356 // Height takes into account the extra height we have since the toolbar | 356 // Height takes into account the extra height we have since the toolbar |
| 357 // only compresses when we're done. | 357 // only compresses when we're done. |
| 358 [view animateToNewHeight:(bookmarks::kBookmarkBarHeight - | 358 [view animateToNewHeight:(bookmarks::kBookmarkBarHeight - |
| 359 kBookmarkBarOverlap) | 359 kBookmarkBarOverlap) |
| 360 duration:kBookmarkBarAnimationDuration]; | 360 duration:kBookmarkBarAnimationDuration]; |
| 361 } else if ([self isAnimatingFromState:bookmarks::kShowingState | 361 } else if ([self isAnimatingFromState:bookmarks::kShowingState |
| 362 toState:bookmarks::kHiddenState]) { | 362 toState:bookmarks::kHiddenState]) { |
| 363 // The toolbar uncompresses immediately at the beginning (otherwise the | |
| 364 // slide looks wrong, since we slide into the bottom of stuff in the | |
| 365 // toolbar). Do this only if we're at the beginning height since we may | |
| 366 // enter this mid-animation. | |
| 367 if (NSHeight([[self view] frame]) == bookmarks::kBookmarkBarHeight) { | |
| 368 [resizeDelegate_ resizeView:[self view] | |
| 369 newHeight:(bookmarks::kBookmarkBarHeight - | |
| 370 kBookmarkBarOverlap)]; | |
| 371 } | |
| 372 [[self backgroundGradientView] setShowsDivider:YES]; | 363 [[self backgroundGradientView] setShowsDivider:YES]; |
| 373 [[self view] setHidden:NO]; | 364 [[self view] setHidden:NO]; |
| 374 AnimatableView* view = [self animatableView]; | 365 AnimatableView* view = [self animatableView]; |
| 375 [view animateToNewHeight:0 | 366 [view animateToNewHeight:0 |
| 376 duration:kBookmarkBarAnimationDuration]; | 367 duration:kBookmarkBarAnimationDuration]; |
| 377 } else if ([self isAnimatingFromState:bookmarks::kShowingState | 368 } else if ([self isAnimatingFromState:bookmarks::kShowingState |
| 378 toState:bookmarks::kDetachedState]) { | 369 toState:bookmarks::kDetachedState]) { |
| 379 // The toolbar uncompresses immediately at the beginning (otherwise the | |
| 380 // slide looks wrong, since we slide into the bottom of stuff in the | |
| 381 // toolbar). Do this only if we're at the beginning height since we may | |
| 382 // enter this mid-animation. | |
| 383 if (NSHeight([[self view] frame]) == bookmarks::kBookmarkBarHeight) { | |
| 384 [resizeDelegate_ resizeView:[self view] | |
| 385 newHeight:(bookmarks::kBookmarkBarHeight - | |
| 386 kBookmarkBarOverlap)]; | |
| 387 } | |
| 388 [[self backgroundGradientView] setShowsDivider:YES]; | 370 [[self backgroundGradientView] setShowsDivider:YES]; |
| 389 [[self view] setHidden:NO]; | 371 [[self view] setHidden:NO]; |
| 390 AnimatableView* view = [self animatableView]; | 372 AnimatableView* view = [self animatableView]; |
| 391 [view animateToNewHeight:bookmarks::kNTPBookmarkBarHeight | 373 [view animateToNewHeight:bookmarks::kNTPBookmarkBarHeight |
| 392 duration:kBookmarkBarAnimationDuration]; | 374 duration:kBookmarkBarAnimationDuration]; |
| 393 } else if ([self isAnimatingFromState:bookmarks::kDetachedState | 375 } else if ([self isAnimatingFromState:bookmarks::kDetachedState |
| 394 toState:bookmarks::kShowingState]) { | 376 toState:bookmarks::kShowingState]) { |
| 395 [[self backgroundGradientView] setShowsDivider:YES]; | 377 [[self backgroundGradientView] setShowsDivider:YES]; |
| 396 [[self view] setHidden:NO]; | 378 [[self view] setHidden:NO]; |
| 397 AnimatableView* view = [self animatableView]; | 379 AnimatableView* view = [self animatableView]; |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 [[self animatableView] currentAnimationProgress]); | 1341 [[self animatableView] currentAnimationProgress]); |
| 1360 } | 1342 } |
| 1361 if ([self isAnimatingFromState:bookmarks::kDetachedState]) { | 1343 if ([self isAnimatingFromState:bookmarks::kDetachedState]) { |
| 1362 return static_cast<CGFloat>( | 1344 return static_cast<CGFloat>( |
| 1363 1 - [[self animatableView] currentAnimationProgress]); | 1345 1 - [[self animatableView] currentAnimationProgress]); |
| 1364 } | 1346 } |
| 1365 return 0; | 1347 return 0; |
| 1366 } | 1348 } |
| 1367 | 1349 |
| 1368 @end | 1350 @end |
| OLD | NEW |