Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.mm

Issue 242823002: Extract GetNodeByID() method from BookmarkModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert a change in bookmarks_helper.cc that colides with a wstring and cq does not like that Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_view.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.h"
6 6
7 #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h" 7 #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h"
8 #include "chrome/browser/bookmarks/bookmark_utils.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #import "chrome/browser/themes/theme_properties.h" 10 #import "chrome/browser/themes/theme_properties.h"
10 #import "chrome/browser/themes/theme_service.h" 11 #import "chrome/browser/themes/theme_service.h"
11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" 13 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
13 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_context_menu_cocoa_controlle r.h" 14 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_context_menu_cocoa_controlle r.h"
14 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" 15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h"
15 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 16 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
16 #import "chrome/browser/ui/cocoa/themed_window.h" 17 #import "chrome/browser/ui/cocoa/themed_window.h"
17 #import "chrome/browser/ui/cocoa/view_id_util.h" 18 #import "chrome/browser/ui/cocoa/view_id_util.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 220
220 // If we're dragging from one profile to another, disallow moving (only 221 // If we're dragging from one profile to another, disallow moving (only
221 // allow copying). Each profile has its own bookmark model, so one way to 222 // allow copying). Each profile has its own bookmark model, so one way to
222 // check whether we are dragging across profiles is to see if the 223 // check whether we are dragging across profiles is to see if the
223 // |BookmarkNode| corresponding to |button| exists in this profile. If it 224 // |BookmarkNode| corresponding to |button| exists in this profile. If it
224 // does, we're dragging within a profile; otherwise, we're dragging across 225 // does, we're dragging within a profile; otherwise, we're dragging across
225 // profiles. 226 // profiles.
226 const BookmarkModel* const model = [[self controller] bookmarkModel]; 227 const BookmarkModel* const model = [[self controller] bookmarkModel];
227 const BookmarkNode* const source_node = [button bookmarkNode]; 228 const BookmarkNode* const source_node = [button bookmarkNode];
228 const BookmarkNode* const target_node = 229 const BookmarkNode* const target_node =
229 model->GetNodeByID(source_node->id()); 230 GetBookmarkNodeByID(model, source_node->id());
230 231
231 BOOL copy = 232 BOOL copy =
232 !([info draggingSourceOperationMask] & NSDragOperationMove) || 233 !([info draggingSourceOperationMask] & NSDragOperationMove) ||
233 (source_node != target_node); 234 (source_node != target_node);
234 rtn = [controller_ dragButton:button 235 rtn = [controller_ dragButton:button
235 to:[info draggingLocation] 236 to:[info draggingLocation]
236 copy:copy]; 237 copy:copy];
237 content::RecordAction(UserMetricsAction("BookmarkBar_DragEnd")); 238 content::RecordAction(UserMetricsAction("BookmarkBar_DragEnd"));
238 } 239 }
239 return rtn; 240 return rtn;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 278
278 @end // @implementation BookmarkBarTextField 279 @end // @implementation BookmarkBarTextField
279 280
280 @implementation BookmarkBarItemContainer 281 @implementation BookmarkBarItemContainer
281 282
282 - (NSMenu*)menu { 283 - (NSMenu*)menu {
283 return [barView_ menu]; 284 return [barView_ menu];
284 } 285 }
285 286
286 @end // @implementation BookmarkBarItemContainer 287 @end // @implementation BookmarkBarItemContainer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698