OLD | NEW |
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 #include "chrome/browser/bookmarks/bookmark_editor.h" | 5 #include "chrome/browser/bookmarks/bookmark_editor.h" |
| 6 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
6 #include "chrome/browser/bookmarks/bookmark_utils.h" | 7 #include "chrome/browser/bookmarks/bookmark_utils.h" |
7 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
10 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
11 | 12 |
12 BookmarkEditor::EditDetails::EditDetails(Type node_type) | 13 BookmarkEditor::EditDetails::EditDetails(Type node_type) |
13 : type(node_type), existing_node(NULL), parent_node(NULL), index(-1) { | 14 : type(node_type), existing_node(NULL), parent_node(NULL), index(-1) { |
14 } | 15 } |
15 | 16 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 details.parent_node = parent_node; | 82 details.parent_node = parent_node; |
82 details.index = index; | 83 details.index = index; |
83 return details; | 84 return details; |
84 } | 85 } |
85 | 86 |
86 BookmarkEditor::EditDetails::~EditDetails() { | 87 BookmarkEditor::EditDetails::~EditDetails() { |
87 } | 88 } |
88 | 89 |
89 void BookmarkEditor::ShowBookmarkAllTabsDialog(Browser* browser) { | 90 void BookmarkEditor::ShowBookmarkAllTabsDialog(Browser* browser) { |
90 Profile* profile = browser->profile(); | 91 Profile* profile = browser->profile(); |
91 BookmarkModel* model = profile->GetBookmarkModel(); | 92 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); |
92 DCHECK(model && model->IsLoaded()); | 93 DCHECK(model && model->IsLoaded()); |
93 | 94 |
94 BookmarkEditor::EditDetails details = | 95 BookmarkEditor::EditDetails details = |
95 BookmarkEditor::EditDetails::AddFolder(model->GetParentForNewNodes(), -1); | 96 BookmarkEditor::EditDetails::AddFolder(model->GetParentForNewNodes(), -1); |
96 bookmark_utils::GetURLsForOpenTabs(browser, &(details.urls)); | 97 bookmark_utils::GetURLsForOpenTabs(browser, &(details.urls)); |
97 DCHECK(!details.urls.empty()); | 98 DCHECK(!details.urls.empty()); |
98 | 99 |
99 BookmarkEditor::Show(browser->window()->GetNativeWindow(), | 100 BookmarkEditor::Show(browser->window()->GetNativeWindow(), |
100 profile, details, BookmarkEditor::SHOW_TREE); | 101 profile, details, BookmarkEditor::SHOW_TREE); |
101 } | 102 } |
102 | 103 |
OLD | NEW |