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_PLUGIN_OBSERVER_H_
6 #define CHROME_BROWSER_PLUGIN_OBSERVER_H_
9 #include "base/memory/weak_ptr.h"
10 #include "content/public/browser/web_contents_observer.h"
12 #if defined(ENABLE_PLUGIN_INSTALLATION)
17 class InfoBarDelegate
;
18 class PluginInstaller
;
19 class TabContentsWrapper
;
21 #if defined(ENABLE_PLUGIN_INSTALLATION)
22 class PluginInstaller
;
25 class PluginObserver
: public content::WebContentsObserver
{
27 explicit PluginObserver(TabContentsWrapper
* tab_contents
);
28 virtual ~PluginObserver();
30 // content::WebContentsObserver implementation.
31 virtual bool OnMessageReceived(const IPC::Message
& message
) OVERRIDE
;
34 #if defined(ENABLE_PLUGIN_INSTALLATION)
35 class PluginPlaceholderHost
;
38 void OnBlockedOutdatedPlugin(const string16
& name
, const GURL
& update_url
);
39 void OnBlockedUnauthorizedPlugin(const string16
& name
);
40 #if defined(ENABLE_PLUGIN_INSTALLATION)
41 void OnFindMissingPlugin(int placeholder_id
, const std::string
& mime_type
);
43 void FoundMissingPlugin(int placeholder_id
,
44 const std::string
& mime_type
,
45 PluginInstaller
* installer
);
46 void DidNotFindMissingPlugin(int placeholder_id
);
47 void InstallMissingPlugin(PluginInstaller
* installer
);
49 void OnOpenAboutPlugins();
50 void OnRemovePluginPlaceholderHost(int placeholder_id
);
52 base::WeakPtrFactory
<PluginObserver
> weak_ptr_factory_
;
54 TabContentsWrapper
* tab_contents_
;
56 #if defined(ENABLE_PLUGIN_INSTALLATION)
57 // Stores all PluginPlaceholderHosts, keyed by their routing ID.
58 std::map
<int, PluginPlaceholderHost
*> plugin_placeholders_
;
61 DISALLOW_COPY_AND_ASSIGN(PluginObserver
);
64 #endif // CHROME_BROWSER_PLUGIN_OBSERVER_H_