Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 2104513004: Don't attempt to show validation bubble for unparented web contents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: whoops Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698