Commit bb32605e authored by miguelg@chromium.org's avatar miguelg@chromium.org

Implement midi permissions on top of the new common permission classes

- move all the generic permission settings from gcm to content_settings
- delete the midi implementation in favour of this one.

Some important changes in midi.

Clicking Yes/No on Bubbles did not save the permission for future uses,
while when using infobars it was saved. Now it is saved in both cases

The existing midi implementation had some renderer crashes that have now
been fixed. It also had a browser race when tring to run the result
callback. Both issues are fixed in this implementation.

The midi cancel closure is not implemented, it does not seem to be used
anywhere and the paradigm was a bit convoluted
(passing it as an out pointer in RequestMidiSysExPermission)

The old midi infobar used to say Allow/Deny but the bubble said Allow/Block,
now it says Allow/Block in both cases.

BUG=392145

Review URL: https://codereview.chromium.org/365123003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282003 0039d316-1c4b-4281-b951-d872f2087c98
parent c98893d9
...@@ -14534,8 +14534,9 @@ Do you accept? ...@@ -14534,8 +14534,9 @@ Do you accept?
<!-- Push messaging strings --> <!-- Push messaging strings -->
<message name="IDS_PUSH_MESSAGES_PERMISSION_QUESTION" desc="Question asked on the info bar whenever a domain wants to send push messages"> <message name="IDS_PUSH_MESSAGES_PERMISSION_QUESTION" desc="Question asked on the info bar whenever a domain wants to send push messages">
<ph name="URL"> $1<ex>maps.google.com</ex> </ph> <ph name="URL">
wants to send you notifications. $1<ex>push.google.com</ex>
</ph> wants to send you notifications.
</message> </message>
<message name="IDS_PUSH_MESSAGES_TAB_LABEL" desc="Label for the push messages section on Content Settings dialog"> <message name="IDS_PUSH_MESSAGES_TAB_LABEL" desc="Label for the push messages section on Content Settings dialog">
Push Messages Push Messages
...@@ -14549,11 +14550,8 @@ Do you accept? ...@@ -14549,11 +14550,8 @@ Do you accept?
<message name="IDS_PUSH_MESSSAGING_BLOCK_RADIO" desc="A radio button in Content Settings dialog to deny a site to send push messages."> <message name="IDS_PUSH_MESSSAGING_BLOCK_RADIO" desc="A radio button in Content Settings dialog to deny a site to send push messages.">
Do not allow any sites to send push messages Do not allow any sites to send push messages
</message> </message>
<message name="IDS_PUSH_MESSAGES_BUBBLE_TEXT" desc="Question asked on the info bar whenever a domain wants to send push messages">
notification tray.
</message>
<message name="IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT" desc="Question asked on the info bar whenever a domain wants to send push messages"> <message name="IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT" desc="Question asked on the info bar whenever a domain wants to send push messages">
notifications push notifications
</message> </message>
</messages> </messages>
</release> </release>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/browser/content_settings/content_settings_utils.h"
#include "chrome/browser/content_settings/cookie_settings.h" #include "chrome/browser/content_settings/cookie_settings.h"
#include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/permission_request_id.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/defaults.h" #include "chrome/browser/defaults.h"
#include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h"
...@@ -2128,9 +2129,12 @@ void ChromeContentBrowserClient::RequestMidiSysExPermission( ...@@ -2128,9 +2129,12 @@ void ChromeContentBrowserClient::RequestMidiSysExPermission(
MidiPermissionContext* context = MidiPermissionContext* context =
MidiPermissionContextFactory::GetForProfile( MidiPermissionContextFactory::GetForProfile(
Profile::FromBrowserContext(web_contents->GetBrowserContext())); Profile::FromBrowserContext(web_contents->GetBrowserContext()));
context->RequestMidiSysExPermission(web_contents, bridge_id, requesting_frame, int renderer_id = web_contents->GetRenderProcessHost()->GetID();
user_gesture, result_callback, int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
cancel_callback); const PermissionRequestID id(renderer_id, render_view_id, bridge_id, GURL());
context->RequestPermission(web_contents, id, requesting_frame,
user_gesture, result_callback);
} }
void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission( void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission(
......
...@@ -2,16 +2,14 @@ ...@@ -2,16 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/services/gcm/permission_bubble_request_impl.h" #include "chrome/browser/content_settings/permission_bubble_request_impl.h"
#include "chrome/browser/services/gcm/permission_context_base.h" #include "chrome/browser/content_settings/permission_context_base.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "grit/theme_resources.h" #include "grit/theme_resources.h"
#include "net/base/net_util.h" #include "net/base/net_util.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
namespace gcm {
PermissionBubbleRequestImpl::PermissionBubbleRequestImpl( PermissionBubbleRequestImpl::PermissionBubbleRequestImpl(
const GURL& request_origin, const GURL& request_origin,
bool user_gesture, bool user_gesture,
...@@ -25,40 +23,64 @@ PermissionBubbleRequestImpl::PermissionBubbleRequestImpl( ...@@ -25,40 +23,64 @@ PermissionBubbleRequestImpl::PermissionBubbleRequestImpl(
display_languages_(display_languages), display_languages_(display_languages),
permission_decided_callback_(permission_decided_callback), permission_decided_callback_(permission_decided_callback),
delete_callback_(delete_callback), delete_callback_(delete_callback),
is_finished_(false) {} is_finished_(false) {
}
PermissionBubbleRequestImpl::~PermissionBubbleRequestImpl() { PermissionBubbleRequestImpl::~PermissionBubbleRequestImpl() {
DCHECK(is_finished_); DCHECK(is_finished_);
} }
int PermissionBubbleRequestImpl::GetIconID() const { int PermissionBubbleRequestImpl::GetIconID() const {
int icon_id;
switch (type_) { switch (type_) {
case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
icon_id = IDR_ALLOWED_MIDI_SYSEX;
break;
case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
return IDR_INFOBAR_WARNING; icon_id = IDR_INFOBAR_WARNING;
break;
default: default:
NOTREACHED(); NOTREACHED();
return IDR_INFOBAR_WARNING;
} }
return IDR_INFOBAR_WARNING; return icon_id;
} }
base::string16 PermissionBubbleRequestImpl::GetMessageText() const { base::string16 PermissionBubbleRequestImpl::GetMessageText() const {
int message_id;
switch (type_) { switch (type_) {
case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
message_id = IDS_MIDI_SYSEX_INFOBAR_QUESTION;
break;
case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
return l10n_util::GetStringUTF16(IDS_PUSH_MESSAGES_BUBBLE_TEXT); message_id = IDS_PUSH_MESSAGES_PERMISSION_QUESTION;
break;
default: default:
NOTREACHED(); NOTREACHED();
return base::string16();
} }
return base::string16(); return l10n_util::GetStringFUTF16(
message_id,
net::FormatUrl(request_origin_, display_languages_,
net::kFormatUrlOmitUsernamePassword |
net::kFormatUrlOmitTrailingSlashOnBareHostname,
net::UnescapeRule::SPACES, NULL, NULL, NULL));
} }
base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const { base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const {
int message_id;
switch (type_) { switch (type_) {
case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
return l10n_util::GetStringUTF16(IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT); message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT;
default: break;
NOTREACHED(); case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
} message_id = IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT;
return base::string16(); break;
default:
NOTREACHED();
return base::string16();
}
return l10n_util::GetStringUTF16(message_id);
} }
bool PermissionBubbleRequestImpl::HasUserGesture() const { bool PermissionBubbleRequestImpl::HasUserGesture() const {
...@@ -85,5 +107,3 @@ void PermissionBubbleRequestImpl::RequestFinished() { ...@@ -85,5 +107,3 @@ void PermissionBubbleRequestImpl::RequestFinished() {
is_finished_ = true; is_finished_ = true;
delete_callback_.Run(); delete_callback_.Run();
} }
} // namespace gcm
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_SERVICES_GCM_PERMISSION_BUBBLE_REQUEST_IMPL_H_ #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_BUBBLE_REQUEST_IMPL_H_
#define CHROME_BROWSER_SERVICES_GCM_PERMISSION_BUBBLE_REQUEST_IMPL_H_ #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_BUBBLE_REQUEST_IMPL_H_
#include "base/callback.h" #include "base/callback.h"
#include "chrome/browser/content_settings/permission_request_id.h" #include "chrome/browser/content_settings/permission_request_id.h"
...@@ -12,9 +12,6 @@ ...@@ -12,9 +12,6 @@
class GURL; class GURL;
// TODO(miguelg): move this class out of GCM.
namespace gcm {
class PermissionContextBase; class PermissionContextBase;
// Default implementation of PermissionBubbleRequest, it is assumed that the // Default implementation of PermissionBubbleRequest, it is assumed that the
...@@ -66,5 +63,4 @@ class PermissionBubbleRequestImpl : public PermissionBubbleRequest { ...@@ -66,5 +63,4 @@ class PermissionBubbleRequestImpl : public PermissionBubbleRequest {
DISALLOW_COPY_AND_ASSIGN(PermissionBubbleRequestImpl); DISALLOW_COPY_AND_ASSIGN(PermissionBubbleRequestImpl);
}; };
} // namespace gcm #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_BUBBLE_REQUEST_IMPL_H_
#endif // CHROME_BROWSER_SERVICES_GCM_PERMISSION_BUBBLE_REQUEST_IMPL_H_
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/services/gcm/permission_context_base.h" #include "chrome/browser/content_settings/permission_context_base.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/permission_bubble_request_impl.h"
#include "chrome/browser/content_settings/permission_queue_controller.h" #include "chrome/browser/content_settings/permission_queue_controller.h"
#include "chrome/browser/content_settings/permission_request_id.h" #include "chrome/browser/content_settings/permission_request_id.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/services/gcm/permission_bubble_request_impl.h"
#include "chrome/browser/ui/website_settings/permission_bubble_manager.h" #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "grit/theme_resources.h" #include "grit/theme_resources.h"
namespace gcm {
PermissionContextBase::PermissionContextBase( PermissionContextBase::PermissionContextBase(
Profile* profile, Profile* profile,
...@@ -46,8 +45,8 @@ void PermissionContextBase::RequestPermission( ...@@ -46,8 +45,8 @@ void PermissionContextBase::RequestPermission(
DecidePermission(web_contents, DecidePermission(web_contents,
id, id,
requesting_frame, requesting_frame.GetOrigin(),
requesting_frame, web_contents->GetLastCommittedURL().GetOrigin(),
user_gesture, user_gesture,
callback); callback);
} }
...@@ -55,77 +54,81 @@ void PermissionContextBase::RequestPermission( ...@@ -55,77 +54,81 @@ void PermissionContextBase::RequestPermission(
void PermissionContextBase::DecidePermission( void PermissionContextBase::DecidePermission(
content::WebContents* web_contents, content::WebContents* web_contents,
const PermissionRequestID& id, const PermissionRequestID& id,
const GURL& requesting_frame, const GURL& requesting_origin,
const GURL& embedder, const GURL& embedder_origin,
bool user_gesture, bool user_gesture,
const BrowserPermissionCallback& callback) { const BrowserPermissionCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
ContentSetting content_setting = ContentSetting content_setting =
profile_->GetHostContentSettingsMap()->GetContentSetting( profile_->GetHostContentSettingsMap()->GetContentSetting(
requesting_frame, embedder, permission_type_, std::string()); requesting_origin, embedder_origin, permission_type_, std::string());
switch (content_setting) { switch (content_setting) {
case CONTENT_SETTING_BLOCK: case CONTENT_SETTING_BLOCK:
PermissionDecided(id, requesting_frame, embedder, callback, false); PermissionDecided(
break; id, requesting_origin, embedder_origin, callback, false);
return;
case CONTENT_SETTING_ALLOW: case CONTENT_SETTING_ALLOW:
PermissionDecided(id, requesting_frame, embedder, callback, true); PermissionDecided(id, requesting_origin, embedder_origin, callback, true);
break; return;
default: default:
if (PermissionBubbleManager::Enabled()) { break;
PermissionBubbleManager* bubble_manager =
PermissionBubbleManager::FromWebContents(web_contents);
DCHECK(bubble_manager);
scoped_ptr<PermissionBubbleRequest> request_ptr(
new PermissionBubbleRequestImpl(
requesting_frame,
user_gesture,
permission_type_,
profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
base::Bind(&PermissionContextBase::NotifyPermissionSet,
weak_factory_.GetWeakPtr(),
id,
requesting_frame,
embedder,
callback),
base::Bind(&PermissionContextBase::CleanUpBubble,
weak_factory_.GetWeakPtr(), id)));
PermissionBubbleRequest* request = request_ptr.get();
bool inserted = pending_bubbles_.add(
id.ToString(), request_ptr.Pass()).second;
DCHECK(inserted) << "Duplicate id " << id.ToString();
bubble_manager->AddRequest(request);
return;
}
// TODO(gbillock): Delete this and the infobar delegate when
// we're using only bubbles. crbug.com/337458
GetQueueController()->CreateInfoBarRequest(
id,
requesting_frame,
embedder,
std::string(),
base::Bind(&PermissionContextBase::NotifyPermissionSet,
weak_factory_.GetWeakPtr(),
id,
requesting_frame,
embedder,
callback,
// the queue controller takes care of persisting the
// permission
false));
} }
if (PermissionBubbleManager::Enabled()) {
PermissionBubbleManager* bubble_manager =
PermissionBubbleManager::FromWebContents(web_contents);
DCHECK(bubble_manager);
scoped_ptr<PermissionBubbleRequest> request_ptr(
new PermissionBubbleRequestImpl(
requesting_origin,
user_gesture,
permission_type_,
profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
base::Bind(&PermissionContextBase::NotifyPermissionSet,
weak_factory_.GetWeakPtr(),
id,
requesting_origin,
embedder_origin,
callback),
base::Bind(&PermissionContextBase::CleanUpBubble,
weak_factory_.GetWeakPtr(), id)));
PermissionBubbleRequest* request = request_ptr.get();
bool inserted = pending_bubbles_.add(
id.ToString(), request_ptr.Pass()).second;
DCHECK(inserted) << "Duplicate id " << id.ToString();
bubble_manager->AddRequest(request);
return;
}
// TODO(gbillock): Delete this and the infobar delegate when
// we're using only bubbles. crbug.com/337458
GetQueueController()->CreateInfoBarRequest(
id,
requesting_origin,
embedder_origin,
std::string(),
base::Bind(&PermissionContextBase::NotifyPermissionSet,
weak_factory_.GetWeakPtr(),
id,
requesting_origin,
embedder_origin,
callback,
// the queue controller takes care of persisting the
// permission
false));
} }
void PermissionContextBase::PermissionDecided( void PermissionContextBase::PermissionDecided(
const PermissionRequestID& id, const PermissionRequestID& id,
const GURL& requesting_frame, const GURL& requesting_origin,
const GURL& embedder, const GURL& embedder_origin,
const BrowserPermissionCallback& callback, const BrowserPermissionCallback& callback,
bool allowed) { bool allowed) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
NotifyPermissionSet(id, requesting_frame, embedder, callback, false, allowed); NotifyPermissionSet(
id, requesting_origin, embedder_origin, callback, false, allowed);
} }
PermissionQueueController* PermissionContextBase::GetQueueController() { PermissionQueueController* PermissionContextBase::GetQueueController() {
...@@ -134,43 +137,36 @@ PermissionQueueController* PermissionContextBase::GetQueueController() { ...@@ -134,43 +137,36 @@ PermissionQueueController* PermissionContextBase::GetQueueController() {
void PermissionContextBase::NotifyPermissionSet( void PermissionContextBase::NotifyPermissionSet(
const PermissionRequestID& id, const PermissionRequestID& id,
const GURL& requesting_frame, const GURL& requesting_origin,
const GURL& embedder, const GURL& embedder_origin,
const BrowserPermissionCallback& callback, const BrowserPermissionCallback& callback,
bool persist, bool persist,
bool allowed) { bool allowed) {
if (persist) {
UpdateContentSetting(requesting_frame, embedder, allowed);
}
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
UpdateTabContext(id, requesting_frame, allowed); if (persist)
UpdateContentSetting(requesting_origin, embedder_origin, allowed);
UpdateTabContext(id, requesting_origin, allowed);
callback.Run(allowed); callback.Run(allowed);
} }
void PermissionContextBase::CleanUpBubble(const PermissionRequestID& id) { void PermissionContextBase::CleanUpBubble(const PermissionRequestID& id) {
base::ScopedPtrHashMap<std::string, PermissionBubbleRequest>::iterator it; size_t success = pending_bubbles_.erase(id.ToString());
it = pending_bubbles_.find(id.ToString()); DCHECK(success == 1) << "Missing request " << id.ToString();
if (it != pending_bubbles_.end()) {
pending_bubbles_.take_and_erase(it);
return;
}
NOTREACHED() << "Missing request";
} }
void PermissionContextBase::UpdateContentSetting( void PermissionContextBase::UpdateContentSetting(
const GURL& requesting_frame, const GURL& requesting_origin,
const GURL& embedder, const GURL& embedder_origin,
bool allowed) { bool allowed) {
DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin());
DCHECK_EQ(embedder_origin, embedder_origin.GetOrigin());
ContentSetting content_setting = ContentSetting content_setting =
allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK;
profile_->GetHostContentSettingsMap()->SetContentSetting( profile_->GetHostContentSettingsMap()->SetContentSetting(
ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), ContentSettingsPattern::FromURLNoWildcard(requesting_origin),
ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()), ContentSettingsPattern::FromURLNoWildcard(embedder_origin),
permission_type_, permission_type_,
std::string(), std::string(),
content_setting); content_setting);
} }
} // namespace gcm
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_SERVICES_GCM_PERMISSION_CONTEXT_BASE_H_ #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_
#define CHROME_BROWSER_SERVICES_GCM_PERMISSION_CONTEXT_BASE_H_ #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_
#include "base/callback.h" #include "base/callback.h"
#include "base/containers/scoped_ptr_hash_map.h" #include "base/containers/scoped_ptr_hash_map.h"
...@@ -24,19 +24,30 @@ class WebContents; ...@@ -24,19 +24,30 @@ class WebContents;
typedef base::Callback<void(bool)> BrowserPermissionCallback; typedef base::Callback<void(bool)> BrowserPermissionCallback;
// TODO(miguelg): Move this out of gcm into a generic place and make
// Midi permissions and others use it.
namespace gcm {
// This base class contains common operations for granting permissions. // This base class contains common operations for granting permissions.
// It is spit out of Midi and Push and will be moved to a common place // It offers the following functionality:
// so it can be used by both classes (and eventually others) in a separate // - Creates a bubble or infobar when a permission is needed
// patch. // - If accepted/denied the permission is saved in content settings for
// It supports both infobars and bubbles, but it handles them differently. // future uses (for the domain that requested it).
// For bubbles, it manages the life cycle of permission request and persists the // - If dismissed the permission is not saved but it's considered denied for
// permission choices when stated by the user. // this one request
// For infobars however all that logic is managed by the internal // - In any case the BrowserPermissionCallback is executed once a decision
// PermissionQueueController object. // about the permission is made by the user.
// The bare minimum you need to create a new permission request is
// - Define your new permission in the ContentSettingsType enum.
// - Create a class that inherits from PermissionContextBase and passes the
// new permission.
// - Inherit from PermissionInfobarDelegate and implement
// |GetMessageText|
// - Edit the PermissionBubbleRequestImpl methods to add the new text for
// the bubble.
// - Hit several asserts for the missing plumbing and fix them :)
// After this you can override several other methods to customize behavior,
// in particular it is advised to override UpdateTabContext in order to manage
// the permission from the omnibox.
// See midi_permission_context.h/cc or push_permission_context.cc/h for some
// examples.
class PermissionContextBase : public KeyedService { class PermissionContextBase : public KeyedService {
public: public:
PermissionContextBase(Profile* profile, PermissionContextBase(Profile* profile,
...@@ -58,21 +69,21 @@ class PermissionContextBase : public KeyedService { ...@@ -58,21 +69,21 @@ class PermissionContextBase : public KeyedService {
// or NotifyPermissionSet if permission decided by presenting an infobar. // or NotifyPermissionSet if permission decided by presenting an infobar.
void DecidePermission(content::WebContents* web_contents, void DecidePermission(content::WebContents* web_contents,
const PermissionRequestID& id, const PermissionRequestID& id,
const GURL& requesting_frame, const GURL& requesting_origin,
const GURL& embedder, const GURL& embedder_origin,
bool user_gesture, bool user_gesture,
const BrowserPermissionCallback& callback); const BrowserPermissionCallback& callback);
// Called when permission is granted without interactively asking the user. // Called when permission is granted without interactively asking the user.
void PermissionDecided(const PermissionRequestID& id, void PermissionDecided(const PermissionRequestID& id,
const GURL& requesting_frame, const GURL& requesting_origin,
const GURL& embedder, const GURL& embedder_origin,
const BrowserPermissionCallback& callback, const BrowserPermissionCallback& callback,
bool allowed); bool allowed);
void NotifyPermissionSet(const PermissionRequestID& id, void NotifyPermissionSet(const PermissionRequestID& id,
const GURL& requesting_frame, const GURL& requesting_origin,
const GURL& embedder, const GURL& embedder_origin,
const BrowserPermissionCallback& callback, const BrowserPermissionCallback& callback,
bool persist, bool persist,
bool allowed); bool allowed);
...@@ -80,7 +91,7 @@ class PermissionContextBase : public KeyedService { ...@@ -80,7 +91,7 @@ class PermissionContextBase : public KeyedService {
// Implementors can override this method to update the icons on the // Implementors can override this method to update the icons on the
// url bar with the result of the new permission. // url bar with the result of the new permission.
virtual void UpdateTabContext(const PermissionRequestID& id, virtual void UpdateTabContext(const PermissionRequestID& id,
const GURL& requesting_frame, const GURL& requesting_origin,
bool allowed) {} bool allowed) {}
// Return an instance of the infobar queue controller, creating it if needed. // Return an instance of the infobar queue controller, creating it if needed.
...@@ -88,8 +99,8 @@ class PermissionContextBase : public KeyedService { ...@@ -88,8 +99,8 @@ class PermissionContextBase : public KeyedService {
private: private:
void UpdateContentSetting( void UpdateContentSetting(
const GURL& requesting_frame, const GURL& requesting_origin,
const GURL& embedder, const GURL& embedder_origin,
bool allowed); bool allowed);
// Called when a bubble is no longer used so it can be cleaned up. // Called when a bubble is no longer used so it can be cleaned up.
...@@ -103,6 +114,4 @@ class PermissionContextBase : public KeyedService { ...@@ -103,6 +114,4 @@ class PermissionContextBase : public KeyedService {
pending_bubbles_; pending_bubbles_;
}; };
} // namespace gcm #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_
#endif // CHROME_BROWSER_SERVICES_GCM_PERMISSION_CONTEXT_BASE_H_
...@@ -2,23 +2,21 @@ ...@@ -2,23 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/services/gcm/permission_infobar_delegate.h" #include "chrome/browser/content_settings/permission_infobar_delegate.h"
#include "chrome/browser/content_settings/permission_queue_controller.h" #include "chrome/browser/content_settings/permission_queue_controller.h"
#include "components/infobars/core/infobar.h" #include "components/infobars/core/infobar.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
namespace gcm {
PermissionInfobarDelegate::~PermissionInfobarDelegate() { PermissionInfobarDelegate::~PermissionInfobarDelegate() {
} }
PermissionInfobarDelegate::PermissionInfobarDelegate( PermissionInfobarDelegate::PermissionInfobarDelegate(
PermissionQueueController* controller, PermissionQueueController* controller,
const PermissionRequestID& id, const PermissionRequestID& id,
const GURL& requesting_frame) const GURL& requesting_origin)
: controller_(controller), id_(id), requesting_frame_(requesting_frame) { : controller_(controller), id_(id), requesting_origin_(requesting_origin) {
} }
void PermissionInfobarDelegate::InfoBarDismissed() { void PermissionInfobarDelegate::InfoBarDismissed() {
...@@ -49,8 +47,8 @@ bool PermissionInfobarDelegate::Cancel() { ...@@ -49,8 +47,8 @@ bool PermissionInfobarDelegate::Cancel() {
void PermissionInfobarDelegate::SetPermission(bool update_content_setting, void PermissionInfobarDelegate::SetPermission(bool update_content_setting,
bool allowed) { bool allowed) {
controller_->OnPermissionSet( controller_->OnPermissionSet(
id_, requesting_frame_, id_, requesting_origin_,
InfoBarService::WebContentsFromInfoBar(infobar())->GetURL(), InfoBarService::WebContentsFromInfoBar(
infobar())->GetLastCommittedURL().GetOrigin(),
update_content_setting, allowed); update_content_setting, allowed);
} }
} // namespace gcm
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_SERVICES_GCM_PERMISSION_INFOBAR_DELEGATE_H_ #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_
#define CHROME_BROWSER_SERVICES_GCM_PERMISSION_INFOBAR_DELEGATE_H_ #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_
#include "chrome/browser/content_settings/permission_request_id.h" #include "chrome/browser/content_settings/permission_request_id.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
...@@ -13,22 +13,21 @@ ...@@ -13,22 +13,21 @@
class NavigationDetails; class NavigationDetails;
class PermissionQueueController; class PermissionQueueController;
namespace gcm { // Base class for permission infobars, it implements the default behavior
// Base class for permission infobars, it implements the default behaviour
// so that the accept/deny buttons grant/deny the relevant permission. // so that the accept/deny buttons grant/deny the relevant permission.
// A basic implementor only needs to implement the methods that // A basic implementor only needs to implement the methods that
// provide an icon and a message text to the infobar. // provide an icon and a message text to the infobar.
class PermissionInfobarDelegate : public ConfirmInfoBarDelegate { class PermissionInfobarDelegate : public ConfirmInfoBarDelegate {
public:
virtual ~PermissionInfobarDelegate();
protected: protected:
PermissionInfobarDelegate(PermissionQueueController* controller, PermissionInfobarDelegate(PermissionQueueController* controller,
const PermissionRequestID& id, const PermissionRequestID& id,
const GURL& requesting_frame); const GURL& requesting_origin);
virtual ~PermissionInfobarDelegate();
// ConfirmInfoBarDelegate: // ConfirmInfoBarDelegate:
virtual base::string16 GetMessageText() const = 0;
virtual void InfoBarDismissed() OVERRIDE; virtual void InfoBarDismissed() OVERRIDE;
virtual infobars::InfoBarDelegate::Type GetInfoBarType() const OVERRIDE; virtual infobars::InfoBarDelegate::Type GetInfoBarType() const OVERRIDE;
virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
...@@ -40,10 +39,9 @@ class PermissionInfobarDelegate : public ConfirmInfoBarDelegate { ...@@ -40,10 +39,9 @@ class PermissionInfobarDelegate : public ConfirmInfoBarDelegate {
PermissionQueueController* controller_; // not owned by us PermissionQueueController* controller_; // not owned by us
const PermissionRequestID id_; const PermissionRequestID id_;
GURL requesting_frame_; GURL requesting_origin_;
DISALLOW_COPY_AND_ASSIGN(PermissionInfobarDelegate); DISALLOW_COPY_AND_ASSIGN(PermissionInfobarDelegate);
}; };
} // namespace gcm #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_
#endif // CHROME_BROWSER_SERVICES_GCM_PERMISSION_INFOBAR_DELEGATE_H_
...@@ -5,91 +5,22 @@ ...@@ -5,91 +5,22 @@
#ifndef CHROME_BROWSER_MEDIA_MIDI_PERMISSION_CONTEXT_H_ #ifndef CHROME_BROWSER_MEDIA_MIDI_PERMISSION_CONTEXT_H_
#define CHROME_BROWSER_MEDIA_MIDI_PERMISSION_CONTEXT_H_ #define CHROME_BROWSER_MEDIA_MIDI_PERMISSION_CONTEXT_H_
#include "base/containers/scoped_ptr_hash_map.h" #include "chrome/browser/content_settings/permission_context_base.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/keyed_service/core/keyed_service.h"
namespace content {
class WebContents;
}
class GURL; class GURL;
class MidiPermissionRequest;
class PermissionQueueController;
class PermissionRequestID; class PermissionRequestID;
class Profile;
// This class manages MIDI permissions flow. Used on the UI thread. class MidiPermissionContext : public PermissionContextBase {
class MidiPermissionContext : public KeyedService {
public: public:
explicit MidiPermissionContext(Profile* profile); explicit MidiPermissionContext(Profile* profile);
virtual ~MidiPermissionContext(); virtual ~MidiPermissionContext();
// KeyedService methods:
virtual void Shutdown() OVERRIDE;
// Request to ask users permission about MIDI.
void RequestMidiSysExPermission(
content::WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
const base::Callback<void(bool)>& result_callback,
base::Closure* cancel_callback);
// Called when the permission decision is made. If a permissions prompt is
// shown to the user it will be called when the user selects an option
// from that prompt.
void NotifyPermissionSet(
const PermissionRequestID& id,
const GURL& requesting_frame,
const base::Callback<void(bool)>& callback,
bool allowed);
private: private:
friend class MidiPermissionRequest;
// Cancel a pending MIDI permission request.
void CancelMidiSysExPermissionRequest(int render_process_id,
int render_view_id,
int bridge_id);
// Decide whether the permission should be granted.
// Calls PermissionDecided if permission can be decided non-interactively,
// or NotifyPermissionSet if permission decided by presenting an infobar.
void DecidePermission(
content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_frame,
const GURL& embedder,
bool user_gesture,
const base::Callback<void(bool)>& callback);
// Called when permission is granted without interactively asking the user.
void PermissionDecided(
const PermissionRequestID& id,
const GURL& requesting_frame,
const GURL& embedder,
const base::Callback<void(bool)>& callback,
bool allowed);
// Return an instance of the infobar queue controller, creating it if needed.
PermissionQueueController* GetQueueController();
// Removes any pending InfoBar request.
void CancelPendingInfobarRequest(const PermissionRequestID& id);
// Notify the context that a particular request object is no longer needed.
void RequestFinished(MidiPermissionRequest* request);
Profile* const profile_;
bool shutting_down_;
scoped_ptr<PermissionQueueController> permission_queue_controller_;
base::ScopedPtrHashMap<std::string, MidiPermissionRequest> pending_requests_;
base::WeakPtrFactory<MidiPermissionContext> weak_factory_; // PermissionContextBase:
virtual void UpdateTabContext(const PermissionRequestID& id,
const GURL& requesting_frame,
bool allowed) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(MidiPermissionContext); DISALLOW_COPY_AND_ASSIGN(MidiPermissionContext);
}; };
......
...@@ -38,38 +38,18 @@ MidiPermissionInfoBarDelegate::MidiPermissionInfoBarDelegate( ...@@ -38,38 +38,18 @@ MidiPermissionInfoBarDelegate::MidiPermissionInfoBarDelegate(
const GURL& requesting_frame, const GURL& requesting_frame,
int contents_unique_id, int contents_unique_id,
const std::string& display_languages) const std::string& display_languages)
: ConfirmInfoBarDelegate(), : PermissionInfobarDelegate(controller, id, requesting_frame),
controller_(controller),
id_(id),
requesting_frame_(requesting_frame), requesting_frame_(requesting_frame),
contents_unique_id_(contents_unique_id),
display_languages_(display_languages) { display_languages_(display_languages) {
} }
MidiPermissionInfoBarDelegate::~MidiPermissionInfoBarDelegate() { MidiPermissionInfoBarDelegate::~MidiPermissionInfoBarDelegate() {
} }
void MidiPermissionInfoBarDelegate::InfoBarDismissed() {
SetPermission(false, false);
}
int MidiPermissionInfoBarDelegate::GetIconID() const { int MidiPermissionInfoBarDelegate::GetIconID() const {
return IDR_INFOBAR_MIDI; return IDR_INFOBAR_MIDI;
} }
infobars::InfoBarDelegate::Type MidiPermissionInfoBarDelegate::GetInfoBarType()
const {
return PAGE_ACTION_TYPE;
}
bool MidiPermissionInfoBarDelegate::ShouldExpireInternal(
const NavigationDetails& details) const {
// This implementation matches InfoBarDelegate::ShouldExpireInternal(), but
// uses the unique ID we set in the constructor instead of that stored in the
// base class.
return (contents_unique_id_ != details.entry_id) || details.is_reload;
}
base::string16 MidiPermissionInfoBarDelegate::GetMessageText() const { base::string16 MidiPermissionInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringFUTF16( return l10n_util::GetStringFUTF16(
IDS_MIDI_SYSEX_INFOBAR_QUESTION, IDS_MIDI_SYSEX_INFOBAR_QUESTION,
...@@ -78,27 +58,3 @@ base::string16 MidiPermissionInfoBarDelegate::GetMessageText() const { ...@@ -78,27 +58,3 @@ base::string16 MidiPermissionInfoBarDelegate::GetMessageText() const {
net::kFormatUrlOmitTrailingSlashOnBareHostname, net::kFormatUrlOmitTrailingSlashOnBareHostname,
net::UnescapeRule::SPACES, NULL, NULL, NULL)); net::UnescapeRule::SPACES, NULL, NULL, NULL));
} }
base::string16 MidiPermissionInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
IDS_MIDI_SYSEX_ALLOW_BUTTON : IDS_MIDI_SYSEX_DENY_BUTTON);
}
bool MidiPermissionInfoBarDelegate::Accept() {
SetPermission(true, true);
return true;
}
bool MidiPermissionInfoBarDelegate::Cancel() {
SetPermission(true, false);
return true;
}
void MidiPermissionInfoBarDelegate::SetPermission(bool update_content_setting,
bool allowed) {
content::WebContents* web_contents =
InfoBarService::WebContentsFromInfoBar(infobar());
controller_->OnPermissionSet(id_, requesting_frame_, web_contents->GetURL(),
update_content_setting, allowed);
}
...@@ -7,17 +7,16 @@ ...@@ -7,17 +7,16 @@
#include <string> #include <string>
#include "chrome/browser/content_settings/permission_request_id.h" #include "chrome/browser/content_settings/permission_infobar_delegate.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
#include "url/gurl.h"
class GURL;
class PermissionQueueController; class PermissionQueueController;
class InfoBarService; class InfoBarService;
// MidiPermissionInfoBarDelegates are created by the // MidiPermissionInfoBarDelegates are created by the
// MidiPermissionContext to control the display and handling of MIDI permission // MidiPermissionContext to control the display and handling of MIDI permission
// infobars to the user. // infobars to the user.
class MidiPermissionInfoBarDelegate : public ConfirmInfoBarDelegate { class MidiPermissionInfoBarDelegate : public PermissionInfobarDelegate {
public: public:
// Creates a MIDI permission infobar and delegate and adds the infobar to // Creates a MIDI permission infobar and delegate and adds the infobar to
// |infobar_service|. Returns the infobar if it was successfully added. // |infobar_service|. Returns the infobar if it was successfully added.
...@@ -36,24 +35,10 @@ class MidiPermissionInfoBarDelegate : public ConfirmInfoBarDelegate { ...@@ -36,24 +35,10 @@ class MidiPermissionInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual ~MidiPermissionInfoBarDelegate(); virtual ~MidiPermissionInfoBarDelegate();
// ConfirmInfoBarDelegate: // ConfirmInfoBarDelegate:
virtual void InfoBarDismissed() OVERRIDE;
virtual int GetIconID() const OVERRIDE;
virtual Type GetInfoBarType() const OVERRIDE;
virtual bool ShouldExpireInternal(
const NavigationDetails& details) const OVERRIDE;
virtual base::string16 GetMessageText() const OVERRIDE; virtual base::string16 GetMessageText() const OVERRIDE;
virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; virtual int GetIconID() const OVERRIDE;
virtual bool Accept() OVERRIDE;
virtual bool Cancel() OVERRIDE;
// Calls back to the controller to inform it of the user's decision.
void SetPermission(bool update_content_setting, bool allowed);
private:
PermissionQueueController* controller_;
const PermissionRequestID id_;
GURL requesting_frame_; GURL requesting_frame_;
int contents_unique_id_;
std::string display_languages_; std::string display_languages_;
DISALLOW_COPY_AND_ASSIGN(MidiPermissionInfoBarDelegate); DISALLOW_COPY_AND_ASSIGN(MidiPermissionInfoBarDelegate);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "components/infobars/core/infobar.h" #include "components/infobars/core/infobar.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "net/base/net_util.h" #include "net/base/net_util.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
...@@ -40,8 +41,16 @@ PushMessagingInfoBarDelegate::~PushMessagingInfoBarDelegate() { ...@@ -40,8 +41,16 @@ PushMessagingInfoBarDelegate::~PushMessagingInfoBarDelegate() {
base::string16 PushMessagingInfoBarDelegate::GetMessageText() const { base::string16 PushMessagingInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringFUTF16( return l10n_util::GetStringFUTF16(
IDS_PUSH_MESSAGES_PERMISSION_QUESTION, IDS_PUSH_MESSAGES_PERMISSION_QUESTION,
net::FormatUrl(requesting_origin_, display_languages_)); net::FormatUrl(requesting_origin_, display_languages_,
net::kFormatUrlOmitUsernamePassword |
net::kFormatUrlOmitTrailingSlashOnBareHostname,
net::UnescapeRule::SPACES, NULL, NULL, NULL));
}
int PushMessagingInfoBarDelegate::GetIconID() const {
// TODO(miguelg): change once we have an icon
return IDR_INFOBAR_WARNING;
} }
} // namespace gcm } // namespace gcm
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_INFOBAR_DELEGATE_H_ #ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_INFOBAR_DELEGATE_H_
#define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_INFOBAR_DELEGATE_H_ #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_INFOBAR_DELEGATE_H_
#include "chrome/browser/services/gcm/permission_infobar_delegate.h" #include "chrome/browser/content_settings/permission_infobar_delegate.h"
class GURL; class GURL;
class InfoBarService; class InfoBarService;
...@@ -15,7 +15,6 @@ namespace gcm { ...@@ -15,7 +15,6 @@ namespace gcm {
// Delegate to allow GCM push messages registration. // Delegate to allow GCM push messages registration.
class PushMessagingInfoBarDelegate : public PermissionInfobarDelegate { class PushMessagingInfoBarDelegate : public PermissionInfobarDelegate {
public: public:
virtual ~PushMessagingInfoBarDelegate();
// Creates a Push Permission infobar and delegate and adds the infobar to // Creates a Push Permission infobar and delegate and adds the infobar to
// |infobar_service|. Returns the infobar if it was successfully added. // |infobar_service|. Returns the infobar if it was successfully added.
...@@ -30,9 +29,11 @@ class PushMessagingInfoBarDelegate : public PermissionInfobarDelegate { ...@@ -30,9 +29,11 @@ class PushMessagingInfoBarDelegate : public PermissionInfobarDelegate {
const PermissionRequestID& id, const PermissionRequestID& id,
const GURL& requesting_frame, const GURL& requesting_frame,
const std::string& display_languages); const std::string& display_languages);
virtual ~PushMessagingInfoBarDelegate();
// ConfirmInfoBarDelegate: // ConfirmInfoBarDelegate:
virtual base::string16 GetMessageText() const OVERRIDE; virtual base::string16 GetMessageText() const OVERRIDE;
virtual int GetIconID() const OVERRIDE;
const GURL requesting_origin_; const GURL requesting_origin_;
const std::string display_languages_; const std::string display_languages_;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_PERMISSION_CONTEXT_H_ #ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_PERMISSION_CONTEXT_H_
#define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_PERMISSION_CONTEXT_H_ #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_PERMISSION_CONTEXT_H_
#include "chrome/browser/services/gcm/permission_context_base.h" #include "chrome/browser/content_settings/permission_context_base.h"
namespace gcm { namespace gcm {
......
...@@ -281,7 +281,8 @@ class ContentSettingBubbleWebContentsObserverBridge ...@@ -281,7 +281,8 @@ class ContentSettingBubbleWebContentsObserverBridge
case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
case CONTENT_SETTINGS_NUM_TYPES: case CONTENT_SETTINGS_NUM_TYPES:
// TODO(miguelg): Remove this when bubble support is implemented // TODO(miguelg): Remove this nib content settings support
// is implemented
case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
NOTREACHED(); NOTREACHED();
} }
......
...@@ -332,6 +332,12 @@ ...@@ -332,6 +332,12 @@
'browser/content_settings/host_content_settings_map.h', 'browser/content_settings/host_content_settings_map.h',
'browser/content_settings/local_shared_objects_container.cc', 'browser/content_settings/local_shared_objects_container.cc',
'browser/content_settings/local_shared_objects_container.h', 'browser/content_settings/local_shared_objects_container.h',
'browser/content_settings/permission_bubble_request_impl.cc',
'browser/content_settings/permission_bubble_request_impl.h',
'browser/content_settings/permission_context_base.cc',
'browser/content_settings/permission_context_base.h',
'browser/content_settings/permission_infobar_delegate.cc',
'browser/content_settings/permission_infobar_delegate.h',
'browser/content_settings/permission_queue_controller.cc', 'browser/content_settings/permission_queue_controller.cc',
'browser/content_settings/permission_queue_controller.h', 'browser/content_settings/permission_queue_controller.h',
'browser/content_settings/permission_request_id.cc', 'browser/content_settings/permission_request_id.cc',
...@@ -1166,10 +1172,6 @@ ...@@ -1166,10 +1172,6 @@
'browser/services/gcm/gcm_profile_service.h', 'browser/services/gcm/gcm_profile_service.h',
'browser/services/gcm/gcm_profile_service_factory.cc', 'browser/services/gcm/gcm_profile_service_factory.cc',
'browser/services/gcm/gcm_profile_service_factory.h', 'browser/services/gcm/gcm_profile_service_factory.h',
'browser/services/gcm/permission_bubble_request_impl.cc',
'browser/services/gcm/permission_bubble_request_impl.h',
'browser/services/gcm/permission_context_base.cc',
'browser/services/gcm/permission_context_base.h',
'browser/services/gcm/push_messaging_infobar_delegate.cc', 'browser/services/gcm/push_messaging_infobar_delegate.cc',
'browser/services/gcm/push_messaging_infobar_delegate.h', 'browser/services/gcm/push_messaging_infobar_delegate.h',
'browser/services/gcm/push_messaging_permission_context.cc', 'browser/services/gcm/push_messaging_permission_context.cc',
...@@ -1178,8 +1180,6 @@ ...@@ -1178,8 +1180,6 @@
'browser/services/gcm/push_messaging_permission_context_factory.h', 'browser/services/gcm/push_messaging_permission_context_factory.h',
'browser/services/gcm/push_messaging_service_impl.cc', 'browser/services/gcm/push_messaging_service_impl.cc',
'browser/services/gcm/push_messaging_service_impl.h', 'browser/services/gcm/push_messaging_service_impl.h',
'browser/services/gcm/permission_infobar_delegate.cc',
'browser/services/gcm/permission_infobar_delegate.h',
'browser/sessions/base_session_service.cc', 'browser/sessions/base_session_service.cc',
'browser/sessions/base_session_service.h', 'browser/sessions/base_session_service.h',
'browser/sessions/session_data_deleter.cc', 'browser/sessions/session_data_deleter.cc',
......
...@@ -50,7 +50,8 @@ void MidiDispatcher::cancelSysexPermissionRequest( ...@@ -50,7 +50,8 @@ void MidiDispatcher::cancelSysexPermissionRequest(
base::string16 origin = request.securityOrigin().toString(); base::string16 origin = request.securityOrigin().toString();
Send(new MidiHostMsg_CancelSysExPermissionRequest( Send(new MidiHostMsg_CancelSysExPermissionRequest(
routing_id(), it.GetCurrentKey(), GURL(origin))); routing_id(), it.GetCurrentKey(), GURL(origin)));
requests_.Remove(it.GetCurrentKey()); // The request will be removed by OnSysExPermissionApproved once
// the blink MIDIAccessInitializer object is deleted.
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment