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/content_settings/tab_specific_content_settings.h" | 5 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, | 92 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, |
| 93 content::Source<HostContentSettingsMap>( | 93 content::Source<HostContentSettingsMap>( |
| 94 profile_->GetHostContentSettingsMap())); | 94 profile_->GetHostContentSettingsMap())); |
| 95 } | 95 } |
| 96 | 96 |
| 97 TabSpecificContentSettings::~TabSpecificContentSettings() { | 97 TabSpecificContentSettings::~TabSpecificContentSettings() { |
| 98 FOR_EACH_OBSERVER( | 98 FOR_EACH_OBSERVER( |
| 99 SiteDataObserver, observer_list_, ContentSettingsDestroyed()); | 99 SiteDataObserver, observer_list_, ContentSettingsDestroyed()); |
| 100 } | 100 } |
| 101 | 101 |
| 102 bool TabSpecificContentSettings::Accept() { | |
|
Garrett Casto
2013/08/27 00:52:24
Seems like these names should be a little more des
npentrel
2013/08/27 16:35:11
Done.
| |
| 103 DCHECK(form_to_save_.get()); | |
| 104 form_to_save_->SavePassword(); | |
| 105 return true; | |
| 106 } | |
| 107 | |
| 108 bool TabSpecificContentSettings::Cancel() { | |
| 109 DCHECK(form_to_save_.get()); | |
| 110 form_to_save_->DeleteSavedPassword(); | |
|
Garrett Casto
2013/08/27 00:52:24
There should be no need to call this before blackl
npentrel
2013/08/27 16:35:11
Done.
| |
| 111 form_to_save_->PermanentlyBlacklist(); | |
| 112 return true; | |
| 113 } | |
| 114 | |
| 102 TabSpecificContentSettings* TabSpecificContentSettings::Get( | 115 TabSpecificContentSettings* TabSpecificContentSettings::Get( |
| 103 int render_process_id, int render_view_id) { | 116 int render_process_id, int render_view_id) { |
| 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 105 | 118 |
| 106 RenderViewHost* view = RenderViewHost::FromID(render_process_id, | 119 RenderViewHost* view = RenderViewHost::FromID(render_process_id, |
| 107 render_view_id); | 120 render_view_id); |
| 108 if (!view) | 121 if (!view) |
| 109 return NULL; | 122 return NULL; |
| 110 | 123 |
| 111 WebContents* web_contents = WebContents::FromRenderViewHost(view); | 124 WebContents* web_contents = WebContents::FromRenderViewHost(view); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 void TabSpecificContentSettings::OnGeolocationPermissionSet( | 469 void TabSpecificContentSettings::OnGeolocationPermissionSet( |
| 457 const GURL& requesting_origin, | 470 const GURL& requesting_origin, |
| 458 bool allowed) { | 471 bool allowed) { |
| 459 geolocation_usages_state_.OnPermissionSet(requesting_origin, allowed); | 472 geolocation_usages_state_.OnPermissionSet(requesting_origin, allowed); |
| 460 content::NotificationService::current()->Notify( | 473 content::NotificationService::current()->Notify( |
| 461 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, | 474 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
| 462 content::Source<WebContents>(web_contents()), | 475 content::Source<WebContents>(web_contents()), |
| 463 content::NotificationService::NoDetails()); | 476 content::NotificationService::NoDetails()); |
| 464 } | 477 } |
| 465 | 478 |
| 466 // TODO(npentrel): Save the password when user accepts the prompt | |
| 467 void TabSpecificContentSettings::OnPasswordSubmitted( | 479 void TabSpecificContentSettings::OnPasswordSubmitted( |
| 468 PasswordFormManager* form_to_save) { | 480 PasswordFormManager* form_to_save) { |
| 481 form_to_save_.reset(form_to_save); | |
| 469 OnContentAllowed(CONTENT_SETTINGS_TYPE_SAVE_PASSWORD); | 482 OnContentAllowed(CONTENT_SETTINGS_TYPE_SAVE_PASSWORD); |
| 470 NotifySiteDataObservers(); | 483 NotifySiteDataObservers(); |
| 471 } | 484 } |
| 472 | 485 |
| 473 TabSpecificContentSettings::PasswordSavingState | 486 TabSpecificContentSettings::PasswordSavingState |
| 474 TabSpecificContentSettings::GetPasswordSavingState() const { | 487 TabSpecificContentSettings::GetPasswordSavingState() const { |
| 475 if (IsContentAllowed(CONTENT_SETTINGS_TYPE_SAVE_PASSWORD)) | 488 if (IsContentAllowed(CONTENT_SETTINGS_TYPE_SAVE_PASSWORD)) |
| 476 return PASSWORD_TO_BE_SAVED; | 489 return PASSWORD_TO_BE_SAVED; |
| 477 else | 490 else |
| 478 return NO_PASSWORD_TO_BE_SAVED; | 491 return NO_PASSWORD_TO_BE_SAVED; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 717 } | 730 } |
| 718 | 731 |
| 719 void TabSpecificContentSettings::RemoveSiteDataObserver( | 732 void TabSpecificContentSettings::RemoveSiteDataObserver( |
| 720 SiteDataObserver* observer) { | 733 SiteDataObserver* observer) { |
| 721 observer_list_.RemoveObserver(observer); | 734 observer_list_.RemoveObserver(observer); |
| 722 } | 735 } |
| 723 | 736 |
| 724 void TabSpecificContentSettings::NotifySiteDataObservers() { | 737 void TabSpecificContentSettings::NotifySiteDataObservers() { |
| 725 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); | 738 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); |
| 726 } | 739 } |
| OLD | NEW |