Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/content_settings/tab_specific_content_settings.h" | 5 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 #include "chrome/browser/content_settings/chrome_content_settings_utils.h" | 22 #include "chrome/browser/content_settings/chrome_content_settings_utils.h" |
| 23 #include "chrome/browser/media/media_stream_capture_indicator.h" | 23 #include "chrome/browser/media/media_stream_capture_indicator.h" |
| 24 #include "chrome/browser/prerender/prerender_manager.h" | 24 #include "chrome/browser/prerender/prerender_manager.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/render_messages.h" | 28 #include "chrome/common/render_messages.h" |
| 29 #include "components/content_settings/core/browser/content_settings_details.h" | 29 #include "components/content_settings/core/browser/content_settings_details.h" |
| 30 #include "components/content_settings/core/browser/content_settings_utils.h" | 30 #include "components/content_settings/core/browser/content_settings_utils.h" |
| 31 #include "components/content_settings/core/browser/host_content_settings_map.h" | 31 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 32 #include "components/rappor/rappor_service.h" | |
| 32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 33 #include "content/public/browser/navigation_controller.h" | 34 #include "content/public/browser/navigation_controller.h" |
| 34 #include "content/public/browser/navigation_details.h" | 35 #include "content/public/browser/navigation_details.h" |
| 35 #include "content/public/browser/navigation_entry.h" | 36 #include "content/public/browser/navigation_entry.h" |
| 36 #include "content/public/browser/notification_registrar.h" | 37 #include "content/public/browser/notification_registrar.h" |
| 37 #include "content/public/browser/notification_service.h" | 38 #include "content/public/browser/notification_service.h" |
| 38 #include "content/public/browser/render_frame_host.h" | 39 #include "content/public/browser/render_frame_host.h" |
| 39 #include "content/public/browser/render_view_host.h" | 40 #include "content/public/browser/render_view_host.h" |
| 40 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
| 41 #include "content/public/browser/web_contents_delegate.h" | 42 #include "content/public/browser/web_contents_delegate.h" |
| 43 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | |
| 42 #include "net/cookies/canonical_cookie.h" | 44 #include "net/cookies/canonical_cookie.h" |
| 43 #include "storage/common/fileapi/file_system_types.h" | 45 #include "storage/common/fileapi/file_system_types.h" |
| 44 | 46 |
| 45 using content::BrowserThread; | 47 using content::BrowserThread; |
| 46 using content::NavigationController; | 48 using content::NavigationController; |
| 47 using content::NavigationEntry; | 49 using content::NavigationEntry; |
| 48 using content::RenderViewHost; | 50 using content::RenderViewHost; |
| 49 using content::WebContents; | 51 using content::WebContents; |
| 50 | 52 |
| 51 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabSpecificContentSettings); | 53 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabSpecificContentSettings); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 content_blocked_[type] = true; | 342 content_blocked_[type] = true; |
| 341 // TODO: it would be nice to have a way of mocking this in tests. | 343 // TODO: it would be nice to have a way of mocking this in tests. |
| 342 content::NotificationService::current()->Notify( | 344 content::NotificationService::current()->Notify( |
| 343 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, | 345 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
| 344 content::Source<WebContents>(web_contents()), | 346 content::Source<WebContents>(web_contents()), |
| 345 content::NotificationService::NoDetails()); | 347 content::NotificationService::NoDetails()); |
| 346 | 348 |
| 347 if (type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) { | 349 if (type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) { |
| 348 content_settings::RecordMixedScriptAction( | 350 content_settings::RecordMixedScriptAction( |
| 349 content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD); | 351 content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD); |
| 352 | |
| 353 // RAPPOR | |
|
Nico
2014/12/19 23:43:53
useless comment
lgarron
2014/12/19 23:50:34
Done.
| |
| 354 rappor::RapporService* rappor_service = | |
| 355 g_browser_process->rappor_service(); | |
| 356 if (rappor_service) { | |
| 357 rappor_service->RecordSample( | |
| 358 "ContentSettings.MixedScript.DisplayedShield", | |
| 359 rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, | |
| 360 net::registry_controlled_domains::GetDomainAndRegistry( | |
| 361 base::UTF16ToUTF8(details), | |
| 362 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); | |
| 363 } | |
| 350 } | 364 } |
| 351 } | 365 } |
| 352 } | 366 } |
| 353 | 367 |
| 354 void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) { | 368 void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) { |
| 355 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) | 369 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) |
| 356 << "Geolocation settings handled by OnGeolocationPermissionSet"; | 370 << "Geolocation settings handled by OnGeolocationPermissionSet"; |
| 357 DCHECK(type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC && | 371 DCHECK(type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC && |
| 358 type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) | 372 type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) |
| 359 << "Media stream settings handled by OnMediaStreamPermissionSet"; | 373 << "Media stream settings handled by OnMediaStreamPermissionSet"; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 787 | 801 |
| 788 void TabSpecificContentSettings::GeolocationDidNavigate( | 802 void TabSpecificContentSettings::GeolocationDidNavigate( |
| 789 const content::LoadCommittedDetails& details) { | 803 const content::LoadCommittedDetails& details) { |
| 790 geolocation_usages_state_.DidNavigate(details); | 804 geolocation_usages_state_.DidNavigate(details); |
| 791 } | 805 } |
| 792 | 806 |
| 793 void TabSpecificContentSettings::MidiDidNavigate( | 807 void TabSpecificContentSettings::MidiDidNavigate( |
| 794 const content::LoadCommittedDetails& details) { | 808 const content::LoadCommittedDetails& details) { |
| 795 midi_usages_state_.DidNavigate(details); | 809 midi_usages_state_.DidNavigate(details); |
| 796 } | 810 } |
| OLD | NEW |