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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 CONTENT_SETTINGS_TYPE_SAVE_PASSWORD), | 581 CONTENT_SETTINGS_TYPE_SAVE_PASSWORD), |
582 state_(TabSpecificContentSettings::NO_PASSWORD_TO_BE_SAVED) { | 582 state_(TabSpecificContentSettings::NO_PASSWORD_TO_BE_SAVED) { |
583 DCHECK(profile); | 583 DCHECK(profile); |
584 TabSpecificContentSettings* content_settings = | 584 TabSpecificContentSettings* content_settings = |
585 TabSpecificContentSettings::FromWebContents(web_contents); | 585 TabSpecificContentSettings::FromWebContents(web_contents); |
586 state_ = content_settings->GetPasswordSavingState(); | 586 state_ = content_settings->GetPasswordSavingState(); |
587 | 587 |
588 SetTitle(); | 588 SetTitle(); |
589 } | 589 } |
590 | 590 |
| 591 SavePasswordBubbleModel::~SavePasswordBubbleModel() {} |
| 592 |
591 void SavePasswordBubbleModel::SetTitle() { | 593 void SavePasswordBubbleModel::SetTitle() { |
592 int title_id = 0; | 594 int title_id = 0; |
593 // If the save password icon was accessed, the icon is displayed and the | 595 // If the save password icon was accessed, the icon is displayed and the |
594 // bubble is instantiated | 596 // bubble is instantiated |
595 if (state_ == TabSpecificContentSettings::PASSWORD_TO_BE_SAVED) | 597 if (state_ == TabSpecificContentSettings::PASSWORD_TO_BE_SAVED) |
596 title_id = IDS_SAVE_PASSWORD; | 598 title_id = IDS_SAVE_PASSWORD; |
597 | 599 |
598 set_title(l10n_util::GetStringUTF8(title_id)); | 600 set_title(l10n_util::GetStringUTF8(title_id)); |
599 } | 601 } |
600 | 602 |
601 void SavePasswordBubbleModel::OnCancelClicked() { | 603 void SavePasswordBubbleModel::OnCancelClicked() { |
602 TabSpecificContentSettings* content_settings = | 604 TabSpecificContentSettings* content_settings = |
603 TabSpecificContentSettings::FromWebContents(web_contents()); | 605 TabSpecificContentSettings::FromWebContents(web_contents()); |
604 content_settings->PasswordFormBlacklisted(); | 606 content_settings->set_password_action(PasswordFormManager::BLACKLIST); |
605 } | 607 } |
606 | 608 |
607 void SavePasswordBubbleModel::OnSaveClicked() { | 609 void SavePasswordBubbleModel::OnSaveClicked() { |
608 TabSpecificContentSettings* content_settings = | 610 TabSpecificContentSettings* content_settings = |
609 TabSpecificContentSettings::FromWebContents(web_contents()); | 611 TabSpecificContentSettings::FromWebContents(web_contents()); |
610 content_settings->PasswordAccepted(); | 612 content_settings->set_password_action(PasswordFormManager::SAVE); |
611 } | 613 } |
612 | 614 |
613 // The model of the content settings bubble for media settings. | 615 // The model of the content settings bubble for media settings. |
614 class ContentSettingMediaStreamBubbleModel | 616 class ContentSettingMediaStreamBubbleModel |
615 : public ContentSettingTitleAndLinkModel { | 617 : public ContentSettingTitleAndLinkModel { |
616 public: | 618 public: |
617 ContentSettingMediaStreamBubbleModel(Delegate* delegate, | 619 ContentSettingMediaStreamBubbleModel(Delegate* delegate, |
618 WebContents* web_contents, | 620 WebContents* web_contents, |
619 Profile* profile); | 621 Profile* profile); |
620 | 622 |
621 virtual ~ContentSettingMediaStreamBubbleModel(); | 623 virtual ~ContentSettingMediaStreamBubbleModel(); |
622 | 624 |
623 private: | 625 private: |
624 // Sets the title of the bubble. | |
625 void SetTitle(); | 626 void SetTitle(); |
626 // Sets the data for the radio buttons of the bubble. | 627 // Sets the data for the radio buttons of the bubble. |
627 void SetRadioGroup(); | 628 void SetRadioGroup(); |
628 // Sets the data for the media menus of the bubble. | 629 // Sets the data for the media menus of the bubble. |
629 void SetMediaMenus(); | 630 void SetMediaMenus(); |
630 // Updates the camera and microphone setting with the passed |setting|. | 631 // Updates the camera and microphone setting with the passed |setting|. |
631 void UpdateSettings(ContentSetting setting); | 632 void UpdateSettings(ContentSetting setting); |
632 // Updates the camera and microphone default device with the passed |type| | 633 // Updates the camera and microphone default device with the passed |type| |
633 // and device. | 634 // and device. |
634 void UpdateDefaultDeviceForType(content::MediaStreamType type, | 635 void UpdateDefaultDeviceForType(content::MediaStreamType type, |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 1362 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
1362 DCHECK_EQ(web_contents_, | 1363 DCHECK_EQ(web_contents_, |
1363 content::Source<WebContents>(source).ptr()); | 1364 content::Source<WebContents>(source).ptr()); |
1364 web_contents_ = NULL; | 1365 web_contents_ = NULL; |
1365 } else { | 1366 } else { |
1366 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 1367 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
1367 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 1368 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
1368 profile_ = NULL; | 1369 profile_ = NULL; |
1369 } | 1370 } |
1370 } | 1371 } |
OLD | NEW |