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