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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 } | 575 } |
576 | 576 |
577 // In general, only show the divider when it's in the normal showing state. | 577 // In general, only show the divider when it's in the normal showing state. |
578 return [self isInState:BookmarkBar::SHOW] ? 0 : 1; | 578 return [self isInState:BookmarkBar::SHOW] ? 0 : 1; |
579 } | 579 } |
580 | 580 |
581 - (NSImage*)faviconForNode:(const BookmarkNode*)node { | 581 - (NSImage*)faviconForNode:(const BookmarkNode*)node { |
582 if (!node) | 582 if (!node) |
583 return defaultImage_; | 583 return defaultImage_; |
584 | 584 |
585 // TODO(joaodasilva): return the "Managed Bookmarks" icon here for the | 585 if (node == bookmarkClient_->managed_node()) { |
586 // managed node. | 586 // Most users never see this node, so the image is only loaded if needed. |
| 587 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 588 return rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER_MANAGED).ToNSImage(); |
| 589 } |
| 590 |
587 if (node->is_folder()) | 591 if (node->is_folder()) |
588 return folderImage_; | 592 return folderImage_; |
589 | 593 |
590 const gfx::Image& favicon = bookmarkModel_->GetFavicon(node); | 594 const gfx::Image& favicon = bookmarkModel_->GetFavicon(node); |
591 if (!favicon.IsEmpty()) | 595 if (!favicon.IsEmpty()) |
592 return favicon.ToNSImage(); | 596 return favicon.ToNSImage(); |
593 | 597 |
594 return defaultImage_; | 598 return defaultImage_; |
595 } | 599 } |
596 | 600 |
(...skipping 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2791 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2795 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
2792 (const BookmarkNode*)node { | 2796 (const BookmarkNode*)node { |
2793 // See if it's in the bar, then if it is in the hierarchy of visible | 2797 // See if it's in the bar, then if it is in the hierarchy of visible |
2794 // folder menus. | 2798 // folder menus. |
2795 if (bookmarkModel_->bookmark_bar_node() == node) | 2799 if (bookmarkModel_->bookmark_bar_node() == node) |
2796 return self; | 2800 return self; |
2797 return [folderController_ controllerForNode:node]; | 2801 return [folderController_ controllerForNode:node]; |
2798 } | 2802 } |
2799 | 2803 |
2800 @end | 2804 @end |
OLD | NEW |