| 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 #ifndef CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ | 5 #ifndef CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ |
| 6 #define CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ | 6 #define CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "chrome/browser/plugins/plugin_prefs.h" | 17 #include "chrome/browser/plugins/plugin_prefs.h" |
| 18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
| 20 #include "content/public/browser/plugin_service_filter.h" | 20 #include "content/public/browser/plugin_service_filter.h" |
| 21 #include "content/public/common/webplugininfo.h" | 21 #include "content/public/common/webplugininfo.h" |
| 22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 23 #include "url/origin.h" |
| 23 | 24 |
| 24 class Profile; | 25 class Profile; |
| 25 | 26 |
| 26 namespace content { | 27 namespace content { |
| 27 class WebContents; | 28 class WebContents; |
| 28 } | 29 } |
| 29 | 30 |
| 30 // This class must be created (by calling the |GetInstance| method) on the UI | 31 // This class must be created (by calling the |GetInstance| method) on the UI |
| 31 // thread, but is safe to use on any thread after that. | 32 // thread, but is safe to use on any thread after that. |
| 32 class ChromePluginServiceFilter : public content::PluginServiceFilter, | 33 class ChromePluginServiceFilter : public content::PluginServiceFilter, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 58 bool load_blocked, | 59 bool load_blocked, |
| 59 const std::string& identifier); | 60 const std::string& identifier); |
| 60 | 61 |
| 61 // PluginServiceFilter implementation. | 62 // PluginServiceFilter implementation. |
| 62 // If |plugin_content_url| is not available, the same GURL passed as | 63 // If |plugin_content_url| is not available, the same GURL passed as |
| 63 // |top_level_url| should be passed. These GURLs may be empty. | 64 // |top_level_url| should be passed. These GURLs may be empty. |
| 64 bool IsPluginAvailable(int render_process_id, | 65 bool IsPluginAvailable(int render_process_id, |
| 65 int render_frame_id, | 66 int render_frame_id, |
| 66 const void* context, | 67 const void* context, |
| 67 const GURL& plugin_content_url, | 68 const GURL& plugin_content_url, |
| 68 const GURL& top_level_url, | 69 const url::Origin& top_level_url, |
| 69 content::WebPluginInfo* plugin) override; | 70 content::WebPluginInfo* plugin) override; |
| 70 | 71 |
| 71 // CanLoadPlugin always grants permission to the browser | 72 // CanLoadPlugin always grants permission to the browser |
| 72 // (render_process_id == 0) | 73 // (render_process_id == 0) |
| 73 bool CanLoadPlugin(int render_process_id, | 74 bool CanLoadPlugin(int render_process_id, |
| 74 const base::FilePath& path) override; | 75 const base::FilePath& path) override; |
| 75 | 76 |
| 76 private: | 77 private: |
| 77 friend struct base::DefaultSingletonTraits<ChromePluginServiceFilter>; | 78 friend struct base::DefaultSingletonTraits<ChromePluginServiceFilter>; |
| 78 struct ContextInfo; | 79 struct ContextInfo; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 109 content::NotificationRegistrar registrar_; | 110 content::NotificationRegistrar registrar_; |
| 110 | 111 |
| 111 base::Lock lock_; // Guards access to member variables. | 112 base::Lock lock_; // Guards access to member variables. |
| 112 | 113 |
| 113 std::map<const void*, std::unique_ptr<ContextInfo>> resource_context_map_; | 114 std::map<const void*, std::unique_ptr<ContextInfo>> resource_context_map_; |
| 114 | 115 |
| 115 std::map<int, ProcessDetails> plugin_details_; | 116 std::map<int, ProcessDetails> plugin_details_; |
| 116 }; | 117 }; |
| 117 | 118 |
| 118 #endif // CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ | 119 #endif // CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ |
| OLD | NEW |