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/plugins/plugin_info_message_filter.h" | 5 #include "chrome/browser/plugins/plugin_info_message_filter.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/common/features.h" | 32 #include "chrome/common/features.h" |
33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
34 #include "chrome/common/render_messages.h" | 34 #include "chrome/common/render_messages.h" |
35 #include "components/component_updater/component_updater_service.h" | 35 #include "components/component_updater/component_updater_service.h" |
36 #include "components/content_settings/core/browser/content_settings_utils.h" | 36 #include "components/content_settings/core/browser/content_settings_utils.h" |
37 #include "components/content_settings/core/browser/host_content_settings_map.h" | 37 #include "components/content_settings/core/browser/host_content_settings_map.h" |
38 #include "components/content_settings/core/common/content_settings.h" | 38 #include "components/content_settings/core/common/content_settings.h" |
39 #include "components/keyed_service/content/browser_context_keyed_service_shutdow
n_notifier_factory.h" | 39 #include "components/keyed_service/content/browser_context_keyed_service_shutdow
n_notifier_factory.h" |
40 #include "components/prefs/pref_service.h" | 40 #include "components/prefs/pref_service.h" |
41 #include "components/rappor/rappor_service_impl.h" | 41 #include "components/rappor/rappor_service_impl.h" |
42 #include "components/ukm/ukm_entry_builder.h" | 42 #include "components/ukm/public/ukm_entry_builder.h" |
43 #include "components/ukm/ukm_service.h" | 43 #include "components/ukm/public/ukm_recorder.h" |
44 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
45 #include "content/public/browser/plugin_service.h" | 45 #include "content/public/browser/plugin_service.h" |
46 #include "content/public/browser/plugin_service_filter.h" | 46 #include "content/public/browser/plugin_service_filter.h" |
47 #include "content/public/browser/render_frame_host.h" | 47 #include "content/public/browser/render_frame_host.h" |
48 #include "content/public/common/content_constants.h" | 48 #include "content/public/common/content_constants.h" |
49 #include "extensions/features/features.h" | 49 #include "extensions/features/features.h" |
50 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 50 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
51 #include "ppapi/features/features.h" | 51 #include "ppapi/features/features.h" |
52 #include "url/gurl.h" | 52 #include "url/gurl.h" |
53 #include "url/origin.h" | 53 #include "url/origin.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 176 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
177 always_authorize_plugins_.Destroy(); | 177 always_authorize_plugins_.Destroy(); |
178 allow_outdated_plugins_.Destroy(); | 178 allow_outdated_plugins_.Destroy(); |
179 } | 179 } |
180 | 180 |
181 PluginInfoMessageFilter::PluginInfoMessageFilter(int render_process_id, | 181 PluginInfoMessageFilter::PluginInfoMessageFilter(int render_process_id, |
182 Profile* profile) | 182 Profile* profile) |
183 : BrowserMessageFilter(ChromeMsgStart), | 183 : BrowserMessageFilter(ChromeMsgStart), |
184 context_(render_process_id, profile), | 184 context_(render_process_id, profile), |
185 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 185 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
186 ukm_source_id_(ukm::UkmService::GetNewSourceID()) { | 186 ukm_source_id_(ukm::UkmRecorder::GetNewSourceID()) { |
187 shutdown_notifier_ = | 187 shutdown_notifier_ = |
188 ShutdownNotifierFactory::GetInstance()->Get(profile)->Subscribe( | 188 ShutdownNotifierFactory::GetInstance()->Get(profile)->Subscribe( |
189 base::Bind(&PluginInfoMessageFilter::ShutdownOnUIThread, | 189 base::Bind(&PluginInfoMessageFilter::ShutdownOnUIThread, |
190 base::Unretained(this))); | 190 base::Unretained(this))); |
191 } | 191 } |
192 | 192 |
193 void PluginInfoMessageFilter::ShutdownOnUIThread() { | 193 void PluginInfoMessageFilter::ShutdownOnUIThread() { |
194 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 194 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
195 context_.ShutdownOnUIThread(); | 195 context_.ShutdownOnUIThread(); |
196 shutdown_notifier_.reset(); | 196 shutdown_notifier_.reset(); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 params.render_frame_id, output->actual_mime_type, | 527 params.render_frame_id, output->actual_mime_type, |
528 params.url, params.main_frame_origin, ukm_source_id_)); | 528 params.url, params.main_frame_origin, ukm_source_id_)); |
529 } | 529 } |
530 } | 530 } |
531 | 531 |
532 void PluginInfoMessageFilter::ReportMetrics( | 532 void PluginInfoMessageFilter::ReportMetrics( |
533 int render_frame_id, | 533 int render_frame_id, |
534 const base::StringPiece& mime_type, | 534 const base::StringPiece& mime_type, |
535 const GURL& url, | 535 const GURL& url, |
536 const url::Origin& main_frame_origin, | 536 const url::Origin& main_frame_origin, |
537 int32_t ukm_source_id) { | 537 ukm::SourceId ukm_source_id) { |
538 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 538 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
539 | 539 |
540 content::RenderFrameHost* frame = content::RenderFrameHost::FromID( | 540 content::RenderFrameHost* frame = content::RenderFrameHost::FromID( |
541 context_.render_process_id(), render_frame_id); | 541 context_.render_process_id(), render_frame_id); |
542 content::WebContents* web_contents = | 542 content::WebContents* web_contents = |
543 content::WebContents::FromRenderFrameHost(frame); | 543 content::WebContents::FromRenderFrameHost(frame); |
544 // This can occur the web contents has already been closed or navigated away. | 544 // This can occur the web contents has already been closed or navigated away. |
545 if (!web_contents) | 545 if (!web_contents) |
546 return; | 546 return; |
547 | 547 |
(...skipping 15 matching lines...) Expand all Loading... |
563 rappor_service->RecordSampleString( | 563 rappor_service->RecordSampleString( |
564 "Plugins.FlashOriginUrl", rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, | 564 "Plugins.FlashOriginUrl", rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, |
565 net::registry_controlled_domains::GetDomainAndRegistry( | 565 net::registry_controlled_domains::GetDomainAndRegistry( |
566 main_frame_origin.GetURL(), | 566 main_frame_origin.GetURL(), |
567 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); | 567 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); |
568 rappor_service->RecordSampleString( | 568 rappor_service->RecordSampleString( |
569 "Plugins.FlashUrl", rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, | 569 "Plugins.FlashUrl", rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, |
570 net::registry_controlled_domains::GetDomainAndRegistry( | 570 net::registry_controlled_domains::GetDomainAndRegistry( |
571 url, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); | 571 url, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); |
572 | 572 |
573 ukm::UkmService* ukm_service = g_browser_process->ukm_service(); | 573 ukm::UkmRecorder* ukm_recorder = g_browser_process->ukm_recorder(); |
574 if (!ukm_service) | 574 if (!ukm_recorder) |
575 return; | 575 return; |
576 ukm_service->UpdateSourceURL(ukm_source_id, | 576 ukm_recorder->UpdateSourceURL(ukm_source_id, |
577 web_contents->GetLastCommittedURL()); | 577 web_contents->GetLastCommittedURL()); |
578 // UkmEntryBuilder records the entry when it goes out of scope. | 578 // UkmEntryBuilder records the entry when it goes out of scope. |
579 std::unique_ptr<ukm::UkmEntryBuilder> builder = | 579 std::unique_ptr<ukm::UkmEntryBuilder> builder = |
580 ukm_service->GetEntryBuilder(ukm_source_id, "Plugins.FlashInstance"); | 580 ukm_recorder->GetEntryBuilder(ukm_source_id, "Plugins.FlashInstance"); |
581 } | 581 } |
582 | 582 |
583 void PluginInfoMessageFilter::Context::MaybeGrantAccess( | 583 void PluginInfoMessageFilter::Context::MaybeGrantAccess( |
584 ChromeViewHostMsg_GetPluginInfo_Status status, | 584 ChromeViewHostMsg_GetPluginInfo_Status status, |
585 const base::FilePath& path) const { | 585 const base::FilePath& path) const { |
586 if (status == ChromeViewHostMsg_GetPluginInfo_Status::kAllowed || | 586 if (status == ChromeViewHostMsg_GetPluginInfo_Status::kAllowed || |
587 status == ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) { | 587 status == ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) { |
588 ChromePluginServiceFilter::GetInstance()->AuthorizePlugin( | 588 ChromePluginServiceFilter::GetInstance()->AuthorizePlugin( |
589 render_process_id_, path); | 589 render_process_id_, path); |
590 } | 590 } |
591 } | 591 } |
592 | 592 |
593 bool PluginInfoMessageFilter::Context::IsPluginEnabled( | 593 bool PluginInfoMessageFilter::Context::IsPluginEnabled( |
594 const content::WebPluginInfo& plugin) const { | 594 const content::WebPluginInfo& plugin) const { |
595 return plugin_prefs_->IsPluginEnabled(plugin); | 595 return plugin_prefs_->IsPluginEnabled(plugin); |
596 } | 596 } |
OLD | NEW |