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

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

Issue 16625004: components: Move user_prefs into user_prefs namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/browser/ui/bookmarks/bookmark_utils.cc » ('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) 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/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/bookmarks/bookmark_editor.h" 10 #include "chrome/browser/bookmarks/bookmark_editor.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 default: 259 default:
260 NOTREACHED(); 260 NOTREACHED();
261 } 261 }
262 262
263 if (delegate_) 263 if (delegate_)
264 delegate_->DidExecuteCommand(id); 264 delegate_->DidExecuteCommand(id);
265 } 265 }
266 266
267 bool BookmarkContextMenuController::IsCommandIdChecked(int command_id) const { 267 bool BookmarkContextMenuController::IsCommandIdChecked(int command_id) const {
268 PrefService* prefs = components::UserPrefs::Get(profile_); 268 PrefService* prefs = user_prefs::UserPrefs::Get(profile_);
269 if (command_id == IDC_BOOKMARK_BAR_ALWAYS_SHOW) 269 if (command_id == IDC_BOOKMARK_BAR_ALWAYS_SHOW)
270 return prefs->GetBoolean(prefs::kShowBookmarkBar); 270 return prefs->GetBoolean(prefs::kShowBookmarkBar);
271 271
272 DCHECK_EQ(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT, command_id); 272 DCHECK_EQ(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT, command_id);
273 return prefs->GetBoolean(prefs::kShowAppsShortcutInBookmarkBar); 273 return prefs->GetBoolean(prefs::kShowAppsShortcutInBookmarkBar);
274 } 274 }
275 275
276 bool BookmarkContextMenuController::IsCommandIdEnabled(int command_id) const { 276 bool BookmarkContextMenuController::IsCommandIdEnabled(int command_id) const {
277 bool enabled; 277 bool enabled;
278 if (IsPlatformCommandIdEnabled(command_id, &enabled)) 278 if (IsPlatformCommandIdEnabled(command_id, &enabled))
279 return enabled; 279 return enabled;
280 280
281 PrefService* prefs = components::UserPrefs::Get(profile_); 281 PrefService* prefs = user_prefs::UserPrefs::Get(profile_);
282 282
283 bool is_root_node = selection_.size() == 1 && 283 bool is_root_node = selection_.size() == 1 &&
284 selection_[0]->parent() == model_->root_node(); 284 selection_[0]->parent() == model_->root_node();
285 bool can_edit = prefs->GetBoolean(prefs::kEditBookmarksEnabled); 285 bool can_edit = prefs->GetBoolean(prefs::kEditBookmarksEnabled);
286 IncognitoModePrefs::Availability incognito_avail = 286 IncognitoModePrefs::Availability incognito_avail =
287 IncognitoModePrefs::GetAvailability(profile_->GetPrefs()); 287 IncognitoModePrefs::GetAvailability(profile_->GetPrefs());
288 switch (command_id) { 288 switch (command_id) {
289 case IDC_BOOKMARK_BAR_OPEN_INCOGNITO: 289 case IDC_BOOKMARK_BAR_OPEN_INCOGNITO:
290 return !profile_->IsOffTheRecord() && 290 return !profile_->IsOffTheRecord() &&
291 incognito_avail != IncognitoModePrefs::DISABLED; 291 incognito_avail != IncognitoModePrefs::DISABLED;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 int event_flags) { 353 int event_flags) {
354 // By default, there are no platform-specific commands. 354 // By default, there are no platform-specific commands.
355 return false; 355 return false;
356 } 356 }
357 #endif // OS_WIN 357 #endif // OS_WIN
358 358
359 void BookmarkContextMenuController::BookmarkModelChanged() { 359 void BookmarkContextMenuController::BookmarkModelChanged() {
360 if (delegate_) 360 if (delegate_)
361 delegate_->CloseMenu(); 361 delegate_->CloseMenu();
362 } 362 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/browser/ui/bookmarks/bookmark_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698