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 "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/mac/sdk_forward_declarations.h" | |
| 8 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 9 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_stats.h" | 13 #include "chrome/browser/bookmarks/bookmark_stats.h" |
| 13 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" | 14 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" |
| 14 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 15 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/themes/theme_properties.h" | 17 #include "chrome/browser/themes/theme_properties.h" |
| 17 #include "chrome/browser/themes/theme_service.h" | 18 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 enabled_extensions().GetAppByURL(url); | 145 enabled_extensions().GetAppByURL(url); |
| 145 if (!extension) | 146 if (!extension) |
| 146 return; | 147 return; |
| 147 | 148 |
| 148 extensions::RecordAppLaunchType(extension_misc::APP_LAUNCH_BOOKMARK_BAR, | 149 extensions::RecordAppLaunchType(extension_misc::APP_LAUNCH_BOOKMARK_BAR, |
| 149 extension->GetType()); | 150 extension->GetType()); |
| 150 } | 151 } |
| 151 | 152 |
| 152 } // namespace | 153 } // namespace |
| 153 | 154 |
| 154 @interface BookmarkBarController(Private) | 155 @interface BookmarkBarController () |
| 155 | 156 |
| 156 // Moves to the given next state (from the current state), possibly animating. | 157 // Moves to the given next state (from the current state), possibly animating. |
| 157 // If |animate| is NO, it will stop any running animation and jump to the given | 158 // If |animate| is NO, it will stop any running animation and jump to the given |
| 158 // state. If YES, it may either (depending on implementation) jump to the end of | 159 // state. If YES, it may either (depending on implementation) jump to the end of |
| 159 // the current animation and begin the next one, or stop the current animation | 160 // the current animation and begin the next one, or stop the current animation |
| 160 // mid-flight and animate to the next state. | 161 // mid-flight and animate to the next state. |
| 161 - (void)moveToState:(BookmarkBar::State)nextState | 162 - (void)moveToState:(BookmarkBar::State)nextState |
| 162 withAnimation:(BOOL)animate; | 163 withAnimation:(BOOL)animate; |
| 163 | 164 |
| 164 // Return the backdrop to the bookmark bar as various types. | 165 // Return the backdrop to the bookmark bar as various types. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 // buttons showing. If too many then show the off-the-side list, if none | 218 // buttons showing. If too many then show the off-the-side list, if none |
| 218 // then show the no items label. | 219 // then show the no items label. |
| 219 - (void)reconfigureBookmarkBar; | 220 - (void)reconfigureBookmarkBar; |
| 220 | 221 |
| 221 - (void)addNode:(const BookmarkNode*)child toMenu:(NSMenu*)menu; | 222 - (void)addNode:(const BookmarkNode*)child toMenu:(NSMenu*)menu; |
| 222 - (void)addFolderNode:(const BookmarkNode*)node toMenu:(NSMenu*)menu; | 223 - (void)addFolderNode:(const BookmarkNode*)node toMenu:(NSMenu*)menu; |
| 223 - (void)tagEmptyMenu:(NSMenu*)menu; | 224 - (void)tagEmptyMenu:(NSMenu*)menu; |
| 224 - (void)clearMenuTagMap; | 225 - (void)clearMenuTagMap; |
| 225 - (int)preferredHeight; | 226 - (int)preferredHeight; |
| 226 - (void)addButtonsToView; | 227 - (void)addButtonsToView; |
| 227 - (BOOL)setBookmarkButtonVisibility; | |
|
tapted
2015/09/21 12:24:03
(this isn't defined, and became an error when the
| |
| 228 - (BOOL)setManagedBookmarksButtonVisibility; | 228 - (BOOL)setManagedBookmarksButtonVisibility; |
| 229 - (BOOL)setSupervisedBookmarksButtonVisibility; | 229 - (BOOL)setSupervisedBookmarksButtonVisibility; |
| 230 - (BOOL)setOtherBookmarksButtonVisibility; | 230 - (BOOL)setOtherBookmarksButtonVisibility; |
| 231 - (BOOL)setAppsPageShortcutButtonVisibility; | 231 - (BOOL)setAppsPageShortcutButtonVisibility; |
| 232 - (BookmarkButton*)createCustomBookmarkButtonForCell:(NSCell*)cell; | 232 - (BookmarkButton*)createCustomBookmarkButtonForCell:(NSCell*)cell; |
| 233 - (void)createManagedBookmarksButton; | 233 - (void)createManagedBookmarksButton; |
| 234 - (void)createSupervisedBookmarksButton; | 234 - (void)createSupervisedBookmarksButton; |
| 235 - (void)createOtherBookmarksButton; | 235 - (void)createOtherBookmarksButton; |
| 236 - (void)createAppsPageShortcutButton; | 236 - (void)createAppsPageShortcutButton; |
| 237 - (void)openAppsPage:(id)sender; | 237 - (void)openAppsPage:(id)sender; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 [button setAction:nil]; | 393 [button setAction:nil]; |
| 394 } | 394 } |
| 395 | 395 |
| 396 bridge_.reset(NULL); | 396 bridge_.reset(NULL); |
| 397 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 397 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 398 [self watchForExitEvent:NO]; | 398 [self watchForExitEvent:NO]; |
| 399 browser_ = nullptr; | 399 browser_ = nullptr; |
| 400 } | 400 } |
| 401 | 401 |
| 402 - (void)awakeFromNib { | 402 - (void)awakeFromNib { |
| 403 [self viewDidLoad]; | |
| 404 } | |
| 405 | |
| 406 - (void)viewDidLoad { | |
| 407 if (bridge_) { | |
| 408 // When running on 10.10, expect both -awakeFromNib and -viewDidLoad to be | |
| 409 // called, but only initialize once. | |
| 410 DCHECK(base::mac::IsOSYosemiteOrLater()); | |
| 411 return; | |
| 412 } | |
| 413 | |
| 403 // We default to NOT open, which means height=0. | 414 // We default to NOT open, which means height=0. |
| 404 DCHECK([[self view] isHidden]); // Hidden so it's OK to change. | 415 DCHECK([[self view] isHidden]); // Hidden so it's OK to change. |
| 405 | 416 |
| 406 // Set our initial height to zero, since that is what the superview | 417 // Set our initial height to zero, since that is what the superview |
| 407 // expects. We will resize ourselves open later if needed. | 418 // expects. We will resize ourselves open later if needed. |
| 408 [[self view] setFrame:NSMakeRect(0, 0, initialWidth_, 0)]; | 419 [[self view] setFrame:NSMakeRect(0, 0, initialWidth_, 0)]; |
| 409 | 420 |
| 410 // Complete init of the "off the side" button, as much as we can. | 421 // Complete init of the "off the side" button, as much as we can. |
| 411 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 422 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 412 [offTheSideButton_ setImage: | 423 [offTheSideButton_ setImage: |
| (...skipping 2513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2926 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2937 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 2927 (const BookmarkNode*)node { | 2938 (const BookmarkNode*)node { |
| 2928 // See if it's in the bar, then if it is in the hierarchy of visible | 2939 // See if it's in the bar, then if it is in the hierarchy of visible |
| 2929 // folder menus. | 2940 // folder menus. |
| 2930 if (bookmarkModel_->bookmark_bar_node() == node) | 2941 if (bookmarkModel_->bookmark_bar_node() == node) |
| 2931 return self; | 2942 return self; |
| 2932 return [folderController_ controllerForNode:node]; | 2943 return [folderController_ controllerForNode:node]; |
| 2933 } | 2944 } |
| 2934 | 2945 |
| 2935 @end | 2946 @end |
| OLD | NEW |