| 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_PLUGIN_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ | 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "components/component_updater/component_updater_service.h" |
| 12 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
| 13 #include "content/public/browser/web_contents_user_data.h" | 15 #include "content/public/browser/web_contents_user_data.h" |
| 14 | 16 |
| 15 #if defined(ENABLE_PLUGIN_INSTALLATION) | 17 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 16 #include <map> | 18 #include <map> |
| 17 #endif | 19 #endif |
| 18 | 20 |
| 19 class GURL; | 21 class GURL; |
| 20 class PluginFinder; | 22 class PluginFinder; |
| 21 class PluginMetadata; | 23 class PluginMetadata; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 public: | 40 public: |
| 39 ~PluginObserver() override; | 41 ~PluginObserver() override; |
| 40 | 42 |
| 41 // content::WebContentsObserver implementation. | 43 // content::WebContentsObserver implementation. |
| 42 void PluginCrashed(const base::FilePath& plugin_path, | 44 void PluginCrashed(const base::FilePath& plugin_path, |
| 43 base::ProcessId plugin_pid) override; | 45 base::ProcessId plugin_pid) override; |
| 44 bool OnMessageReceived(const IPC::Message& message, | 46 bool OnMessageReceived(const IPC::Message& message, |
| 45 content::RenderFrameHost* render_frame_host) override; | 47 content::RenderFrameHost* render_frame_host) override; |
| 46 | 48 |
| 47 private: | 49 private: |
| 50 class ComponentObserver; |
| 48 explicit PluginObserver(content::WebContents* web_contents); | 51 explicit PluginObserver(content::WebContents* web_contents); |
| 49 friend class content::WebContentsUserData<PluginObserver>; | 52 friend class content::WebContentsUserData<PluginObserver>; |
| 50 | 53 |
| 51 class PluginPlaceholderHost; | 54 class PluginPlaceholderHost; |
| 52 | 55 |
| 53 // Message handlers: | 56 // Message handlers: |
| 54 void OnBlockedUnauthorizedPlugin(const base::string16& name, | 57 void OnBlockedUnauthorizedPlugin(const base::string16& name, |
| 55 const std::string& identifier); | 58 const std::string& identifier); |
| 56 void OnBlockedOutdatedPlugin(int placeholder_id, | 59 void OnBlockedOutdatedPlugin(int placeholder_id, |
| 57 const std::string& identifier); | 60 const std::string& identifier); |
| 61 void OnBlockedComponentUpdatedPlugin(int placeholder_id, |
| 62 const std::string& identifier); |
| 58 #if defined(ENABLE_PLUGIN_INSTALLATION) | 63 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 59 void OnRemovePluginPlaceholderHost(int placeholder_id); | 64 void OnRemovePluginPlaceholderHost(int placeholder_id); |
| 60 #endif | 65 #endif |
| 66 void RemoveComponentObserver(int placeholder_id); |
| 61 void OnOpenAboutPlugins(); | 67 void OnOpenAboutPlugins(); |
| 62 void OnCouldNotLoadPlugin(const base::FilePath& plugin_path); | 68 void OnCouldNotLoadPlugin(const base::FilePath& plugin_path); |
| 63 | 69 |
| 64 #if defined(ENABLE_PLUGIN_INSTALLATION) | 70 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 65 // Stores all PluginPlaceholderHosts, keyed by their routing ID. | 71 // Stores all PluginPlaceholderHosts, keyed by their routing ID. |
| 66 std::map<int, PluginPlaceholderHost*> plugin_placeholders_; | 72 std::map<int, PluginPlaceholderHost*> plugin_placeholders_; |
| 67 #endif | 73 #endif |
| 68 | 74 |
| 75 // Stores all ComponentObservers, keyed by their routing ID. |
| 76 std::map<int, std::unique_ptr<ComponentObserver>> component_observers_; |
| 77 |
| 69 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; | 78 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; |
| 70 | 79 |
| 71 DISALLOW_COPY_AND_ASSIGN(PluginObserver); | 80 DISALLOW_COPY_AND_ASSIGN(PluginObserver); |
| 72 }; | 81 }; |
| 73 | 82 |
| 74 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ | 83 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ |
| OLD | NEW |