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

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

Issue 2194243002: Suppress JavaScript dialogs when a tab puts itself into fullscreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: content:: Created 4 years, 4 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 | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/fast_unload_controller.cc » ('j') | 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 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 1199
1200 // The detached bookmark bar has appearance of floating above the 1200 // The detached bookmark bar has appearance of floating above the
1201 // web-contents. This does not play nicely with overscroll navigation 1201 // web-contents. This does not play nicely with overscroll navigation
1202 // gestures. So disable overscroll navigation when the bookmark bar is in the 1202 // gestures. So disable overscroll navigation when the bookmark bar is in the
1203 // detached state and the overscroll effect moves the layers. 1203 // detached state and the overscroll effect moves the layers.
1204 if (value == "1" && bookmark_bar_state_ == BookmarkBar::DETACHED) 1204 if (value == "1" && bookmark_bar_state_ == BookmarkBar::DETACHED)
1205 return false; 1205 return false;
1206 return true; 1206 return true;
1207 } 1207 }
1208 1208
1209 bool Browser::ShouldSuppressDialogs(WebContents* source, bool before_unload) {
1210 if (before_unload)
1211 return false;
1212
1213 return exclusive_access_manager_->fullscreen_controller()
Matt Giuca 2016/08/02 01:42:20 optionally add a comment: // Do not show dialogs i
Avi (use Gerrit) 2016/08/02 03:53:30 That seems obvious enough from the code, though.
Matt Giuca 2016/08/02 04:23:50 Acknowledged, but see below because it's going to
1214 ->IsControllerInitiatedFullscreen();
Matt Giuca 2016/08/02 03:34:56 Actually, I thought some more about this. I think
Avi (use Gerrit) 2016/08/02 03:53:30 That is a very reasonable approach, and I was thin
Matt Giuca 2016/08/02 04:23:50 Actually, I started doing this but I discovered th
Avi (use Gerrit) 2016/08/02 04:27:54 In that case, agreed, I'll clarify. How about: //
Matt Giuca 2016/08/02 04:28:52 SGTM.
1215 }
1216
1209 bool Browser::ShouldPreserveAbortedURLs(WebContents* source) { 1217 bool Browser::ShouldPreserveAbortedURLs(WebContents* source) {
1210 // Allow failed URLs to stick around in the omnibox on the NTP, but not when 1218 // Allow failed URLs to stick around in the omnibox on the NTP, but not when
1211 // other pages have committed. 1219 // other pages have committed.
1212 Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext()); 1220 Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext());
1213 if (!profile || !source->GetController().GetLastCommittedEntry()) 1221 if (!profile || !source->GetController().GetLastCommittedEntry())
1214 return false; 1222 return false;
1215 GURL committed_url(source->GetController().GetLastCommittedEntry()->GetURL()); 1223 GURL committed_url(source->GetController().GetLastCommittedEntry()->GetURL());
1216 return search::IsNTPURL(committed_url, profile); 1224 return search::IsNTPURL(committed_url, profile);
1217 } 1225 }
1218 1226
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
2602 if (contents && !allow_js_access) { 2610 if (contents && !allow_js_access) {
2603 contents->web_contents()->GetController().LoadURL( 2611 contents->web_contents()->GetController().LoadURL(
2604 target_url, 2612 target_url,
2605 content::Referrer(), 2613 content::Referrer(),
2606 ui::PAGE_TRANSITION_LINK, 2614 ui::PAGE_TRANSITION_LINK,
2607 std::string()); // No extra headers. 2615 std::string()); // No extra headers.
2608 } 2616 }
2609 2617
2610 return contents != NULL; 2618 return contents != NULL;
2611 } 2619 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/fast_unload_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698