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

Side by Side Diff: chrome/browser/plugins/plugin_info_message_filter.cc

Issue 2284053002: Register a fake Flash with chrome://plugins during browser start-up. (Closed)
Patch Set: Through #5 + git pull && gclient sync Created 4 years, 3 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 | « no previous file | chrome/common/chrome_content_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 10 #include <memory>
10 #include <utility> 11 #include <utility>
11 12
12 #include "base/bind.h" 13 #include "base/bind.h"
13 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "base/task_runner_util.h" 16 #include "base/task_runner_util.h"
16 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 20 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
20 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" 21 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
21 #include "chrome/browser/plugins/plugin_filter_utils.h" 22 #include "chrome/browser/plugins/plugin_filter_utils.h"
22 #include "chrome/browser/plugins/plugin_finder.h" 23 #include "chrome/browser/plugins/plugin_finder.h"
23 #include "chrome/browser/plugins/plugin_metadata.h" 24 #include "chrome/browser/plugins/plugin_metadata.h"
24 #include "chrome/browser/plugins/plugin_prefs.h" 25 #include "chrome/browser/plugins/plugin_prefs.h"
25 #include "chrome/browser/plugins/plugins_field_trial.h" 26 #include "chrome/browser/plugins/plugins_field_trial.h"
26 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/ui/browser_otr_state.h" 28 #include "chrome/browser/ui/browser_otr_state.h"
29 #include "chrome/common/chrome_content_client.h"
28 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
29 #include "chrome/common/render_messages.h" 31 #include "chrome/common/render_messages.h"
30 #include "components/component_updater/component_updater_service.h" 32 #include "components/component_updater/component_updater_service.h"
31 #include "components/content_settings/core/browser/content_settings_utils.h" 33 #include "components/content_settings/core/browser/content_settings_utils.h"
32 #include "components/content_settings/core/browser/host_content_settings_map.h" 34 #include "components/content_settings/core/browser/host_content_settings_map.h"
33 #include "components/content_settings/core/common/content_settings.h" 35 #include "components/content_settings/core/common/content_settings.h"
34 #include "components/prefs/pref_service.h" 36 #include "components/prefs/pref_service.h"
35 #include "components/rappor/rappor_service.h" 37 #include "components/rappor/rappor_service.h"
36 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
37 #include "content/public/browser/plugin_service.h" 39 #include "content/public/browser/plugin_service.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 WebPluginInfo* plugin, 399 WebPluginInfo* plugin,
398 std::string* actual_mime_type, 400 std::string* actual_mime_type,
399 std::unique_ptr<PluginMetadata>* plugin_metadata) const { 401 std::unique_ptr<PluginMetadata>* plugin_metadata) const {
400 *status = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed; 402 *status = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed;
401 403
402 bool allow_wildcard = true; 404 bool allow_wildcard = true;
403 std::vector<WebPluginInfo> matching_plugins; 405 std::vector<WebPluginInfo> matching_plugins;
404 std::vector<std::string> mime_types; 406 std::vector<std::string> mime_types;
405 PluginService::GetInstance()->GetPluginInfoArray( 407 PluginService::GetInstance()->GetPluginInfoArray(
406 url, mime_type, allow_wildcard, &matching_plugins, &mime_types); 408 url, mime_type, allow_wildcard, &matching_plugins, &mime_types);
409 #if defined(GOOGLE_CHROME_BUILD)
410 base::FilePath notPresent =
Lei Zhang 2016/08/30 00:17:57 nit: not_present
waffles 2016/08/30 00:21:16 Done.
411 base::FilePath::FromUTF8Unsafe(ChromeContentClient::kNotPresent);
412 matching_plugins.erase(
413 std::remove_if(
414 matching_plugins.begin(), matching_plugins.end(),
415 [&](const WebPluginInfo& info) { return info.path == notPresent; }),
416 matching_plugins.end());
417 #endif // defined(GOOGLE_CHROME_BUILD)
407 if (matching_plugins.empty()) { 418 if (matching_plugins.empty()) {
408 *status = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound; 419 *status = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound;
409 return false; 420 return false;
410 } 421 }
411 422
412 content::PluginServiceFilter* filter = 423 content::PluginServiceFilter* filter =
413 PluginService::GetInstance()->GetFilter(); 424 PluginService::GetInstance()->GetFilter();
414 size_t i = 0; 425 size_t i = 0;
415 for (; i < matching_plugins.size(); ++i) { 426 for (; i < matching_plugins.size(); ++i) {
416 if (!filter || filter->IsPluginAvailable(render_process_id_, 427 if (!filter || filter->IsPluginAvailable(render_process_id_,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 status == ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) { 495 status == ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) {
485 ChromePluginServiceFilter::GetInstance()->AuthorizePlugin( 496 ChromePluginServiceFilter::GetInstance()->AuthorizePlugin(
486 render_process_id_, path); 497 render_process_id_, path);
487 } 498 }
488 } 499 }
489 500
490 bool PluginInfoMessageFilter::Context::IsPluginEnabled( 501 bool PluginInfoMessageFilter::Context::IsPluginEnabled(
491 const content::WebPluginInfo& plugin) const { 502 const content::WebPluginInfo& plugin) const {
492 return plugin_prefs_->IsPluginEnabled(plugin); 503 return plugin_prefs_->IsPluginEnabled(plugin);
493 } 504 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_content_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698