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

Unified Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 7520023: Converted IncognitoForced boolean policy into IncognitoModeAvailability enum policy. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed unnecessary comment. Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/render_view_context_menu.cc
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index ab01be8ed893402fb6c277eda330891b6d923dc9..d02f69d183ef73e409e3620ebde1947b0faf16fb 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/net/browser_url_util.h"
#include "chrome/browser/page_info_window.h"
#include "chrome/browser/platform_util.h"
+#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/prefs/pref_member.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -977,6 +978,8 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
return true;
}
+ IncognitoModePrefs::Availability incognito_avail =
+ IncognitoModePrefs::GetAvailability(profile_->GetPrefs());
switch (id) {
case IDC_BACK:
return source_tab_contents_->controller().CanGoBack();
@@ -1028,8 +1031,10 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
}
case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB:
- case IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW:
return params_.link_url.is_valid();
+ case IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW:
+ return params_.link_url.is_valid() &&
+ incognito_avail != IncognitoModePrefs::FORCED;
case IDC_CONTENT_CONTEXT_COPYLINKLOCATION:
return params_.unfiltered_link_url.is_valid();
@@ -1153,7 +1158,7 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD:
return !profile_->IsOffTheRecord() && params_.link_url.is_valid() &&
- profile_->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled);
+ incognito_avail != IncognitoModePrefs::DISABLED;
case IDC_SPELLCHECK_ADD_TO_DICTIONARY:
return !params_.misspelled_word.empty();
« no previous file with comments | « chrome/browser/profiles/profile.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698