diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-23 18:08:53 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-23 18:08:53 +0000 |
commit | 7d478a4a4a933e8ceb52d579ca78327af91c899f (patch) | |
tree | 62634be4a22d09b6ffb89422afcf8d01a4986561 | |
parent | ca21ee3baf737591e6ded0bb24a69234d77d3c77 (diff) | |
download | chromium_src-7d478a4a4a933e8ceb52d579ca78327af91c899f.zip chromium_src-7d478a4a4a933e8ceb52d579ca78327af91c899f.tar.gz chromium_src-7d478a4a4a933e8ceb52d579ca78327af91c899f.tar.bz2 |
TBR: nsylvain
Revert
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29908 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/nibs/BookmarkBar.xib | 25 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.mm | 16 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller_unittest.mm | 33 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_view.h | 6 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_view.mm | 57 |
6 files changed, 5 insertions, 135 deletions
diff --git a/chrome/app/nibs/BookmarkBar.xib b/chrome/app/nibs/BookmarkBar.xib index 52f4fa3..0163b28 100644 --- a/chrome/app/nibs/BookmarkBar.xib +++ b/chrome/app/nibs/BookmarkBar.xib @@ -634,14 +634,6 @@ </object> <int key="connectionID">94</int> </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">controller_</string> - <reference key="source" ref="610146462"/> - <reference key="destination" ref="1001"/> - </object> - <int key="connectionID">95</int> - </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -964,7 +956,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{191, 181}, {600, 144}}</string> + <string>{{1111, 613}, {600, 144}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -1028,7 +1020,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">95</int> + <int key="maxID">94</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -1126,17 +1118,8 @@ <string key="className">BookmarkBarView</string> <string key="superclassName">NSView</string> <object class="NSMutableDictionary" key="outlets"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>controller_</string> - <string>noItemTextfield_</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>BookmarkBarController</string> - <string>NSTextField</string> - </object> + <string key="NS.key.0">noItemTextfield_</string> + <string key="NS.object.0">NSTextField</string> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> diff --git a/chrome/browser/cocoa/bookmark_bar_controller.h b/chrome/browser/cocoa/bookmark_bar_controller.h index e01312f..31a7f2b 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.h +++ b/chrome/browser/cocoa/bookmark_bar_controller.h @@ -137,9 +137,6 @@ const CGFloat kNoBookmarksNTPVerticalOffset = 27.0; // to the user having selected "Always show the bookmark bar") - (BOOL)isAlwaysVisible; -// Returns true if at least one bookmark was added. -- (BOOL)addURLs:(NSArray*)urls withTitles:(NSArray*)titles at:(NSPoint)point; - // Actions for manipulating bookmarks. // From a button, ... - (IBAction)openBookmark:(id)sender; diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm index 6413e8f..52ec734 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller.mm @@ -202,22 +202,6 @@ browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); } -- (BOOL)addURLs:(NSArray*)urls withTitles:(NSArray*)titles at:(NSPoint)point { - // TODO(jrg): Support drops on folders etc - // TODO(jrg): Use |point|. - DCHECK([urls count] == [titles count]); - const BookmarkNode* node = bookmarkModel_->GetBookmarkBarNode(); - - for (size_t i = 0; i < [urls count]; ++i) { - bookmarkModel_->AddURL( - node, - node->GetChildCount(), - base::SysNSStringToWide([titles objectAtIndex:i]), - GURL([[urls objectAtIndex:i] UTF8String])); - } - return YES; -} - - (int)currentTabContentsHeight { return browser_->GetSelectedTabContents()->view()->GetContainerSize(). height(); diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm index be96e60..985e96f 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm @@ -6,7 +6,6 @@ #include "base/basictypes.h" #include "base/scoped_nsobject.h" -#include "base/sys_string_conversions.h" #import "chrome/browser/cocoa/bookmark_bar_constants.h" #import "chrome/browser/cocoa/bookmark_bar_controller.h" #import "chrome/browser/cocoa/bookmark_bar_view.h" @@ -670,38 +669,6 @@ TEST_F(BookmarkBarControllerTest, BookmarkButtonSizing) { } } -TEST_F(BookmarkBarControllerTest, DropBookmarks) { - BookmarkModel* model = helper_.profile()->GetBookmarkModel(); - const BookmarkNode* parent = model->GetBookmarkBarNode(); - - const char* urls[] = { - "http://qwantz.com", - "http://xkcd.com", - "javascript:alert('lolwut')" - }; - std::wstring titles[] = { - std::wstring(L"Philosophoraptor"), - std::wstring(L"Can't draw"), - std::wstring(L"Inspiration") - }; - EXPECT_EQ(arraysize(urls), arraysize(titles)); - - NSMutableArray* nsurls = [NSMutableArray arrayWithCapacity:0]; - NSMutableArray* nstitles = [NSMutableArray arrayWithCapacity:0]; - for (size_t i = 0; i < arraysize(urls); ++i) { - [nsurls addObject:[NSString stringWithCString:urls[i]]]; - [nstitles addObject:base::SysWideToNSString(titles[i])]; - } - - [bar_ addURLs:nsurls withTitles:nstitles at:NSZeroPoint]; - EXPECT_EQ(3, parent->GetChildCount()); - for (int i = 0; i < parent->GetChildCount(); ++i) { - EXPECT_EQ(parent->GetChild(i)->GetURL(), GURL(urls[i])); - EXPECT_EQ(parent->GetChild(i)->GetTitle(), titles[i]); - } -} - - // Cannot test these methods since they simply call a single static // method, BookmarkEditor::Show(), which is impossible to mock. // editBookmark:, addPage: diff --git a/chrome/browser/cocoa/bookmark_bar_view.h b/chrome/browser/cocoa/bookmark_bar_view.h index 9b81ec4..9bd94d2 100644 --- a/chrome/browser/cocoa/bookmark_bar_view.h +++ b/chrome/browser/cocoa/bookmark_bar_view.h @@ -10,15 +10,11 @@ #import <Cocoa/Cocoa.h> -@class BookmarkBarController; - @interface BookmarkBarView : NSView { - @private - IBOutlet BookmarkBarController* controller_; IBOutlet NSTextField* noItemTextfield_; } -- (NSTextField*)noItemTextfield; +-(NSTextField*)noItemTextfield; @end diff --git a/chrome/browser/cocoa/bookmark_bar_view.mm b/chrome/browser/cocoa/bookmark_bar_view.mm index d2dc208..a991e71 100644 --- a/chrome/browser/cocoa/bookmark_bar_view.mm +++ b/chrome/browser/cocoa/bookmark_bar_view.mm @@ -3,10 +3,7 @@ // found in the LICENSE file. #import "chrome/browser/cocoa/bookmark_bar_view.h" - -#import "chrome/browser/cocoa/bookmark_bar_controller.h" #import "third_party/GTM/AppKit/GTMTheme.h" -#import "third_party/mozilla/include/NSPasteboard+Utils.h" @interface BookmarkBarView (Private) - (void)themeDidChangeNotification:(NSNotification*)aNotification; @@ -17,8 +14,6 @@ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - // This probably isn't strictly necessary, but can't hurt. - [self unregisterDraggedTypes]; [super dealloc]; } @@ -28,11 +23,6 @@ selector:@selector(themeDidChangeNotification:) name:kGTMThemeDidChangeNotification object:nil]; - - DCHECK(controller_ && "Expected this to be hooked via in Interface Builder"); - NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, - NSHTMLPboardType, NSURLPboardType, nil]; - [self registerForDraggedTypes:types]; } - (void)viewDidMoveToWindow { @@ -61,51 +51,4 @@ return noItemTextfield_; } -// NSDraggingDestination methods - -- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info { - if ([[info draggingPasteboard] containsURLData]) - return NSDragOperationCopy; - return NSDragOperationNone; -} - -- (BOOL)wantsPeriodicDraggingUpdates { - // TODO(port): This should probably return |YES| and the controller should - // slide the existing bookmark buttons interactively to the side to make - // room for the about-to-be-dropped bookmark. - return NO; -} - -- (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info { - if ([[info draggingPasteboard] containsURLData]) - return NSDragOperationCopy; - return NSDragOperationNone; -} - -- (void)draggingEnded:(id<NSDraggingInfo>)info { -} - -- (void)draggingExited:(id<NSDraggingInfo>)info { -} - -- (BOOL)prepareForDragOperation:(id<NSDraggingInfo>)info { - return YES; -} - -- (BOOL)performDragOperation:(id<NSDraggingInfo>)info { - NSPasteboard* pboard = [info draggingPasteboard]; - DCHECK([pboard containsURLData]); - - NSArray* urls = nil; - NSArray* titles = nil; - [pboard getURLs:&urls andTitles:&titles]; - - return [controller_ addURLs:urls - withTitles:titles - at:[info draggingLocation]]; -} - -- (void)concludeDragOperation:(id<NSDraggingInfo>)info { -} - @end // @implementation BookmarkBarView |