popup_blocked_helper.cc 987 B

123456789101112131415161718192021222324
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/blocked_content/android/popup_blocked_helper.h"
  5. #include "components/blocked_content/popup_blocker_tab_helper.h"
  6. #include "url/gurl.h"
  7. namespace blocked_content {
  8. void ShowBlockedPopups(content::WebContents* web_contents) {
  9. blocked_content::PopupBlockerTabHelper* popup_blocker_helper =
  10. blocked_content::PopupBlockerTabHelper::FromWebContents(web_contents);
  11. DCHECK(popup_blocker_helper);
  12. popup_blocker_helper->ShowAllBlockedPopups();
  13. }
  14. bool PopupSettingManagedByPolicy(HostContentSettingsMap* map, const GURL& url) {
  15. content_settings::SettingInfo setting_info;
  16. const base::Value setting = map->GetWebsiteSetting(
  17. url, url, ContentSettingsType::POPUPS, &setting_info);
  18. return setting_info.source == content_settings::SETTING_SOURCE_POLICY;
  19. }
  20. } // namespace blocked_content