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

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

Issue 243703003: Removes win8_util (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar Created 6 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bookmarks/bookmark_context_menu_controller.h" 5 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 void BookmarkContextMenuController::AddCheckboxItem(int id, 123 void BookmarkContextMenuController::AddCheckboxItem(int id,
124 int localization_id) { 124 int localization_id) {
125 menu_model_->AddCheckItemWithStringId(id, localization_id); 125 menu_model_->AddCheckItemWithStringId(id, localization_id);
126 } 126 }
127 127
128 void BookmarkContextMenuController::ExecuteCommand(int id, int event_flags) { 128 void BookmarkContextMenuController::ExecuteCommand(int id, int event_flags) {
129 if (delegate_) 129 if (delegate_)
130 delegate_->WillExecuteCommand(id, selection_); 130 delegate_->WillExecuteCommand(id, selection_);
131 131
132 if (ExecutePlatformCommand(id, event_flags)) {
133 if (delegate_)
134 delegate_->DidExecuteCommand(id);
135 return;
136 }
137
138 switch (id) { 132 switch (id) {
139 case IDC_BOOKMARK_BAR_OPEN_ALL: 133 case IDC_BOOKMARK_BAR_OPEN_ALL:
140 case IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO: 134 case IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO:
141 case IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW: { 135 case IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW: {
142 WindowOpenDisposition initial_disposition; 136 WindowOpenDisposition initial_disposition;
143 if (id == IDC_BOOKMARK_BAR_OPEN_ALL) { 137 if (id == IDC_BOOKMARK_BAR_OPEN_ALL) {
144 initial_disposition = NEW_BACKGROUND_TAB; 138 initial_disposition = NEW_BACKGROUND_TAB;
145 content::RecordAction( 139 content::RecordAction(
146 UserMetricsAction("BookmarkBar_ContextMenu_OpenAll")); 140 UserMetricsAction("BookmarkBar_ContextMenu_OpenAll"));
147 } else if (id == IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW) { 141 } else if (id == IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 bool BookmarkContextMenuController::IsCommandIdChecked(int command_id) const { 310 bool BookmarkContextMenuController::IsCommandIdChecked(int command_id) const {
317 PrefService* prefs = profile_->GetPrefs(); 311 PrefService* prefs = profile_->GetPrefs();
318 if (command_id == IDC_BOOKMARK_BAR_ALWAYS_SHOW) 312 if (command_id == IDC_BOOKMARK_BAR_ALWAYS_SHOW)
319 return prefs->GetBoolean(prefs::kShowBookmarkBar); 313 return prefs->GetBoolean(prefs::kShowBookmarkBar);
320 314
321 DCHECK_EQ(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT, command_id); 315 DCHECK_EQ(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT, command_id);
322 return prefs->GetBoolean(prefs::kShowAppsShortcutInBookmarkBar); 316 return prefs->GetBoolean(prefs::kShowAppsShortcutInBookmarkBar);
323 } 317 }
324 318
325 bool BookmarkContextMenuController::IsCommandIdEnabled(int command_id) const { 319 bool BookmarkContextMenuController::IsCommandIdEnabled(int command_id) const {
326 bool enabled = false;
327 if (IsPlatformCommandIdEnabled(command_id, &enabled))
328 return enabled;
329
330 PrefService* prefs = profile_->GetPrefs(); 320 PrefService* prefs = profile_->GetPrefs();
331 321
332 bool is_root_node = selection_.size() == 1 && 322 bool is_root_node = selection_.size() == 1 &&
333 selection_[0]->parent() == model_->root_node(); 323 selection_[0]->parent() == model_->root_node();
334 bool can_edit = prefs->GetBoolean(prefs::kEditBookmarksEnabled); 324 bool can_edit = prefs->GetBoolean(prefs::kEditBookmarksEnabled);
335 IncognitoModePrefs::Availability incognito_avail = 325 IncognitoModePrefs::Availability incognito_avail =
336 IncognitoModePrefs::GetAvailability(prefs); 326 IncognitoModePrefs::GetAvailability(prefs);
337 switch (command_id) { 327 switch (command_id) {
338 case IDC_BOOKMARK_BAR_OPEN_INCOGNITO: 328 case IDC_BOOKMARK_BAR_OPEN_INCOGNITO:
339 return !profile_->IsOffTheRecord() && 329 return !profile_->IsOffTheRecord() &&
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 383 }
394 return true; 384 return true;
395 } 385 }
396 386
397 bool BookmarkContextMenuController::GetAcceleratorForCommandId( 387 bool BookmarkContextMenuController::GetAcceleratorForCommandId(
398 int command_id, 388 int command_id,
399 ui::Accelerator* accelerator) { 389 ui::Accelerator* accelerator) {
400 return false; 390 return false;
401 } 391 }
402 392
403 #if !defined(OS_WIN)
404 bool BookmarkContextMenuController::IsPlatformCommandIdEnabled(
405 int command_id,
406 bool* enabled) const {
407 // By default, there are no platform-specific enabled or disabled commands.
408 return false;
409 }
410
411 bool BookmarkContextMenuController::ExecutePlatformCommand(int id,
412 int event_flags) {
413 // By default, there are no platform-specific commands.
414 return false;
415 }
416 #endif // OS_WIN
417
418 void BookmarkContextMenuController::BookmarkModelChanged() { 393 void BookmarkContextMenuController::BookmarkModelChanged() {
419 if (delegate_) 394 if (delegate_)
420 delegate_->CloseMenu(); 395 delegate_->CloseMenu();
421 } 396 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698