Chromium Code Reviews| 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 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2091 } | 2091 } |
| 2092 | 2092 |
| 2093 Browser* browser = GetBrowser(); | 2093 Browser* browser = GetBrowser(); |
| 2094 return browser && chrome::CanPrint(browser); | 2094 return browser && chrome::CanPrint(browser); |
| 2095 } | 2095 } |
| 2096 | 2096 |
| 2097 bool RenderViewContextMenu::IsRouteMediaEnabled() const { | 2097 bool RenderViewContextMenu::IsRouteMediaEnabled() const { |
| 2098 if (!media_router::MediaRouterEnabled(browser_context_)) | 2098 if (!media_router::MediaRouterEnabled(browser_context_)) |
| 2099 return false; | 2099 return false; |
| 2100 | 2100 |
| 2101 Browser* browser = chrome::FindBrowserWithWebContents(source_web_contents_); | 2101 Browser* browser = GetBrowser(); |
| 2102 if (!browser) | 2102 if (!browser) |
| 2103 return false; | 2103 return false; |
| 2104 | 2104 |
| 2105 // Disable the command if there is an active modal dialog. | 2105 // Disable the command if there is an active modal dialog. |
| 2106 // We don't use |source_web_contents_| here because it could be the | 2106 // We don't use |source_web_contents_| here because it could be the |
| 2107 // WebContents for something that's not the current tab (e.g., WebUI | 2107 // WebContents for something that's not the current tab (e.g., WebUI |
| 2108 // modal dialog). | 2108 // modal dialog). |
| 2109 WebContents* web_contents = | 2109 WebContents* web_contents = |
| 2110 browser->tab_strip_model()->GetActiveWebContents(); | 2110 browser->tab_strip_model()->GetActiveWebContents(); |
| 2111 if (!web_contents) | 2111 if (!web_contents) |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2370 GetPrefs(browser_context_)->GetBoolean(prefs::kPrintPreviewDisabled), | 2370 GetPrefs(browser_context_)->GetBoolean(prefs::kPrintPreviewDisabled), |
| 2371 !params_.selection_text.empty()); | 2371 !params_.selection_text.empty()); |
| 2372 #endif // defined(ENABLE_PRINTING) | 2372 #endif // defined(ENABLE_PRINTING) |
| 2373 } | 2373 } |
| 2374 | 2374 |
| 2375 void RenderViewContextMenu::ExecRouteMedia() { | 2375 void RenderViewContextMenu::ExecRouteMedia() { |
| 2376 #if defined(ENABLE_MEDIA_ROUTER) | 2376 #if defined(ENABLE_MEDIA_ROUTER) |
| 2377 if (!media_router::MediaRouterEnabled(browser_context_)) | 2377 if (!media_router::MediaRouterEnabled(browser_context_)) |
| 2378 return; | 2378 return; |
| 2379 | 2379 |
| 2380 Browser* browser = | 2380 Browser* browser = |
|
lazyboy
2016/08/11 18:52:40
I think you need to change this?
Also |source_web
takumif
2016/08/15 16:40:10
Done.
| |
| 2381 chrome::FindBrowserWithWebContents(source_web_contents_); | 2381 chrome::FindBrowserWithWebContents(source_web_contents_); |
| 2382 DCHECK(browser); | 2382 DCHECK(browser); |
| 2383 | 2383 |
| 2384 media_router::MediaRouterDialogController* dialog_controller = | 2384 media_router::MediaRouterDialogController* dialog_controller = |
| 2385 media_router::MediaRouterDialogController::GetOrCreateForWebContents( | 2385 media_router::MediaRouterDialogController::GetOrCreateForWebContents( |
| 2386 source_web_contents_); | 2386 source_web_contents_); |
| 2387 if (!dialog_controller) | 2387 if (!dialog_controller) |
| 2388 return; | 2388 return; |
| 2389 | 2389 |
| 2390 dialog_controller->ShowMediaRouterDialog(); | 2390 dialog_controller->ShowMediaRouterDialog(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2453 void RenderViewContextMenu::PluginActionAt( | 2453 void RenderViewContextMenu::PluginActionAt( |
| 2454 const gfx::Point& location, | 2454 const gfx::Point& location, |
| 2455 const WebPluginAction& action) { | 2455 const WebPluginAction& action) { |
| 2456 source_web_contents_->GetRenderViewHost()-> | 2456 source_web_contents_->GetRenderViewHost()-> |
| 2457 ExecutePluginActionAtLocation(location, action); | 2457 ExecutePluginActionAtLocation(location, action); |
| 2458 } | 2458 } |
| 2459 | 2459 |
| 2460 Browser* RenderViewContextMenu::GetBrowser() const { | 2460 Browser* RenderViewContextMenu::GetBrowser() const { |
| 2461 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2461 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
| 2462 } | 2462 } |
| OLD | NEW |