[email protected] | 18a4d63c8 | 2012-05-25 23:37:03 | [diff] [blame] | 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. |
| 4 | |
| 5 | #include "chrome/browser/pepper_flash_settings_manager.h" |
| 6 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 7 | #include <map> |
| 8 | #include <utility> |
[email protected] | 18a4d63c8 | 2012-05-25 23:37:03 | [diff] [blame] | 9 | #include <vector> |
| 10 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 11 | #include "base/bind.h" |
| 12 | #include "base/compiler_specific.h" |
[email protected] | bb9c975 | 2013-04-25 23:02:11 | [diff] [blame] | 13 | #include "base/file_util.h" |
[email protected] | 3853a4c | 2013-02-11 17:15:57 | [diff] [blame] | 14 | #include "base/prefs/pref_service.h" |
[email protected] | fb44196 | 2013-05-08 05:35:24 | [diff] [blame] | 15 | #include "base/sequenced_task_runner_helpers.h" |
[email protected] | e309f31 | 2013-06-07 21:50:08 | [diff] [blame^] | 16 | #include "base/strings/utf_string_conversions.h" |
[email protected] | 0f5e57f5 | 2012-09-20 20:53:18 | [diff] [blame] | 17 | #include "chrome/browser/plugins/plugin_prefs.h" |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 18 | #include "chrome/browser/profiles/profile.h" |
[email protected] | bb9c975 | 2013-04-25 23:02:11 | [diff] [blame] | 19 | #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h" |
[email protected] | 18a4d63c8 | 2012-05-25 23:37:03 | [diff] [blame] | 20 | #include "chrome/common/pref_names.h" |
[email protected] | 75fee37 | 2013-03-06 00:42:44 | [diff] [blame] | 21 | #include "components/user_prefs/pref_registry_syncable.h" |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 22 | #include "content/public/browser/browser_context.h" |
| 23 | #include "content/public/browser/browser_thread.h" |
| 24 | #include "content/public/browser/pepper_flash_settings_helper.h" |
[email protected] | 18a4d63c8 | 2012-05-25 23:37:03 | [diff] [blame] | 25 | #include "content/public/browser/plugin_service.h" |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 26 | #include "content/public/common/content_constants.h" |
[email protected] | 18a4d63c8 | 2012-05-25 23:37:03 | [diff] [blame] | 27 | #include "googleurl/src/gurl.h" |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 28 | #include "ipc/ipc_channel.h" |
[email protected] | 4e07f84 | 2012-11-15 22:22:17 | [diff] [blame] | 29 | #include "ipc/ipc_listener.h" |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 30 | #include "ppapi/proxy/ppapi_messages.h" |
[email protected] | 18a4d63c8 | 2012-05-25 23:37:03 | [diff] [blame] | 31 | #include "webkit/plugins/plugin_constants.h" |
| 32 | #include "webkit/plugins/webplugininfo.h" |
| 33 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 34 | using content::BrowserThread; |
| 35 | |
| 36 | class PepperFlashSettingsManager::Core |
[email protected] | b44f8ad | 2012-06-15 20:52:58 | [diff] [blame] | 37 | : public IPC::Listener, |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 38 | public base::RefCountedThreadSafe<Core, BrowserThread::DeleteOnIOThread> { |
| 39 | public: |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 40 | Core(base::WeakPtr<PepperFlashSettingsManager> manager, |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 41 | content::BrowserContext* browser_context); |
| 42 | |
[email protected] | 6464cc1 | 2012-07-12 09:25:53 | [diff] [blame] | 43 | void Initialize(); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 44 | |
| 45 | // Notifies the core that it has been detached. Afterwards, no method should |
| 46 | // be called any more. |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 47 | void Detach(); |
| 48 | |
| 49 | void DeauthorizeContentLicenses(uint32 request_id); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 50 | void GetPermissionSettings( |
| 51 | uint32 request_id, |
| 52 | PP_Flash_BrowserOperations_SettingType setting_type); |
| 53 | void SetDefaultPermission( |
| 54 | uint32 request_id, |
| 55 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 56 | PP_Flash_BrowserOperations_Permission permission, |
| 57 | bool clear_site_specific); |
| 58 | void SetSitePermission(uint32 request_id, |
| 59 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 60 | const ppapi::FlashSiteSettings& sites); |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 61 | void GetSitesWithData(uint32 request_id); |
| 62 | void ClearSiteData(uint32 request_id, |
| 63 | const std::string& site, |
| 64 | uint64 flags, |
| 65 | uint64 max_age); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 66 | |
[email protected] | b44f8ad | 2012-06-15 20:52:58 | [diff] [blame] | 67 | // IPC::Listener implementation. |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 68 | virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 69 | virtual void OnChannelError() OVERRIDE; |
| 70 | |
| 71 | private: |
| 72 | friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
| 73 | friend class base::DeleteHelper<Core>; |
| 74 | |
| 75 | enum RequestType { |
| 76 | INVALID_REQUEST_TYPE = 0, |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 77 | DEAUTHORIZE_CONTENT_LICENSES, |
| 78 | GET_PERMISSION_SETTINGS, |
| 79 | SET_DEFAULT_PERMISSION, |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 80 | SET_SITE_PERMISSION, |
| 81 | GET_SITES_WITH_DATA, |
| 82 | CLEAR_SITE_DATA, |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 83 | }; |
| 84 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 85 | enum State { |
| 86 | STATE_UNINITIALIZED = 0, |
| 87 | STATE_INITIALIZED, |
| 88 | STATE_ERROR, |
| 89 | STATE_DETACHED, |
| 90 | }; |
| 91 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 92 | struct PendingRequest { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 93 | PendingRequest() |
| 94 | : id(0), |
| 95 | type(INVALID_REQUEST_TYPE), |
| 96 | setting_type(PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC), |
| 97 | permission(PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT), |
[email protected] | 3695fe3 | 2012-08-03 01:55:59 | [diff] [blame] | 98 | clear_site_specific(false), |
| 99 | flags(0), |
| 100 | max_age(0) { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 101 | } |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 102 | |
| 103 | uint32 id; |
| 104 | RequestType type; |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 105 | |
| 106 | // Used by GET_PERMISSION_SETTINGS, SET_DEFAULT_PERMISSION and |
| 107 | // SET_SITE_PERMISSION. |
| 108 | PP_Flash_BrowserOperations_SettingType setting_type; |
| 109 | |
| 110 | // Used by SET_DEFAULT_PERMISSION. |
| 111 | PP_Flash_BrowserOperations_Permission permission; |
| 112 | bool clear_site_specific; |
| 113 | |
| 114 | // Used by SET_SITE_PERMISSION. |
| 115 | ppapi::FlashSiteSettings sites; |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 116 | |
| 117 | // Used by CLEAR_SITE_DATA |
| 118 | std::string site; |
| 119 | uint64 flags; |
| 120 | uint64 max_age; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 121 | }; |
| 122 | |
| 123 | virtual ~Core(); |
| 124 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 125 | void ConnectToChannel(bool success, const IPC::ChannelHandle& handle); |
| 126 | |
[email protected] | 6464cc1 | 2012-07-12 09:25:53 | [diff] [blame] | 127 | void InitializeOnIOThread(); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 128 | void DeauthorizeContentLicensesOnIOThread(uint32 request_id); |
[email protected] | bb9c975 | 2013-04-25 23:02:11 | [diff] [blame] | 129 | void DeauthorizeContentLicensesOnBlockingPool( |
| 130 | uint32 request_id, |
| 131 | const base::FilePath& profile_path); |
| 132 | void DeauthorizeContentLicensesInPlugin(uint32 request_id, bool success); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 133 | void GetPermissionSettingsOnIOThread( |
| 134 | uint32 request_id, |
| 135 | PP_Flash_BrowserOperations_SettingType setting_type); |
| 136 | void SetDefaultPermissionOnIOThread( |
| 137 | uint32 request_id, |
| 138 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 139 | PP_Flash_BrowserOperations_Permission permission, |
| 140 | bool clear_site_specific); |
| 141 | void SetSitePermissionOnIOThread( |
| 142 | uint32 request_id, |
| 143 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 144 | const ppapi::FlashSiteSettings& sites); |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 145 | void GetSitesWithDataOnIOThread(uint32 request_id); |
| 146 | void ClearSiteDataOnIOThread(uint32 request_id, |
| 147 | const std::string& site, |
| 148 | uint64 flags, |
| 149 | uint64 max_age); |
[email protected] | 4d4ee4c | 2012-06-22 19:11:30 | [diff] [blame] | 150 | void DetachOnIOThread(); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 151 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 152 | void NotifyErrorFromIOThread(); |
| 153 | |
| 154 | void NotifyDeauthorizeContentLicensesCompleted(uint32 request_id, |
| 155 | bool success); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 156 | void NotifyGetPermissionSettingsCompleted( |
| 157 | uint32 request_id, |
| 158 | bool success, |
| 159 | PP_Flash_BrowserOperations_Permission default_permission, |
| 160 | const ppapi::FlashSiteSettings& sites); |
| 161 | void NotifySetDefaultPermissionCompleted(uint32 request_id, bool success); |
| 162 | void NotifySetSitePermissionCompleted(uint32 request_id, bool success); |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 163 | void NotifyGetSitesWithDataCompleted(uint32 request_id, |
| 164 | const std::vector<std::string>& sites); |
| 165 | void NotifyClearSiteDataCompleted(uint32 request_id, bool success); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 166 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 167 | void NotifyError( |
| 168 | const std::vector<std::pair<uint32, RequestType> >& notifications); |
| 169 | |
| 170 | // Message handlers. |
| 171 | void OnDeauthorizeContentLicensesResult(uint32 request_id, bool success); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 172 | void OnGetPermissionSettingsResult( |
| 173 | uint32 request_id, |
| 174 | bool success, |
| 175 | PP_Flash_BrowserOperations_Permission default_permission, |
| 176 | const ppapi::FlashSiteSettings& sites); |
| 177 | void OnSetDefaultPermissionResult(uint32 request_id, bool success); |
| 178 | void OnSetSitePermissionResult(uint32 request_id, bool success); |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 179 | void OnGetSitesWithDataResult(uint32 request_id, |
| 180 | const std::vector<std::string>& sites); |
| 181 | void OnClearSiteDataResult(uint32 request_id, bool success); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 182 | |
| 183 | // Used only on the UI thread. |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 184 | base::WeakPtr<PepperFlashSettingsManager> manager_; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 185 | |
| 186 | // Used only on the I/O thread. |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 187 | base::FilePath plugin_data_path_; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 188 | |
| 189 | // The channel is NULL until we have opened a connection to the broker |
| 190 | // process. Used only on the I/O thread. |
| 191 | scoped_ptr<IPC::Channel> channel_; |
| 192 | |
| 193 | // Used only on the I/O thread. |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 194 | State state_; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 195 | |
| 196 | // Requests that need to be sent once the channel to the broker process is |
| 197 | // established. Used only on the I/O thread. |
| 198 | std::vector<PendingRequest> pending_requests_; |
| 199 | // Requests that have been sent but haven't got replied. Used only on the |
| 200 | // I/O thread. |
| 201 | std::map<uint32, RequestType> pending_responses_; |
| 202 | |
| 203 | // Used only on the I/O thread. |
| 204 | scoped_refptr<content::PepperFlashSettingsHelper> helper_; |
| 205 | |
| 206 | // Path for the current profile. Must be retrieved on the UI thread from the |
| 207 | // browser context when we start so we can use it later on the I/O thread. |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 208 | base::FilePath browser_context_path_; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 209 | |
| 210 | scoped_refptr<PluginPrefs> plugin_prefs_; |
| 211 | }; |
| 212 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 213 | PepperFlashSettingsManager::Core::Core( |
| 214 | base::WeakPtr<PepperFlashSettingsManager> manager, |
| 215 | content::BrowserContext* browser_context) |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 216 | : manager_(manager), |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 217 | state_(STATE_UNINITIALIZED), |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 218 | browser_context_path_(browser_context->GetPath()), |
| 219 | plugin_prefs_(PluginPrefs::GetForProfile( |
| 220 | Profile::FromBrowserContext(browser_context))) { |
| 221 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | PepperFlashSettingsManager::Core::~Core() { |
| 225 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 226 | } |
| 227 | |
[email protected] | 6464cc1 | 2012-07-12 09:25:53 | [diff] [blame] | 228 | void PepperFlashSettingsManager::Core::Initialize() { |
| 229 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 230 | BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 231 | base::Bind(&Core::InitializeOnIOThread, this)); |
| 232 | } |
| 233 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 234 | void PepperFlashSettingsManager::Core::Detach() { |
| 235 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 236 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 237 | // This call guarantees that one ref is retained until we get to the DETACHED |
| 238 | // state. This is important. Otherwise, if the ref count drops to zero on the |
[email protected] | 4d4ee4c | 2012-06-22 19:11:30 | [diff] [blame] | 239 | // UI thread (which posts a task to delete this object on the I/O thread) |
| 240 | // while the I/O thread doesn't know about it, methods on the I/O thread might |
| 241 | // increase the ref count again and cause double deletion. |
| 242 | BrowserThread::PostTask( |
| 243 | BrowserThread::IO, FROM_HERE, base::Bind(&Core::DetachOnIOThread, this)); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | void PepperFlashSettingsManager::Core::DeauthorizeContentLicenses( |
| 247 | uint32 request_id) { |
| 248 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 249 | |
| 250 | BrowserThread::PostTask( |
| 251 | BrowserThread::IO, FROM_HERE, |
| 252 | base::Bind(&Core::DeauthorizeContentLicensesOnIOThread, this, |
| 253 | request_id)); |
| 254 | } |
| 255 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 256 | void PepperFlashSettingsManager::Core::GetPermissionSettings( |
| 257 | uint32 request_id, |
| 258 | PP_Flash_BrowserOperations_SettingType setting_type) { |
| 259 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 260 | |
| 261 | BrowserThread::PostTask( |
| 262 | BrowserThread::IO, FROM_HERE, |
| 263 | base::Bind(&Core::GetPermissionSettingsOnIOThread, this, request_id, |
| 264 | setting_type)); |
| 265 | } |
| 266 | |
| 267 | void PepperFlashSettingsManager::Core::SetDefaultPermission( |
| 268 | uint32 request_id, |
| 269 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 270 | PP_Flash_BrowserOperations_Permission permission, |
| 271 | bool clear_site_specific) { |
| 272 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 273 | |
| 274 | BrowserThread::PostTask( |
| 275 | BrowserThread::IO, FROM_HERE, |
| 276 | base::Bind(&Core::SetDefaultPermissionOnIOThread, this, request_id, |
| 277 | setting_type, permission, clear_site_specific)); |
| 278 | } |
| 279 | |
| 280 | void PepperFlashSettingsManager::Core::SetSitePermission( |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 281 | uint32 request_id, |
| 282 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 283 | const ppapi::FlashSiteSettings& sites) { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 284 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 285 | |
| 286 | BrowserThread::PostTask( |
| 287 | BrowserThread::IO, FROM_HERE, |
| 288 | base::Bind(&Core::SetSitePermissionOnIOThread, this, request_id, |
| 289 | setting_type, sites)); |
| 290 | } |
| 291 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 292 | void PepperFlashSettingsManager::Core::GetSitesWithData(uint32 request_id) { |
| 293 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 294 | |
| 295 | BrowserThread::PostTask( |
| 296 | BrowserThread::IO, FROM_HERE, |
| 297 | base::Bind(&Core::GetSitesWithDataOnIOThread, this, request_id)); |
| 298 | } |
| 299 | |
| 300 | void PepperFlashSettingsManager::Core::ClearSiteData(uint32 request_id, |
| 301 | const std::string& site, |
| 302 | uint64 flags, |
| 303 | uint64 max_age) { |
| 304 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 305 | |
| 306 | BrowserThread::PostTask( |
| 307 | BrowserThread::IO, FROM_HERE, |
| 308 | base::Bind(&Core::ClearSiteDataOnIOThread, this, request_id, |
| 309 | site, flags, max_age)); |
| 310 | } |
| 311 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 312 | bool PepperFlashSettingsManager::Core::OnMessageReceived( |
| 313 | const IPC::Message& message) { |
| 314 | IPC_BEGIN_MESSAGE_MAP(Core, message) |
| 315 | IPC_MESSAGE_HANDLER(PpapiHostMsg_DeauthorizeContentLicensesResult, |
| 316 | OnDeauthorizeContentLicensesResult) |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 317 | IPC_MESSAGE_HANDLER(PpapiHostMsg_GetPermissionSettingsResult, |
| 318 | OnGetPermissionSettingsResult) |
| 319 | IPC_MESSAGE_HANDLER(PpapiHostMsg_SetDefaultPermissionResult, |
| 320 | OnSetDefaultPermissionResult) |
| 321 | IPC_MESSAGE_HANDLER(PpapiHostMsg_SetSitePermissionResult, |
| 322 | OnSetSitePermissionResult) |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 323 | IPC_MESSAGE_HANDLER(PpapiHostMsg_GetSitesWithDataResult, |
| 324 | OnGetSitesWithDataResult) |
| 325 | IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult, |
| 326 | OnClearSiteDataResult) |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 327 | IPC_MESSAGE_UNHANDLED_ERROR() |
| 328 | IPC_END_MESSAGE_MAP() |
| 329 | |
| 330 | return true; |
| 331 | } |
| 332 | |
| 333 | void PepperFlashSettingsManager::Core::OnChannelError() { |
| 334 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 335 | if (state_ == STATE_DETACHED) |
[email protected] | 4d4ee4c | 2012-06-22 19:11:30 | [diff] [blame] | 336 | return; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 337 | |
| 338 | NotifyErrorFromIOThread(); |
| 339 | } |
| 340 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 341 | void PepperFlashSettingsManager::Core::ConnectToChannel( |
| 342 | bool success, |
| 343 | const IPC::ChannelHandle& handle) { |
| 344 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 345 | if (state_ == STATE_DETACHED) |
[email protected] | 4d4ee4c | 2012-06-22 19:11:30 | [diff] [blame] | 346 | return; |
| 347 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 348 | DCHECK(state_ == STATE_UNINITIALIZED); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 349 | DCHECK(!channel_.get()); |
| 350 | |
| 351 | if (!success) { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 352 | DLOG(ERROR) << "Couldn't open plugin channel"; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 353 | NotifyErrorFromIOThread(); |
| 354 | return; |
| 355 | } |
| 356 | |
| 357 | channel_.reset(new IPC::Channel(handle, IPC::Channel::MODE_CLIENT, this)); |
| 358 | if (!channel_->Connect()) { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 359 | DLOG(ERROR) << "Couldn't connect to plugin"; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 360 | NotifyErrorFromIOThread(); |
| 361 | return; |
| 362 | } |
| 363 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 364 | state_ = STATE_INITIALIZED; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 365 | |
| 366 | std::vector<PendingRequest> temp_pending_requests; |
| 367 | temp_pending_requests.swap(pending_requests_); |
| 368 | for (std::vector<PendingRequest>::iterator iter = |
| 369 | temp_pending_requests.begin(); |
| 370 | iter != temp_pending_requests.end(); ++iter) { |
| 371 | switch (iter->type) { |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 372 | case INVALID_REQUEST_TYPE: |
| 373 | NOTREACHED(); |
| 374 | break; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 375 | case DEAUTHORIZE_CONTENT_LICENSES: |
| 376 | DeauthorizeContentLicensesOnIOThread(iter->id); |
| 377 | break; |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 378 | case GET_PERMISSION_SETTINGS: |
| 379 | GetPermissionSettingsOnIOThread(iter->id, iter->setting_type); |
| 380 | break; |
| 381 | case SET_DEFAULT_PERMISSION: |
| 382 | SetDefaultPermissionOnIOThread( |
| 383 | iter->id, iter->setting_type, iter->permission, |
| 384 | iter->clear_site_specific); |
| 385 | break; |
| 386 | case SET_SITE_PERMISSION: |
| 387 | SetSitePermissionOnIOThread(iter->id, iter->setting_type, iter->sites); |
| 388 | break; |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 389 | case GET_SITES_WITH_DATA: |
| 390 | GetSitesWithDataOnIOThread(iter->id); |
| 391 | break; |
| 392 | case CLEAR_SITE_DATA: |
| 393 | ClearSiteDataOnIOThread(iter->id, iter->site, iter->flags, |
| 394 | iter->max_age); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 395 | break; |
| 396 | } |
| 397 | } |
| 398 | } |
| 399 | |
[email protected] | 6464cc1 | 2012-07-12 09:25:53 | [diff] [blame] | 400 | void PepperFlashSettingsManager::Core::InitializeOnIOThread() { |
| 401 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 402 | DCHECK_EQ(STATE_UNINITIALIZED, state_); |
[email protected] | 6464cc1 | 2012-07-12 09:25:53 | [diff] [blame] | 403 | |
| 404 | webkit::WebPluginInfo plugin_info; |
| 405 | if (!PepperFlashSettingsManager::IsPepperFlashInUse(plugin_prefs_.get(), |
| 406 | &plugin_info)) { |
| 407 | NotifyErrorFromIOThread(); |
| 408 | return; |
| 409 | } |
| 410 | |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 411 | base::FilePath profile_path = |
[email protected] | 6464cc1 | 2012-07-12 09:25:53 | [diff] [blame] | 412 | browser_context_path_.Append(content::kPepperDataDirname); |
| 413 | #if defined(OS_WIN) |
| 414 | plugin_data_path_ = profile_path.Append(plugin_info.name); |
| 415 | #else |
| 416 | plugin_data_path_ = profile_path.Append(UTF16ToUTF8(plugin_info.name)); |
| 417 | #endif |
| 418 | |
| 419 | helper_ = content::PepperFlashSettingsHelper::Create(); |
| 420 | content::PepperFlashSettingsHelper::OpenChannelCallback callback = |
| 421 | base::Bind(&Core::ConnectToChannel, this); |
| 422 | helper_->OpenChannelToBroker(plugin_info.path, callback); |
| 423 | } |
| 424 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 425 | void PepperFlashSettingsManager::Core::DeauthorizeContentLicensesOnIOThread( |
| 426 | uint32 request_id) { |
| 427 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 428 | DCHECK_NE(STATE_DETACHED, state_); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 429 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 430 | if (state_ == STATE_UNINITIALIZED) { |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 431 | PendingRequest request; |
| 432 | request.id = request_id; |
| 433 | request.type = DEAUTHORIZE_CONTENT_LICENSES; |
| 434 | pending_requests_.push_back(request); |
| 435 | return; |
| 436 | } |
| 437 | |
| 438 | pending_responses_.insert( |
| 439 | std::make_pair(request_id, DEAUTHORIZE_CONTENT_LICENSES)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 440 | if (state_ == STATE_ERROR) { |
| 441 | NotifyErrorFromIOThread(); |
| 442 | return; |
| 443 | } |
| 444 | |
[email protected] | bb9c975 | 2013-04-25 23:02:11 | [diff] [blame] | 445 | #if defined(OS_CHROMEOS) |
| 446 | BrowserThread::PostBlockingPoolTask(FROM_HERE, |
| 447 | base::Bind(&Core::DeauthorizeContentLicensesOnBlockingPool, this, |
| 448 | request_id, browser_context_path_)); |
| 449 | #else |
| 450 | DeauthorizeContentLicensesInPlugin(request_id, true); |
| 451 | #endif |
| 452 | } |
| 453 | |
| 454 | // TODO(raymes): This is temporary code to migrate ChromeOS devices to the new |
| 455 | // scheme for generating device IDs. Delete this once we are sure most ChromeOS |
| 456 | // devices have been migrated. |
| 457 | void PepperFlashSettingsManager::Core::DeauthorizeContentLicensesOnBlockingPool( |
| 458 | uint32 request_id, |
| 459 | const base::FilePath& profile_path) { |
| 460 | // ChromeOS used to store the device ID in a file but this is no longer used. |
| 461 | // Wipe that file. |
| 462 | const base::FilePath& device_id_path = |
| 463 | chrome::DeviceIDFetcher::GetLegacyDeviceIDPath(profile_path); |
| 464 | bool success = file_util::Delete(device_id_path, false); |
| 465 | |
| 466 | BrowserThread::PostTask( |
| 467 | BrowserThread::IO, FROM_HERE, |
| 468 | base::Bind(&Core::DeauthorizeContentLicensesInPlugin, this, request_id, |
| 469 | success)); |
| 470 | } |
| 471 | |
| 472 | void PepperFlashSettingsManager::Core::DeauthorizeContentLicensesInPlugin( |
| 473 | uint32 request_id, |
| 474 | bool success) { |
| 475 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 476 | if (!success) { |
| 477 | NotifyErrorFromIOThread(); |
| 478 | return; |
| 479 | } |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 480 | IPC::Message* msg = |
| 481 | new PpapiMsg_DeauthorizeContentLicenses(request_id, plugin_data_path_); |
| 482 | if (!channel_->Send(msg)) { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 483 | DLOG(ERROR) << "Couldn't send DeauthorizeContentLicenses message"; |
| 484 | // A failure notification for the current request will be sent since |
| 485 | // |pending_responses_| has been updated. |
| 486 | NotifyErrorFromIOThread(); |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | void PepperFlashSettingsManager::Core::GetPermissionSettingsOnIOThread( |
| 491 | uint32 request_id, |
| 492 | PP_Flash_BrowserOperations_SettingType setting_type) { |
| 493 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 494 | DCHECK_NE(STATE_DETACHED, state_); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 495 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 496 | if (state_ == STATE_UNINITIALIZED) { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 497 | PendingRequest request; |
| 498 | request.id = request_id; |
| 499 | request.type = GET_PERMISSION_SETTINGS; |
| 500 | request.setting_type = setting_type; |
| 501 | pending_requests_.push_back(request); |
| 502 | return; |
| 503 | } |
| 504 | |
| 505 | pending_responses_.insert( |
| 506 | std::make_pair(request_id, GET_PERMISSION_SETTINGS)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 507 | if (state_ == STATE_ERROR) { |
| 508 | NotifyErrorFromIOThread(); |
| 509 | return; |
| 510 | } |
| 511 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 512 | IPC::Message* msg = new PpapiMsg_GetPermissionSettings( |
| 513 | request_id, plugin_data_path_, setting_type); |
| 514 | if (!channel_->Send(msg)) { |
| 515 | DLOG(ERROR) << "Couldn't send GetPermissionSettings message"; |
| 516 | // A failure notification for the current request will be sent since |
| 517 | // |pending_responses_| has been updated. |
| 518 | NotifyErrorFromIOThread(); |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | void PepperFlashSettingsManager::Core::SetDefaultPermissionOnIOThread( |
| 523 | uint32 request_id, |
| 524 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 525 | PP_Flash_BrowserOperations_Permission permission, |
| 526 | bool clear_site_specific) { |
| 527 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 528 | DCHECK_NE(STATE_DETACHED, state_); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 529 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 530 | if (state_ == STATE_UNINITIALIZED) { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 531 | PendingRequest request; |
| 532 | request.id = request_id; |
| 533 | request.type = SET_DEFAULT_PERMISSION; |
| 534 | request.setting_type = setting_type; |
| 535 | request.permission = permission; |
| 536 | request.clear_site_specific = clear_site_specific; |
| 537 | pending_requests_.push_back(request); |
| 538 | return; |
| 539 | } |
| 540 | |
| 541 | pending_responses_.insert(std::make_pair(request_id, SET_DEFAULT_PERMISSION)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 542 | if (state_ == STATE_ERROR) { |
| 543 | NotifyErrorFromIOThread(); |
| 544 | return; |
| 545 | } |
| 546 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 547 | IPC::Message* msg = new PpapiMsg_SetDefaultPermission( |
| 548 | request_id, plugin_data_path_, setting_type, permission, |
| 549 | clear_site_specific); |
| 550 | if (!channel_->Send(msg)) { |
| 551 | DLOG(ERROR) << "Couldn't send SetDefaultPermission message"; |
| 552 | // A failure notification for the current request will be sent since |
| 553 | // |pending_responses_| has been updated. |
| 554 | NotifyErrorFromIOThread(); |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | void PepperFlashSettingsManager::Core::SetSitePermissionOnIOThread( |
| 559 | uint32 request_id, |
| 560 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 561 | const ppapi::FlashSiteSettings& sites) { |
| 562 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 563 | DCHECK_NE(STATE_DETACHED, state_); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 564 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 565 | if (state_ == STATE_UNINITIALIZED) { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 566 | pending_requests_.push_back(PendingRequest()); |
| 567 | PendingRequest& request = pending_requests_.back(); |
| 568 | request.id = request_id; |
| 569 | request.type = SET_SITE_PERMISSION; |
| 570 | request.setting_type = setting_type; |
| 571 | request.sites = sites; |
| 572 | return; |
| 573 | } |
| 574 | |
| 575 | pending_responses_.insert(std::make_pair(request_id, SET_SITE_PERMISSION)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 576 | if (state_ == STATE_ERROR) { |
| 577 | NotifyErrorFromIOThread(); |
| 578 | return; |
| 579 | } |
| 580 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 581 | IPC::Message* msg = new PpapiMsg_SetSitePermission( |
| 582 | request_id, plugin_data_path_, setting_type, sites); |
| 583 | if (!channel_->Send(msg)) { |
| 584 | DLOG(ERROR) << "Couldn't send SetSitePermission message"; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 585 | // A failure notification for the current request will be sent since |
| 586 | // |pending_responses_| has been updated. |
| 587 | NotifyErrorFromIOThread(); |
| 588 | } |
| 589 | } |
| 590 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 591 | void PepperFlashSettingsManager::Core::GetSitesWithDataOnIOThread( |
| 592 | uint32 request_id) { |
| 593 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 594 | DCHECK_NE(STATE_DETACHED, state_); |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 595 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 596 | if (state_ == STATE_UNINITIALIZED) { |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 597 | pending_requests_.push_back(PendingRequest()); |
| 598 | PendingRequest& request = pending_requests_.back(); |
| 599 | request.id = request_id; |
| 600 | request.type = GET_SITES_WITH_DATA; |
| 601 | return; |
| 602 | } |
| 603 | |
| 604 | pending_responses_.insert(std::make_pair(request_id, GET_SITES_WITH_DATA)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 605 | if (state_ == STATE_ERROR) { |
| 606 | NotifyErrorFromIOThread(); |
| 607 | return; |
| 608 | } |
| 609 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 610 | IPC::Message* msg = new PpapiMsg_GetSitesWithData( |
| 611 | request_id, plugin_data_path_); |
| 612 | if (!channel_->Send(msg)) { |
| 613 | DLOG(ERROR) << "Couldn't send GetSitesWithData message"; |
| 614 | // A failure notification for the current request will be sent since |
| 615 | // |pending_responses_| has been updated. |
| 616 | NotifyErrorFromIOThread(); |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | void PepperFlashSettingsManager::Core::ClearSiteDataOnIOThread( |
| 621 | uint32 request_id, |
| 622 | const std::string& site, |
| 623 | uint64 flags, |
| 624 | uint64 max_age) { |
| 625 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 626 | DCHECK_NE(STATE_DETACHED, state_); |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 627 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 628 | if (state_ == STATE_UNINITIALIZED) { |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 629 | pending_requests_.push_back(PendingRequest()); |
| 630 | PendingRequest& request = pending_requests_.back(); |
| 631 | request.id = request_id; |
| 632 | request.type = CLEAR_SITE_DATA; |
| 633 | request.site = site; |
| 634 | request.flags = flags; |
| 635 | request.max_age = max_age; |
| 636 | return; |
| 637 | } |
| 638 | |
| 639 | pending_responses_.insert(std::make_pair(request_id, CLEAR_SITE_DATA)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 640 | if (state_ == STATE_ERROR) { |
| 641 | NotifyErrorFromIOThread(); |
| 642 | return; |
| 643 | } |
| 644 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 645 | IPC::Message* msg = new PpapiMsg_ClearSiteData( |
| 646 | request_id, plugin_data_path_, site, flags, max_age); |
| 647 | if (!channel_->Send(msg)) { |
| 648 | DLOG(ERROR) << "Couldn't send ClearSiteData message"; |
| 649 | // A failure notification for the current request will be sent since |
| 650 | // |pending_responses_| has been updated. |
| 651 | NotifyErrorFromIOThread(); |
| 652 | } |
| 653 | } |
| 654 | |
[email protected] | 4d4ee4c | 2012-06-22 19:11:30 | [diff] [blame] | 655 | void PepperFlashSettingsManager::Core::DetachOnIOThread() { |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 656 | state_ = STATE_DETACHED; |
[email protected] | 4d4ee4c | 2012-06-22 19:11:30 | [diff] [blame] | 657 | } |
| 658 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 659 | void PepperFlashSettingsManager::Core::NotifyErrorFromIOThread() { |
| 660 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 661 | if (state_ == STATE_DETACHED) |
[email protected] | 4d4ee4c | 2012-06-22 19:11:30 | [diff] [blame] | 662 | return; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 663 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 664 | state_ = STATE_ERROR; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 665 | std::vector<std::pair<uint32, RequestType> > notifications; |
| 666 | for (std::vector<PendingRequest>::iterator iter = pending_requests_.begin(); |
| 667 | iter != pending_requests_.end(); ++iter) { |
| 668 | notifications.push_back(std::make_pair(iter->id, iter->type)); |
| 669 | } |
| 670 | pending_requests_.clear(); |
| 671 | notifications.insert(notifications.end(), pending_responses_.begin(), |
| 672 | pending_responses_.end()); |
| 673 | pending_responses_.clear(); |
| 674 | |
| 675 | BrowserThread::PostTask( |
| 676 | BrowserThread::UI, FROM_HERE, |
| 677 | base::Bind(&Core::NotifyError, this, notifications)); |
| 678 | } |
| 679 | |
| 680 | void |
| 681 | PepperFlashSettingsManager::Core::NotifyDeauthorizeContentLicensesCompleted( |
| 682 | uint32 request_id, |
| 683 | bool success) { |
| 684 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 685 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 686 | if (manager_.get()) { |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 687 | manager_->client_->OnDeauthorizeContentLicensesCompleted( |
| 688 | request_id, success); |
| 689 | } |
| 690 | } |
| 691 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 692 | void PepperFlashSettingsManager::Core::NotifyGetPermissionSettingsCompleted( |
| 693 | uint32 request_id, |
| 694 | bool success, |
| 695 | PP_Flash_BrowserOperations_Permission default_permission, |
| 696 | const ppapi::FlashSiteSettings& sites) { |
| 697 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 698 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 699 | if (manager_.get()) { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 700 | manager_->client_->OnGetPermissionSettingsCompleted( |
| 701 | request_id, success, default_permission, sites); |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | void PepperFlashSettingsManager::Core::NotifySetDefaultPermissionCompleted( |
| 706 | uint32 request_id, |
| 707 | bool success) { |
| 708 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 709 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 710 | if (manager_.get()) { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 711 | manager_->client_->OnSetDefaultPermissionCompleted( |
| 712 | request_id, success); |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | void PepperFlashSettingsManager::Core::NotifySetSitePermissionCompleted( |
| 717 | uint32 request_id, |
| 718 | bool success) { |
| 719 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 720 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 721 | if (manager_.get()) { |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 722 | manager_->client_->OnSetSitePermissionCompleted( |
| 723 | request_id, success); |
| 724 | } |
| 725 | } |
| 726 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 727 | void PepperFlashSettingsManager::Core::NotifyGetSitesWithDataCompleted( |
| 728 | uint32 request_id, |
| 729 | const std::vector<std::string>& sites) { |
| 730 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 731 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 732 | if (manager_.get()) { |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 733 | manager_->client_->OnGetSitesWithDataCompleted( |
| 734 | request_id, sites); |
| 735 | } |
| 736 | } |
| 737 | |
| 738 | void PepperFlashSettingsManager::Core::NotifyClearSiteDataCompleted( |
| 739 | uint32 request_id, |
| 740 | bool success) { |
| 741 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 742 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 743 | if (manager_.get()) |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 744 | manager_->client_->OnClearSiteDataCompleted(request_id, success); |
| 745 | } |
| 746 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 747 | void PepperFlashSettingsManager::Core::NotifyError( |
| 748 | const std::vector<std::pair<uint32, RequestType> >& notifications) { |
| 749 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 750 | |
| 751 | scoped_refptr<Core> protector(this); |
| 752 | for (std::vector<std::pair<uint32, RequestType> >::const_iterator iter = |
| 753 | notifications.begin(); iter != notifications.end(); ++iter) { |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 754 | // Check |manager_| for each iteration in case it is destroyed in one of |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 755 | // the callbacks. |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 756 | if (!manager_.get()) |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 757 | return; |
| 758 | |
| 759 | switch (iter->second) { |
| 760 | case INVALID_REQUEST_TYPE: |
| 761 | NOTREACHED(); |
| 762 | break; |
| 763 | case DEAUTHORIZE_CONTENT_LICENSES: |
| 764 | manager_->client_->OnDeauthorizeContentLicensesCompleted( |
| 765 | iter->first, false); |
| 766 | break; |
| 767 | case GET_PERMISSION_SETTINGS: |
| 768 | manager_->client_->OnGetPermissionSettingsCompleted( |
| 769 | iter->first, false, PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT, |
| 770 | ppapi::FlashSiteSettings()); |
| 771 | break; |
| 772 | case SET_DEFAULT_PERMISSION: |
| 773 | manager_->client_->OnSetDefaultPermissionCompleted( |
| 774 | iter->first, false); |
| 775 | break; |
| 776 | case SET_SITE_PERMISSION: |
| 777 | manager_->client_->OnSetSitePermissionCompleted(iter->first, false); |
| 778 | break; |
| 779 | case GET_SITES_WITH_DATA: |
| 780 | manager_->client_->OnGetSitesWithDataCompleted( |
| 781 | iter->first, std::vector<std::string>()); |
| 782 | break; |
| 783 | case CLEAR_SITE_DATA: |
| 784 | manager_->client_->OnClearSiteDataCompleted(iter->first, false); |
| 785 | break; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 786 | } |
| 787 | } |
| 788 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 789 | if (manager_.get()) |
| 790 | manager_->OnError(this); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 791 | } |
| 792 | |
| 793 | void PepperFlashSettingsManager::Core::OnDeauthorizeContentLicensesResult( |
| 794 | uint32 request_id, |
| 795 | bool success) { |
| 796 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 797 | if (state_ == STATE_DETACHED) |
[email protected] | 4d4ee4c | 2012-06-22 19:11:30 | [diff] [blame] | 798 | return; |
| 799 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 800 | DLOG_IF(ERROR, !success) << "DeauthorizeContentLicenses returned error"; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 801 | |
| 802 | std::map<uint32, RequestType>::iterator iter = |
| 803 | pending_responses_.find(request_id); |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 804 | if (iter == pending_responses_.end()) |
| 805 | return; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 806 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 807 | DCHECK_EQ(iter->second, DEAUTHORIZE_CONTENT_LICENSES); |
| 808 | |
| 809 | pending_responses_.erase(iter); |
| 810 | BrowserThread::PostTask( |
| 811 | BrowserThread::UI, FROM_HERE, |
| 812 | base::Bind(&Core::NotifyDeauthorizeContentLicensesCompleted, this, |
| 813 | request_id, success)); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 814 | } |
| 815 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 816 | void PepperFlashSettingsManager::Core::OnGetPermissionSettingsResult( |
| 817 | uint32 request_id, |
| 818 | bool success, |
| 819 | PP_Flash_BrowserOperations_Permission default_permission, |
| 820 | const ppapi::FlashSiteSettings& sites) { |
| 821 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 822 | if (state_ == STATE_DETACHED) |
[email protected] | 4d4ee4c | 2012-06-22 19:11:30 | [diff] [blame] | 823 | return; |
| 824 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 825 | DLOG_IF(ERROR, !success) << "GetPermissionSettings returned error"; |
| 826 | |
| 827 | std::map<uint32, RequestType>::iterator iter = |
| 828 | pending_responses_.find(request_id); |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 829 | if (iter == pending_responses_.end()) |
| 830 | return; |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 831 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 832 | DCHECK_EQ(iter->second, GET_PERMISSION_SETTINGS); |
| 833 | |
| 834 | pending_responses_.erase(iter); |
| 835 | BrowserThread::PostTask( |
| 836 | BrowserThread::UI, FROM_HERE, |
| 837 | base::Bind(&Core::NotifyGetPermissionSettingsCompleted, this, |
| 838 | request_id, success, default_permission, sites)); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 839 | } |
| 840 | |
| 841 | void PepperFlashSettingsManager::Core::OnSetDefaultPermissionResult( |
| 842 | uint32 request_id, |
| 843 | bool success) { |
| 844 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 845 | if (state_ == STATE_DETACHED) |
[email protected] | 4d4ee4c | 2012-06-22 19:11:30 | [diff] [blame] | 846 | return; |
| 847 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 848 | DLOG_IF(ERROR, !success) << "SetDefaultPermission returned error"; |
| 849 | |
| 850 | std::map<uint32, RequestType>::iterator iter = |
| 851 | pending_responses_.find(request_id); |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 852 | if (iter == pending_responses_.end()) |
| 853 | return; |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 854 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 855 | DCHECK_EQ(iter->second, SET_DEFAULT_PERMISSION); |
| 856 | |
| 857 | pending_responses_.erase(iter); |
| 858 | BrowserThread::PostTask( |
| 859 | BrowserThread::UI, FROM_HERE, |
| 860 | base::Bind(&Core::NotifySetDefaultPermissionCompleted, this, |
| 861 | request_id, success)); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 862 | } |
| 863 | |
| 864 | void PepperFlashSettingsManager::Core::OnSetSitePermissionResult( |
| 865 | uint32 request_id, |
| 866 | bool success) { |
| 867 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 868 | if (state_ == STATE_DETACHED) |
[email protected] | 4d4ee4c | 2012-06-22 19:11:30 | [diff] [blame] | 869 | return; |
| 870 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 871 | DLOG_IF(ERROR, !success) << "SetSitePermission returned error"; |
| 872 | |
| 873 | std::map<uint32, RequestType>::iterator iter = |
| 874 | pending_responses_.find(request_id); |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 875 | if (iter == pending_responses_.end()) |
| 876 | return; |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 877 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 878 | DCHECK_EQ(iter->second, SET_SITE_PERMISSION); |
| 879 | |
| 880 | pending_responses_.erase(iter); |
| 881 | BrowserThread::PostTask( |
| 882 | BrowserThread::UI, FROM_HERE, |
| 883 | base::Bind(&Core::NotifySetSitePermissionCompleted, this, request_id, |
| 884 | success)); |
| 885 | } |
| 886 | |
| 887 | void PepperFlashSettingsManager::Core::OnGetSitesWithDataResult( |
| 888 | uint32 request_id, |
| 889 | const std::vector<std::string>& sites) { |
| 890 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 891 | if (state_ == STATE_DETACHED) |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 892 | return; |
| 893 | |
| 894 | std::map<uint32, RequestType>::iterator iter = |
| 895 | pending_responses_.find(request_id); |
| 896 | if (iter == pending_responses_.end()) |
| 897 | return; |
| 898 | |
| 899 | DCHECK_EQ(iter->second, GET_SITES_WITH_DATA); |
| 900 | |
| 901 | pending_responses_.erase(iter); |
| 902 | BrowserThread::PostTask( |
| 903 | BrowserThread::UI, FROM_HERE, |
| 904 | base::Bind(&Core::NotifyGetSitesWithDataCompleted, this, request_id, |
| 905 | sites)); |
| 906 | } |
| 907 | |
| 908 | void PepperFlashSettingsManager::Core::OnClearSiteDataResult( |
| 909 | uint32 request_id, |
| 910 | bool success) { |
| 911 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 912 | if (state_ == STATE_DETACHED) |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 913 | return; |
| 914 | |
| 915 | DLOG_IF(ERROR, !success) << "ClearSiteData returned error"; |
| 916 | |
| 917 | std::map<uint32, RequestType>::iterator iter = |
| 918 | pending_responses_.find(request_id); |
| 919 | if (iter == pending_responses_.end()) |
| 920 | return; |
| 921 | |
| 922 | DCHECK_EQ(iter->second, CLEAR_SITE_DATA); |
| 923 | |
| 924 | pending_responses_.erase(iter); |
| 925 | BrowserThread::PostTask( |
| 926 | BrowserThread::UI, FROM_HERE, |
| 927 | base::Bind(&Core::NotifyClearSiteDataCompleted, this, request_id, |
| 928 | success)); |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 929 | } |
| 930 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 931 | PepperFlashSettingsManager::PepperFlashSettingsManager( |
| 932 | Client* client, |
| 933 | content::BrowserContext* browser_context) |
[email protected] | 9c00909 | 2013-05-01 03:14:09 | [diff] [blame] | 934 | : weak_ptr_factory_(this), |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 935 | client_(client), |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 936 | browser_context_(browser_context), |
| 937 | next_request_id_(1) { |
| 938 | DCHECK(client); |
| 939 | DCHECK(browser_context); |
| 940 | } |
| 941 | |
| 942 | PepperFlashSettingsManager::~PepperFlashSettingsManager() { |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 943 | if (core_.get()) |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 944 | core_->Detach(); |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 945 | } |
| 946 | |
[email protected] | 18a4d63c8 | 2012-05-25 23:37:03 | [diff] [blame] | 947 | // static |
| 948 | bool PepperFlashSettingsManager::IsPepperFlashInUse( |
| 949 | PluginPrefs* plugin_prefs, |
| 950 | webkit::WebPluginInfo* plugin_info) { |
| 951 | if (!plugin_prefs) |
| 952 | return false; |
| 953 | |
| 954 | content::PluginService* plugin_service = |
| 955 | content::PluginService::GetInstance(); |
| 956 | std::vector<webkit::WebPluginInfo> plugins; |
| 957 | plugin_service->GetPluginInfoArray( |
| 958 | GURL(), kFlashPluginSwfMimeType, false, &plugins, NULL); |
| 959 | |
| 960 | for (std::vector<webkit::WebPluginInfo>::iterator iter = plugins.begin(); |
| 961 | iter != plugins.end(); ++iter) { |
| 962 | if (webkit::IsPepperPlugin(*iter) && plugin_prefs->IsPluginEnabled(*iter)) { |
| 963 | if (plugin_info) |
| 964 | *plugin_info = *iter; |
| 965 | return true; |
| 966 | } |
| 967 | } |
| 968 | return false; |
| 969 | } |
| 970 | |
| 971 | // static |
[email protected] | c753f14 | 2013-02-10 13:14:04 | [diff] [blame] | 972 | void PepperFlashSettingsManager::RegisterUserPrefs( |
[email protected] | 443e931 | 2013-05-06 06:17:34 | [diff] [blame] | 973 | user_prefs::PrefRegistrySyncable* registry) { |
| 974 | registry->RegisterBooleanPref( |
| 975 | prefs::kDeauthorizeContentLicenses, |
| 976 | false, |
| 977 | user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
[email protected] | 18a4d63c8 | 2012-05-25 23:37:03 | [diff] [blame] | 978 | |
[email protected] | 443e931 | 2013-05-06 06:17:34 | [diff] [blame] | 979 | registry->RegisterBooleanPref( |
| 980 | prefs::kPepperFlashSettingsEnabled, |
| 981 | true, |
| 982 | user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
[email protected] | 18a4d63c8 | 2012-05-25 23:37:03 | [diff] [blame] | 983 | } |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 984 | |
[email protected] | bb9c975 | 2013-04-25 23:02:11 | [diff] [blame] | 985 | uint32 PepperFlashSettingsManager::DeauthorizeContentLicenses( |
| 986 | PrefService* prefs) { |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 987 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 988 | |
[email protected] | bb9c975 | 2013-04-25 23:02:11 | [diff] [blame] | 989 | // Clear the device ID salt which has the effect of regenerating a device |
| 990 | // ID. Since this happens synchronously (and on the UI thread), we don't have |
| 991 | // to add it to a pending request. |
| 992 | prefs->ClearPref(prefs::kDRMSalt); |
| 993 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 994 | EnsureCoreExists(); |
| 995 | uint32 id = GetNextRequestId(); |
| 996 | core_->DeauthorizeContentLicenses(id); |
| 997 | return id; |
| 998 | } |
| 999 | |
[email protected] | ee4dd68 | 2012-06-12 15:49:33 | [diff] [blame] | 1000 | uint32 PepperFlashSettingsManager::GetPermissionSettings( |
| 1001 | PP_Flash_BrowserOperations_SettingType setting_type) { |
| 1002 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1003 | |
| 1004 | EnsureCoreExists(); |
| 1005 | uint32 id = GetNextRequestId(); |
| 1006 | core_->GetPermissionSettings(id, setting_type); |
| 1007 | return id; |
| 1008 | } |
| 1009 | |
| 1010 | uint32 PepperFlashSettingsManager::SetDefaultPermission( |
| 1011 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 1012 | PP_Flash_BrowserOperations_Permission permission, |
| 1013 | bool clear_site_specific) { |
| 1014 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1015 | |
| 1016 | EnsureCoreExists(); |
| 1017 | uint32 id = GetNextRequestId(); |
| 1018 | core_->SetDefaultPermission(id, setting_type, permission, |
| 1019 | clear_site_specific); |
| 1020 | return id; |
| 1021 | } |
| 1022 | |
| 1023 | uint32 PepperFlashSettingsManager::SetSitePermission( |
| 1024 | PP_Flash_BrowserOperations_SettingType setting_type, |
| 1025 | const ppapi::FlashSiteSettings& sites) { |
| 1026 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1027 | |
| 1028 | EnsureCoreExists(); |
| 1029 | uint32 id = GetNextRequestId(); |
| 1030 | core_->SetSitePermission(id, setting_type, sites); |
| 1031 | return id; |
| 1032 | } |
| 1033 | |
[email protected] | 951ef0b | 2012-07-27 22:46:53 | [diff] [blame] | 1034 | uint32 PepperFlashSettingsManager::GetSitesWithData() { |
| 1035 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1036 | |
| 1037 | EnsureCoreExists(); |
| 1038 | uint32 id = GetNextRequestId(); |
| 1039 | core_->GetSitesWithData(id); |
| 1040 | return id; |
| 1041 | } |
| 1042 | |
| 1043 | uint32 PepperFlashSettingsManager::ClearSiteData(const std::string& site, |
| 1044 | uint64 flags, |
| 1045 | uint64 max_age) { |
| 1046 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1047 | |
| 1048 | EnsureCoreExists(); |
| 1049 | uint32 id = GetNextRequestId(); |
| 1050 | core_->ClearSiteData(id, site, flags, max_age); |
| 1051 | return id; |
| 1052 | } |
| 1053 | |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 1054 | uint32 PepperFlashSettingsManager::GetNextRequestId() { |
| 1055 | return next_request_id_++; |
| 1056 | } |
| 1057 | |
| 1058 | void PepperFlashSettingsManager::EnsureCoreExists() { |
[email protected] | 6464cc1 | 2012-07-12 09:25:53 | [diff] [blame] | 1059 | if (!core_.get()) { |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 1060 | core_ = new Core(weak_ptr_factory_.GetWeakPtr(), browser_context_); |
[email protected] | 6464cc1 | 2012-07-12 09:25:53 | [diff] [blame] | 1061 | core_->Initialize(); |
| 1062 | } |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 1063 | } |
| 1064 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 1065 | void PepperFlashSettingsManager::OnError(Core* core) { |
| 1066 | DCHECK(core); |
| 1067 | if (core != core_.get()) |
| 1068 | return; |
[email protected] | 1a55944 | 2012-05-27 07:18:46 | [diff] [blame] | 1069 | |
[email protected] | 7c82691 | 2012-10-01 22:05:27 | [diff] [blame] | 1070 | core_->Detach(); |
| 1071 | core_ = NULL; |
| 1072 | } |