| Index: chrome/browser/renderer_host/pepper/flash_lso_settings_helper.h
|
| diff --git a/chrome/browser/renderer_host/pepper/flash_lso_settings_helper.h b/chrome/browser/renderer_host/pepper/flash_lso_settings_helper.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..752fed846542fed378387a099207d4e2ff0b81ec
|
| --- /dev/null
|
| +++ b/chrome/browser/renderer_host/pepper/flash_lso_settings_helper.h
|
| @@ -0,0 +1,90 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_FLASH_LSO_SETTINGS_HELPER_H_
|
| +#define CHROME_BROWSER_RENDERER_HOST_PEPPER_FLASH_LSO_SETTINGS_HELPER_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/callback.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "content/public/browser/notification_observer.h"
|
| +#include "content/public/browser/notification_registrar.h"
|
| +#include "ppapi/c/private/ppb_flash.h"
|
| +
|
| +class GURL;
|
| +class Profile;
|
| +
|
| +namespace content {
|
| +class ResourceContext;
|
| +}
|
| +
|
| +namespace chrome {
|
| +
|
| +// This class aids in getting the Flash LSO Settings.
|
| +class FlashLSOSettingsHelper
|
| + : public base::RefCountedThreadSafe<FlashLSOSettingsHelper>,
|
| + public content::NotificationObserver {
|
| + public:
|
| + explicit FlashLSOSettingsHelper(int render_process_id);
|
| +
|
| + // Get the Flash local data restrictions for the given document/plugin URLs.
|
| + // Should only be called from the IO thread. |callback| will be run with the
|
| + // data restriction settings on the IO thread. It may be run synchronously or
|
| + // asynchronously.
|
| + void GetLocalDataRestrictions(
|
| + const GURL& document_url,
|
| + const GURL& plugin_url,
|
| + base::Callback<void(PP_FlashLSORestrictions)> callback);
|
| +
|
| + private:
|
| + virtual ~FlashLSOSettingsHelper();
|
| + friend class base::RefCountedThreadSafe<FlashLSOSettingsHelper>;
|
| +
|
| + // Run |callback| with the local data restrictions for the given resource
|
| + // context. The resource context is cached locally.
|
| + void GetLocalDataRestrictionsHelper(
|
| + const GURL& document_url,
|
| + const GURL& plugin_url,
|
| + base::Callback<void(PP_FlashLSORestrictions)> callback,
|
| + content::ResourceContext* resource_context);
|
| +
|
| + // Gets the resource context for the given render process ID. The resource
|
| + // context belongs to the Profile which lives on the UI thread so this should
|
| + // be run on the UI thread. This also registers this class for a notification
|
| + // on profile destruction so that the resource context is not accessed after
|
| + // that point.
|
| + content::ResourceContext* GetResourceContext(int render_process_id);
|
| +
|
| + // content::NotificationObserver implementation.
|
| + virtual void Observe(int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) OVERRIDE;
|
| +
|
| + // Clear |resource_context_| on the IO thread when the profile is destroyed.
|
| + void ClearResourceContext();
|
| +
|
| + // The render process ID of the renderer process to get LSO settings for.
|
| + // Should only be accessed on the IO thread.
|
| + int render_process_id_;
|
| +
|
| + // Whether the |resource_context_| has been initialized yet. Should only be
|
| + // accessed from the UI thread.
|
| + bool initialized_;
|
| +
|
| + // For fetching the Flash LSO settings. Should only be accessed from the IO
|
| + // thread.
|
| + content::ResourceContext* resource_context_;
|
| +
|
| + // Registrar for receiving profile destruction notifications. Should only be
|
| + // accessed from the UI thread.
|
| + scoped_ptr<content::NotificationRegistrar> registrar_;
|
| +
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(FlashLSOSettingsHelper);
|
| +};
|
| +
|
| +} // namespace chrome
|
| +
|
| +#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_FLASH_LSO_SETTINGS_HELPER_H_
|
|
|