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

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

Issue 7039047: Clean up bookmark_bar_folder_view testing. Specifically get it working with OCMock. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleaned up nits Created 9 years, 7 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h"
10 #include "content/browser/user_metrics.h" 10 #include "content/browser/user_metrics.h"
11 11
12 #import "third_party/mozilla/NSPasteboard+Utils.h" 12 #import "third_party/mozilla/NSPasteboard+Utils.h"
13 13
14 @implementation BookmarkBarFolderView 14 @implementation BookmarkBarFolderView
15 15
16 @synthesize dropIndicatorShown = dropIndicatorShown_; 16 @synthesize dropIndicatorShown = dropIndicatorShown_;
17 @synthesize dropIndicatorPosition = dropIndicatorPosition_; 17 @synthesize dropIndicatorPosition = dropIndicatorPosition_;
18 @synthesize controller = controller_;
18 19
19 - (void)awakeFromNib { 20 - (void)awakeFromNib {
20 NSArray* types = [NSArray arrayWithObjects: 21 NSArray* types = [NSArray arrayWithObjects:
21 NSStringPboardType, 22 NSStringPboardType,
22 NSHTMLPboardType, 23 NSHTMLPboardType,
23 NSURLPboardType, 24 NSURLPboardType,
24 kBookmarkButtonDragType, 25 kBookmarkButtonDragType,
25 kBookmarkDictionaryListPboardType, 26 kBookmarkDictionaryListPboardType,
26 nil]; 27 nil];
27 [self registerForDraggedTypes:types]; 28 [self registerForDraggedTypes:types];
28 } 29 }
29 30
30 - (void)dealloc { 31 - (void)dealloc {
31 [self unregisterDraggedTypes]; 32 [self unregisterDraggedTypes];
32 [super dealloc]; 33 [super dealloc];
33 } 34 }
34 35
35 - (id<BookmarkButtonControllerProtocol>)controller { 36 - (id<BookmarkButtonControllerProtocol>)controller {
36 // When needed for testing, set the local data member |controller_| to 37 // When needed for testing, set the local data member |controller_| to
37 // the test controller. 38 // the test controller.
38 return controller_ ? controller_ : [[self window] windowController]; 39 return controller_ ? controller_ : [[self window] windowController];
39 } 40 }
40 41
41 - (void)setController:(id)controller {
42 controller_ = controller;
43 }
44
45 - (void)drawRect:(NSRect)rect { 42 - (void)drawRect:(NSRect)rect {
46 // TODO(jrg): copied from bookmark_bar_view but orientation changed. 43 // TODO(jrg): copied from bookmark_bar_view but orientation changed.
47 // Code dup sucks but I'm not sure I can take 16 lines and make it 44 // Code dup sucks but I'm not sure I can take 16 lines and make it
48 // generic for horiz vs vertical while keeping things simple. 45 // generic for horiz vs vertical while keeping things simple.
49 // TODO(jrg): when throwing it all away and using animations, try 46 // TODO(jrg): when throwing it all away and using animations, try
50 // hard to make a common routine for both. 47 // hard to make a common routine for both.
51 // http://crbug.com/35966, http://crbug.com/35968 48 // http://crbug.com/35966, http://crbug.com/35968
52 49
53 // Draw the bookmark-button-dragging drop indicator if necessary. 50 // Draw the bookmark-button-dragging drop indicator if necessary.
54 if (dropIndicatorShown_) { 51 if (dropIndicatorShown_) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 NSPasteboard* pboard = [info draggingPasteboard]; 195 NSPasteboard* pboard = [info draggingPasteboard];
199 if ([pboard dataForType:kBookmarkButtonDragType] && 196 if ([pboard dataForType:kBookmarkButtonDragType] &&
200 [self performDragOperationForBookmarkButton:info]) 197 [self performDragOperationForBookmarkButton:info])
201 return YES; 198 return YES;
202 if ([pboard containsURLData] && [self performDragOperationForURL:info]) 199 if ([pboard containsURLData] && [self performDragOperationForURL:info])
203 return YES; 200 return YES;
204 return NO; 201 return NO;
205 } 202 }
206 203
207 @end 204 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698