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/views/bookmark_context_menu_controller_views.h" | 5 #include "chrome/browser/views/bookmark_context_menu_controller_views.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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 | 151 |
152 if (selection_[0]->is_url()) { | 152 if (selection_[0]->is_url()) { |
153 BookmarkEditor::Configuration editor_config; | 153 BookmarkEditor::Configuration editor_config; |
154 if (configuration_ == BOOKMARK_BAR) | 154 if (configuration_ == BOOKMARK_BAR) |
155 editor_config = BookmarkEditor::SHOW_TREE; | 155 editor_config = BookmarkEditor::SHOW_TREE; |
156 else | 156 else |
157 editor_config = BookmarkEditor::NO_TREE; | 157 editor_config = BookmarkEditor::NO_TREE; |
158 BookmarkEditor::Show(parent_window_, profile_, parent_, | 158 BookmarkEditor::Show(parent_window_, profile_, parent_, |
159 BookmarkEditor::EditDetails(selection_[0]), | 159 BookmarkEditor::EditDetails(selection_[0]), |
160 editor_config, NULL); | 160 editor_config); |
161 } else { | 161 } else { |
162 BookmarkFolderEditorController::Show(profile_, parent_window_, | 162 BookmarkFolderEditorController::Show(profile_, parent_window_, |
163 selection_[0], -1, BookmarkFolderEditorController::NONE); | 163 selection_[0], -1, BookmarkFolderEditorController::NONE); |
164 } | 164 } |
165 break; | 165 break; |
166 | 166 |
167 case IDS_BOOKMARK_BAR_REMOVE: { | 167 case IDS_BOOKMARK_BAR_REMOVE: { |
168 UserMetrics::RecordAction( | 168 UserMetrics::RecordAction( |
169 UserMetricsAction("BookmarkBar_ContextMenu_Remove"), profile_); | 169 UserMetricsAction("BookmarkBar_ContextMenu_Remove"), profile_); |
170 | 170 |
(...skipping 11 matching lines...) Expand all Loading... |
182 UserMetrics::RecordAction( | 182 UserMetrics::RecordAction( |
183 UserMetricsAction("BookmarkBar_ContextMenu_Add"), profile_); | 183 UserMetricsAction("BookmarkBar_ContextMenu_Add"), profile_); |
184 | 184 |
185 BookmarkEditor::Configuration editor_config = | 185 BookmarkEditor::Configuration editor_config = |
186 (configuration_ == BOOKMARK_BAR) ? BookmarkEditor::SHOW_TREE : | 186 (configuration_ == BOOKMARK_BAR) ? BookmarkEditor::SHOW_TREE : |
187 BookmarkEditor::NO_TREE; | 187 BookmarkEditor::NO_TREE; |
188 // TODO: this should honor the index from GetParentForNewNodes. | 188 // TODO: this should honor the index from GetParentForNewNodes. |
189 BookmarkEditor::Show( | 189 BookmarkEditor::Show( |
190 parent_window_, profile_, | 190 parent_window_, profile_, |
191 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL), | 191 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL), |
192 BookmarkEditor::EditDetails(), editor_config, NULL); | 192 BookmarkEditor::EditDetails(), editor_config); |
193 break; | 193 break; |
194 } | 194 } |
195 | 195 |
196 case IDS_BOOMARK_BAR_NEW_FOLDER: { | 196 case IDS_BOOMARK_BAR_NEW_FOLDER: { |
197 UserMetrics::RecordAction( | 197 UserMetrics::RecordAction( |
198 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder"), | 198 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder"), |
199 profile_); | 199 profile_); |
200 int index; | 200 int index; |
201 const BookmarkNode* parent = | 201 const BookmarkNode* parent = |
202 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index); | 202 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 return model; | 315 return model; |
316 } | 316 } |
317 | 317 |
318 bool BookmarkContextMenuControllerViews::HasURLs() const { | 318 bool BookmarkContextMenuControllerViews::HasURLs() const { |
319 for (size_t i = 0; i < selection_.size(); ++i) { | 319 for (size_t i = 0; i < selection_.size(); ++i) { |
320 if (NodeHasURLs(selection_[i])) | 320 if (NodeHasURLs(selection_[i])) |
321 return true; | 321 return true; |
322 } | 322 } |
323 return false; | 323 return false; |
324 } | 324 } |
OLD | NEW |