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 #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 : public update_client::UpdateClient::Observer { | |
|
Bernhard Bauer
2016/07/29 09:14:24
I think you could just declare the class here and
waffles
2016/07/29 21:07:25
Done.
| |
| 51 public: | |
| 52 using Events = update_client::UpdateClient::Observer::Events; | |
| 53 ComponentObserver(PluginObserver* observer, | |
| 54 int routing_id, | |
| 55 const std::string& component_id); | |
| 56 void OnEvent(Events event, const std::string& id) override; | |
| 57 | |
| 58 private: | |
| 59 PluginObserver* observer_; | |
| 60 int routing_id_; | |
| 61 std::string component_id_; | |
| 62 DISALLOW_COPY_AND_ASSIGN(ComponentObserver); | |
| 63 }; | |
| 48 explicit PluginObserver(content::WebContents* web_contents); | 64 explicit PluginObserver(content::WebContents* web_contents); |
| 49 friend class content::WebContentsUserData<PluginObserver>; | 65 friend class content::WebContentsUserData<PluginObserver>; |
| 66 friend class ComponentObserver; | |
|
Bernhard Bauer
2016/07/29 09:14:24
I don't think this friend declaration is now neces
waffles
2016/07/29 21:07:25
Done.
| |
| 50 | 67 |
| 51 class PluginPlaceholderHost; | 68 class PluginPlaceholderHost; |
| 52 | 69 |
| 53 // Message handlers: | 70 // Message handlers: |
| 54 void OnBlockedUnauthorizedPlugin(const base::string16& name, | 71 void OnBlockedUnauthorizedPlugin(const base::string16& name, |
| 55 const std::string& identifier); | 72 const std::string& identifier); |
| 56 void OnBlockedOutdatedPlugin(int placeholder_id, | 73 void OnBlockedOutdatedPlugin(int placeholder_id, |
| 57 const std::string& identifier); | 74 const std::string& identifier); |
| 75 void OnBlockedComponentUpdatedPlugin(int placeholder_id, | |
| 76 const std::string& identifier); | |
| 58 #if defined(ENABLE_PLUGIN_INSTALLATION) | 77 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 59 void OnRemovePluginPlaceholderHost(int placeholder_id); | 78 void OnRemovePluginPlaceholderHost(int placeholder_id); |
| 60 #endif | 79 #endif |
| 80 void RemoveComponentObserver(int placeholder_id); | |
| 61 void OnOpenAboutPlugins(); | 81 void OnOpenAboutPlugins(); |
| 62 void OnCouldNotLoadPlugin(const base::FilePath& plugin_path); | 82 void OnCouldNotLoadPlugin(const base::FilePath& plugin_path); |
| 63 | 83 |
| 64 #if defined(ENABLE_PLUGIN_INSTALLATION) | 84 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 65 // Stores all PluginPlaceholderHosts, keyed by their routing ID. | 85 // Stores all PluginPlaceholderHosts, keyed by their routing ID. |
| 66 std::map<int, PluginPlaceholderHost*> plugin_placeholders_; | 86 std::map<int, PluginPlaceholderHost*> plugin_placeholders_; |
| 67 #endif | 87 #endif |
| 68 | 88 |
| 89 // Stores all ComponentObservers, keyed by their routing ID. | |
| 90 std::map<int, std::unique_ptr<ComponentObserver>> component_observers_; | |
| 91 | |
| 69 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; | 92 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; |
| 70 | 93 |
| 71 DISALLOW_COPY_AND_ASSIGN(PluginObserver); | 94 DISALLOW_COPY_AND_ASSIGN(PluginObserver); |
| 72 }; | 95 }; |
| 73 | 96 |
| 74 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ | 97 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ |
| OLD | NEW |