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_container.h" | 5 #include "chrome/browser/ui/blocked_content/blocked_content_container.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/favicon/favicon_tab_helper.h" |
8 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 9 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
9 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
10 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
11 | 12 |
12 using content::OpenURLParams; | 13 using content::OpenURLParams; |
13 using content::WebContents; | 14 using content::WebContents; |
14 | 15 |
15 // static | 16 // static |
16 const size_t BlockedContentContainer::kImpossibleNumberOfPopups = 30; | 17 const size_t BlockedContentContainer::kImpossibleNumberOfPopups = 30; |
17 | 18 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 VLOG(1) << "Warning: Renderer is sending more popups to us than should be " | 50 VLOG(1) << "Warning: Renderer is sending more popups to us than should be " |
50 "possible. Renderer compromised?"; | 51 "possible. Renderer compromised?"; |
51 return; | 52 return; |
52 } | 53 } |
53 | 54 |
54 blocked_contents_.push_back( | 55 blocked_contents_.push_back( |
55 BlockedContent(web_contents, disposition, bounds, user_gesture)); | 56 BlockedContent(web_contents, disposition, bounds, user_gesture)); |
56 web_contents->SetDelegate(this); | 57 web_contents->SetDelegate(this); |
57 | 58 |
58 BlockedContentTabHelper::CreateForWebContents(web_contents); | 59 BlockedContentTabHelper::CreateForWebContents(web_contents); |
| 60 // Various UI parts assume the ability to retrieve favicons from blocked |
| 61 // content. |
| 62 FaviconTabHelper::CreateForWebContents(web_contents); |
59 BlockedContentTabHelper::FromWebContents(web_contents)->set_delegate(this); | 63 BlockedContentTabHelper::FromWebContents(web_contents)->set_delegate(this); |
60 | 64 |
61 // Since the new web_contents will not be shown, call WasHidden to change | 65 // Since the new web_contents will not be shown, call WasHidden to change |
62 // its status on both RenderViewHost and RenderView. | 66 // its status on both RenderViewHost and RenderView. |
63 web_contents->WasHidden(); | 67 web_contents->WasHidden(); |
64 } | 68 } |
65 | 69 |
66 void BlockedContentContainer::LaunchForContents( | 70 void BlockedContentContainer::LaunchForContents( |
67 content::WebContents* web_contents) { | 71 content::WebContents* web_contents) { |
68 // Open the popup. | 72 // Open the popup. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 bool BlockedContentContainer::ShouldSuppressDialogs() { | 177 bool BlockedContentContainer::ShouldSuppressDialogs() { |
174 // Suppress JavaScript dialogs when inside a constrained popup window (because | 178 // Suppress JavaScript dialogs when inside a constrained popup window (because |
175 // that activates them and breaks them out of the constrained window jail). | 179 // that activates them and breaks them out of the constrained window jail). |
176 return true; | 180 return true; |
177 } | 181 } |
178 | 182 |
179 content::WebContents* BlockedContentContainer::GetConstrainingWebContents( | 183 content::WebContents* BlockedContentContainer::GetConstrainingWebContents( |
180 content::WebContents* source) { | 184 content::WebContents* source) { |
181 return owner_; | 185 return owner_; |
182 } | 186 } |
OLD | NEW |