Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 #include "components/bookmarks/common/bookmark_pref_names.h" | 56 #include "components/bookmarks/common/bookmark_pref_names.h" |
| 57 #include "components/bookmarks/managed/managed_bookmark_service.h" | 57 #include "components/bookmarks/managed/managed_bookmark_service.h" |
| 58 #include "components/prefs/pref_service.h" | 58 #include "components/prefs/pref_service.h" |
| 59 #include "content/public/browser/user_metrics.h" | 59 #include "content/public/browser/user_metrics.h" |
| 60 #include "content/public/browser/web_contents.h" | 60 #include "content/public/browser/web_contents.h" |
| 61 #include "extensions/browser/extension_registry.h" | 61 #include "extensions/browser/extension_registry.h" |
| 62 #include "extensions/common/extension.h" | 62 #include "extensions/common/extension.h" |
| 63 #include "extensions/common/extension_set.h" | 63 #include "extensions/common/extension_set.h" |
| 64 #include "grit/theme_resources.h" | 64 #include "grit/theme_resources.h" |
| 65 #import "ui/base/cocoa/cocoa_base_utils.h" | 65 #import "ui/base/cocoa/cocoa_base_utils.h" |
| 66 #import "ui/base/cocoa/nsview_additions.h" | |
| 66 #include "ui/base/l10n/l10n_util_mac.h" | 67 #include "ui/base/l10n/l10n_util_mac.h" |
| 67 #include "ui/base/resource/resource_bundle.h" | 68 #include "ui/base/resource/resource_bundle.h" |
| 68 #include "ui/gfx/image/image.h" | 69 #include "ui/gfx/image/image.h" |
| 69 #include "ui/resources/grit/ui_resources.h" | 70 #include "ui/resources/grit/ui_resources.h" |
| 70 | 71 |
| 71 using base::UserMetricsAction; | 72 using base::UserMetricsAction; |
| 72 using bookmarks::BookmarkModel; | 73 using bookmarks::BookmarkModel; |
| 73 using bookmarks::BookmarkNode; | 74 using bookmarks::BookmarkNode; |
| 74 using bookmarks::BookmarkNodeData; | 75 using bookmarks::BookmarkNodeData; |
| 75 using content::OpenURLParams; | 76 using content::OpenURLParams; |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1034 } | 1035 } |
| 1035 | 1036 |
| 1036 - (int)preferredHeight { | 1037 - (int)preferredHeight { |
| 1037 DCHECK(![self isAnimationRunning]); | 1038 DCHECK(![self isAnimationRunning]); |
| 1038 | 1039 |
| 1039 if (!barIsEnabled_) | 1040 if (!barIsEnabled_) |
| 1040 return 0; | 1041 return 0; |
| 1041 | 1042 |
| 1042 switch (currentState_) { | 1043 switch (currentState_) { |
| 1043 case BookmarkBar::SHOW: | 1044 case BookmarkBar::SHOW: |
| 1044 return chrome::kBookmarkBarHeight; | 1045 // When on a Retina display the toolbar is 1pt shorter than normal so the |
| 1046 // bookmark bar needs to be 1pt taller in order for the bookmark icons to | |
| 1047 // appear in the right place. See https://crbug.com/326245 . | |
|
Alexei Svitkine (slow)
2016/02/23 01:20:34
Nit: Please make this comment refer to the change
shrike
2016/02/23 01:23:54
If I understand you correctly, you are saying that
| |
| 1048 return [[self view] cr_lineWidth] == 0.5 ? chrome::kBookmarkBarHeight + 1 | |
| 1049 : chrome::kBookmarkBarHeight; | |
| 1045 case BookmarkBar::DETACHED: | 1050 case BookmarkBar::DETACHED: |
| 1046 return chrome::kNTPBookmarkBarHeight; | 1051 return chrome::kNTPBookmarkBarHeight; |
| 1047 case BookmarkBar::HIDDEN: | 1052 case BookmarkBar::HIDDEN: |
| 1048 return 0; | 1053 return 0; |
| 1049 } | 1054 } |
| 1050 } | 1055 } |
| 1051 | 1056 |
| 1052 // Recursively add the given bookmark node and all its children to | 1057 // Recursively add the given bookmark node and all its children to |
| 1053 // menu, one menu item per node. | 1058 // menu, one menu item per node. |
| 1054 - (void)addNode:(const BookmarkNode*)child toMenu:(NSMenu*)menu { | 1059 - (void)addNode:(const BookmarkNode*)child toMenu:(NSMenu*)menu { |
| (...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2945 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2950 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 2946 (const BookmarkNode*)node { | 2951 (const BookmarkNode*)node { |
| 2947 // See if it's in the bar, then if it is in the hierarchy of visible | 2952 // See if it's in the bar, then if it is in the hierarchy of visible |
| 2948 // folder menus. | 2953 // folder menus. |
| 2949 if (bookmarkModel_->bookmark_bar_node() == node) | 2954 if (bookmarkModel_->bookmark_bar_node() == node) |
| 2950 return self; | 2955 return self; |
| 2951 return [folderController_ controllerForNode:node]; | 2956 return [folderController_ controllerForNode:node]; |
| 2952 } | 2957 } |
| 2953 | 2958 |
| 2954 @end | 2959 @end |
| OLD | NEW |