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

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

Issue 10270004: cocoa/bookmarks: Do not rely on Browser::tabstrip_model() accessor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nico review -> contents Created 8 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
« 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 26 matching lines...) Expand all
37 [self setInitialName: 37 [self setInitialName:
38 l10n_util::GetNSStringWithFixup(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME)]; 38 l10n_util::GetNSStringWithFixup(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME)];
39 [super awakeFromNib]; 39 [super awakeFromNib];
40 } 40 }
41 41
42 #pragma mark Bookmark Editing 42 #pragma mark Bookmark Editing
43 43
44 - (void)UpdateActiveTabPairs { 44 - (void)UpdateActiveTabPairs {
45 activeTabPairsVector_.clear(); 45 activeTabPairsVector_.clear();
46 Browser* browser = BrowserList::GetLastActive(); 46 Browser* browser = BrowserList::GetLastActive();
47 TabStripModel* tabstrip_model = browser->tabstrip_model(); 47 const int tabCount = browser->tab_count();
48 const int tabCount = tabstrip_model->count();
49 for (int i = 0; i < tabCount; ++i) { 48 for (int i = 0; i < tabCount; ++i) {
50 WebContents* wc = tabstrip_model->GetTabContentsAt(i)->web_contents(); 49 WebContents* contents = browser->GetWebContentsAt(i);
51 const string16 tabTitle = wc->GetTitle(); 50 ActiveTabNameURLPair tabPair(contents->GetTitle(), contents->GetURL());
52 const GURL& tabURL(wc->GetURL());
53 ActiveTabNameURLPair tabPair(tabTitle, tabURL);
54 activeTabPairsVector_.push_back(tabPair); 51 activeTabPairsVector_.push_back(tabPair);
55 } 52 }
56 } 53 }
57 54
58 // Called by -[BookmarkEditorBaseController ok:]. Creates the container 55 // Called by -[BookmarkEditorBaseController ok:]. Creates the container
59 // folder for the tabs and then the bookmarks in that new folder. 56 // 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. 57 // Returns a BOOL as an NSNumber indicating that the commit may proceed.
61 - (NSNumber*)didCommit { 58 - (NSNumber*)didCommit {
62 const BookmarkNode* newParentNode = [self selectedNode]; 59 const BookmarkNode* newParentNode = [self selectedNode];
63 if (!newParentNode) 60 if (!newParentNode)
(...skipping 16 matching lines...) Expand all
80 } 77 }
81 return [NSNumber numberWithBool:YES]; 78 return [NSNumber numberWithBool:YES];
82 } 79 }
83 80
84 - (ActiveTabsNameURLPairVector*)activeTabPairsVector { 81 - (ActiveTabsNameURLPairVector*)activeTabPairsVector {
85 return &activeTabPairsVector_; 82 return &activeTabPairsVector_;
86 } 83 }
87 84
88 @end // BookmarkAllTabsController 85 @end // BookmarkAllTabsController
89 86
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