| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 bool Browser::TabsNeedBeforeUnloadFired() { | 1253 bool Browser::TabsNeedBeforeUnloadFired() { |
| 1254 if (IsFastTabUnloadEnabled()) | 1254 if (IsFastTabUnloadEnabled()) |
| 1255 return fast_unload_controller_->TabsNeedBeforeUnloadFired(); | 1255 return fast_unload_controller_->TabsNeedBeforeUnloadFired(); |
| 1256 return unload_controller_->TabsNeedBeforeUnloadFired(); | 1256 return unload_controller_->TabsNeedBeforeUnloadFired(); |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 void Browser::ShowValidationMessage(content::WebContents* web_contents, | 1259 void Browser::ShowValidationMessage(content::WebContents* web_contents, |
| 1260 const gfx::Rect& anchor_in_root_view, | 1260 const gfx::Rect& anchor_in_root_view, |
| 1261 const base::string16& main_text, | 1261 const base::string16& main_text, |
| 1262 const base::string16& sub_text) { | 1262 const base::string16& sub_text) { |
| 1263 // If the web contents is unparented (e.g. in a blocked popup) it does not |
| 1264 // make sense to show a validation message. See http://crbug.com/616990 |
| 1265 if (!web_contents->GetTopLevelNativeWindow()) |
| 1266 return; |
| 1263 validation_message_bubble_ = | 1267 validation_message_bubble_ = |
| 1264 TabDialogs::FromWebContents(web_contents) | 1268 TabDialogs::FromWebContents(web_contents) |
| 1265 ->ShowValidationMessage(anchor_in_root_view, main_text, sub_text); | 1269 ->ShowValidationMessage(anchor_in_root_view, main_text, sub_text); |
| 1266 } | 1270 } |
| 1267 | 1271 |
| 1268 void Browser::HideValidationMessage(content::WebContents* web_contents) { | 1272 void Browser::HideValidationMessage(content::WebContents* web_contents) { |
| 1269 if (validation_message_bubble_) | 1273 if (validation_message_bubble_) |
| 1270 validation_message_bubble_->CloseValidationMessage(); | 1274 validation_message_bubble_->CloseValidationMessage(); |
| 1271 } | 1275 } |
| 1272 | 1276 |
| (...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2598 if (contents && !allow_js_access) { | 2602 if (contents && !allow_js_access) { |
| 2599 contents->web_contents()->GetController().LoadURL( | 2603 contents->web_contents()->GetController().LoadURL( |
| 2600 target_url, | 2604 target_url, |
| 2601 content::Referrer(), | 2605 content::Referrer(), |
| 2602 ui::PAGE_TRANSITION_LINK, | 2606 ui::PAGE_TRANSITION_LINK, |
| 2603 std::string()); // No extra headers. | 2607 std::string()); // No extra headers. |
| 2604 } | 2608 } |
| 2605 | 2609 |
| 2606 return contents != NULL; | 2610 return contents != NULL; |
| 2607 } | 2611 } |
| OLD | NEW |