| 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" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_stats.h" | 13 #include "chrome/browser/bookmarks/bookmark_stats.h" |
| 14 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 14 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
| 15 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" |
| 15 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 16 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/themes/theme_properties.h" | 18 #include "chrome/browser/themes/theme_properties.h" |
| 18 #include "chrome/browser/themes/theme_service.h" | 19 #include "chrome/browser/themes/theme_service.h" |
| 19 #import "chrome/browser/themes/theme_service_factory.h" | 20 #import "chrome/browser/themes/theme_service_factory.h" |
| 20 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" | 21 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" |
| 21 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 22 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 22 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/browser/ui/browser_list.h" | 24 #include "chrome/browser/ui/browser_list.h" |
| 24 #include "chrome/browser/ui/chrome_pages.h" | 25 #include "chrome/browser/ui/chrome_pages.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 initialWidth:(CGFloat)initialWidth | 247 initialWidth:(CGFloat)initialWidth |
| 247 delegate:(id<BookmarkBarControllerDelegate>)delegate | 248 delegate:(id<BookmarkBarControllerDelegate>)delegate |
| 248 resizeDelegate:(id<ViewResizer>)resizeDelegate { | 249 resizeDelegate:(id<ViewResizer>)resizeDelegate { |
| 249 if ((self = [super initWithNibName:@"BookmarkBar" | 250 if ((self = [super initWithNibName:@"BookmarkBar" |
| 250 bundle:base::mac::FrameworkBundle()])) { | 251 bundle:base::mac::FrameworkBundle()])) { |
| 251 currentState_ = BookmarkBar::HIDDEN; | 252 currentState_ = BookmarkBar::HIDDEN; |
| 252 lastState_ = BookmarkBar::HIDDEN; | 253 lastState_ = BookmarkBar::HIDDEN; |
| 253 | 254 |
| 254 browser_ = browser; | 255 browser_ = browser; |
| 255 initialWidth_ = initialWidth; | 256 initialWidth_ = initialWidth; |
| 256 bookmarkClient_ = BookmarkModelFactory::GetChromeBookmarkClientForProfile( | 257 bookmarkModel_ = BookmarkModelFactory::GetForProfile(browser_->profile()); |
| 257 browser_->profile()); | 258 bookmarkClient_ = |
| 258 bookmarkModel_ = bookmarkClient_->model(); | 259 ChromeBookmarkClientFactory::GetForProfile(browser_->profile()); |
| 259 buttons_.reset([[NSMutableArray alloc] init]); | 260 buttons_.reset([[NSMutableArray alloc] init]); |
| 260 delegate_ = delegate; | 261 delegate_ = delegate; |
| 261 resizeDelegate_ = resizeDelegate; | 262 resizeDelegate_ = resizeDelegate; |
| 262 folderTarget_.reset( | 263 folderTarget_.reset( |
| 263 [[BookmarkFolderTarget alloc] initWithController:self | 264 [[BookmarkFolderTarget alloc] initWithController:self |
| 264 profile:browser_->profile()]); | 265 profile:browser_->profile()]); |
| 265 | 266 |
| 266 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 267 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 267 folderImage_.reset( | 268 folderImage_.reset( |
| 268 rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER).CopyNSImage()); | 269 rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER).CopyNSImage()); |
| (...skipping 2509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2778 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2779 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 2779 (const BookmarkNode*)node { | 2780 (const BookmarkNode*)node { |
| 2780 // See if it's in the bar, then if it is in the hierarchy of visible | 2781 // See if it's in the bar, then if it is in the hierarchy of visible |
| 2781 // folder menus. | 2782 // folder menus. |
| 2782 if (bookmarkModel_->bookmark_bar_node() == node) | 2783 if (bookmarkModel_->bookmark_bar_node() == node) |
| 2783 return self; | 2784 return self; |
| 2784 return [folderController_ controllerForNode:node]; | 2785 return [folderController_ controllerForNode:node]; |
| 2785 } | 2786 } |
| 2786 | 2787 |
| 2787 @end | 2788 @end |
| OLD | NEW |