Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/content_settings/content_setting_bubble_model.h" | 5 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1240 ~ContentSettingSubresourceFilterBubbleModel() {} | 1240 ~ContentSettingSubresourceFilterBubbleModel() {} |
| 1241 | 1241 |
| 1242 void ContentSettingSubresourceFilterBubbleModel::SetTitle() { | 1242 void ContentSettingSubresourceFilterBubbleModel::SetTitle() { |
| 1243 set_title( | 1243 set_title( |
| 1244 l10n_util::GetStringUTF16(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_TITLE)); | 1244 l10n_util::GetStringUTF16(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_TITLE)); |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 void ContentSettingSubresourceFilterBubbleModel::SetManageText() { | 1247 void ContentSettingSubresourceFilterBubbleModel::SetManageText() { |
| 1248 set_manage_text( | 1248 set_manage_text( |
| 1249 l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD)); | 1249 l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD)); |
| 1250 set_show_manage_text_as_button(true); | 1250 set_show_manage_text_as_checkbox(true); |
| 1251 } | 1251 } |
| 1252 | 1252 |
| 1253 void ContentSettingSubresourceFilterBubbleModel::SetMessage() { | 1253 void ContentSettingSubresourceFilterBubbleModel::SetMessage() { |
| 1254 set_message(l10n_util::GetStringUTF16( | 1254 set_message(l10n_util::GetStringUTF16( |
| 1255 IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_EXPLANATION)); | 1255 IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_EXPLANATION)); |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 void ContentSettingSubresourceFilterBubbleModel::OnManageLinkClicked() { | 1258 void ContentSettingSubresourceFilterBubbleModel::OnManageCheckboxChecked( |
| 1259 subresource_filter::ContentSubresourceFilterDriverFactory* driver_factory = | 1259 bool is_checked) { |
| 1260 subresource_filter::ContentSubresourceFilterDriverFactory:: | 1260 int string_id = |
| 1261 FromWebContents(web_contents()); | 1261 is_checked ? IDS_FILTERED_DECEPTIVE_CONTENT_RELOAD_ACTION : IDS_DONE; |
|
msw
2017/04/06 00:44:56
aside: It'd be nice if we could just re-use IDS_AP
Charlie Harrison
2017/04/06 02:04:58
OK, I was not sure of the best practice here, cons
msw
2017/04/06 02:19:29
Generally, it's good to reuse and consolidate stri
| |
| 1262 driver_factory->OnReloadRequested(); | 1262 set_done_button_text(l10n_util::GetStringUTF16(string_id)); |
| 1263 is_checked_ = is_checked; | |
| 1264 } | |
| 1265 | |
| 1266 void ContentSettingSubresourceFilterBubbleModel::OnDoneClicked() { | |
| 1267 if (is_checked_) { | |
| 1268 subresource_filter::ContentSubresourceFilterDriverFactory* driver_factory = | |
| 1269 subresource_filter::ContentSubresourceFilterDriverFactory:: | |
| 1270 FromWebContents(web_contents()); | |
| 1271 driver_factory->OnReloadRequested(); | |
| 1272 } | |
| 1263 } | 1273 } |
| 1264 | 1274 |
| 1265 ContentSettingSubresourceFilterBubbleModel* | 1275 ContentSettingSubresourceFilterBubbleModel* |
| 1266 ContentSettingSubresourceFilterBubbleModel::AsSubresourceFilterBubbleModel() { | 1276 ContentSettingSubresourceFilterBubbleModel::AsSubresourceFilterBubbleModel() { |
| 1267 return this; | 1277 return this; |
| 1268 } | 1278 } |
| 1269 | 1279 |
| 1270 // ContentSettingMidiSysExBubbleModel ------------------------------------------ | 1280 // ContentSettingMidiSysExBubbleModel ------------------------------------------ |
| 1271 | 1281 |
| 1272 class ContentSettingMidiSysExBubbleModel | 1282 class ContentSettingMidiSysExBubbleModel |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1547 | 1557 |
| 1548 ContentSettingBubbleModel::DomainList::~DomainList() {} | 1558 ContentSettingBubbleModel::DomainList::~DomainList() {} |
| 1549 | 1559 |
| 1550 ContentSettingBubbleModel::MediaMenu::MediaMenu() : disabled(false) {} | 1560 ContentSettingBubbleModel::MediaMenu::MediaMenu() : disabled(false) {} |
| 1551 | 1561 |
| 1552 ContentSettingBubbleModel::MediaMenu::MediaMenu(const MediaMenu& other) = | 1562 ContentSettingBubbleModel::MediaMenu::MediaMenu(const MediaMenu& other) = |
| 1553 default; | 1563 default; |
| 1554 | 1564 |
| 1555 ContentSettingBubbleModel::MediaMenu::~MediaMenu() {} | 1565 ContentSettingBubbleModel::MediaMenu::~MediaMenu() {} |
| 1556 | 1566 |
| 1557 ContentSettingBubbleModel::BubbleContent::BubbleContent() | 1567 ContentSettingBubbleModel::BubbleContent::BubbleContent() {} |
| 1558 : radio_group_enabled(false), | |
| 1559 custom_link_enabled(false), | |
| 1560 show_manage_text_as_button(false) {} | |
| 1561 | 1568 |
| 1562 ContentSettingBubbleModel::BubbleContent::~BubbleContent() {} | 1569 ContentSettingBubbleModel::BubbleContent::~BubbleContent() {} |
| 1563 | 1570 |
| 1564 void ContentSettingBubbleModel::Observe( | 1571 void ContentSettingBubbleModel::Observe( |
| 1565 int type, | 1572 int type, |
| 1566 const content::NotificationSource& source, | 1573 const content::NotificationSource& source, |
| 1567 const content::NotificationDetails& details) { | 1574 const content::NotificationDetails& details) { |
| 1568 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 1575 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
| 1569 DCHECK_EQ(web_contents_, | 1576 DCHECK_EQ(web_contents_, |
| 1570 content::Source<WebContents>(source).ptr()); | 1577 content::Source<WebContents>(source).ptr()); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1590 | 1597 |
| 1591 ContentSettingSubresourceFilterBubbleModel* | 1598 ContentSettingSubresourceFilterBubbleModel* |
| 1592 ContentSettingBubbleModel::AsSubresourceFilterBubbleModel() { | 1599 ContentSettingBubbleModel::AsSubresourceFilterBubbleModel() { |
| 1593 return nullptr; | 1600 return nullptr; |
| 1594 } | 1601 } |
| 1595 | 1602 |
| 1596 ContentSettingDownloadsBubbleModel* | 1603 ContentSettingDownloadsBubbleModel* |
| 1597 ContentSettingBubbleModel::AsDownloadsBubbleModel() { | 1604 ContentSettingBubbleModel::AsDownloadsBubbleModel() { |
| 1598 return nullptr; | 1605 return nullptr; |
| 1599 } | 1606 } |
| OLD | NEW |