OLD | NEW |
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_bar_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 resizeDelegate_ = resizeDelegate; | 250 resizeDelegate_ = resizeDelegate; |
251 folderTarget_.reset([[BookmarkFolderTarget alloc] initWithController:self]); | 251 folderTarget_.reset([[BookmarkFolderTarget alloc] initWithController:self]); |
252 | 252 |
253 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 253 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
254 folderImage_.reset( | 254 folderImage_.reset( |
255 rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER).CopyNSImage()); | 255 rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER).CopyNSImage()); |
256 defaultImage_.reset( | 256 defaultImage_.reset( |
257 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage()); | 257 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage()); |
258 | 258 |
259 innerContentAnimationsEnabled_ = YES; | 259 innerContentAnimationsEnabled_ = YES; |
260 // Disable state animations (for example, showing or hiding the bookmark | 260 stateAnimationsEnabled_ = YES; |
261 // bar) if the detached bookmark bar will be shown at the bottom of the new | |
262 // tab page. | |
263 stateAnimationsEnabled_ = ![self shouldShowAtBottomWhenDetached]; | |
264 | 261 |
265 // Register for theme changes, bookmark button pulsing, ... | 262 // Register for theme changes, bookmark button pulsing, ... |
266 NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter]; | 263 NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter]; |
267 [defaultCenter addObserver:self | 264 [defaultCenter addObserver:self |
268 selector:@selector(themeDidChangeNotification:) | 265 selector:@selector(themeDidChangeNotification:) |
269 name:kBrowserThemeDidChangeNotification | 266 name:kBrowserThemeDidChangeNotification |
270 object:nil]; | 267 object:nil]; |
271 [defaultCenter addObserver:self | 268 [defaultCenter addObserver:self |
272 selector:@selector(pulseBookmarkNotification:) | 269 selector:@selector(pulseBookmarkNotification:) |
273 name:bookmark_button::kPulseBookmarkButtonNotification | 270 name:bookmark_button::kPulseBookmarkButtonNotification |
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2352 BrowserWindowController* browserController = | 2349 BrowserWindowController* browserController = |
2353 [BrowserWindowController browserWindowControllerForView:[self view]]; | 2350 [BrowserWindowController browserWindowControllerForView:[self view]]; |
2354 return NSHeight([[browserController tabContentArea] frame]); | 2351 return NSHeight([[browserController tabContentArea] frame]); |
2355 } | 2352 } |
2356 | 2353 |
2357 - (ui::ThemeProvider*)themeProvider { | 2354 - (ui::ThemeProvider*)themeProvider { |
2358 return ThemeServiceFactory::GetForProfile(browser_->profile()); | 2355 return ThemeServiceFactory::GetForProfile(browser_->profile()); |
2359 } | 2356 } |
2360 | 2357 |
2361 - (BOOL)shouldShowAtBottomWhenDetached { | 2358 - (BOOL)shouldShowAtBottomWhenDetached { |
2362 return chrome::search::IsInstantExtendedAPIEnabled(browser_->profile()); | 2359 return NO; |
2363 } | 2360 } |
2364 | 2361 |
2365 #pragma mark BookmarkButtonDelegate Protocol | 2362 #pragma mark BookmarkButtonDelegate Protocol |
2366 | 2363 |
2367 - (void)fillPasteboard:(NSPasteboard*)pboard | 2364 - (void)fillPasteboard:(NSPasteboard*)pboard |
2368 forDragOfButton:(BookmarkButton*)button { | 2365 forDragOfButton:(BookmarkButton*)button { |
2369 [[self folderTarget] fillPasteboard:pboard forDragOfButton:button]; | 2366 [[self folderTarget] fillPasteboard:pboard forDragOfButton:button]; |
2370 } | 2367 } |
2371 | 2368 |
2372 // BookmarkButtonDelegate protocol implementation. When menus are | 2369 // BookmarkButtonDelegate protocol implementation. When menus are |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2838 return buttonContextMenu_; | 2835 return buttonContextMenu_; |
2839 } | 2836 } |
2840 | 2837 |
2841 // Intentionally ignores ownership issues; used for testing and we try | 2838 // Intentionally ignores ownership issues; used for testing and we try |
2842 // to minimize touching the object passed in (likely a mock). | 2839 // to minimize touching the object passed in (likely a mock). |
2843 - (void)setButtonContextMenu:(id)menu { | 2840 - (void)setButtonContextMenu:(id)menu { |
2844 buttonContextMenu_ = menu; | 2841 buttonContextMenu_ = menu; |
2845 } | 2842 } |
2846 | 2843 |
2847 @end | 2844 @end |
OLD | NEW |