| 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/ui/blocked_content/blocked_content_tab_helper.h" | 8 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 9 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Overridden from content::WebContentsDelegate: | 111 // Overridden from content::WebContentsDelegate: |
| 112 | 112 |
| 113 WebContents* BlockedContentContainer::OpenURLFromTab( | 113 WebContents* BlockedContentContainer::OpenURLFromTab( |
| 114 WebContents* source, | 114 WebContents* source, |
| 115 const OpenURLParams& params) { | 115 const OpenURLParams& params) { |
| 116 return owner_->web_contents()->OpenURL(params); | 116 return owner_->web_contents()->OpenURL(params); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void BlockedContentContainer::AddNewContents(WebContents* source, | 119 bool BlockedContentContainer::AddNewContents(WebContents* source, |
| 120 WebContents* new_contents, | 120 WebContents* new_contents, |
| 121 WindowOpenDisposition disposition, | 121 WindowOpenDisposition disposition, |
| 122 const gfx::Rect& initial_position, | 122 const gfx::Rect& initial_position, |
| 123 bool user_gesture) { | 123 bool user_gesture) { |
| 124 owner_->web_contents()->AddNewContents( | 124 owner_->web_contents()->AddNewContents( |
| 125 new_contents, disposition, initial_position, user_gesture); | 125 new_contents, disposition, initial_position, user_gesture); |
| 126 return true; |
| 126 } | 127 } |
| 127 | 128 |
| 128 void BlockedContentContainer::CloseContents(WebContents* source) { | 129 void BlockedContentContainer::CloseContents(WebContents* source) { |
| 129 for (BlockedContents::iterator i(blocked_contents_.begin()); | 130 for (BlockedContents::iterator i(blocked_contents_.begin()); |
| 130 i != blocked_contents_.end(); ++i) { | 131 i != blocked_contents_.end(); ++i) { |
| 131 TabContents* tab_contents = i->tab_contents; | 132 TabContents* tab_contents = i->tab_contents; |
| 132 if (tab_contents->web_contents() == source) { | 133 if (tab_contents->web_contents() == source) { |
| 133 tab_contents->web_contents()->SetDelegate(NULL); | 134 tab_contents->web_contents()->SetDelegate(NULL); |
| 134 tab_contents->blocked_content_tab_helper()->set_delegate(NULL); | 135 tab_contents->blocked_content_tab_helper()->set_delegate(NULL); |
| 135 blocked_contents_.erase(i); | 136 blocked_contents_.erase(i); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 160 bool BlockedContentContainer::ShouldSuppressDialogs() { | 161 bool BlockedContentContainer::ShouldSuppressDialogs() { |
| 161 // Suppress JavaScript dialogs when inside a constrained popup window (because | 162 // Suppress JavaScript dialogs when inside a constrained popup window (because |
| 162 // that activates them and breaks them out of the constrained window jail). | 163 // that activates them and breaks them out of the constrained window jail). |
| 163 return true; | 164 return true; |
| 164 } | 165 } |
| 165 | 166 |
| 166 TabContents* BlockedContentContainer::GetConstrainingTabContents( | 167 TabContents* BlockedContentContainer::GetConstrainingTabContents( |
| 167 TabContents* source) { | 168 TabContents* source) { |
| 168 return owner_; | 169 return owner_; |
| 169 } | 170 } |
| OLD | NEW |