| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |