| 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 "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/tab_contents/web_contents_user_data.h" | 9 #include "chrome/browser/tab_contents/web_contents_user_data.h" |
| 10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 class PluginObserver : public content::WebContentsObserver, | 29 class PluginObserver : public content::WebContentsObserver, |
| 30 public WebContentsUserData<PluginObserver> { | 30 public WebContentsUserData<PluginObserver> { |
| 31 public: | 31 public: |
| 32 virtual ~PluginObserver(); | 32 virtual ~PluginObserver(); |
| 33 | 33 |
| 34 // content::WebContentsObserver implementation. | 34 // content::WebContentsObserver implementation. |
| 35 virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE; | 35 virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE; |
| 36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 37 | 37 |
| 38 #if defined(ENABLE_PLUGIN_INSTALLATION) | |
| 39 void InstallMissingPlugin(PluginInstaller* installer); | |
| 40 #endif | |
| 41 | |
| 42 // Make public the web_contents() accessor that is protected in the parent. | |
| 43 using content::WebContentsObserver::web_contents; | |
| 44 | |
| 45 private: | 38 private: |
| 46 explicit PluginObserver(content::WebContents* web_contents); | 39 explicit PluginObserver(content::WebContents* web_contents); |
| 47 static int kUserDataKey; | 40 static int kUserDataKey; |
| 48 friend class WebContentsUserData<PluginObserver>; | 41 friend class WebContentsUserData<PluginObserver>; |
| 49 | 42 |
| 50 class PluginPlaceholderHost; | 43 class PluginPlaceholderHost; |
| 51 | 44 |
| 45 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 46 void InstallMissingPlugin(PluginInstaller* installer); |
| 47 #endif |
| 48 |
| 49 // Message handlers: |
| 52 void OnBlockedUnauthorizedPlugin(const string16& name, | 50 void OnBlockedUnauthorizedPlugin(const string16& name, |
| 53 const std::string& identifier); | 51 const std::string& identifier); |
| 54 void OnBlockedOutdatedPlugin(int placeholder_id, | 52 void OnBlockedOutdatedPlugin(int placeholder_id, |
| 55 const std::string& identifier); | 53 const std::string& identifier); |
| 56 #if defined(ENABLE_PLUGIN_INSTALLATION) | 54 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 57 void OnFindMissingPlugin(int placeholder_id, const std::string& mime_type); | 55 void OnFindMissingPlugin(int placeholder_id, const std::string& mime_type); |
| 58 | 56 |
| 59 void FindMissingPlugin(int placeholder_id, | 57 void FindMissingPlugin(int placeholder_id, |
| 60 const std::string& mime_type, | 58 const std::string& mime_type, |
| 61 PluginFinder* plugin_finder); | 59 PluginFinder* plugin_finder); |
| 62 void FindPluginToUpdate(int placeholder_id, | 60 void FindPluginToUpdate(int placeholder_id, |
| 63 const std::string& identifier, | 61 const std::string& identifier, |
| 64 PluginFinder* plugin_finder); | 62 PluginFinder* plugin_finder); |
| 65 void OnRemovePluginPlaceholderHost(int placeholder_id); | 63 void OnRemovePluginPlaceholderHost(int placeholder_id); |
| 66 #endif | 64 #endif |
| 67 void OnOpenAboutPlugins(); | 65 void OnOpenAboutPlugins(); |
| 68 void OnCouldNotLoadPlugin(const FilePath& plugin_path); | 66 void OnCouldNotLoadPlugin(const FilePath& plugin_path); |
| 69 | 67 |
| 70 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; | 68 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; |
| 71 | 69 |
| 72 #if defined(ENABLE_PLUGIN_INSTALLATION) | 70 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 73 // Stores all PluginPlaceholderHosts, keyed by their routing ID. | 71 // Stores all PluginPlaceholderHosts, keyed by their routing ID. |
| 74 std::map<int, PluginPlaceholderHost*> plugin_placeholders_; | 72 std::map<int, PluginPlaceholderHost*> plugin_placeholders_; |
| 75 #endif | 73 #endif |
| 76 | 74 |
| 77 DISALLOW_COPY_AND_ASSIGN(PluginObserver); | 75 DISALLOW_COPY_AND_ASSIGN(PluginObserver); |
| 78 }; | 76 }; |
| 79 | 77 |
| 80 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ | 78 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ |
| OLD | NEW |