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

Side by Side Diff: chrome/browser/permissions/permission_infobar_delegate.cc

Issue 2341953004: Decouple MediaStreamInfoBarDelegate from GroupedPermissionInfoBarDelegate (Closed)
Patch Set: nits change Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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/permissions/permission_infobar_delegate.h" 5 #include "chrome/browser/permissions/permission_infobar_delegate.h"
6 6
7 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" 7 #include "chrome/browser/permissions/permission_decision_auto_blocker.h"
8 #include "chrome/browser/permissions/permission_request.h" 8 #include "chrome/browser/permissions/permission_request.h"
9 #include "chrome/browser/permissions/permission_uma_util.h" 9 #include "chrome/browser/permissions/permission_uma_util.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
(...skipping 19 matching lines...) Expand all
30 const PermissionSetCallback& callback) 30 const PermissionSetCallback& callback)
31 : requesting_origin_(requesting_origin), 31 : requesting_origin_(requesting_origin),
32 permission_type_(permission_type), 32 permission_type_(permission_type),
33 content_settings_type_(content_settings_type), 33 content_settings_type_(content_settings_type),
34 profile_(profile), 34 profile_(profile),
35 callback_(callback), 35 callback_(callback),
36 action_taken_(false), 36 action_taken_(false),
37 user_gesture_(user_gesture), 37 user_gesture_(user_gesture),
38 persist_(true) {} 38 persist_(true) {}
39 39
40 std::vector<int> PermissionInfoBarDelegate::content_settings() const {
41 return std::vector<int>(1, content_settings_type_);
Sergey Ulanov 2016/09/24 00:05:00 return std::vector<int> { content_settings_type_ }
lshang 2016/09/25 23:49:10 Done.
42 }
43
40 bool PermissionInfoBarDelegate::ShouldShowPersistenceToggle() const { 44 bool PermissionInfoBarDelegate::ShouldShowPersistenceToggle() const {
41 return (permission_type_ == content::PermissionType::GEOLOCATION) && 45 return (permission_type_ == content::PermissionType::GEOLOCATION ||
46 permission_type_ == content::PermissionType::AUDIO_CAPTURE ||
47 permission_type_ == content::PermissionType::VIDEO_CAPTURE) &&
42 PermissionUtil::ShouldShowPersistenceToggle(); 48 PermissionUtil::ShouldShowPersistenceToggle();
43 } 49 }
44 50
45 base::string16 PermissionInfoBarDelegate::GetMessageText() const { 51 base::string16 PermissionInfoBarDelegate::GetMessageText() const {
46 return l10n_util::GetStringFUTF16( 52 return l10n_util::GetStringFUTF16(
47 GetMessageResourceId(), 53 GetMessageResourceId(),
48 url_formatter::FormatUrlForSecurityDisplay( 54 url_formatter::FormatUrlForSecurityDisplay(
49 requesting_origin_, 55 requesting_origin_,
50 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC)); 56 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC));
51 } 57 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 98
93 SetPermission(update_content_setting, DENIED); 99 SetPermission(update_content_setting, DENIED);
94 return true; 100 return true;
95 } 101 }
96 102
97 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, 103 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting,
98 PermissionAction decision) { 104 PermissionAction decision) {
99 action_taken_ = true; 105 action_taken_ = true;
100 callback_.Run(update_content_setting, decision); 106 callback_.Run(update_content_setting, decision);
101 } 107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698