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

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

Issue 10256013: cocoa: Get rid of an unused wstring floating around BookmarkAllTabsController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_all_tabs_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.h"
6 6
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_model.h" 9 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #include "chrome/browser/tabs/tab_strip_model.h" 10 #include "chrome/browser/tabs/tab_strip_model.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 const GURL& tabURL(wc->GetURL()); 52 const GURL& tabURL(wc->GetURL());
53 ActiveTabNameURLPair tabPair(tabTitle, tabURL); 53 ActiveTabNameURLPair tabPair(tabTitle, tabURL);
54 activeTabPairsVector_.push_back(tabPair); 54 activeTabPairsVector_.push_back(tabPair);
55 } 55 }
56 } 56 }
57 57
58 // Called by -[BookmarkEditorBaseController ok:]. Creates the container 58 // Called by -[BookmarkEditorBaseController ok:]. Creates the container
59 // folder for the tabs and then the bookmarks in that new folder. 59 // folder for the tabs and then the bookmarks in that new folder.
60 // Returns a BOOL as an NSNumber indicating that the commit may proceed. 60 // Returns a BOOL as an NSNumber indicating that the commit may proceed.
61 - (NSNumber*)didCommit { 61 - (NSNumber*)didCommit {
62 NSString* name = [[self displayName] stringByTrimmingCharactersInSet:
63 [NSCharacterSet newlineCharacterSet]];
64 std::wstring newTitle = base::SysNSStringToWide(name);
65 const BookmarkNode* newParentNode = [self selectedNode]; 62 const BookmarkNode* newParentNode = [self selectedNode];
66 if (!newParentNode) 63 if (!newParentNode)
67 return [NSNumber numberWithBool:NO]; 64 return [NSNumber numberWithBool:NO];
68 int newIndex = newParentNode->child_count(); 65 int newIndex = newParentNode->child_count();
69 // Create the new folder which will contain all of the tab URLs. 66 // Create the new folder which will contain all of the tab URLs.
70 NSString* newFolderName = [self displayName]; 67 NSString* newFolderName = [self displayName];
71 string16 newFolderString = base::SysNSStringToUTF16(newFolderName); 68 string16 newFolderString = base::SysNSStringToUTF16(newFolderName);
72 BookmarkModel* model = [self bookmarkModel]; 69 BookmarkModel* model = [self bookmarkModel];
73 const BookmarkNode* newFolder = model->AddFolder(newParentNode, newIndex, 70 const BookmarkNode* newFolder = model->AddFolder(newParentNode, newIndex,
74 newFolderString); 71 newFolderString);
75 // Get a list of all open tabs, create nodes for them, and add 72 // Get a list of all open tabs, create nodes for them, and add
76 // to the new folder node. 73 // to the new folder node.
77 [self UpdateActiveTabPairs]; 74 [self UpdateActiveTabPairs];
78 int i = 0; 75 int i = 0;
79 for (ActiveTabsNameURLPairVector::const_iterator it = 76 for (ActiveTabsNameURLPairVector::const_iterator it =
80 activeTabPairsVector_.begin(); 77 activeTabPairsVector_.begin();
81 it != activeTabPairsVector_.end(); ++it, ++i) { 78 it != activeTabPairsVector_.end(); ++it, ++i) {
82 model->AddURL(newFolder, i, it->first, it->second); 79 model->AddURL(newFolder, i, it->first, it->second);
83 } 80 }
84 return [NSNumber numberWithBool:YES]; 81 return [NSNumber numberWithBool:YES];
85 } 82 }
86 83
87 - (ActiveTabsNameURLPairVector*)activeTabPairsVector { 84 - (ActiveTabsNameURLPairVector*)activeTabPairsVector {
88 return &activeTabPairsVector_; 85 return &activeTabPairsVector_;
89 } 86 }
90 87
91 @end // BookmarkAllTabsController 88 @end // BookmarkAllTabsController
92 89
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698