OLD | NEW |
---|---|
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 26 matching lines...) Expand all Loading... | |
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* wc = browser->GetWebContentsAt(i); |
Nico
2012/04/30 15:23:47
nit: The styleguide discourages abbreviations. Doe
tfarina
2012/04/30 16:59:12
Done.
| |
51 const string16 tabTitle = wc->GetTitle(); | 50 ActiveTabNameURLPair tabPair(wc->GetTitle(), wc->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 NSString* name = [[self displayName] stringByTrimmingCharactersInSet: | 59 NSString* name = [[self displayName] stringByTrimmingCharactersInSet: |
63 [NSCharacterSet newlineCharacterSet]]; | 60 [NSCharacterSet newlineCharacterSet]]; |
(...skipping 19 matching lines...) Expand all Loading... | |
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 |
OLD | NEW |