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

Side by Side Diff: chrome/browser/permissions/permission_request_manager.cc

Issue 2856413002: Remove unused HasUserGestureRequest and unneeded request_url_ in PermissionRequestManager (Closed)
Patch Set: Created 3 years, 7 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/permissions/permission_request_manager.h ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/permissions/permission_request_manager.h" 5 #include "chrome/browser/permissions/permission_request_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void PermissionRequestManager::AddRequest(PermissionRequest* request) { 106 void PermissionRequestManager::AddRequest(PermissionRequest* request) {
107 // TODO(tsergeant): change the UMA to no longer mention bubbles. 107 // TODO(tsergeant): change the UMA to no longer mention bubbles.
108 base::RecordAction(base::UserMetricsAction("PermissionBubbleRequest")); 108 base::RecordAction(base::UserMetricsAction("PermissionBubbleRequest"));
109 109
110 // TODO(gbillock): is there a race between an early request on a 110 // TODO(gbillock): is there a race between an early request on a
111 // newly-navigated page and the to-be-cleaned-up requests on the previous 111 // newly-navigated page and the to-be-cleaned-up requests on the previous
112 // page? We should maybe listen to DidStartNavigationToPendingEntry (and 112 // page? We should maybe listen to DidStartNavigationToPendingEntry (and
113 // any other renderer-side nav initiations?). Double-check this for 113 // any other renderer-side nav initiations?). Double-check this for
114 // correct behavior on interstitials -- we probably want to basically queue 114 // correct behavior on interstitials -- we probably want to basically queue
115 // any request for which GetVisibleURL != GetLastCommittedURL. 115 // any request for which GetVisibleURL != GetLastCommittedURL.
116 request_url_ = web_contents()->GetLastCommittedURL(); 116 const GURL& request_url_ = web_contents()->GetLastCommittedURL();
117 bool is_main_frame = url::Origin(request_url_) 117 bool is_main_frame = url::Origin(request_url_)
118 .IsSameOriginWith(url::Origin(request->GetOrigin())); 118 .IsSameOriginWith(url::Origin(request->GetOrigin()));
119 119
120 // Don't re-add an existing request or one with a duplicate text request. 120 // Don't re-add an existing request or one with a duplicate text request.
121 PermissionRequest* existing_request = GetExistingRequest(request); 121 PermissionRequest* existing_request = GetExistingRequest(request);
122 if (existing_request) { 122 if (existing_request) {
123 // |request| is a duplicate. Add it to |duplicate_requests_| unless it's the 123 // |request| is a duplicate. Add it to |duplicate_requests_| unless it's the
124 // same object as |existing_request| or an existing duplicate. 124 // same object as |existing_request| or an existing duplicate.
125 if (request == existing_request) 125 if (request == existing_request)
126 return; 126 return;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 std::vector<PermissionRequest*>::iterator requests_iter; 412 std::vector<PermissionRequest*>::iterator requests_iter;
413 for (requests_iter = requests_.begin(); 413 for (requests_iter = requests_.begin();
414 requests_iter != requests_.end(); 414 requests_iter != requests_.end();
415 requests_iter++) { 415 requests_iter++) {
416 RequestFinishedIncludingDuplicates(*requests_iter); 416 RequestFinishedIncludingDuplicates(*requests_iter);
417 } 417 }
418 requests_.clear(); 418 requests_.clear();
419 accept_states_.clear(); 419 accept_states_.clear();
420 if (queued_requests_.size() || queued_frame_requests_.size()) 420 if (queued_requests_.size() || queued_frame_requests_.size())
421 TriggerShowBubble(); 421 TriggerShowBubble();
422 else
423 request_url_ = GURL();
424 } 422 }
425 423
426 void PermissionRequestManager::CancelPendingQueues() { 424 void PermissionRequestManager::CancelPendingQueues() {
427 std::vector<PermissionRequest*>::iterator requests_iter; 425 std::vector<PermissionRequest*>::iterator requests_iter;
428 for (requests_iter = queued_requests_.begin(); 426 for (requests_iter = queued_requests_.begin();
429 requests_iter != queued_requests_.end(); 427 requests_iter != queued_requests_.end();
430 requests_iter++) { 428 requests_iter++) {
431 RequestFinishedIncludingDuplicates(*requests_iter); 429 RequestFinishedIncludingDuplicates(*requests_iter);
432 } 430 }
433 for (requests_iter = queued_frame_requests_.begin(); 431 for (requests_iter = queued_frame_requests_.begin();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 case DENY_ALL: 524 case DENY_ALL:
527 Deny(); 525 Deny();
528 break; 526 break;
529 case DISMISS: 527 case DISMISS:
530 Closing(); 528 Closing();
531 break; 529 break;
532 case NONE: 530 case NONE:
533 NOTREACHED(); 531 NOTREACHED();
534 } 532 }
535 } 533 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_request_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698