OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/android/content_settings/popup_blocked_infobar_deleg ate.h" | 5 #include "chrome/browser/ui/android/content_settings/popup_blocked_infobar_deleg ate.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 #include "chrome/browser/content_settings/chrome_content_settings_utils.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
11 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 13 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
14 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
15 #include "chrome/grit/theme_resources.h" | 15 #include "chrome/grit/theme_resources.h" |
16 #include "components/content_settings/core/browser/host_content_settings_map.h" | 16 #include "components/content_settings/core/browser/host_content_settings_map.h" |
17 #include "components/content_settings/core/common/content_settings.h" | 17 #include "components/content_settings/core/common/content_settings.h" |
18 #include "components/content_settings/core/common/content_settings_types.h" | 18 #include "components/content_settings/core/common/content_settings_types.h" |
19 #include "components/infobars/core/infobar.h" | 19 #include "components/infobars/core/infobar.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
42 // This will be fixed once we have an in place replace infobar mechanism. | 42 // This will be fixed once we have an in place replace infobar mechanism. |
43 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { | 43 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { |
44 infobars::InfoBar* existing_infobar = infobar_service->infobar_at(i); | 44 infobars::InfoBar* existing_infobar = infobar_service->infobar_at(i); |
45 if (existing_infobar->delegate()->AsPopupBlockedInfoBarDelegate()) { | 45 if (existing_infobar->delegate()->AsPopupBlockedInfoBarDelegate()) { |
46 infobar_service->ReplaceInfoBar(existing_infobar, std::move(infobar)); | 46 infobar_service->ReplaceInfoBar(existing_infobar, std::move(infobar)); |
47 return; | 47 return; |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 infobar_service->AddInfoBar(std::move(infobar)); | 51 infobar_service->AddInfoBar(std::move(infobar)); |
52 | |
53 content_settings::RecordPopupsAction( | |
54 content_settings::POPUPS_ACTION_DISPLAYED_INFOBAR_ON_MOBILE); | |
Nico
2017/02/02 22:09:49
This looks like general code, why is the enum call
charleszhao
2017/02/03 02:20:48
These two enum
POPUPS_ACTION_DISPLAYED_INFOBAR_ON
| |
52 } | 55 } |
53 | 56 |
54 PopupBlockedInfoBarDelegate::~PopupBlockedInfoBarDelegate() { | 57 PopupBlockedInfoBarDelegate::~PopupBlockedInfoBarDelegate() { |
55 } | 58 } |
56 | 59 |
57 infobars::InfoBarDelegate::InfoBarIdentifier | 60 infobars::InfoBarDelegate::InfoBarIdentifier |
58 PopupBlockedInfoBarDelegate::GetIdentifier() const { | 61 PopupBlockedInfoBarDelegate::GetIdentifier() const { |
59 return POPUP_BLOCKED_INFOBAR_DELEGATE; | 62 return POPUP_BLOCKED_INFOBAR_DELEGATE; |
60 } | 63 } |
61 | 64 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 InfoBarService::WebContentsFromInfoBar(infobar()); | 112 InfoBarService::WebContentsFromInfoBar(infobar()); |
110 PopupBlockerTabHelper* popup_blocker_helper = | 113 PopupBlockerTabHelper* popup_blocker_helper = |
111 PopupBlockerTabHelper::FromWebContents(web_contents); | 114 PopupBlockerTabHelper::FromWebContents(web_contents); |
112 DCHECK(popup_blocker_helper); | 115 DCHECK(popup_blocker_helper); |
113 PopupBlockerTabHelper::PopupIdMap blocked_popups = | 116 PopupBlockerTabHelper::PopupIdMap blocked_popups = |
114 popup_blocker_helper->GetBlockedPopupRequests(); | 117 popup_blocker_helper->GetBlockedPopupRequests(); |
115 for (PopupBlockerTabHelper::PopupIdMap::iterator it = blocked_popups.begin(); | 118 for (PopupBlockerTabHelper::PopupIdMap::iterator it = blocked_popups.begin(); |
116 it != blocked_popups.end(); ++it) | 119 it != blocked_popups.end(); ++it) |
117 popup_blocker_helper->ShowBlockedPopup(it->first); | 120 popup_blocker_helper->ShowBlockedPopup(it->first); |
118 | 121 |
122 content_settings::RecordPopupsAction( | |
123 content_settings::POPUPS_ACTION_CLICKED_ALWAYS_SHOW_ON_MOBILE); | |
Nico
2017/02/02 22:09:49
same question
charleszhao
2017/02/05 23:03:13
Done.
| |
119 return true; | 124 return true; |
120 } | 125 } |
OLD | NEW |