Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6265)

Unified Diff: chrome/browser/media/protected_media_identifier_permission_context.h

Issue 769103002: Refactor ProtectedMediaIdentifierPermissionContext to derive from PermissionContextBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply comments, fix compile Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/protected_media_identifier_permission_context.h
diff --git a/chrome/browser/media/protected_media_identifier_permission_context.h b/chrome/browser/media/protected_media_identifier_permission_context.h
index e456014e9c74e9ce9ef76e5d619057f834c30309..3ee9aa225485fa6a128b0e25a73afb21dde87f1a 100644
--- a/chrome/browser/media/protected_media_identifier_permission_context.h
+++ b/chrome/browser/media/protected_media_identifier_permission_context.h
@@ -5,12 +5,7 @@
#ifndef CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_
#define CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_
-#include <map>
-#include <string>
-
-#include "base/callback_forward.h"
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/content_settings/permission_queue_controller.h"
+#include "chrome/browser/content_settings/permission_context_base.h"
class PermissionRequestID;
class Profile;
@@ -23,76 +18,29 @@ class WebContents;
// Manages protected media identifier permissions flow, and delegates UI
// handling via PermissionQueueController.
class ProtectedMediaIdentifierPermissionContext
- : public base::RefCountedThreadSafe<
- ProtectedMediaIdentifierPermissionContext> {
+ : public PermissionContextBase,
+ public base::RefCountedThreadSafe<
Miguel Garcia 2014/12/03 18:57:37 Do you still need this RefCounted inheritance? Per
timvolodine 2014/12/04 17:22:26 Done.
+ ProtectedMediaIdentifierPermissionContext> {
public:
explicit ProtectedMediaIdentifierPermissionContext(Profile* profile);
- void RequestProtectedMediaIdentifierPermission(
- content::WebContents* web_contents,
- const GURL& origin,
- base::Callback<void(bool)> result_callback);
-
- void CancelProtectedMediaIdentifierPermissionRequests(int render_process_id,
- int render_view_id,
- const GURL& origin);
-
- // Called on the UI thread when the profile is about to be destroyed.
- void ShutdownOnUIThread();
+ // In addition to the base class flow checks that it is only code from
+ // valid iframes. It also adds special logic when called through an extension.
+ void RequestPermission(content::WebContents* web_contents,
+ const PermissionRequestID& id,
+ const GURL& requesting_frame_origin,
+ bool user_gesture,
+ const BrowserPermissionCallback& callback) override;
private:
friend class base::RefCountedThreadSafe<
ProtectedMediaIdentifierPermissionContext>;
- ~ProtectedMediaIdentifierPermissionContext();
-
- Profile* profile() const { return profile_; }
-
- // Return an instance of the infobar queue controller, creating it
- // if necessary.
- PermissionQueueController* QueueController();
-
- // Notifies whether or not the corresponding bridge is allowed to use
- // protected media identifier via
- // SetProtectedMediaIdentifierPermissionResponse(). Called on the UI thread.
- void NotifyPermissionSet(const PermissionRequestID& id,
- const GURL& origin,
- const base::Callback<void(bool)>& callback,
- bool allowed);
-
- // Decide whether the protected media identifier permission should be granted.
- // Calls PermissionDecided if permission can be decided non-interactively,
- // or NotifyPermissionSet if permission decided by presenting an
- // infobar to the user. Called on the UI thread.
- void DecidePermission(const PermissionRequestID& id,
- const GURL& origin,
- const GURL& embedder,
- content::RenderViewHost* rvh,
- const base::Callback<void(bool)>& callback);
-
- // Called when permission is granted without interactively asking
- // the user. Can be overridden to introduce additional UI flow.
- // Should ultimately ensure that NotifyPermissionSet is called.
- // Called on the UI thread.
- void PermissionDecided(const PermissionRequestID& id,
- const GURL& origin,
- const GURL& embedder,
- const base::Callback<void(bool)>& callback,
- bool allowed);
-
- // Create an PermissionQueueController. overridden in derived classes to
- // provide additional UI flow. Called on the UI thread.
- PermissionQueueController* CreateQueueController();
- // Removes pending InfoBar requests that match |bridge_id| from the tab
- // given by |render_process_id| and |render_view_id|.
- void CancelPendingInfobarRequests(int render_process_id,
- int render_view_id,
- const GURL& origin);
+ ~ProtectedMediaIdentifierPermissionContext() override;
- // These must only be accessed from the UI thread.
- Profile* const profile_;
- bool shutting_down_;
- scoped_ptr<PermissionQueueController> permission_queue_controller_;
+ void UpdateTabContext(const PermissionRequestID& id,
+ const GURL& requesting_frame,
+ bool allowed) override;
DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext);
};

Powered by Google App Engine
This is Rietveld 408576698