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 Profile* profile = browser->profile(); | |
79 #if defined(USE_AURA) | |
80 BookmarkAllTabsDialog::Show(profile); | |
81 #elif defined(TOOLKIT_VIEWS) || defined(OS_WIN) | |
82 if (ChromeWebUI::IsMoreWebUI()) { | |
83 BookmarkAllTabsDialog::Show(profile); | |
84 } else { | |
85 BookmarkModel* model = profile->GetBookmarkModel(); | |
mazda
2011/11/10 06:03:46
It's nice to make a function to do things in else-
yoshiki
2011/11/10 07:54:38
Done.
| |
86 DCHECK(model && model->IsLoaded()); | |
87 | |
88 BookmarkEditor::EditDetails details = BookmarkEditor::EditDetails | |
89 ::AddFolder(model->GetParentForNewNodes(), -1); | |
90 bookmark_utils::GetURLsForOpenTabs(browser, &(details.urls)); | |
91 DCHECK(!details.urls.empty()); | |
92 | |
93 BookmarkEditor::Show(browser->window()->GetNativeHandle(), | |
94 profile, details, BookmarkEditor::SHOW_TREE); | |
95 } | |
96 #else | |
97 BookmarkModel* model = profile->GetBookmarkModel(); | |
98 DCHECK(model && model->IsLoaded()); | |
99 | |
100 BookmarkEditor::EditDetails details = | |
101 BookmarkEditor::EditDetails::AddFolder(model->GetParentForNewNodes(), -1); | |
102 bookmark_utils::GetURLsForOpenTabs(browser, &(details.urls)); | |
103 DCHECK(!details.urls.empty()); | |
104 | |
105 BookmarkEditor::Show(browser->window()->GetNativeHandle(), | |
106 profile, details, BookmarkEditor::SHOW_TREE); | |
107 #endif | |
108 } | |
OLD | NEW |