| OLD | NEW |
| 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_context_base.h" | 5 #include "chrome/browser/permissions/permission_context_base.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 const PermissionRequestID& id, | 112 const PermissionRequestID& id, |
| 113 const GURL& url, | 113 const GURL& url, |
| 114 ContentSetting response) { | 114 ContentSetting response) { |
| 115 DCHECK(response == CONTENT_SETTING_ALLOW || | 115 DCHECK(response == CONTENT_SETTING_ALLOW || |
| 116 response == CONTENT_SETTING_BLOCK || | 116 response == CONTENT_SETTING_BLOCK || |
| 117 response == CONTENT_SETTING_ASK); | 117 response == CONTENT_SETTING_ASK); |
| 118 #if defined(OS_ANDROID) | 118 #if defined(OS_ANDROID) |
| 119 bool update_content_setting = response != CONTENT_SETTING_ASK; | 119 bool update_content_setting = response != CONTENT_SETTING_ASK; |
| 120 bool allowed = response == CONTENT_SETTING_ALLOW; | 120 bool allowed = response == CONTENT_SETTING_ALLOW; |
| 121 context->GetInfoBarController()->OnPermissionSet( | 121 context->GetInfoBarController()->OnPermissionSet( |
| 122 id, url, url, update_content_setting, allowed); | 122 id, url, url, false /* user_gesture */, update_content_setting, |
| 123 allowed); |
| 123 #else | 124 #else |
| 124 PermissionRequestManager* manager = | 125 PermissionRequestManager* manager = |
| 125 PermissionRequestManager::FromWebContents(web_contents()); | 126 PermissionRequestManager::FromWebContents(web_contents()); |
| 126 switch (response) { | 127 switch (response) { |
| 127 case CONTENT_SETTING_ALLOW: | 128 case CONTENT_SETTING_ALLOW: |
| 128 manager->Accept(); | 129 manager->Accept(); |
| 129 break; | 130 break; |
| 130 case CONTENT_SETTING_BLOCK: | 131 case CONTENT_SETTING_BLOCK: |
| 131 manager->Deny(); | 132 manager->Deny(); |
| 132 break; | 133 break; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 TestParallelRequests(CONTENT_SETTING_ALLOW); | 420 TestParallelRequests(CONTENT_SETTING_ALLOW); |
| 420 } | 421 } |
| 421 | 422 |
| 422 TEST_F(PermissionContextBaseTests, TestParallelRequestsBlocked) { | 423 TEST_F(PermissionContextBaseTests, TestParallelRequestsBlocked) { |
| 423 TestParallelRequests(CONTENT_SETTING_BLOCK); | 424 TestParallelRequests(CONTENT_SETTING_BLOCK); |
| 424 } | 425 } |
| 425 | 426 |
| 426 TEST_F(PermissionContextBaseTests, TestParallelRequestsDismissed) { | 427 TEST_F(PermissionContextBaseTests, TestParallelRequestsDismissed) { |
| 427 TestParallelRequests(CONTENT_SETTING_ASK); | 428 TestParallelRequests(CONTENT_SETTING_ASK); |
| 428 } | 429 } |
| OLD | NEW |