OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_PLUGIN_OBSERVER_H_ | |
6 #define CHROME_BROWSER_PLUGIN_OBSERVER_H_ | |
7 | |
8 #include "base/memory/weak_ptr.h" | |
9 #include "content/public/browser/web_contents_observer.h" | |
10 | |
11 #if defined(ENABLE_PLUGIN_INSTALLATION) | |
12 #include <map> | |
13 #endif | |
14 | |
15 class GURL; | |
16 class InfoBarDelegate; | |
17 class PluginFinder; | |
18 class TabContents; | |
19 | |
20 #if defined(ENABLE_PLUGIN_INSTALLATION) | |
21 class PluginInstaller; | |
22 class PluginPlaceholderHost; | |
23 #endif | |
24 | |
25 class PluginObserver : public content::WebContentsObserver { | |
26 public: | |
27 explicit PluginObserver(TabContents* tab_contents); | |
28 virtual ~PluginObserver(); | |
29 | |
30 // content::WebContentsObserver implementation. | |
31 virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE; | |
32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
33 | |
34 #if defined(ENABLE_PLUGIN_INSTALLATION) | |
35 void InstallMissingPlugin(PluginInstaller* installer); | |
36 #endif | |
37 | |
38 TabContents* tab_contents() { return tab_contents_; } | |
39 | |
40 private: | |
41 class PluginPlaceholderHost; | |
42 | |
43 void OnBlockedUnauthorizedPlugin(const string16& name, | |
44 const std::string& identifier); | |
45 void OnBlockedOutdatedPlugin(int placeholder_id, | |
46 const std::string& identifier); | |
47 #if defined(ENABLE_PLUGIN_INSTALLATION) | |
48 void OnFindMissingPlugin(int placeholder_id, const std::string& mime_type); | |
49 | |
50 void FindMissingPlugin(int placeholder_id, | |
51 const std::string& mime_type, | |
52 PluginFinder* plugin_finder); | |
53 void FindPluginToUpdate(int placeholder_id, | |
54 const std::string& identifier, | |
55 PluginFinder* plugin_finder); | |
56 void OnRemovePluginPlaceholderHost(int placeholder_id); | |
57 #endif | |
58 void OnOpenAboutPlugins(); | |
59 void OnCouldNotLoadPlugin(const FilePath& plugin_path); | |
60 | |
61 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; | |
62 | |
63 TabContents* tab_contents_; | |
64 | |
65 #if defined(ENABLE_PLUGIN_INSTALLATION) | |
66 // Stores all PluginPlaceholderHosts, keyed by their routing ID. | |
67 std::map<int, PluginPlaceholderHost*> plugin_placeholders_; | |
68 #endif | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(PluginObserver); | |
71 }; | |
72 | |
73 #endif // CHROME_BROWSER_PLUGIN_OBSERVER_H_ | |
OLD | NEW |