OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_context_menu_controller.h" | 5 #include "chrome/browser/bookmarks/bookmark_context_menu_controller.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/bookmarks/bookmark_editor.h" | 9 #include "chrome/browser/bookmarks/bookmark_editor.h" |
10 #include "chrome/browser/bookmarks/bookmark_folder_editor_controller.h" | 10 #include "chrome/browser/bookmarks/bookmark_folder_editor_controller.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 171 } |
172 | 172 |
173 if (selection_[0]->is_url()) { | 173 if (selection_[0]->is_url()) { |
174 BookmarkEditor::Configuration editor_config; | 174 BookmarkEditor::Configuration editor_config; |
175 if (configuration_ == BOOKMARK_BAR) | 175 if (configuration_ == BOOKMARK_BAR) |
176 editor_config = BookmarkEditor::SHOW_TREE; | 176 editor_config = BookmarkEditor::SHOW_TREE; |
177 else | 177 else |
178 editor_config = BookmarkEditor::NO_TREE; | 178 editor_config = BookmarkEditor::NO_TREE; |
179 BookmarkEditor::Show(parent_window_, profile_, parent_, | 179 BookmarkEditor::Show(parent_window_, profile_, parent_, |
180 BookmarkEditor::EditDetails(selection_[0]), | 180 BookmarkEditor::EditDetails(selection_[0]), |
181 editor_config, NULL); | 181 editor_config); |
182 } else { | 182 } else { |
183 BookmarkFolderEditorController::Show(profile_, parent_window_, | 183 BookmarkFolderEditorController::Show(profile_, parent_window_, |
184 selection_[0], -1, BookmarkFolderEditorController::NONE); | 184 selection_[0], -1, BookmarkFolderEditorController::NONE); |
185 } | 185 } |
186 break; | 186 break; |
187 | 187 |
188 case IDS_BOOKMARK_BAR_REMOVE: { | 188 case IDS_BOOKMARK_BAR_REMOVE: { |
189 UserMetrics::RecordAction( | 189 UserMetrics::RecordAction( |
190 UserMetricsAction("BookmarkBar_ContextMenu_Remove"), | 190 UserMetricsAction("BookmarkBar_ContextMenu_Remove"), |
191 profile_); | 191 profile_); |
(...skipping 11 matching lines...) Expand all Loading... |
203 UserMetricsAction("BookmarkBar_ContextMenu_Add"), | 203 UserMetricsAction("BookmarkBar_ContextMenu_Add"), |
204 profile_); | 204 profile_); |
205 | 205 |
206 BookmarkEditor::Configuration editor_config = | 206 BookmarkEditor::Configuration editor_config = |
207 (configuration_ == BOOKMARK_BAR) ? BookmarkEditor::SHOW_TREE : | 207 (configuration_ == BOOKMARK_BAR) ? BookmarkEditor::SHOW_TREE : |
208 BookmarkEditor::NO_TREE; | 208 BookmarkEditor::NO_TREE; |
209 // TODO: this should honor the index from GetParentForNewNodes. | 209 // TODO: this should honor the index from GetParentForNewNodes. |
210 BookmarkEditor::Show( | 210 BookmarkEditor::Show( |
211 parent_window_, profile_, | 211 parent_window_, profile_, |
212 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL), | 212 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL), |
213 BookmarkEditor::EditDetails(), editor_config, NULL); | 213 BookmarkEditor::EditDetails(), editor_config); |
214 break; | 214 break; |
215 } | 215 } |
216 | 216 |
217 case IDS_BOOMARK_BAR_NEW_FOLDER: { | 217 case IDS_BOOMARK_BAR_NEW_FOLDER: { |
218 UserMetrics::RecordAction( | 218 UserMetrics::RecordAction( |
219 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder"), | 219 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder"), |
220 profile_); | 220 profile_); |
221 int index; | 221 int index; |
222 const BookmarkNode* parent = | 222 const BookmarkNode* parent = |
223 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index); | 223 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 delegate_->CloseMenu(); | 331 delegate_->CloseMenu(); |
332 } | 332 } |
333 | 333 |
334 bool BookmarkContextMenuController::HasURLs() const { | 334 bool BookmarkContextMenuController::HasURLs() const { |
335 for (size_t i = 0; i < selection_.size(); ++i) { | 335 for (size_t i = 0; i < selection_.size(); ++i) { |
336 if (NodeHasURLs(selection_[i])) | 336 if (NodeHasURLs(selection_[i])) |
337 return true; | 337 return true; |
338 } | 338 } |
339 return false; | 339 return false; |
340 } | 340 } |
OLD | NEW |