| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/privacy_blacklist/blacklist_observer.h" | 5 #include "chrome/browser/privacy_blacklist/blacklist_observer.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "chrome/browser/blocked_popup_container.h" | 10 #include "chrome/browser/blocked_popup_container.h" |
| 11 #include "chrome/browser/chrome_thread.h" |
| 11 #include "chrome/browser/privacy_blacklist/blacklist.h" | 12 #include "chrome/browser/privacy_blacklist/blacklist.h" |
| 12 #include "chrome/browser/renderer_host/render_view_host.h" | 13 #include "chrome/browser/renderer_host/render_view_host.h" |
| 13 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 14 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 14 #include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" | 15 #include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" |
| 15 #include "chrome/browser/tab_contents/tab_contents.h" | 16 #include "chrome/browser/tab_contents/tab_contents.h" |
| 16 #include "chrome/common/notification_details.h" | 17 #include "chrome/common/notification_details.h" |
| 17 #include "chrome/common/notification_service.h" | 18 #include "chrome/common/notification_service.h" |
| 18 #include "chrome/common/notification_type.h" | 19 #include "chrome/common/notification_type.h" |
| 19 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 20 | 21 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 string16 reason_; | 57 string16 reason_; |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 void BlacklistObserver::ContentBlocked(const URLRequest* request) { | 60 void BlacklistObserver::ContentBlocked(const URLRequest* request) { |
| 60 const URLRequest::UserData* d = | 61 const URLRequest::UserData* d = |
| 61 request->GetUserData(&Blacklist::kRequestDataKey); | 62 request->GetUserData(&Blacklist::kRequestDataKey); |
| 62 const Blacklist::Match* match = static_cast<const Blacklist::Match*>(d); | 63 const Blacklist::Match* match = static_cast<const Blacklist::Match*>(d); |
| 63 const ResourceDispatcherHostRequestInfo* info = | 64 const ResourceDispatcherHostRequestInfo* info = |
| 64 ResourceDispatcherHost::InfoForRequest(request); | 65 ResourceDispatcherHost::InfoForRequest(request); |
| 65 const GURL& gurl = request->url(); | 66 const GURL& gurl = request->url(); |
| 66 BlockedContentNotice* task = new BlockedContentNotice(gurl, match, info); | |
| 67 | 67 |
| 68 // Notify the UI that something non-visual has been blocked. We can | 68 // Notify the UI that something non-visual has been blocked. |
| 69 // safely cast the delegate to the ResourceDispatherHost because it | 69 ChromeThread::PostTask( |
| 70 // is the only place where Blacklist::Match data is added to requests. | 70 ChromeThread::UI, FROM_HERE, |
| 71 static_cast<ResourceDispatcherHost*>(request->delegate())-> | 71 new BlockedContentNotice(gurl, match, info)); |
| 72 ui_loop()->PostTask(FROM_HERE, task); | |
| 73 } | 72 } |
| OLD | NEW |