OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "base/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
6 #include "base/time/time.h" | 6 #include "base/time/time.h" |
| 7 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 9 #include "chrome/browser/download/download_request_limiter.h" |
8 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
11 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 13 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
12 #include "chrome/browser/ui/location_bar/location_bar.h" | 14 #include "chrome/browser/ui/location_bar/location_bar.h" |
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
14 #include "chrome/browser/ui/test/test_browser_dialog.h" | 16 #include "chrome/browser/ui/test/test_browser_dialog.h" |
15 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" | 17 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
16 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
17 #include "components/content_settings/core/common/content_settings_types.h" | 19 #include "components/content_settings/core/common/content_settings_types.h" |
(...skipping 27 matching lines...) Expand all Loading... |
45 content_settings->OnMediaStreamPermissionSet( | 47 content_settings->OnMediaStreamPermissionSet( |
46 GURL::EmptyGURL(), | 48 GURL::EmptyGURL(), |
47 content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC | 49 content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC |
48 ? TabSpecificContentSettings::MICROPHONE_ACCESSED | 50 ? TabSpecificContentSettings::MICROPHONE_ACCESSED |
49 : TabSpecificContentSettings::CAMERA_ACCESSED, | 51 : TabSpecificContentSettings::CAMERA_ACCESSED, |
50 std::string(), std::string(), std::string(), std::string()); | 52 std::string(), std::string(), std::string(), std::string()); |
51 break; | 53 break; |
52 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 54 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
53 content_settings->OnGeolocationPermissionSet(GURL::EmptyGURL(), false); | 55 content_settings->OnGeolocationPermissionSet(GURL::EmptyGURL(), false); |
54 break; | 56 break; |
| 57 case CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS: |
| 58 // Automatic downloads are handled by DownloadRequestLimiter. |
| 59 g_browser_process->download_request_limiter() |
| 60 ->GetDownloadState(web_contents, web_contents, true) |
| 61 ->SetDownloadStatusAndNotify( |
| 62 DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED); |
| 63 break; |
55 default: | 64 default: |
56 // For all other content_types passed in, mark them as blocked. | 65 // For all other content_types passed in, mark them as blocked. |
57 content_settings->OnContentBlocked(content_type); | 66 content_settings->OnContentBlocked(content_type); |
58 break; | 67 break; |
59 } | 68 } |
60 browser()->window()->UpdateToolbar(web_contents); | 69 browser()->window()->UpdateToolbar(web_contents); |
61 LocationBarTesting* location_bar_testing = | 70 LocationBarTesting* location_bar_testing = |
62 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); | 71 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); |
63 EXPECT_TRUE(location_bar_testing->TestContentSettingImagePressed( | 72 EXPECT_TRUE(location_bar_testing->TestContentSettingImagePressed( |
64 ContentSettingImageModel::GetContentSettingImageModelIndexForTesting( | 73 ContentSettingImageModel::GetContentSettingImageModelIndexForTesting( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 160 |
152 IN_PROC_BROWSER_TEST_F(ContentSettingBubbleDialogTest, | 161 IN_PROC_BROWSER_TEST_F(ContentSettingBubbleDialogTest, |
153 InvokeDialog_midi_sysex) { | 162 InvokeDialog_midi_sysex) { |
154 RunDialog(); | 163 RunDialog(); |
155 } | 164 } |
156 | 165 |
157 IN_PROC_BROWSER_TEST_F(ContentSettingBubbleDialogTest, | 166 IN_PROC_BROWSER_TEST_F(ContentSettingBubbleDialogTest, |
158 InvokeDialog_subresource_filter) { | 167 InvokeDialog_subresource_filter) { |
159 RunDialog(); | 168 RunDialog(); |
160 } | 169 } |
OLD | NEW |