OLD | NEW |
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/cocoa/bookmarks/bookmark_all_tabs_controller.h" | 5 #import "chrome/browser/cocoa/bookmarks/bookmark_all_tabs_controller.h" |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
11 #include "chrome/browser/browser.h" | 11 #include "chrome/browser/browser.h" |
12 #include "chrome/browser/browser_list.h" | 12 #include "chrome/browser/browser_list.h" |
13 #include "chrome/browser/tab_contents/tab_contents.h" | 13 #include "chrome/browser/tab_contents/tab_contents.h" |
| 14 #include "chrome/browser/tab_contents_wrapper.h" |
14 #include "chrome/browser/tabs/tab_strip_model.h" | 15 #include "chrome/browser/tabs/tab_strip_model.h" |
15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
16 | 17 |
17 @implementation BookmarkAllTabsController | 18 @implementation BookmarkAllTabsController |
18 | 19 |
19 - (id)initWithParentWindow:(NSWindow*)parentWindow | 20 - (id)initWithParentWindow:(NSWindow*)parentWindow |
20 profile:(Profile*)profile | 21 profile:(Profile*)profile |
21 parent:(const BookmarkNode*)parent | 22 parent:(const BookmarkNode*)parent |
22 configuration:(BookmarkEditor::Configuration)configuration { | 23 configuration:(BookmarkEditor::Configuration)configuration { |
23 NSString* nibName = @"BookmarkAllTabs"; | 24 NSString* nibName = @"BookmarkAllTabs"; |
(...skipping 13 matching lines...) Expand all Loading... |
37 } | 38 } |
38 | 39 |
39 #pragma mark Bookmark Editing | 40 #pragma mark Bookmark Editing |
40 | 41 |
41 - (void)UpdateActiveTabPairs { | 42 - (void)UpdateActiveTabPairs { |
42 activeTabPairsVector_.clear(); | 43 activeTabPairsVector_.clear(); |
43 Browser* browser = BrowserList::GetLastActive(); | 44 Browser* browser = BrowserList::GetLastActive(); |
44 TabStripModel* tabstrip_model = browser->tabstrip_model(); | 45 TabStripModel* tabstrip_model = browser->tabstrip_model(); |
45 const int tabCount = tabstrip_model->count(); | 46 const int tabCount = tabstrip_model->count(); |
46 for (int i = 0; i < tabCount; ++i) { | 47 for (int i = 0; i < tabCount; ++i) { |
47 TabContents* tc = tabstrip_model->GetTabContentsAt(i); | 48 TabContents* tc = tabstrip_model->GetTabContentsAt(i)->tab_contents(); |
48 const string16 tabTitle = tc->GetTitle(); | 49 const string16 tabTitle = tc->GetTitle(); |
49 const GURL& tabURL(tc->GetURL()); | 50 const GURL& tabURL(tc->GetURL()); |
50 ActiveTabNameURLPair tabPair(tabTitle, tabURL); | 51 ActiveTabNameURLPair tabPair(tabTitle, tabURL); |
51 activeTabPairsVector_.push_back(tabPair); | 52 activeTabPairsVector_.push_back(tabPair); |
52 } | 53 } |
53 } | 54 } |
54 | 55 |
55 // Called by -[BookmarkEditorBaseController ok:]. Creates the container | 56 // Called by -[BookmarkEditorBaseController ok:]. Creates the container |
56 // folder for the tabs and then the bookmarks in that new folder. | 57 // folder for the tabs and then the bookmarks in that new folder. |
57 // Returns a BOOL as an NSNumber indicating that the commit may proceed. | 58 // Returns a BOOL as an NSNumber indicating that the commit may proceed. |
(...skipping 20 matching lines...) Expand all Loading... |
78 } | 79 } |
79 return [NSNumber numberWithBool:YES]; | 80 return [NSNumber numberWithBool:YES]; |
80 } | 81 } |
81 | 82 |
82 - (ActiveTabsNameURLPairVector*)activeTabPairsVector { | 83 - (ActiveTabsNameURLPairVector*)activeTabPairsVector { |
83 return &activeTabPairsVector_; | 84 return &activeTabPairsVector_; |
84 } | 85 } |
85 | 86 |
86 @end // BookmarkAllTabsController | 87 @end // BookmarkAllTabsController |
87 | 88 |
OLD | NEW |