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

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

Issue 2726853007: Views/Permissions: Update desktop UI to display BLOCK for embargoed permissions. (Closed)
Patch Set: Review comments. Created 3 years, 9 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
« no previous file with comments | « chrome/browser/permissions/permission_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/website_settings/website_settings.h" 5 #include "chrome/browser/ui/website_settings/website_settings.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_manager.h"
36 #include "chrome/browser/permissions/permission_result.h"
35 #include "chrome/browser/permissions/permission_uma_util.h" 37 #include "chrome/browser/permissions/permission_uma_util.h"
36 #include "chrome/browser/permissions/permission_util.h" 38 #include "chrome/browser/permissions/permission_util.h"
37 #include "chrome/browser/profiles/profile.h" 39 #include "chrome/browser/profiles/profile.h"
38 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" 40 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
39 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" 41 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h"
40 #include "chrome/browser/ui/website_settings/website_settings_ui.h" 42 #include "chrome/browser/ui/website_settings/website_settings_ui.h"
41 #include "chrome/browser/usb/usb_chooser_context.h" 43 #include "chrome/browser/usb/usb_chooser_context.h"
42 #include "chrome/browser/usb/usb_chooser_context_factory.h" 44 #include "chrome/browser/usb/usb_chooser_context_factory.h"
43 #include "chrome/common/chrome_switches.h" 45 #include "chrome/common/chrome_switches.h"
44 #include "chrome/common/url_constants.h" 46 #include "chrome/common/url_constants.h"
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 if (info.primary_pattern == ContentSettingsPattern::Wildcard() && 669 if (info.primary_pattern == ContentSettingsPattern::Wildcard() &&
668 info.secondary_pattern == ContentSettingsPattern::Wildcard()) { 670 info.secondary_pattern == ContentSettingsPattern::Wildcard()) {
669 permission_info.default_setting = permission_info.setting; 671 permission_info.default_setting = permission_info.setting;
670 permission_info.setting = CONTENT_SETTING_DEFAULT; 672 permission_info.setting = CONTENT_SETTING_DEFAULT;
671 } else { 673 } else {
672 permission_info.default_setting = 674 permission_info.default_setting =
673 content_settings_->GetDefaultContentSetting(permission_info.type, 675 content_settings_->GetDefaultContentSetting(permission_info.type,
674 NULL); 676 NULL);
675 } 677 }
676 678
679 // For permissions that are still prompting the user and haven't been
680 // explicitly set by another source, check its embargo status.
681 if (PermissionUtil::IsPermission(permission_info.type) &&
682 permission_info.setting == CONTENT_SETTING_DEFAULT &&
683 permission_info.source ==
684 content_settings::SettingSource::SETTING_SOURCE_USER) {
685 // TODO(raymes): Use GetPermissionStatus() to retrieve information
686 // about *all* permissions once it has default behaviour implemented for
687 // ContentSettingTypes that aren't permissions.
688 PermissionResult permission_result =
689 PermissionManager::Get(profile_)->GetPermissionStatus(
690 permission_info.type, site_url_, site_url_);
691
692 // If under embargo, update |permission_info| to reflect that.
693 if (permission_result.content_setting == CONTENT_SETTING_BLOCK)
raymes 2017/03/06 23:06:52 I think there are some reasons for correctness to
Patti Lor 2017/03/07 06:31:28 Done.
694 permission_info.setting = permission_result.content_setting;
695 }
696
677 permission_info_list.push_back(permission_info); 697 permission_info_list.push_back(permission_info);
678 } 698 }
679 699
680 for (const ChooserUIInfo& ui_info : kChooserUIInfo) { 700 for (const ChooserUIInfo& ui_info : kChooserUIInfo) {
681 ChooserContextBase* context = ui_info.get_context(profile_); 701 ChooserContextBase* context = ui_info.get_context(profile_);
682 const GURL origin = site_url_.GetOrigin(); 702 const GURL origin = site_url_.GetOrigin();
683 auto chosen_objects = context->GetGrantedObjects(origin, origin); 703 auto chosen_objects = context->GetGrantedObjects(origin, origin);
684 for (std::unique_ptr<base::DictionaryValue>& object : chosen_objects) { 704 for (std::unique_ptr<base::DictionaryValue>& object : chosen_objects) {
685 chosen_object_info_list.push_back( 705 chosen_object_info_list.push_back(
686 base::MakeUnique<WebsiteSettingsUI::ChosenObjectInfo>( 706 base::MakeUnique<WebsiteSettingsUI::ChosenObjectInfo>(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 info.connection_status = site_connection_status_; 749 info.connection_status = site_connection_status_;
730 info.connection_status_description = 750 info.connection_status_description =
731 UTF16ToUTF8(site_connection_details_); 751 UTF16ToUTF8(site_connection_details_);
732 info.identity_status = site_identity_status_; 752 info.identity_status = site_identity_status_;
733 info.identity_status_description = 753 info.identity_status_description =
734 UTF16ToUTF8(site_identity_details_); 754 UTF16ToUTF8(site_identity_details_);
735 info.certificate = certificate_; 755 info.certificate = certificate_;
736 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; 756 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_;
737 ui_->SetIdentityInfo(info); 757 ui_->SetIdentityInfo(info);
738 } 758 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698