OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/services/gcm/permission_infobar_delegate.h" | |
6 | |
7 #include "chrome/browser/content_settings/permission_queue_controller.h" | |
8 #include "components/infobars/core/infobar.h" | |
9 #include "grit/generated_resources.h" | |
10 #include "ui/base/l10n/l10n_util.h" | |
11 | |
12 namespace gcm { | |
13 | |
14 PermissionInfobarDelegate::~PermissionInfobarDelegate() { | |
15 } | |
16 | |
17 PermissionInfobarDelegate::PermissionInfobarDelegate( | |
18 PermissionQueueController* controller, | |
19 const PermissionRequestID& id, | |
20 GURL& requesting_frame) | |
21 : controller_(controller), id_(id), requesting_frame_(requesting_frame) { | |
22 } | |
23 | |
24 void PermissionInfobarDelegate::InfoBarDismissed() { | |
25 SetPermission(false, false); | |
26 } | |
27 | |
28 infobars::InfoBarDelegate::Type PermissionInfobarDelegate::GetInfoBarType() | |
29 const { | |
Peter Kasting
2014/06/19 17:58:20
Nit: "const" should be on same line as last arg (i
Miguel Garcia
2014/06/19 21:49:22
Done.
| |
30 return PAGE_ACTION_TYPE; | |
31 } | |
32 | |
33 base::string16 PermissionInfobarDelegate::GetButtonLabel( | |
34 InfoBarButton button) const { | |
35 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW | |
36 : IDS_PERMISSION_DENY); | |
Peter Kasting
2014/06/19 17:58:20
Nit: clang-format error; instead, break after "?"
Miguel Garcia
2014/06/19 21:49:22
Done.
| |
37 } | |
38 | |
39 bool PermissionInfobarDelegate::Accept() { | |
40 SetPermission(true, true); | |
41 return true; | |
42 } | |
43 | |
44 bool PermissionInfobarDelegate::Cancel() { | |
45 SetPermission(true, false); | |
46 return true; | |
47 } | |
48 | |
49 void PermissionInfobarDelegate::SetPermission(bool update_content_setting, | |
50 bool allowed) { | |
51 content::WebContents* web_contents = | |
52 InfoBarService::WebContentsFromInfoBar(infobar()); | |
Peter Kasting
2014/06/19 17:58:20
Nit: You can inline this below if you start the ar
Miguel Garcia
2014/06/19 21:49:22
Done.
| |
53 controller_->OnPermissionSet(id_, | |
54 requesting_frame_, | |
55 web_contents->GetURL(), | |
56 update_content_setting, | |
57 allowed); | |
58 } | |
Peter Kasting
2014/06/19 17:58:20
Nit: Blank line below this
Miguel Garcia
2014/06/19 21:49:22
Done.
| |
59 } // namespace gcm | |
OLD | NEW |