OLD | NEW |
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_PEPPER_FLASH_SETTINGS_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PEPPER_FLASH_SETTINGS_MANAGER_H_ |
6 #define CHROME_BROWSER_PEPPER_FLASH_SETTINGS_MANAGER_H_ | 6 #define CHROME_BROWSER_PEPPER_FLASH_SETTINGS_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "ppapi/c/private/ppp_flash_browser_operations.h" |
| 12 #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h" |
11 | 13 |
12 class PluginPrefs; | 14 class PluginPrefs; |
13 class PrefService; | 15 class PrefService; |
14 | 16 |
15 namespace content { | 17 namespace content { |
16 class BrowserContext; | 18 class BrowserContext; |
17 } | 19 } |
18 | 20 |
19 namespace webkit { | 21 namespace webkit { |
20 struct WebPluginInfo; | 22 struct WebPluginInfo; |
21 } | 23 } |
22 | 24 |
23 // PepperFlashSettingsManager communicates with a PPAPI broker process to | 25 // PepperFlashSettingsManager communicates with a PPAPI broker process to |
24 // read/write Pepper Flash settings. | 26 // read/write Pepper Flash settings. |
25 class PepperFlashSettingsManager { | 27 class PepperFlashSettingsManager { |
26 public: | 28 public: |
27 class Client { | 29 class Client { |
28 public: | 30 public: |
29 virtual ~Client() {} | 31 virtual ~Client() {} |
30 | 32 |
31 virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id, | 33 virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id, |
32 bool success) = 0; | 34 bool success) {} |
| 35 virtual void OnGetPermissionSettingsCompleted( |
| 36 uint32 request_id, |
| 37 bool success, |
| 38 PP_Flash_BrowserOperations_Permission default_permission, |
| 39 const ppapi::FlashSiteSettings& sites) {} |
| 40 |
| 41 virtual void OnSetDefaultPermissionCompleted(uint32 request_id, |
| 42 bool success) {} |
| 43 |
| 44 virtual void OnSetSitePermissionCompleted(uint32 request_id, |
| 45 bool success) {} |
33 }; | 46 }; |
34 | 47 |
35 // |client| must outlive this object. It is guaranteed that |client| won't | 48 // |client| must outlive this object. It is guaranteed that |client| won't |
36 // receive any notifications after this object goes away. | 49 // receive any notifications after this object goes away. |
37 PepperFlashSettingsManager(Client* client, | 50 PepperFlashSettingsManager(Client* client, |
38 content::BrowserContext* browser_context); | 51 content::BrowserContext* browser_context); |
39 ~PepperFlashSettingsManager(); | 52 ~PepperFlashSettingsManager(); |
40 | 53 |
41 // |plugin_info| will be updated if it is not NULL and the method returns | 54 // |plugin_info| will be updated if it is not NULL and the method returns |
42 // true. | 55 // true. |
43 static bool IsPepperFlashInUse(PluginPrefs* plugin_prefs, | 56 static bool IsPepperFlashInUse(PluginPrefs* plugin_prefs, |
44 webkit::WebPluginInfo* plugin_info); | 57 webkit::WebPluginInfo* plugin_info); |
45 | 58 |
46 static void RegisterUserPrefs(PrefService* prefs); | 59 static void RegisterUserPrefs(PrefService* prefs); |
47 | 60 |
48 // Requests to deauthorize content licenses. | 61 // Requests to deauthorize content licenses. |
49 // Client::OnDeauthorizeContentLicensesCompleted() will be called when the | 62 // Client::OnDeauthorizeContentLicensesCompleted() will be called when the |
50 // operation is completed. | 63 // operation is completed. |
51 // The return value is the same as the request ID passed into | 64 // The return value is the same as the request ID passed into |
52 // Client::OnDeauthorizeContentLicensesCompleted(). | 65 // Client::OnDeauthorizeContentLicensesCompleted(). |
53 uint32 DeauthorizeContentLicenses(); | 66 uint32 DeauthorizeContentLicenses(); |
54 | 67 |
| 68 // Gets permission settings. |
| 69 // Client::OnGetPermissionSettingsCompleted() will be called when the |
| 70 // operation is completed. |
| 71 uint32 GetPermissionSettings( |
| 72 PP_Flash_BrowserOperations_SettingType setting_type); |
| 73 |
| 74 // Sets default permission. |
| 75 // Client::OnSetDefaultPermissionCompleted() will be called when the |
| 76 // operation is completed. |
| 77 uint32 SetDefaultPermission( |
| 78 PP_Flash_BrowserOperations_SettingType setting_type, |
| 79 PP_Flash_BrowserOperations_Permission permission, |
| 80 bool clear_site_specific); |
| 81 |
| 82 // Sets site-specific permission. |
| 83 // Client::OnSetSitePermissionCompleted() will be called when the operation |
| 84 // is completed. |
| 85 uint32 SetSitePermission(PP_Flash_BrowserOperations_SettingType setting_type, |
| 86 const ppapi::FlashSiteSettings& sites); |
| 87 |
55 private: | 88 private: |
56 // Core does most of the work. It is ref-counted so that its lifespan can be | 89 // Core does most of the work. It is ref-counted so that its lifespan can be |
57 // independent of the containing object's: | 90 // independent of the containing object's: |
58 // - The manager can be deleted on the UI thread while the core still being | 91 // - The manager can be deleted on the UI thread while the core still being |
59 // used on the I/O thread. | 92 // used on the I/O thread. |
60 // - The manager can delete the core when it encounters errors and create | 93 // - The manager can delete the core when it encounters errors and create |
61 // another one to handle new requests. | 94 // another one to handle new requests. |
62 class Core; | 95 class Core; |
63 | 96 |
64 uint32 GetNextRequestId(); | 97 uint32 GetNextRequestId(); |
(...skipping 10 matching lines...) Expand all Loading... |
75 content::BrowserContext* browser_context_; | 108 content::BrowserContext* browser_context_; |
76 | 109 |
77 scoped_refptr<Core> core_; | 110 scoped_refptr<Core> core_; |
78 | 111 |
79 uint32 next_request_id_; | 112 uint32 next_request_id_; |
80 | 113 |
81 DISALLOW_COPY_AND_ASSIGN(PepperFlashSettingsManager); | 114 DISALLOW_COPY_AND_ASSIGN(PepperFlashSettingsManager); |
82 }; | 115 }; |
83 | 116 |
84 #endif // CHROME_BROWSER_PEPPER_FLASH_SETTINGS_MANAGER_H_ | 117 #endif // CHROME_BROWSER_PEPPER_FLASH_SETTINGS_MANAGER_H_ |
OLD | NEW |