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

Side by Side Diff: chrome/browser/bookmarks/bookmark_context_menu_controller.cc

Issue 7957002: Reland 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: Merge with trunk. 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 #if defined(WEBUI_DIALOGS) 142 BookmarkEditor::Show(parent_window_, profile_,
143 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); 143 BookmarkEditor::EditDetails::EditNode(selection_[0]),
144 DCHECK(browser); 144 BookmarkEditor::SHOW_TREE);
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
151 } else { 145 } else {
152 BookmarkFolderEditorController::Show(profile_, parent_window_, 146 BookmarkFolderEditorController::Show(profile_, parent_window_,
153 selection_[0], -1, 147 selection_[0], -1,
154 BookmarkFolderEditorController::EXISTING_BOOKMARK); 148 BookmarkFolderEditorController::EXISTING_BOOKMARK);
155 } 149 }
156 break; 150 break;
157 151
158 case IDC_BOOKMARK_BAR_REMOVE: { 152 case IDC_BOOKMARK_BAR_REMOVE: {
159 UserMetrics::RecordAction( 153 UserMetrics::RecordAction(
160 UserMetricsAction("BookmarkBar_ContextMenu_Remove")); 154 UserMetricsAction("BookmarkBar_ContextMenu_Remove"));
161 155
162 for (size_t i = 0; i < selection_.size(); ++i) { 156 for (size_t i = 0; i < selection_.size(); ++i) {
163 int index = selection_[i]->parent()->GetIndexOf(selection_[i]); 157 int index = selection_[i]->parent()->GetIndexOf(selection_[i]);
164 if (index > -1) 158 if (index > -1)
165 model_->Remove(selection_[i]->parent(), index); 159 model_->Remove(selection_[i]->parent(), index);
166 } 160 }
167 selection_.clear(); 161 selection_.clear();
168 break; 162 break;
169 } 163 }
170 164
171 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: { 165 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: {
172 UserMetrics::RecordAction( 166 UserMetrics::RecordAction(
173 UserMetricsAction("BookmarkBar_ContextMenu_Add")); 167 UserMetricsAction("BookmarkBar_ContextMenu_Add"));
174 168
175 #if defined(WEBUI_DIALOGS)
176 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
177 DCHECK(browser);
178 browser->OpenBookmarkManagerAddNodeIn(selection_[0]->id());
179 #else
180 // TODO: this should honor the index from GetParentForNewNodes. 169 // TODO: this should honor the index from GetParentForNewNodes.
181 BookmarkEditor::Show( 170 BookmarkEditor::Show(
182 parent_window_, profile_, 171 parent_window_, profile_,
183 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL), 172 BookmarkEditor::EditDetails::AddNodeInFolder(
184 BookmarkEditor::EditDetails(), BookmarkEditor::SHOW_TREE); 173 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL)),
185 #endif 174 BookmarkEditor::SHOW_TREE);
186 break; 175 break;
187 } 176 }
188 177
189 case IDC_BOOKMARK_BAR_NEW_FOLDER: { 178 case IDC_BOOKMARK_BAR_NEW_FOLDER: {
190 UserMetrics::RecordAction( 179 UserMetrics::RecordAction(
191 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder")); 180 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder"));
192 int index; 181 int index;
193 const BookmarkNode* parent = 182 const BookmarkNode* parent =
194 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index); 183 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index);
195 BookmarkFolderEditorController::Show(profile_, parent_window_, parent, 184 BookmarkFolderEditorController::Show(profile_, parent_window_, parent,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 delegate_->CloseMenu(); 305 delegate_->CloseMenu();
317 } 306 }
318 307
319 bool BookmarkContextMenuController::HasURLs() const { 308 bool BookmarkContextMenuController::HasURLs() const {
320 for (size_t i = 0; i < selection_.size(); ++i) { 309 for (size_t i = 0; i < selection_.size(); ++i) {
321 if (bookmark_utils::NodeHasURLs(selection_[i])) 310 if (bookmark_utils::NodeHasURLs(selection_[i]))
322 return true; 311 return true;
323 } 312 }
324 return false; 313 return false;
325 } 314 }
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