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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 radio_group.default_item = 1; | 356 radio_group.default_item = 1; |
357 } else if (setting == CONTENT_SETTING_ALLOW) { | 357 } else if (setting == CONTENT_SETTING_ALLOW) { |
358 radio_group.default_item = kAllowButtonIndex; | 358 radio_group.default_item = kAllowButtonIndex; |
359 // |block_setting_| is already set to |CONTENT_SETTING_BLOCK|. | 359 // |block_setting_| is already set to |CONTENT_SETTING_BLOCK|. |
360 } else { | 360 } else { |
361 radio_group.default_item = 1; | 361 radio_group.default_item = 1; |
362 block_setting_ = setting; | 362 block_setting_ = setting; |
363 } | 363 } |
364 if (setting_source != SETTING_SOURCE_USER) { | 364 if (setting_source != SETTING_SOURCE_USER) { |
365 set_radio_group_enabled(false); | 365 set_radio_group_enabled(false); |
| 366 set_custom_link_enabled(false); |
366 } else { | 367 } else { |
367 set_radio_group_enabled(true); | 368 set_radio_group_enabled(true); |
| 369 set_custom_link_enabled(true); |
368 } | 370 } |
369 selected_item_ = radio_group.default_item; | 371 selected_item_ = radio_group.default_item; |
370 set_radio_group(radio_group); | 372 set_radio_group(radio_group); |
371 } | 373 } |
372 | 374 |
373 void ContentSettingSingleRadioGroup::AddException(ContentSetting setting) { | 375 void ContentSettingSingleRadioGroup::AddException(ContentSetting setting) { |
374 if (profile()) { | 376 if (profile()) { |
375 profile()->GetHostContentSettingsMap()->AddExceptionForURL( | 377 profile()->GetHostContentSettingsMap()->AddExceptionForURL( |
376 bubble_content().radio_group.url, | 378 bubble_content().radio_group.url, |
377 bubble_content().radio_group.url, | 379 bubble_content().radio_group.url, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 }; | 444 }; |
443 | 445 |
444 ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel( | 446 ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel( |
445 Delegate* delegate, | 447 Delegate* delegate, |
446 WebContents* web_contents, | 448 WebContents* web_contents, |
447 Profile* profile, | 449 Profile* profile, |
448 ContentSettingsType content_type) | 450 ContentSettingsType content_type) |
449 : ContentSettingSingleRadioGroup( | 451 : ContentSettingSingleRadioGroup( |
450 delegate, web_contents, profile, content_type) { | 452 delegate, web_contents, profile, content_type) { |
451 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); | 453 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); |
452 set_custom_link_enabled(web_contents && | 454 // Disable the "Run all plugins this time" link if the user already clicked on |
453 TabSpecificContentSettings::FromWebContents( | 455 // the link. If the setting is controlled by policy then the link is already |
454 web_contents)->load_plugins_link_enabled()); | 456 // disabled. Therfore only set the enabled state to false, never to true. |
| 457 if (web_contents && |
| 458 !TabSpecificContentSettings::FromWebContents( |
| 459 web_contents)->load_plugins_link_enabled()) { |
| 460 set_custom_link_enabled(false); |
| 461 } |
455 } | 462 } |
456 | 463 |
457 ContentSettingPluginBubbleModel::~ContentSettingPluginBubbleModel() { | 464 ContentSettingPluginBubbleModel::~ContentSettingPluginBubbleModel() { |
458 if (settings_changed()) { | 465 if (settings_changed()) { |
459 // If the user elected to allow all plugins then run plugins at this time. | 466 // If the user elected to allow all plugins then run plugins at this time. |
460 if (selected_item() == kAllowButtonIndex) | 467 if (selected_item() == kAllowButtonIndex) |
461 OnCustomLinkClicked(); | 468 OnCustomLinkClicked(); |
462 } | 469 } |
463 } | 470 } |
464 | 471 |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 1306 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
1300 DCHECK_EQ(web_contents_, | 1307 DCHECK_EQ(web_contents_, |
1301 content::Source<WebContents>(source).ptr()); | 1308 content::Source<WebContents>(source).ptr()); |
1302 web_contents_ = NULL; | 1309 web_contents_ = NULL; |
1303 } else { | 1310 } else { |
1304 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 1311 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
1305 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 1312 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
1306 profile_ = NULL; | 1313 profile_ = NULL; |
1307 } | 1314 } |
1308 } | 1315 } |
OLD | NEW |