Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / plugins / plugin_observer.h
blobb0f43b77927e74c6414a9a826798a41bf73cd2b4
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.
5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_
6 #define CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "content/public/browser/web_contents_observer.h"
11 #include "content/public/browser/web_contents_user_data.h"
13 #if defined(ENABLE_PLUGIN_INSTALLATION)
14 #include <map>
15 #endif
17 class GURL;
18 class InfoBarDelegate;
19 class PluginFinder;
20 class PluginMetadata;
22 #if defined(ENABLE_PLUGIN_INSTALLATION)
23 class PluginInstaller;
24 class PluginPlaceholderHost;
25 #endif
27 namespace content {
28 class WebContents;
31 class PluginObserver : public content::WebContentsObserver,
32 public content::WebContentsUserData<PluginObserver> {
33 public:
34 virtual ~PluginObserver();
36 // content::WebContentsObserver implementation.
37 virtual void RenderFrameCreated(
38 content::RenderFrameHost* render_frame_host) OVERRIDE;
39 virtual void PluginCrashed(const base::FilePath& plugin_path,
40 base::ProcessId plugin_pid) OVERRIDE;
41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
43 private:
44 explicit PluginObserver(content::WebContents* web_contents);
45 friend class content::WebContentsUserData<PluginObserver>;
47 class PluginPlaceholderHost;
49 #if defined(ENABLE_PLUGIN_INSTALLATION)
50 void InstallMissingPlugin(PluginInstaller* installer,
51 const PluginMetadata* plugin_metadata);
52 #endif
54 // Message handlers:
55 void OnBlockedUnauthorizedPlugin(const base::string16& name,
56 const std::string& identifier);
57 void OnBlockedOutdatedPlugin(int placeholder_id,
58 const std::string& identifier);
59 #if defined(ENABLE_PLUGIN_INSTALLATION)
60 void OnFindMissingPlugin(int placeholder_id, const std::string& mime_type);
62 void OnRemovePluginPlaceholderHost(int placeholder_id);
63 #endif
64 void OnOpenAboutPlugins();
65 void OnCouldNotLoadPlugin(const base::FilePath& plugin_path);
66 void OnNPAPINotSupported(const std::string& identifier);
68 #if defined(ENABLE_PLUGIN_INSTALLATION)
69 // Stores all PluginPlaceholderHosts, keyed by their routing ID.
70 std::map<int, PluginPlaceholderHost*> plugin_placeholders_;
71 #endif
73 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_;
75 DISALLOW_COPY_AND_ASSIGN(PluginObserver);
78 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_