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

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

Issue 7670041: Add --use-more-webui runtime flag to toggle WebUI replacements for native dialogs. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
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
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
138 BookmarkEditor::Show(parent_widget_->GetNativeWindow(), profile_, 133 BookmarkEditor::Show(parent_widget_->GetNativeWindow(), profile_,
139 parent_, BookmarkEditor::EditDetails(selection_[0]), 134 BookmarkEditor::EditDetails::EditNode(selection_[0]),
140 BookmarkEditor::SHOW_TREE); 135 BookmarkEditor::SHOW_TREE);
141 #endif
142 } else { 136 } else {
143 BookmarkFolderEditorController::Show(profile_, 137 BookmarkFolderEditorController::Show(profile_,
144 parent_widget_->GetNativeWindow(), selection_[0], -1, 138 parent_widget_->GetNativeWindow(), selection_[0], -1,
145 BookmarkFolderEditorController::EXISTING_BOOKMARK); 139 BookmarkFolderEditorController::EXISTING_BOOKMARK);
146 } 140 }
147 break; 141 break;
148 142
149 case IDC_BOOKMARK_BAR_REMOVE: { 143 case IDC_BOOKMARK_BAR_REMOVE: {
150 UserMetrics::RecordAction( 144 UserMetrics::RecordAction(
151 UserMetricsAction("BookmarkBar_ContextMenu_Remove")); 145 UserMetricsAction("BookmarkBar_ContextMenu_Remove"));
152 146
153 delegate_->WillRemoveBookmarks(selection_); 147 delegate_->WillRemoveBookmarks(selection_);
154 for (size_t i = 0; i < selection_.size(); ++i) { 148 for (size_t i = 0; i < selection_.size(); ++i) {
155 model->Remove(selection_[i]->parent(), 149 model->Remove(selection_[i]->parent(),
156 selection_[i]->parent()->GetIndexOf(selection_[i])); 150 selection_[i]->parent()->GetIndexOf(selection_[i]));
157 } 151 }
158 delegate_->DidRemoveBookmarks(); 152 delegate_->DidRemoveBookmarks();
159 selection_.clear(); 153 selection_.clear();
160 break; 154 break;
161 } 155 }
162 156
163 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: { 157 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: {
164 UserMetrics::RecordAction( 158 UserMetrics::RecordAction(
165 UserMetricsAction("BookmarkBar_ContextMenu_Add")); 159 UserMetricsAction("BookmarkBar_ContextMenu_Add"));
166 160
167 #if defined(WEBUI_DIALOGS)
168 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
169 DCHECK(browser);
170 browser->OpenBookmarkManagerAddNodeIn(selection_[0]->id());
171 #else
172 // TODO: this should honor the index from GetParentForNewNodes. 161 // TODO: this should honor the index from GetParentForNewNodes.
173 BookmarkEditor::Show( 162 BookmarkEditor::Show(
174 parent_widget_->GetNativeWindow(), profile_, 163 parent_widget_->GetNativeWindow(), profile_,
175 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL), 164 BookmarkEditor::EditDetails::AddNodeInFolder(
176 BookmarkEditor::EditDetails(), BookmarkEditor::SHOW_TREE); 165 bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL)),
177 #endif 166 BookmarkEditor::SHOW_TREE);
178 break; 167 break;
179 } 168 }
180 169
181 case IDC_BOOKMARK_BAR_NEW_FOLDER: { 170 case IDC_BOOKMARK_BAR_NEW_FOLDER: {
182 UserMetrics::RecordAction( 171 UserMetrics::RecordAction(
183 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder")); 172 UserMetricsAction("BookmarkBar_ContextMenu_NewFolder"));
184 int index; 173 int index;
185 const BookmarkNode* parent = 174 const BookmarkNode* parent =
186 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index); 175 bookmark_utils::GetParentForNewNodes(parent_, selection_, &index);
187 BookmarkFolderEditorController::Show(profile_, 176 BookmarkFolderEditorController::Show(profile_,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 return model; 296 return model;
308 } 297 }
309 298
310 bool BookmarkContextMenuControllerViews::HasURLs() const { 299 bool BookmarkContextMenuControllerViews::HasURLs() const {
311 for (size_t i = 0; i < selection_.size(); ++i) { 300 for (size_t i = 0; i < selection_.size(); ++i) {
312 if (bookmark_utils::NodeHasURLs(selection_[i])) 301 if (bookmark_utils::NodeHasURLs(selection_[i]))
313 return true; 302 return true;
314 } 303 }
315 return false; 304 return false;
316 } 305 }
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