| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 5 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 void BlockedContentTabHelper::PopupNotificationVisibilityChanged( | 51 void BlockedContentTabHelper::PopupNotificationVisibilityChanged( |
| 52 bool visible) { | 52 bool visible) { |
| 53 if (!tab_contents_->in_destructor()) | 53 if (!tab_contents_->in_destructor()) |
| 54 tab_contents_->content_settings()->SetPopupsBlocked(visible); | 54 tab_contents_->content_settings()->SetPopupsBlocked(visible); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void BlockedContentTabHelper::SendNotification(TabContents* contents, | 57 void BlockedContentTabHelper::SendNotification(TabContents* contents, |
| 58 bool blocked_state) { | 58 bool blocked_state) { |
| 59 content::NotificationService::current()->Notify( | 59 content::NotificationService::current()->Notify( |
| 60 chrome::NOTIFICATION_CONTENT_BLOCKED_STATE_CHANGED, | 60 chrome::NOTIFICATION_CONTENT_BLOCKED_STATE_CHANGED, |
| 61 content::Source<TabContents>(contents), | 61 content::Source<content::WebContents>(contents->web_contents()), |
| 62 content::Details<const bool>(&blocked_state)); | 62 content::Details<const bool>(&blocked_state)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void BlockedContentTabHelper::SetAllContentsBlocked(bool value) { | 65 void BlockedContentTabHelper::SetAllContentsBlocked(bool value) { |
| 66 if (all_contents_blocked_ == value) | 66 if (all_contents_blocked_ == value) |
| 67 return; | 67 return; |
| 68 | 68 |
| 69 all_contents_blocked_ = value; | 69 all_contents_blocked_ = value; |
| 70 if (!all_contents_blocked_ && blocked_contents_->GetBlockedContentsCount()) { | 70 if (!all_contents_blocked_ && blocked_contents_->GetBlockedContentsCount()) { |
| 71 std::vector<TabContents*> blocked; | 71 std::vector<TabContents*> blocked; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 | 143 |
| 144 size_t BlockedContentTabHelper::GetBlockedContentsCount() const { | 144 size_t BlockedContentTabHelper::GetBlockedContentsCount() const { |
| 145 return blocked_contents_->GetBlockedContentsCount(); | 145 return blocked_contents_->GetBlockedContentsCount(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void BlockedContentTabHelper::GetBlockedContents( | 148 void BlockedContentTabHelper::GetBlockedContents( |
| 149 std::vector<TabContents*>* blocked_contents) const { | 149 std::vector<TabContents*>* blocked_contents) const { |
| 150 blocked_contents_->GetBlockedContents(blocked_contents); | 150 blocked_contents_->GetBlockedContents(blocked_contents); |
| 151 } | 151 } |
| OLD | NEW |