| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GUEST_VIEW_WEB_VIEW_PLUGIN_PERMISSION_HELPER_H_ | 5 #ifndef CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_PLUGIN_PERMISSION_HELPER_H_ |
| 6 #define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_PLUGIN_PERMISSION_HELPER_H_ | 6 #define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_PLUGIN_PERMISSION_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
| 10 #include "content/public/browser/web_contents_user_data.h" | 10 #include "content/public/browser/web_contents_user_data.h" |
| 11 | 11 |
| 12 class PluginPermissionHelper | 12 class PluginPermissionHelper |
| 13 : public content::WebContentsUserData<PluginPermissionHelper>, | 13 : public content::WebContentsUserData<PluginPermissionHelper>, |
| 14 public content::WebContentsObserver { | 14 public content::WebContentsObserver { |
| 15 public: | 15 public: |
| 16 virtual ~PluginPermissionHelper(); | 16 virtual ~PluginPermissionHelper(); |
| 17 | 17 |
| 18 private: | 18 private: |
| 19 explicit PluginPermissionHelper(content::WebContents* web_contents); | 19 explicit PluginPermissionHelper(content::WebContents* web_contents); |
| 20 friend class content::WebContentsUserData<PluginPermissionHelper>; | 20 friend class content::WebContentsUserData<PluginPermissionHelper>; |
| 21 | 21 |
| 22 // content::WebContentsObserver implementation. | 22 // content::WebContentsObserver implementation. |
| 23 virtual bool OnMessageReceived( |
| 24 const IPC::Message& message, |
| 25 content::RenderFrameHost* render_frame_host) OVERRIDE; |
| 23 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 26 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 24 | 27 |
| 25 // Message handlers: | 28 // Message handlers: |
| 26 void OnBlockedUnauthorizedPlugin(const base::string16& name, | 29 void OnBlockedUnauthorizedPlugin(const base::string16& name, |
| 27 const std::string& identifier); | 30 const std::string& identifier); |
| 28 void OnCouldNotLoadPlugin(const base::FilePath& plugin_path); | 31 void OnCouldNotLoadPlugin(const base::FilePath& plugin_path); |
| 29 void OnBlockedOutdatedPlugin(int placeholder_id, | 32 void OnBlockedOutdatedPlugin(int placeholder_id, |
| 30 const std::string& identifier); | 33 const std::string& identifier); |
| 31 void OnNPAPINotSupported(const std::string& identifier); | 34 void OnNPAPINotSupported(const std::string& identifier); |
| 32 void OnOpenAboutPlugins(); | 35 void OnOpenAboutPlugins(); |
| 33 #if defined(ENABLE_PLUGIN_INSTALLATION) | 36 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 34 void OnFindMissingPlugin(int placeholder_id, const std::string& mime_type); | 37 void OnFindMissingPlugin(int placeholder_id, const std::string& mime_type); |
| 35 | 38 |
| 36 void OnRemovePluginPlaceholderHost(int placeholder_id); | 39 void OnRemovePluginPlaceholderHost(int placeholder_id); |
| 37 #endif | 40 #endif |
| 38 | 41 |
| 39 void OnPermissionResponse(const std::string& identifier, | 42 void OnPermissionResponse(const std::string& identifier, |
| 40 bool allow, | 43 bool allow, |
| 41 const std::string& user_input); | 44 const std::string& user_input); |
| 42 | 45 |
| 43 base::WeakPtrFactory<PluginPermissionHelper> weak_factory_; | 46 base::WeakPtrFactory<PluginPermissionHelper> weak_factory_; |
| 44 | 47 |
| 45 DISALLOW_COPY_AND_ASSIGN(PluginPermissionHelper); | 48 DISALLOW_COPY_AND_ASSIGN(PluginPermissionHelper); |
| 46 }; | 49 }; |
| 47 | 50 |
| 48 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_PLUGIN_PERMISSION_HELPER_H_ | 51 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_PLUGIN_PERMISSION_HELPER_H_ |
| OLD | NEW |