OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #import "ios/chrome/browser/web/blocked_popup_tab_helper.h" | 5 #import "ios/chrome/browser/web/blocked_popup_tab_helper.h" |
6 | 6 |
7 #include <UIKit/UIKit.h> | 7 #include <UIKit/UIKit.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/format_macros.h" | 12 #include "base/format_macros.h" |
13 #include "base/mac/bundle_locations.h" | 13 #include "base/mac/bundle_locations.h" |
14 #include "base/mac/foundation_util.h" | 14 #include "base/mac/foundation_util.h" |
15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "components/content_settings/core/browser/host_content_settings_map.h" | 18 #include "components/content_settings/core/browser/host_content_settings_map.h" |
19 #include "components/infobars/core/confirm_infobar_delegate.h" | 19 #include "components/infobars/core/confirm_infobar_delegate.h" |
20 #include "components/infobars/core/infobar.h" | 20 #include "components/infobars/core/infobar.h" |
21 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 21 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
22 #include "ios/chrome/browser/content_settings/host_content_settings_map_factory.
h" | 22 #include "ios/chrome/browser/content_settings/host_content_settings_map_factory.
h" |
23 #include "ios/chrome/browser/infobars/infobar_manager_impl.h" | 23 #include "ios/chrome/browser/infobars/infobar_manager_impl.h" |
24 #include "ios/chrome/grit/ios_strings.h" | 24 #include "ios/chrome/grit/ios_strings.h" |
25 #include "ios/web/public/referrer.h" | 25 #include "ios/web/public/referrer.h" |
26 #include "net/base/mac/url_conversions.h" | 26 #include "net/base/mac/url_conversions.h" |
27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/gfx/image/image.h" | 28 #include "ui/gfx/image/image.h" |
29 | 29 |
| 30 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 31 #error "This file requires ARC support." |
| 32 #endif |
| 33 |
30 DEFINE_WEB_STATE_USER_DATA_KEY(BlockedPopupTabHelper); | 34 DEFINE_WEB_STATE_USER_DATA_KEY(BlockedPopupTabHelper); |
31 | 35 |
32 namespace { | 36 namespace { |
33 // The infobar to display when a popup is blocked. | 37 // The infobar to display when a popup is blocked. |
34 class BlockPopupInfoBarDelegate : public ConfirmInfoBarDelegate { | 38 class BlockPopupInfoBarDelegate : public ConfirmInfoBarDelegate { |
35 public: | 39 public: |
36 BlockPopupInfoBarDelegate( | 40 BlockPopupInfoBarDelegate( |
37 ios::ChromeBrowserState* browser_state, | 41 ios::ChromeBrowserState* browser_state, |
38 web::WebState* web_state, | 42 web::WebState* web_state, |
39 const std::vector<BlockedPopupTabHelper::Popup>& popups) | 43 const std::vector<BlockedPopupTabHelper::Popup>& popups) |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 DCHECK(infobar_manager); | 163 DCHECK(infobar_manager); |
160 | 164 |
161 if (scoped_observer_.IsObserving(infobar_manager)) { | 165 if (scoped_observer_.IsObserving(infobar_manager)) { |
162 return; | 166 return; |
163 } | 167 } |
164 | 168 |
165 // Verify that this object is never observing more than one InfoBarManager. | 169 // Verify that this object is never observing more than one InfoBarManager. |
166 DCHECK(!scoped_observer_.IsObservingSources()); | 170 DCHECK(!scoped_observer_.IsObservingSources()); |
167 scoped_observer_.Add(infobar_manager); | 171 scoped_observer_.Add(infobar_manager); |
168 } | 172 } |
OLD | NEW |