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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_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_folder_view.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_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/ui/cocoa/bookmarks/bookmark_bar_controller.h" 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h"
11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
12 #include "content/public/browser/user_metrics.h" 13 #include "content/public/browser/user_metrics.h"
13 14
14 using base::UserMetricsAction; 15 using base::UserMetricsAction;
15 16
16 #import "third_party/mozilla/NSPasteboard+Utils.h" 17 #import "third_party/mozilla/NSPasteboard+Utils.h"
17 18
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 155
155 // If we're dragging from one profile to another, disallow moving (only 156 // If we're dragging from one profile to another, disallow moving (only
156 // allow copying). Each profile has its own bookmark model, so one way to 157 // allow copying). Each profile has its own bookmark model, so one way to
157 // check whether we are dragging across profiles is to see if the 158 // check whether we are dragging across profiles is to see if the
158 // |BookmarkNode| corresponding to |button| exists in this profile. If it 159 // |BookmarkNode| corresponding to |button| exists in this profile. If it
159 // does, we're dragging within a profile; otherwise, we're dragging across 160 // does, we're dragging within a profile; otherwise, we're dragging across
160 // profiles. 161 // profiles.
161 const BookmarkModel* const model = [[self controller] bookmarkModel]; 162 const BookmarkModel* const model = [[self controller] bookmarkModel];
162 const BookmarkNode* const source_node = [button bookmarkNode]; 163 const BookmarkNode* const source_node = [button bookmarkNode];
163 const BookmarkNode* const target_node = 164 const BookmarkNode* const target_node =
164 model->GetNodeByID(source_node->id()); 165 GetBookmarkNodeByID(model, source_node->id());
165 166
166 BOOL copy = 167 BOOL copy =
167 !([info draggingSourceOperationMask] & NSDragOperationMove) || 168 !([info draggingSourceOperationMask] & NSDragOperationMove) ||
168 (source_node != target_node); 169 (source_node != target_node);
169 doDrag = [[self controller] dragButton:button 170 doDrag = [[self controller] dragButton:button
170 to:[info draggingLocation] 171 to:[info draggingLocation]
171 copy:copy]; 172 copy:copy];
172 content::RecordAction(UserMetricsAction("BookmarkBarFolder_DragEnd")); 173 content::RecordAction(UserMetricsAction("BookmarkBarFolder_DragEnd"));
173 } 174 }
174 return doDrag; 175 return doDrag;
(...skipping 24 matching lines...) Expand all
199 [dropIndicator_ setBorderType:NSLineBorder]; 200 [dropIndicator_ setBorderType:NSLineBorder];
200 [dropIndicator_ setAlphaValue:0.85]; 201 [dropIndicator_ setAlphaValue:0.85];
201 [self addSubview:dropIndicator_]; 202 [self addSubview:dropIndicator_];
202 } else { 203 } else {
203 [dropIndicator_ removeFromSuperview]; 204 [dropIndicator_ removeFromSuperview];
204 dropIndicator_.reset(); 205 dropIndicator_.reset();
205 } 206 }
206 } 207 }
207 208
208 @end 209 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698