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

Side by Side Diff: chrome/browser/ui/page_info/page_info.cc

Issue 2790473004: Permissions: Clear embargo if user changes an embargoed permission's setting. (Closed)
Patch Set: Created 3 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/page_info/page_info.h" 5 #include "chrome/browser/ui/page_info/page_info.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" 25 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
26 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" 26 #include "chrome/browser/browsing_data/browsing_data_database_helper.h"
27 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" 27 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h"
28 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" 28 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
29 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" 29 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
30 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 30 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
31 #include "chrome/browser/content_settings/local_shared_objects_container.h" 31 #include "chrome/browser/content_settings/local_shared_objects_container.h"
32 #include "chrome/browser/history/history_service_factory.h" 32 #include "chrome/browser/history/history_service_factory.h"
33 #include "chrome/browser/infobars/infobar_service.h" 33 #include "chrome/browser/infobars/infobar_service.h"
34 #include "chrome/browser/permissions/chooser_context_base.h" 34 #include "chrome/browser/permissions/chooser_context_base.h"
35 #include "chrome/browser/permissions/permission_decision_auto_blocker.h"
35 #include "chrome/browser/permissions/permission_manager.h" 36 #include "chrome/browser/permissions/permission_manager.h"
36 #include "chrome/browser/permissions/permission_result.h" 37 #include "chrome/browser/permissions/permission_result.h"
37 #include "chrome/browser/permissions/permission_uma_util.h" 38 #include "chrome/browser/permissions/permission_uma_util.h"
38 #include "chrome/browser/permissions/permission_util.h" 39 #include "chrome/browser/permissions/permission_util.h"
39 #include "chrome/browser/profiles/profile.h" 40 #include "chrome/browser/profiles/profile.h"
40 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" 41 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
41 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" 42 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h"
42 #include "chrome/browser/ui/page_info/page_info_ui.h" 43 #include "chrome/browser/ui/page_info/page_info_ui.h"
43 #include "chrome/browser/usb/usb_chooser_context.h" 44 #include "chrome/browser/usb/usb_chooser_context.h"
44 #include "chrome/browser/usb/usb_chooser_context_factory.h" 45 #include "chrome/browser/usb/usb_chooser_context_factory.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 "WebsiteSettings.OriginInfo.PermissionChanged.Blocked", histogram_value, 297 "WebsiteSettings.OriginInfo.PermissionChanged.Blocked", histogram_value,
297 num_values); 298 num_values);
298 } 299 }
299 300
300 // This is technically redundant given the histogram above, but putting the 301 // This is technically redundant given the histogram above, but putting the
301 // total count of permission changes in another histogram makes it easier to 302 // total count of permission changes in another histogram makes it easier to
302 // compare it against other kinds of actions in PageInfo[PopupView]. 303 // compare it against other kinds of actions in PageInfo[PopupView].
303 RecordPageInfoAction(PAGE_INFO_CHANGED_PERMISSION); 304 RecordPageInfoAction(PAGE_INFO_CHANGED_PERMISSION);
304 305
305 PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter( 306 PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter(
306 this->profile_, this->site_url_, this->site_url_, type, 307 this->profile_, this->site_url_, this->site_url_, type,
dominickn 2017/04/03 01:35:31 Nit: the this-> usage here and below is weird (onl
Patti Lor 2017/04/05 08:34:27 Sorry, I thought for some reason there was a reaso
307 PermissionSourceUI::OIB); 308 PermissionSourceUI::OIB);
308 309
310 // If the setting was changed away from an embargo status (which will always
311 // be BLOCK), clear the embargo.
312 if (setting != CONTENT_SETTING_BLOCK && PermissionUtil::IsPermission(type)) {
313 PermissionResult permission_result =
314 PermissionManager::Get(profile_)->GetPermissionStatus(
315 type, this->site_url_, this->site_url_);
316 switch (permission_result.source) {
317 case PermissionStatusSource::MULTIPLE_DISMISSALS:
318 case PermissionStatusSource::SAFE_BROWSING_BLACKLIST:
319 PermissionDecisionAutoBlocker::GetForProfile(profile_)
320 ->RemoveEmbargoByURL(this->site_url_, type);
321 break;
322 default:
323 break;
324 }
325 }
309 content_settings_->SetNarrowestContentSetting(site_url_, site_url_, type, 326 content_settings_->SetNarrowestContentSetting(site_url_, site_url_, type,
310 setting); 327 setting);
311 328
312 show_info_bar_ = true; 329 show_info_bar_ = true;
313 330
314 // Refresh the UI to reflect the new setting. 331 // Refresh the UI to reflect the new setting.
315 PresentSitePermissions(); 332 PresentSitePermissions();
316 } 333 }
317 334
318 void PageInfo::OnSiteChosenObjectDeleted(const ChooserUIInfo& ui_info, 335 void PageInfo::OnSiteChosenObjectDeleted(const ChooserUIInfo& ui_info,
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 info.site_identity = UTF16ToUTF8(GetSimpleSiteName(site_url_)); 758 info.site_identity = UTF16ToUTF8(GetSimpleSiteName(site_url_));
742 759
743 info.connection_status = site_connection_status_; 760 info.connection_status = site_connection_status_;
744 info.connection_status_description = UTF16ToUTF8(site_connection_details_); 761 info.connection_status_description = UTF16ToUTF8(site_connection_details_);
745 info.identity_status = site_identity_status_; 762 info.identity_status = site_identity_status_;
746 info.identity_status_description = UTF16ToUTF8(site_identity_details_); 763 info.identity_status_description = UTF16ToUTF8(site_identity_details_);
747 info.certificate = certificate_; 764 info.certificate = certificate_;
748 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; 765 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_;
749 ui_->SetIdentityInfo(info); 766 ui_->SetIdentityInfo(info);
750 } 767 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698