OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_bar_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
6 | 6 |
7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_editor.h" | 10 #include "chrome/browser/bookmarks/bookmark_editor.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "grit/ui_resources.h" | 49 #include "grit/ui_resources.h" |
50 #include "skia/ext/skia_utils_mac.h" | 50 #include "skia/ext/skia_utils_mac.h" |
51 #include "ui/base/l10n/l10n_util_mac.h" | 51 #include "ui/base/l10n/l10n_util_mac.h" |
52 #include "ui/base/resource/resource_bundle.h" | 52 #include "ui/base/resource/resource_bundle.h" |
53 #include "ui/gfx/image/image.h" | 53 #include "ui/gfx/image/image.h" |
54 #include "ui/gfx/mac/nsimage_cache.h" | 54 #include "ui/gfx/mac/nsimage_cache.h" |
55 | 55 |
56 using content::OpenURLParams; | 56 using content::OpenURLParams; |
57 using content::Referrer; | 57 using content::Referrer; |
58 using content::UserMetricsAction; | 58 using content::UserMetricsAction; |
| 59 using content::WebContents; |
59 | 60 |
60 // Bookmark bar state changing and animations | 61 // Bookmark bar state changing and animations |
61 // | 62 // |
62 // The bookmark bar has three real states: "showing" (a normal bar attached to | 63 // The bookmark bar has three real states: "showing" (a normal bar attached to |
63 // the toolbar), "hidden", and "detached" (pretending to be part of the web | 64 // the toolbar), "hidden", and "detached" (pretending to be part of the web |
64 // content on the NTP). It can, or at least should be able to, animate between | 65 // content on the NTP). It can, or at least should be able to, animate between |
65 // these states. There are several complications even without animation: | 66 // these states. There are several complications even without animation: |
66 // - The placement of the bookmark bar is done by the BWC, and it needs to know | 67 // - The placement of the bookmark bar is done by the BWC, and it needs to know |
67 // the state in order to place the bookmark bar correctly (immediately below | 68 // the state in order to place the bookmark bar correctly (immediately below |
68 // the toolbar when showing, below the infobar when detached). | 69 // the toolbar when showing, below the infobar when detached). |
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2276 if ([self isAnimatingFromState:bookmarks::kDetachedState]) { | 2277 if ([self isAnimatingFromState:bookmarks::kDetachedState]) { |
2277 return static_cast<CGFloat>( | 2278 return static_cast<CGFloat>( |
2278 1 - [[self animatableView] currentAnimationProgress]); | 2279 1 - [[self animatableView] currentAnimationProgress]); |
2279 } | 2280 } |
2280 return 0; | 2281 return 0; |
2281 } | 2282 } |
2282 | 2283 |
2283 #pragma mark BookmarkBarToolbarViewController Protocol | 2284 #pragma mark BookmarkBarToolbarViewController Protocol |
2284 | 2285 |
2285 - (int)currentTabContentsHeight { | 2286 - (int)currentTabContentsHeight { |
2286 TabContents* tc = browser_->GetSelectedTabContents(); | 2287 WebContents* wc = browser_->GetSelectedWebContents(); |
2287 return tc ? tc->GetView()->GetContainerSize().height() : 0; | 2288 return wc ? wc->GetView()->GetContainerSize().height() : 0; |
2288 } | 2289 } |
2289 | 2290 |
2290 - (ui::ThemeProvider*)themeProvider { | 2291 - (ui::ThemeProvider*)themeProvider { |
2291 return ThemeServiceFactory::GetForProfile(browser_->profile()); | 2292 return ThemeServiceFactory::GetForProfile(browser_->profile()); |
2292 } | 2293 } |
2293 | 2294 |
2294 #pragma mark BookmarkButtonDelegate Protocol | 2295 #pragma mark BookmarkButtonDelegate Protocol |
2295 | 2296 |
2296 - (void)fillPasteboard:(NSPasteboard*)pboard | 2297 - (void)fillPasteboard:(NSPasteboard*)pboard |
2297 forDragOfButton:(BookmarkButton*)button { | 2298 forDragOfButton:(BookmarkButton*)button { |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2782 // to minimize touching the object passed in (likely a mock). | 2783 // to minimize touching the object passed in (likely a mock). |
2783 - (void)setButtonContextMenu:(id)menu { | 2784 - (void)setButtonContextMenu:(id)menu { |
2784 buttonContextMenu_ = menu; | 2785 buttonContextMenu_ = menu; |
2785 } | 2786 } |
2786 | 2787 |
2787 - (void)setIgnoreAnimations:(BOOL)ignore { | 2788 - (void)setIgnoreAnimations:(BOOL)ignore { |
2788 ignoreAnimations_ = ignore; | 2789 ignoreAnimations_ = ignore; |
2789 } | 2790 } |
2790 | 2791 |
2791 @end | 2792 @end |
OLD | NEW |