Index: chrome/browser/ui/browser_commands.cc |
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc |
index cd2fdbdf4a78c750861840b86677663b921f7bf7..e1e028848a2a9879776263eb8c822228c41f9d7d 100644 |
--- a/chrome/browser/ui/browser_commands.cc |
+++ b/chrome/browser/ui/browser_commands.cc |
@@ -65,7 +65,7 @@ |
#include "components/bookmarks/browser/bookmark_utils.h" |
#include "components/google/core/browser/google_util.h" |
#include "components/translate/core/browser/language_state.h" |
-#include "components/web_modal/popup_manager.h" |
+#include "components/web_modal/web_contents_modal_dialog_manager.h" |
#include "content/public/browser/devtools_agent_host.h" |
#include "content/public/browser/navigation_controller.h" |
#include "content/public/browser/navigation_entry.h" |
@@ -110,6 +110,7 @@ using content::OpenURLParams; |
using content::Referrer; |
using content::SSLStatus; |
using content::WebContents; |
+using web_modal::WebContentsModalDialogManager; |
namespace chrome { |
namespace { |
@@ -245,21 +246,15 @@ void ReloadInternal(Browser* browser, |
new_tab->GetController().Reload(true); |
} |
-bool IsShowingWebContentsModalDialog(Browser* browser) { |
+bool IsShowingWebContentsModalDialog(const Browser* browser) { |
WebContents* web_contents = |
browser->tab_strip_model()->GetActiveWebContents(); |
if (!web_contents) |
return false; |
- // In test code we may not have a popup manager. |
- if (!browser->popup_manager()) |
- return false; |
- |
- // TODO(gbillock): This is currently called in production by the CanPrint |
- // method, and may be too restrictive if we allow print preview to overlap. |
- // Re-assess how to queue print preview after we know more about popup |
- // management policy. |
- return browser->popup_manager()->IsWebModalDialogActive(web_contents); |
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
+ WebContentsModalDialogManager::FromWebContents(web_contents); |
+ return web_contents_modal_dialog_manager->IsDialogActive(); |
} |
bool PrintPreviewShowing(const Browser* browser) { |
@@ -867,13 +862,9 @@ void Print(Browser* browser) { |
#endif // defined(ENABLE_PRINTING) |
} |
-bool CanPrint(Browser* browser) { |
+bool CanPrint(const Browser* browser) { |
// Do not print when printing is disabled via pref or policy. |
// Do not print when a constrained window is showing. It's confusing. |
- // TODO(gbillock): Need to re-assess the call to |
- // IsShowingWebContentsModalDialog after a popup management policy is |
- // refined -- we will probably want to just queue the print request, not |
- // block it. |
return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) && |
!(IsShowingWebContentsModalDialog(browser) || |
GetContentRestrictions(browser) & CONTENT_RESTRICTION_PRINT); |
@@ -888,7 +879,7 @@ void AdvancedPrint(Browser* browser) { |
#endif |
} |
-bool CanAdvancedPrint(Browser* browser) { |
+bool CanAdvancedPrint(const Browser* browser) { |
// If printing is not disabled via pref or policy, it is always possible to |
// advanced print when the print preview is visible. The exception to this |
// is under Win8 ash, since showing the advanced print dialog will open it |