| 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" |
| 10 #include "base/memory/ref_counted.h" |
| 11 |
| 9 class PluginPrefs; | 12 class PluginPrefs; |
| 10 | 13 |
| 14 namespace content { |
| 15 class BrowserContext; |
| 16 } |
| 17 |
| 11 namespace webkit { | 18 namespace webkit { |
| 12 struct WebPluginInfo; | 19 struct WebPluginInfo; |
| 13 } | 20 } |
| 14 | 21 |
| 15 // PepperFlashSettingsManager communicates with a PPAPI broker process to | 22 // PepperFlashSettingsManager communicates with a PPAPI broker process to |
| 16 // read/write Pepper Flash settings. | 23 // read/write Pepper Flash settings. |
| 17 class PepperFlashSettingsManager { | 24 class PepperFlashSettingsManager { |
| 18 public: | 25 public: |
| 26 class Client { |
| 27 public: |
| 28 virtual ~Client() {} |
| 29 |
| 30 virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id, |
| 31 bool success) = 0; |
| 32 }; |
| 33 |
| 34 // |client| must outlive this object. It is guaranteed that |client| won't |
| 35 // receive any notifications after this object goes away. |
| 36 PepperFlashSettingsManager(Client* client, |
| 37 content::BrowserContext* browser_context); |
| 38 ~PepperFlashSettingsManager(); |
| 39 |
| 19 // |plugin_info| will be updated if it is not NULL and the method returns | 40 // |plugin_info| will be updated if it is not NULL and the method returns |
| 20 // true. | 41 // true. |
| 21 static bool IsPepperFlashInUse(PluginPrefs* plugin_prefs, | 42 static bool IsPepperFlashInUse(PluginPrefs* plugin_prefs, |
| 22 webkit::WebPluginInfo* plugin_info); | 43 webkit::WebPluginInfo* plugin_info); |
| 44 |
| 45 // Requests to deauthorize content licenses. |
| 46 // Client::OnDeauthorizeContentLicensesCompleted() will be called when the |
| 47 // operation is completed. |
| 48 // The return value is the same as the request ID passed into |
| 49 // Client::OnDeauthorizeContentLicensesCompleted(). |
| 50 uint32 DeauthorizeContentLicenses(); |
| 51 |
| 52 private: |
| 53 // Core does most of the work. It is ref-counted so that its lifespan can be |
| 54 // independent of the containing object's: |
| 55 // - The manager can be deleted on the UI thread while the core still being |
| 56 // used on the I/O thread. |
| 57 // - The manager can delete the core when it encounters errors and create |
| 58 // another one to handle new requests. |
| 59 class Core; |
| 60 |
| 61 uint32 GetNextRequestId(); |
| 62 |
| 63 void EnsureCoreExists(); |
| 64 |
| 65 // Notified by |core_| when an error occurs. |
| 66 void OnError(); |
| 67 |
| 68 // |client_| is not owned by this object and must outlive it. |
| 69 Client* client_; |
| 70 |
| 71 // The browser context for the profile. |
| 72 content::BrowserContext* browser_context_; |
| 73 |
| 74 scoped_refptr<Core> core_; |
| 75 |
| 76 uint32 next_request_id_; |
| 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(PepperFlashSettingsManager); |
| 23 }; | 79 }; |
| 24 | 80 |
| 25 #endif // CHROME_BROWSER_PEPPER_FLASH_SETTINGS_MANAGER_H_ | 81 #endif // CHROME_BROWSER_PEPPER_FLASH_SETTINGS_MANAGER_H_ |
| OLD | NEW |