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" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
16 #include "ui/base/l10n/l10n_util_mac.h" | 16 #include "ui/base/l10n/l10n_util_mac.h" |
17 | 17 |
| 18 using content::WebContents; |
| 19 |
18 @implementation BookmarkAllTabsController | 20 @implementation BookmarkAllTabsController |
19 | 21 |
20 - (id)initWithParentWindow:(NSWindow*)parentWindow | 22 - (id)initWithParentWindow:(NSWindow*)parentWindow |
21 profile:(Profile*)profile | 23 profile:(Profile*)profile |
22 parent:(const BookmarkNode*)parent | 24 parent:(const BookmarkNode*)parent |
23 configuration:(BookmarkEditor::Configuration)configuration { | 25 configuration:(BookmarkEditor::Configuration)configuration { |
24 NSString* nibName = @"BookmarkAllTabs"; | 26 NSString* nibName = @"BookmarkAllTabs"; |
25 if ((self = [super initWithParentWindow:parentWindow | 27 if ((self = [super initWithParentWindow:parentWindow |
26 nibName:nibName | 28 nibName:nibName |
27 profile:profile | 29 profile:profile |
(...skipping 10 matching lines...) Expand all Loading... |
38 } | 40 } |
39 | 41 |
40 #pragma mark Bookmark Editing | 42 #pragma mark Bookmark Editing |
41 | 43 |
42 - (void)UpdateActiveTabPairs { | 44 - (void)UpdateActiveTabPairs { |
43 activeTabPairsVector_.clear(); | 45 activeTabPairsVector_.clear(); |
44 Browser* browser = BrowserList::GetLastActive(); | 46 Browser* browser = BrowserList::GetLastActive(); |
45 TabStripModel* tabstrip_model = browser->tabstrip_model(); | 47 TabStripModel* tabstrip_model = browser->tabstrip_model(); |
46 const int tabCount = tabstrip_model->count(); | 48 const int tabCount = tabstrip_model->count(); |
47 for (int i = 0; i < tabCount; ++i) { | 49 for (int i = 0; i < tabCount; ++i) { |
48 TabContents* tc = tabstrip_model->GetTabContentsAt(i)->tab_contents(); | 50 WebContents* wc = tabstrip_model->GetTabContentsAt(i)->web_contents(); |
49 const string16 tabTitle = tc->GetTitle(); | 51 const string16 tabTitle = wc->GetTitle(); |
50 const GURL& tabURL(tc->GetURL()); | 52 const GURL& tabURL(wc->GetURL()); |
51 ActiveTabNameURLPair tabPair(tabTitle, tabURL); | 53 ActiveTabNameURLPair tabPair(tabTitle, tabURL); |
52 activeTabPairsVector_.push_back(tabPair); | 54 activeTabPairsVector_.push_back(tabPair); |
53 } | 55 } |
54 } | 56 } |
55 | 57 |
56 // Called by -[BookmarkEditorBaseController ok:]. Creates the container | 58 // Called by -[BookmarkEditorBaseController ok:]. Creates the container |
57 // 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. |
58 // 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. |
59 - (NSNumber*)didCommit { | 61 - (NSNumber*)didCommit { |
60 NSString* name = [[self displayName] stringByTrimmingCharactersInSet: | 62 NSString* name = [[self displayName] stringByTrimmingCharactersInSet: |
(...skipping 20 matching lines...) Expand all Loading... |
81 } | 83 } |
82 return [NSNumber numberWithBool:YES]; | 84 return [NSNumber numberWithBool:YES]; |
83 } | 85 } |
84 | 86 |
85 - (ActiveTabsNameURLPairVector*)activeTabPairsVector { | 87 - (ActiveTabsNameURLPairVector*)activeTabPairsVector { |
86 return &activeTabPairsVector_; | 88 return &activeTabPairsVector_; |
87 } | 89 } |
88 | 90 |
89 @end // BookmarkAllTabsController | 91 @end // BookmarkAllTabsController |
90 | 92 |
OLD | NEW |