Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(860)

Side by Side Diff: chrome/browser/plugins/plugin_observer.h

Issue 2154773002: Implement Just-In-Time Flash updates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First Review Pass Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
13 #include "content/public/browser/web_contents_user_data.h" 13 #include "content/public/browser/web_contents_user_data.h"
14 14
15 #if defined(ENABLE_PLUGIN_INSTALLATION) 15 #if defined(ENABLE_PLUGIN_INSTALLATION)
16 #include <map> 16 #include <map>
17 #endif 17 #endif
18 18
19 class GURL; 19 class GURL;
20 class PluginFinder; 20 class PluginFinder;
21 class PluginMetadata; 21 class PluginMetadata;
22 22
23 #if defined(ENABLE_PLUGIN_INSTALLATION) 23 #if defined(ENABLE_PLUGIN_INSTALLATION)
24 class PluginInstaller; 24 class PluginInstaller;
25 class PluginPlaceholderHost; 25 class PluginPlaceholderHost;
26 #endif 26 #endif
27 27
28 class ComponentObserver;
29
28 namespace content { 30 namespace content {
29 class WebContents; 31 class WebContents;
30 } 32 }
31 33
32 namespace infobars { 34 namespace infobars {
33 class InfoBarDelegate; 35 class InfoBarDelegate;
34 } 36 }
35 37
36 class PluginObserver : public content::WebContentsObserver, 38 class PluginObserver : public content::WebContentsObserver,
37 public content::WebContentsUserData<PluginObserver> { 39 public content::WebContentsUserData<PluginObserver> {
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:
48 explicit PluginObserver(content::WebContents* web_contents); 50 explicit PluginObserver(content::WebContents* web_contents);
49 friend class content::WebContentsUserData<PluginObserver>; 51 friend class content::WebContentsUserData<PluginObserver>;
52 friend class ComponentObserver;
Bernhard Bauer 2016/07/28 10:25:10 Could you make this an inner class? That way it wo
waffles 2016/07/28 20:06:27 Done.
50 53
51 class PluginPlaceholderHost; 54 class PluginPlaceholderHost;
52 55
53 // Message handlers: 56 // Message handlers:
54 void OnBlockedUnauthorizedPlugin(const base::string16& name, 57 void OnBlockedUnauthorizedPlugin(const base::string16& name,
55 const std::string& identifier); 58 const std::string& identifier);
56 void OnBlockedOutdatedPlugin(int placeholder_id, 59 void OnBlockedOutdatedPlugin(int placeholder_id,
57 const std::string& identifier); 60 const std::string& identifier);
61 void OnBlockedUpdatePlugin(int placeholder_id,
62 const std::string& identifier);
58 #if defined(ENABLE_PLUGIN_INSTALLATION) 63 #if defined(ENABLE_PLUGIN_INSTALLATION)
59 void OnRemovePluginPlaceholderHost(int placeholder_id); 64 void OnRemovePluginPlaceholderHost(int placeholder_id);
60 #endif 65 #endif
66 void RemoveComponentObserver(int placeholder_id);
61 void OnOpenAboutPlugins(); 67 void OnOpenAboutPlugins();
62 void OnCouldNotLoadPlugin(const base::FilePath& plugin_path); 68 void OnCouldNotLoadPlugin(const base::FilePath& plugin_path);
63 69
64 #if defined(ENABLE_PLUGIN_INSTALLATION) 70 #if defined(ENABLE_PLUGIN_INSTALLATION)
65 // Stores all PluginPlaceholderHosts, keyed by their routing ID. 71 // Stores all PluginPlaceholderHosts, keyed by their routing ID.
66 std::map<int, PluginPlaceholderHost*> plugin_placeholders_; 72 std::map<int, PluginPlaceholderHost*> plugin_placeholders_;
67 #endif 73 #endif
68 74
75 // Stores all PluginPlaceholderHosts, keyed by their routing ID.
Bernhard Bauer 2016/07/28 10:25:10 Nit: stores all ComponentObservers?
waffles 2016/07/28 20:06:27 Done.
76 std::map<int, ComponentObserver*> component_observers_;
Bernhard Bauer 2016/07/28 10:25:10 This map could store unique_ptr<>'s now (|plugin_p
waffles 2016/07/28 20:06:27 Done.
77
69 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; 78 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_;
70 79
71 DISALLOW_COPY_AND_ASSIGN(PluginObserver); 80 DISALLOW_COPY_AND_ASSIGN(PluginObserver);
72 }; 81 };
73 82
74 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ 83 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698