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 "app/mac/nsimage_cache.h" | |
8 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
9 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
10 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
11 #include "chrome/browser/bookmarks/bookmark_editor.h" | 10 #include "chrome/browser/bookmarks/bookmark_editor.h" |
12 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
13 #include "chrome/browser/bookmarks/bookmark_utils.h" | 12 #include "chrome/browser/bookmarks/bookmark_utils.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
17 #import "chrome/browser/themes/theme_service.h" | 16 #import "chrome/browser/themes/theme_service.h" |
(...skipping 26 matching lines...) Expand all Loading... |
44 #include "content/browser/tab_contents/tab_contents.h" | 43 #include "content/browser/tab_contents/tab_contents.h" |
45 #include "content/browser/tab_contents/tab_contents_view.h" | 44 #include "content/browser/tab_contents/tab_contents_view.h" |
46 #include "content/browser/user_metrics.h" | 45 #include "content/browser/user_metrics.h" |
47 #include "grit/app_resources.h" | 46 #include "grit/app_resources.h" |
48 #include "grit/generated_resources.h" | 47 #include "grit/generated_resources.h" |
49 #include "grit/theme_resources.h" | 48 #include "grit/theme_resources.h" |
50 #include "skia/ext/skia_utils_mac.h" | 49 #include "skia/ext/skia_utils_mac.h" |
51 #include "ui/base/l10n/l10n_util_mac.h" | 50 #include "ui/base/l10n/l10n_util_mac.h" |
52 #include "ui/base/resource/resource_bundle.h" | 51 #include "ui/base/resource/resource_bundle.h" |
53 #include "ui/gfx/image/image.h" | 52 #include "ui/gfx/image/image.h" |
| 53 #include "ui/gfx/mac/nsimage_cache.h" |
54 | 54 |
55 // Bookmark bar state changing and animations | 55 // Bookmark bar state changing and animations |
56 // | 56 // |
57 // The bookmark bar has three real states: "showing" (a normal bar attached to | 57 // The bookmark bar has three real states: "showing" (a normal bar attached to |
58 // the toolbar), "hidden", and "detached" (pretending to be part of the web | 58 // the toolbar), "hidden", and "detached" (pretending to be part of the web |
59 // content on the NTP). It can, or at least should be able to, animate between | 59 // content on the NTP). It can, or at least should be able to, animate between |
60 // these states. There are several complications even without animation: | 60 // these states. There are several complications even without animation: |
61 // - The placement of the bookmark bar is done by the BWC, and it needs to know | 61 // - The placement of the bookmark bar is done by the BWC, and it needs to know |
62 // the state in order to place the bookmark bar correctly (immediately below | 62 // the state in order to place the bookmark bar correctly (immediately below |
63 // the toolbar when showing, below the infobar when detached). | 63 // the toolbar when showing, below the infobar when detached). |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 initialWidth_ = initialWidth; | 236 initialWidth_ = initialWidth; |
237 bookmarkModel_ = browser_->profile()->GetBookmarkModel(); | 237 bookmarkModel_ = browser_->profile()->GetBookmarkModel(); |
238 buttons_.reset([[NSMutableArray alloc] init]); | 238 buttons_.reset([[NSMutableArray alloc] init]); |
239 delegate_ = delegate; | 239 delegate_ = delegate; |
240 resizeDelegate_ = resizeDelegate; | 240 resizeDelegate_ = resizeDelegate; |
241 folderTarget_.reset([[BookmarkFolderTarget alloc] initWithController:self]); | 241 folderTarget_.reset([[BookmarkFolderTarget alloc] initWithController:self]); |
242 | 242 |
243 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 243 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
244 folderImage_.reset( | 244 folderImage_.reset( |
245 [rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER) retain]); | 245 [rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER) retain]); |
246 defaultImage_.reset([app::mac::GetCachedImageWithName(@"nav.pdf") retain]); | 246 defaultImage_.reset([gfx::GetCachedImageWithName(@"nav.pdf") retain]); |
247 | 247 |
248 // Register for theme changes, bookmark button pulsing, ... | 248 // Register for theme changes, bookmark button pulsing, ... |
249 NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter]; | 249 NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter]; |
250 [defaultCenter addObserver:self | 250 [defaultCenter addObserver:self |
251 selector:@selector(themeDidChangeNotification:) | 251 selector:@selector(themeDidChangeNotification:) |
252 name:kBrowserThemeDidChangeNotification | 252 name:kBrowserThemeDidChangeNotification |
253 object:nil]; | 253 object:nil]; |
254 [defaultCenter addObserver:self | 254 [defaultCenter addObserver:self |
255 selector:@selector(pulseBookmarkNotification:) | 255 selector:@selector(pulseBookmarkNotification:) |
256 name:bookmark_button::kPulseBookmarkButtonNotification | 256 name:bookmark_button::kPulseBookmarkButtonNotification |
(...skipping 2465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2722 // to minimize touching the object passed in (likely a mock). | 2722 // to minimize touching the object passed in (likely a mock). |
2723 - (void)setButtonContextMenu:(id)menu { | 2723 - (void)setButtonContextMenu:(id)menu { |
2724 buttonContextMenu_ = menu; | 2724 buttonContextMenu_ = menu; |
2725 } | 2725 } |
2726 | 2726 |
2727 - (void)setIgnoreAnimations:(BOOL)ignore { | 2727 - (void)setIgnoreAnimations:(BOOL)ignore { |
2728 ignoreAnimations_ = ignore; | 2728 ignoreAnimations_ = ignore; |
2729 } | 2729 } |
2730 | 2730 |
2731 @end | 2731 @end |
OLD | NEW |