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

Side by Side Diff: chrome/browser/bookmarks/bookmark_context_menu_controller.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
« no previous file with comments | « build/common.gypi ('k') | chrome/browser/bookmarks/bookmark_editor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bookmarks/bookmark_context_menu_controller.h" 5 #include "chrome/browser/bookmarks/bookmark_context_menu_controller.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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 case IDC_BOOKMARK_BAR_EDIT: 132 case IDC_BOOKMARK_BAR_EDIT:
133 UserMetrics::RecordAction( 133 UserMetrics::RecordAction(
134 UserMetricsAction("BookmarkBar_ContextMenu_Edit")); 134 UserMetricsAction("BookmarkBar_ContextMenu_Edit"));
135 135
136 if (selection_.size() != 1) { 136 if (selection_.size() != 1) {
137 NOTREACHED(); 137 NOTREACHED();
138 break; 138 break;
139 } 139 }
140 140
141 if (selection_[0]->is_url()) { 141 if (selection_[0]->is_url()) {
142 BookmarkEditor::Show(parent_window_, profile_, 142 #if defined(WEBUI_DIALOGS)
143 BookmarkEditor::EditDetails::EditNode(selection_[0]), 143 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
144 BookmarkEditor::SHOW_TREE); 144 DCHECK(browser);
145 browser->OpenBookmarkManagerEditNode(selection_[0]->id());
146 #else
147 BookmarkEditor::Show(parent_window_, profile_, parent_,
148 BookmarkEditor::EditDetails(selection_[0]),
149 BookmarkEditor::SHOW_TREE);
150 #endif
145 } else { 151 } else {
146 BookmarkFolderEditorController::Show(profile_, parent_window_, 152 BookmarkFolderEditorController::Show(profile_, parent_window_,
147 selection_[0], -1, 153 selection_[0], -1,
148 BookmarkFolderEditorController::EXISTING_BOOKMARK); 154 BookmarkFolderEditorController::EXISTING_BOOKMARK);
149 } 155 }
150 break; 156 break;
151 157
152 case IDC_BOOKMARK_BAR_REMOVE: { 158 case IDC_BOOKMARK_BAR_REMOVE: {
153 UserMetrics::RecordAction( 159 UserMetrics::RecordAction(
154 UserMetricsAction("BookmarkBar_ContextMenu_Remove")); 160 UserMetricsAction("BookmarkBar_ContextMenu_Remove"));
155 161
156 for (size_t i = 0; i < selection_.size(); ++i) { 162 for (size_t i = 0; i < selection_.size(); ++i) {
157 int index = selection_[i]->parent()->GetIndexOf(selection_[i]); 163 int index = selection_[i]->parent()->GetIndexOf(selection_[i]);
158 if (index > -1) 164 if (index > -1)
159 model_->Remove(selection_[i]->parent(), index); 165 model_->Remove(selection_[i]->parent(), index);
160 } 166 }
161 selection_.clear(); 167 selection_.clear();
162 break; 168 break;
163 } 169 }
164 170
165 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: { 171 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: {
166 UserMetrics::RecordAction( 172 UserMetrics::RecordAction(
167 UserMetricsAction("BookmarkBar_ContextMenu_Add")); 173 UserMetricsAction("BookmarkBar_ContextMenu_Add"));
168 174
175 #if defined(WEBUI_DIALOGS)
176 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
177 DCHECK(browser);
178 browser->OpenBookmarkManagerAddNodeIn(selection_[0]->id());
179 #else
169 // TODO: this should honor the index from GetParentForNewNodes. 180 // TODO: this should honor the index from GetParentForNewNodes.
170 BookmarkEditor::Show( 181 BookmarkEditor::Show(
171 parent_window_, profile_, 182 parent_window_, profile_,
172 BookmarkEditor::EditDetails::AddNodeInFolder( 183 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL),
173 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL)), 184 BookmarkEditor::EditDetails(), BookmarkEditor::SHOW_TREE);
174 BookmarkEditor::SHOW_TREE); 185 #endif
175 break; 186 break;
176 } 187 }
177 188
178 case IDC_BOOKMARK_BAR_NEW_FOLDER: { 189 case IDC_BOOKMARK_BAR_NEW_FOLDER: {
179 UserMetrics::RecordAction( 190 UserMetrics::RecordAction(
180 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder")); 191 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder"));
181 int index; 192 int index;
182 const BookmarkNode* parent = 193 const BookmarkNode* parent =
183 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index); 194 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index);
184 BookmarkFolderEditorController::Show(profile_, parent_window_, parent, 195 BookmarkFolderEditorController::Show(profile_, parent_window_, parent,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 delegate_->CloseMenu(); 316 delegate_->CloseMenu();
306 } 317 }
307 318
308 bool BookmarkContextMenuController::HasURLs() const { 319 bool BookmarkContextMenuController::HasURLs() const {
309 for (size_t i = 0; i < selection_.size(); ++i) { 320 for (size_t i = 0; i < selection_.size(); ++i) {
310 if (bookmark_utils::NodeHasURLs(selection_[i])) 321 if (bookmark_utils::NodeHasURLs(selection_[i]))
311 return true; 322 return true;
312 } 323 }
313 return false; 324 return false;
314 } 325 }
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | chrome/browser/bookmarks/bookmark_editor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698