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

Side by Side Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 2850153002: Disable Open in Incognito context item for urls disallowed in Incognito (Closed)
Patch Set: Address feedback Created 3 years, 7 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 | « no previous file | chrome/browser/renderer_context_menu/render_view_context_menu_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer_context_menu/render_view_context_menu.h" 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 2148
2149 const web_modal::WebContentsModalDialogManager* manager = 2149 const web_modal::WebContentsModalDialogManager* manager =
2150 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); 2150 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents);
2151 return !manager || !manager->IsDialogActive(); 2151 return !manager || !manager->IsDialogActive();
2152 } 2152 }
2153 2153
2154 bool RenderViewContextMenu::IsOpenLinkOTREnabled() const { 2154 bool RenderViewContextMenu::IsOpenLinkOTREnabled() const {
2155 if (browser_context_->IsOffTheRecord() || !params_.link_url.is_valid()) 2155 if (browser_context_->IsOffTheRecord() || !params_.link_url.is_valid())
2156 return false; 2156 return false;
2157 2157
2158 if (!chrome::IsURLAllowedInIncognito(params_.link_url, browser_context_))
2159 return false;
2160
2158 IncognitoModePrefs::Availability incognito_avail = 2161 IncognitoModePrefs::Availability incognito_avail =
2159 IncognitoModePrefs::GetAvailability(GetPrefs(browser_context_)); 2162 IncognitoModePrefs::GetAvailability(GetPrefs(browser_context_));
2160 return incognito_avail != IncognitoModePrefs::DISABLED; 2163 return incognito_avail != IncognitoModePrefs::DISABLED;
2161 } 2164 }
2162 2165
2163 void RenderViewContextMenu::ExecOpenLinkNewTab() { 2166 void RenderViewContextMenu::ExecOpenLinkNewTab() {
2164 Browser* browser = chrome::FindBrowserWithWebContents(source_web_contents_); 2167 Browser* browser = chrome::FindBrowserWithWebContents(source_web_contents_);
2165 OpenURLWithExtraHeaders(params_.link_url, GetDocumentURL(params_), 2168 OpenURLWithExtraHeaders(params_.link_url, GetDocumentURL(params_),
2166 (!browser || browser->is_app()) 2169 (!browser || browser->is_app())
2167 ? WindowOpenDisposition::NEW_FOREGROUND_TAB 2170 ? WindowOpenDisposition::NEW_FOREGROUND_TAB
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 void RenderViewContextMenu::PluginActionAt( 2493 void RenderViewContextMenu::PluginActionAt(
2491 const gfx::Point& location, 2494 const gfx::Point& location,
2492 const WebPluginAction& action) { 2495 const WebPluginAction& action) {
2493 source_web_contents_->GetRenderViewHost()-> 2496 source_web_contents_->GetRenderViewHost()->
2494 ExecutePluginActionAtLocation(location, action); 2497 ExecutePluginActionAtLocation(location, action);
2495 } 2498 }
2496 2499
2497 Browser* RenderViewContextMenu::GetBrowser() const { 2500 Browser* RenderViewContextMenu::GetBrowser() const {
2498 return chrome::FindBrowserWithWebContents(embedder_web_contents_); 2501 return chrome::FindBrowserWithWebContents(embedder_web_contents_);
2499 } 2502 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698