| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/services/gcm/permission_infobar_delegate.h" | 5 #include "chrome/browser/content_settings/permission_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/content_settings/permission_queue_controller.h" | 7 #include "chrome/browser/content_settings/permission_queue_controller.h" |
| 8 #include "components/infobars/core/infobar.h" | 8 #include "components/infobars/core/infobar.h" |
| 9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| 11 | 11 |
| 12 namespace gcm { | |
| 13 | |
| 14 PermissionInfobarDelegate::~PermissionInfobarDelegate() { | 12 PermissionInfobarDelegate::~PermissionInfobarDelegate() { |
| 15 } | 13 } |
| 16 | 14 |
| 17 PermissionInfobarDelegate::PermissionInfobarDelegate( | 15 PermissionInfobarDelegate::PermissionInfobarDelegate( |
| 18 PermissionQueueController* controller, | 16 PermissionQueueController* controller, |
| 19 const PermissionRequestID& id, | 17 const PermissionRequestID& id, |
| 20 const GURL& requesting_frame) | 18 const GURL& requesting_origin) |
| 21 : controller_(controller), id_(id), requesting_frame_(requesting_frame) { | 19 : controller_(controller), id_(id), requesting_origin_(requesting_origin) { |
| 22 } | 20 } |
| 23 | 21 |
| 24 void PermissionInfobarDelegate::InfoBarDismissed() { | 22 void PermissionInfobarDelegate::InfoBarDismissed() { |
| 25 SetPermission(false, false); | 23 SetPermission(false, false); |
| 26 } | 24 } |
| 27 | 25 |
| 28 infobars::InfoBarDelegate::Type | 26 infobars::InfoBarDelegate::Type |
| 29 PermissionInfobarDelegate::GetInfoBarType() const { | 27 PermissionInfobarDelegate::GetInfoBarType() const { |
| 30 return PAGE_ACTION_TYPE; | 28 return PAGE_ACTION_TYPE; |
| 31 } | 29 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 42 } | 40 } |
| 43 | 41 |
| 44 bool PermissionInfobarDelegate::Cancel() { | 42 bool PermissionInfobarDelegate::Cancel() { |
| 45 SetPermission(true, false); | 43 SetPermission(true, false); |
| 46 return true; | 44 return true; |
| 47 } | 45 } |
| 48 | 46 |
| 49 void PermissionInfobarDelegate::SetPermission(bool update_content_setting, | 47 void PermissionInfobarDelegate::SetPermission(bool update_content_setting, |
| 50 bool allowed) { | 48 bool allowed) { |
| 51 controller_->OnPermissionSet( | 49 controller_->OnPermissionSet( |
| 52 id_, requesting_frame_, | 50 id_, requesting_origin_, |
| 53 InfoBarService::WebContentsFromInfoBar(infobar())->GetURL(), | 51 InfoBarService::WebContentsFromInfoBar( |
| 52 infobar())->GetLastCommittedURL().GetOrigin(), |
| 54 update_content_setting, allowed); | 53 update_content_setting, allowed); |
| 55 } | 54 } |
| 56 } // namespace gcm | |
| OLD | NEW |