Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1041)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc

Issue 7919028: Revert 101581 - Add --use-more-webui runtime flag to toggle WebUI replacements for native dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/ui/views/bookmarks/bookmark_context_menu_controller_vie ws.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_vie ws.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 case IDC_BOOKMARK_BAR_EDIT: 123 case IDC_BOOKMARK_BAR_EDIT:
124 UserMetrics::RecordAction( 124 UserMetrics::RecordAction(
125 UserMetricsAction("BookmarkBar_ContextMenu_Edit")); 125 UserMetricsAction("BookmarkBar_ContextMenu_Edit"));
126 126
127 if (selection_.size() != 1) { 127 if (selection_.size() != 1) {
128 NOTREACHED(); 128 NOTREACHED();
129 return; 129 return;
130 } 130 }
131 131
132 if (selection_[0]->is_url()) { 132 if (selection_[0]->is_url()) {
133 #if defined(WEBUI_DIALOGS)
134 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
135 DCHECK(browser);
136 browser->OpenBookmarkManagerEditNode(selection_[0]->id());
137 #else
133 BookmarkEditor::Show(parent_widget_->GetNativeWindow(), profile_, 138 BookmarkEditor::Show(parent_widget_->GetNativeWindow(), profile_,
134 BookmarkEditor::EditDetails::EditNode(selection_[0]), 139 parent_, BookmarkEditor::EditDetails(selection_[0]),
135 BookmarkEditor::SHOW_TREE); 140 BookmarkEditor::SHOW_TREE);
141 #endif
136 } else { 142 } else {
137 BookmarkFolderEditorController::Show(profile_, 143 BookmarkFolderEditorController::Show(profile_,
138 parent_widget_->GetNativeWindow(), selection_[0], -1, 144 parent_widget_->GetNativeWindow(), selection_[0], -1,
139 BookmarkFolderEditorController::EXISTING_BOOKMARK); 145 BookmarkFolderEditorController::EXISTING_BOOKMARK);
140 } 146 }
141 break; 147 break;
142 148
143 case IDC_BOOKMARK_BAR_REMOVE: { 149 case IDC_BOOKMARK_BAR_REMOVE: {
144 UserMetrics::RecordAction( 150 UserMetrics::RecordAction(
145 UserMetricsAction("BookmarkBar_ContextMenu_Remove")); 151 UserMetricsAction("BookmarkBar_ContextMenu_Remove"));
146 152
147 delegate_->WillRemoveBookmarks(selection_); 153 delegate_->WillRemoveBookmarks(selection_);
148 for (size_t i = 0; i < selection_.size(); ++i) { 154 for (size_t i = 0; i < selection_.size(); ++i) {
149 model->Remove(selection_[i]->parent(), 155 model->Remove(selection_[i]->parent(),
150 selection_[i]->parent()->GetIndexOf(selection_[i])); 156 selection_[i]->parent()->GetIndexOf(selection_[i]));
151 } 157 }
152 delegate_->DidRemoveBookmarks(); 158 delegate_->DidRemoveBookmarks();
153 selection_.clear(); 159 selection_.clear();
154 break; 160 break;
155 } 161 }
156 162
157 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: { 163 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: {
158 UserMetrics::RecordAction( 164 UserMetrics::RecordAction(
159 UserMetricsAction("BookmarkBar_ContextMenu_Add")); 165 UserMetricsAction("BookmarkBar_ContextMenu_Add"));
160 166
167 #if defined(WEBUI_DIALOGS)
168 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
169 DCHECK(browser);
170 browser->OpenBookmarkManagerAddNodeIn(selection_[0]->id());
171 #else
161 // TODO: this should honor the index from GetParentForNewNodes. 172 // TODO: this should honor the index from GetParentForNewNodes.
162 BookmarkEditor::Show( 173 BookmarkEditor::Show(
163 parent_widget_->GetNativeWindow(), profile_, 174 parent_widget_->GetNativeWindow(), profile_,
164 BookmarkEditor::EditDetails::AddNodeInFolder( 175 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL),
165 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL)), 176 BookmarkEditor::EditDetails(), BookmarkEditor::SHOW_TREE);
166 BookmarkEditor::SHOW_TREE); 177 #endif
167 break; 178 break;
168 } 179 }
169 180
170 case IDC_BOOKMARK_BAR_NEW_FOLDER: { 181 case IDC_BOOKMARK_BAR_NEW_FOLDER: {
171 UserMetrics::RecordAction( 182 UserMetrics::RecordAction(
172 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder")); 183 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder"));
173 int index; 184 int index;
174 const BookmarkNode* parent = 185 const BookmarkNode* parent =
175 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index); 186 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index);
176 BookmarkFolderEditorController::Show(profile_, 187 BookmarkFolderEditorController::Show(profile_,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 return model; 307 return model;
297 } 308 }
298 309
299 bool BookmarkContextMenuControllerViews::HasURLs() const { 310 bool BookmarkContextMenuControllerViews::HasURLs() const {
300 for (size_t i = 0; i < selection_.size(); ++i) { 311 for (size_t i = 0; i < selection_.size(); ++i) {
301 if (bookmark_utils::NodeHasURLs(selection_[i])) 312 if (bookmark_utils::NodeHasURLs(selection_[i]))
302 return true; 313 return true;
303 } 314 }
304 return false; 315 return false;
305 } 316 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698