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 #include "chrome/browser/bookmarks/bookmark_editor.h" | 5 #include "chrome/browser/bookmarks/bookmark_editor.h" |
6 #include "chrome/browser/bookmarks/bookmark_input_window_dialog_controller.h" | 6 #include "chrome/browser/bookmarks/bookmark_input_window_dialog_controller.h" |
7 #include "chrome/browser/bookmarks/bookmark_model.h" | 7 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_window.h" |
8 #include "chrome/browser/ui/webui/chrome_web_ui.h" | 11 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
| 12 #include "chrome/browser/ui/webui/bookmark_all_tabs_dialog.h" |
9 | 13 |
10 BookmarkEditor::EditDetails::EditDetails(Type node_type) | 14 BookmarkEditor::EditDetails::EditDetails(Type node_type) |
11 : type(node_type), existing_node(NULL), parent_node(NULL) { | 15 : type(node_type), existing_node(NULL), parent_node(NULL) { |
12 } | 16 } |
13 | 17 |
14 BookmarkEditor::EditDetails BookmarkEditor::EditDetails::EditNode( | 18 BookmarkEditor::EditDetails BookmarkEditor::EditDetails::EditNode( |
15 const BookmarkNode* node) { | 19 const BookmarkNode* node) { |
16 EditDetails details(EXISTING_NODE); | 20 EditDetails details(EXISTING_NODE); |
17 details.existing_node = node; | 21 details.existing_node = node; |
18 if (node) | 22 if (node) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 details.urls.empty())) { | 66 details.urls.empty())) { |
63 BookmarkInputWindowDialogController::Show(profile, parent_window, details); | 67 BookmarkInputWindowDialogController::Show(profile, parent_window, details); |
64 return; | 68 return; |
65 } | 69 } |
66 | 70 |
67 // Delegate to the platform native bookmark editor code. | 71 // Delegate to the platform native bookmark editor code. |
68 ShowNative(parent_window, profile, details.parent_node, details, | 72 ShowNative(parent_window, profile, details.parent_node, details, |
69 configuration); | 73 configuration); |
70 #endif | 74 #endif |
71 } | 75 } |
| 76 |
| 77 void BookmarkEditor::ShowBookmarkAllTabsDialog(Browser* browser) { |
| 78 #if defined(USE_AURA) |
| 79 Profile* profile = browser->profile(); |
| 80 BookmarkAllTabsDialog::Show(profile); |
| 81 #elif defined(TOOLKIT_VIEWS) || defined(OS_WIN) |
| 82 Profile* profile = browser->profile(); |
| 83 if (ChromeWebUI::IsMoreWebUI()) |
| 84 BookmarkAllTabsDialog::Show(profile); |
| 85 else |
| 86 BookmarkEditor::ShowNativeBookmarkAllTabsDialog(browser); |
| 87 #else |
| 88 BookmarkEditor::ShowNativeBookmarkAllTabsDialog(browser); |
| 89 #endif |
| 90 } |
| 91 |
| 92 #if !defined(USE_AURA) |
| 93 void BookmarkEditor::ShowNativeBookmarkAllTabsDialog(Browser* browser) { |
| 94 Profile* profile = browser->profile(); |
| 95 BookmarkModel* model = profile->GetBookmarkModel(); |
| 96 DCHECK(model && model->IsLoaded()); |
| 97 |
| 98 BookmarkEditor::EditDetails details = |
| 99 BookmarkEditor::EditDetails::AddFolder(model->GetParentForNewNodes(), -1); |
| 100 bookmark_utils::GetURLsForOpenTabs(browser, &(details.urls)); |
| 101 DCHECK(!details.urls.empty()); |
| 102 |
| 103 BookmarkEditor::Show(browser->window()->GetNativeHandle(), |
| 104 profile, details, BookmarkEditor::SHOW_TREE); |
| 105 } |
| 106 #endif |
OLD | NEW |