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

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

Issue 475193002: Add a single site view page to view and modify content settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 4 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/website_settings/website_settings.h" 5 #include "chrome/browser/ui/website_settings/website_settings.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // one rule for the default setting. Get the rule that currently defines 261 // one rule for the default setting. Get the rule that currently defines
262 // the permission for the given permission |type|. Then test whether the 262 // the permission for the given permission |type|. Then test whether the
263 // existing rule is more specific than the rule we are about to create. If 263 // existing rule is more specific than the rule we are about to create. If
264 // the existing rule is more specific, than change the existing rule instead 264 // the existing rule is more specific, than change the existing rule instead
265 // of creating a new rule that would be hidden behind the existing rule. 265 // of creating a new rule that would be hidden behind the existing rule.
266 // This is not a concern for CONTENT_SETTINGS_TYPE_MEDIASTREAM since users 266 // This is not a concern for CONTENT_SETTINGS_TYPE_MEDIASTREAM since users
267 // can not create media settings exceptions by hand. 267 // can not create media settings exceptions by hand.
268 content_settings::SettingInfo info; 268 content_settings::SettingInfo info;
269 scoped_ptr<base::Value> v(content_settings_->GetWebsiteSetting( 269 scoped_ptr<base::Value> v(content_settings_->GetWebsiteSetting(
270 site_url_, site_url_, type, std::string(), &info)); 270 site_url_, site_url_, type, std::string(), &info));
271 DCHECK(info.source == content_settings::SETTING_SOURCE_USER); 271 content_settings_->SetNarrowestWebsiteSetting(
272 ContentSettingsPattern::Relation r1 = 272 primary_pattern, secondary_pattern, type, std::string(), setting, info);
273 info.primary_pattern.Compare(primary_pattern); 273 } else {
274 DCHECK(r1 != ContentSettingsPattern::DISJOINT_ORDER_POST &&
275 r1 != ContentSettingsPattern::DISJOINT_ORDER_PRE);
276 if (r1 == ContentSettingsPattern::PREDECESSOR) {
277 primary_pattern = info.primary_pattern;
278 } else if (r1 == ContentSettingsPattern::IDENTITY) {
279 ContentSettingsPattern::Relation r2 =
280 info.secondary_pattern.Compare(secondary_pattern);
281 DCHECK(r2 != ContentSettingsPattern::DISJOINT_ORDER_POST &&
282 r2 != ContentSettingsPattern::DISJOINT_ORDER_PRE);
283 if (r2 == ContentSettingsPattern::PREDECESSOR)
284 secondary_pattern = info.secondary_pattern;
285 }
286
287 base::Value* value = NULL; 274 base::Value* value = NULL;
288 if (setting != CONTENT_SETTING_DEFAULT) 275 if (setting != CONTENT_SETTING_DEFAULT)
289 value = new base::FundamentalValue(setting); 276 value = new base::FundamentalValue(setting);
290 content_settings_->SetWebsiteSetting( 277 content_settings_->SetWebsiteSetting(
291 primary_pattern, secondary_pattern, type, std::string(), value); 278 primary_pattern, secondary_pattern, type, std::string(), value);
292 } 279 }
293 280
294 show_info_bar_ = true; 281 show_info_bar_ = true;
295 282
296 // TODO(markusheintz): This is a temporary hack to fix issue: 283 // TODO(markusheintz): This is a temporary hack to fix issue:
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 if (visited_before_today) { 715 if (visited_before_today) {
729 first_visit_text = l10n_util::GetStringFUTF16( 716 first_visit_text = l10n_util::GetStringFUTF16(
730 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, 717 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY,
731 base::TimeFormatShortDate(first_visit)); 718 base::TimeFormatShortDate(first_visit));
732 } else { 719 } else {
733 first_visit_text = l10n_util::GetStringUTF16( 720 first_visit_text = l10n_util::GetStringUTF16(
734 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); 721 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY);
735 } 722 }
736 ui_->SetFirstVisit(first_visit_text); 723 ui_->SetFirstVisit(first_visit_text);
737 } 724 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698