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

Unified Diff: chrome/browser/content_settings/permission_queue_controller.cc

Issue 20990005: Web MIDI: implement permission infobar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable icon for now Created 7 years, 5 months 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/content_settings/permission_queue_controller.cc
diff --git a/chrome/browser/content_settings/permission_queue_controller.cc b/chrome/browser/content_settings/permission_queue_controller.cc
index 4b471b819dca6d8032586ddfad8c19143aac9308..5c55137ac8cf57bd66296f298d52ff0be047c121 100644
--- a/chrome/browser/content_settings/permission_queue_controller.cc
+++ b/chrome/browser/content_settings/permission_queue_controller.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/geolocation/geolocation_infobar_delegate.h"
#include "chrome/browser/infobars/infobar.h"
#include "chrome/browser/infobars/infobar_service.h"
+#include "chrome/browser/media/midi_permission_infobar_delegate.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/common/content_settings.h"
@@ -34,7 +35,8 @@ InfoBarService* GetInfoBarService(const PermissionRequestID& id) {
class PermissionQueueController::PendingInfoBarRequest {
public:
- PendingInfoBarRequest(const PermissionRequestID& id,
+ PendingInfoBarRequest(ContentSettingsType type,
+ const PermissionRequestID& id,
const GURL& requesting_frame,
const GURL& embedder,
PermissionDecidedCallback callback);
@@ -53,6 +55,7 @@ class PermissionQueueController::PendingInfoBarRequest {
const std::string& display_languages);
private:
+ ContentSettingsType type_;
PermissionRequestID id_;
GURL requesting_frame_;
GURL embedder_;
@@ -63,11 +66,13 @@ class PermissionQueueController::PendingInfoBarRequest {
};
PermissionQueueController::PendingInfoBarRequest::PendingInfoBarRequest(
+ ContentSettingsType type,
const PermissionRequestID& id,
const GURL& requesting_frame,
const GURL& embedder,
PermissionDecidedCallback callback)
- : id_(id),
+ : type_(type),
+ id_(id),
requesting_frame_(requesting_frame),
embedder_(embedder),
callback_(callback),
@@ -91,10 +96,21 @@ void PermissionQueueController::PendingInfoBarRequest::RunCallback(
void PermissionQueueController::PendingInfoBarRequest::CreateInfoBar(
PermissionQueueController* controller,
const std::string& display_languages) {
- // TODO(toyoshim): Remove following dependency on geolocation.
scherkus (not reviewing) 2013/07/31 18:09:55 is this TODO actually fixed?
Takashi Toyoshima 2013/08/01 08:27:38 OK, I keep this TODO here and will handle later in
- infobar_ = GeolocationInfoBarDelegate::Create(
- GetInfoBarService(id_), controller, id_, requesting_frame_,
- display_languages);
+ switch (type_) {
+ case CONTENT_SETTINGS_TYPE_GEOLOCATION:
+ infobar_ = GeolocationInfoBarDelegate::Create(
+ GetInfoBarService(id_), controller, id_, requesting_frame_,
+ display_languages);
+ break;
+ case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
+ infobar_ = MIDIPermissionInfoBarDelegate::Create(
+ GetInfoBarService(id_), controller, id_, requesting_frame_,
+ display_languages);
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
}
@@ -126,7 +142,7 @@ void PermissionQueueController::CreateInfoBarRequest(
DCHECK(!i->id().Equals(id));
pending_infobar_requests_.push_back(PendingInfoBarRequest(
- id, requesting_frame, embedder, callback));
+ type_, id, requesting_frame, embedder, callback));
if (!AlreadyShowingInfoBarForTab(id))
ShowQueuedInfoBarForTab(id);
}

Powered by Google App Engine
This is Rietveld 408576698