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

Side by Side Diff: trunk/src/chrome/browser/ui/content_settings/content_setting_bubble_model.cc

Issue 24024006: Revert 221424 "Save password functionality added to the save pas..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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/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"
11 #include "chrome/browser/content_settings/content_settings_utils.h" 11 #include "chrome/browser/content_settings/content_settings_utils.h"
12 #include "chrome/browser/content_settings/cookie_settings.h" 12 #include "chrome/browser/content_settings/cookie_settings.h"
13 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
13 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 14 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
14 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 15 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
15 #include "chrome/browser/favicon/favicon_tab_helper.h" 16 #include "chrome/browser/favicon/favicon_tab_helper.h"
16 #include "chrome/browser/infobars/infobar_service.h" 17 #include "chrome/browser/infobars/infobar_service.h"
17 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 18 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
18 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" 19 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
19 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" 21 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
21 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate. h" 22 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate. h"
22 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" 23 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_LINK}, 157 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_LINK},
157 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_LINK}, 158 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_LINK},
158 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_LINK}, 159 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_LINK},
159 {CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_GEOLOCATION_BUBBLE_MANAGE_LINK}, 160 {CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_GEOLOCATION_BUBBLE_MANAGE_LINK},
160 {CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, IDS_LEARN_MORE}, 161 {CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, IDS_LEARN_MORE},
161 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, IDS_HANDLERS_BUBBLE_MANAGE_LINK}, 162 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, IDS_HANDLERS_BUBBLE_MANAGE_LINK},
162 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, IDS_MEDIASTREAM_BUBBLE_MANAGE_LINK}, 163 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, IDS_MEDIASTREAM_BUBBLE_MANAGE_LINK},
163 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_PPAPI_BROKER_BUBBLE_MANAGE_LINK}, 164 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_PPAPI_BROKER_BUBBLE_MANAGE_LINK},
164 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_BLOCKED_DOWNLOADS_LINK}, 165 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_BLOCKED_DOWNLOADS_LINK},
165 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, IDS_MIDI_SYSEX_BUBBLE_MANAGE_LINK}, 166 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, IDS_MIDI_SYSEX_BUBBLE_MANAGE_LINK},
166 {CONTENT_SETTINGS_TYPE_SAVE_PASSWORD,
167 IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS},
168 }; 167 };
169 set_manage_link(l10n_util::GetStringUTF8( 168 set_manage_link(l10n_util::GetStringUTF8(
170 GetIdForContentType(kLinkIDs, arraysize(kLinkIDs), content_type()))); 169 GetIdForContentType(kLinkIDs, arraysize(kLinkIDs), content_type())));
171 } 170 }
172 171
173 void ContentSettingTitleAndLinkModel::OnManageLinkClicked() { 172 void ContentSettingTitleAndLinkModel::OnManageLinkClicked() {
174 if (delegate_) 173 if (delegate_)
175 delegate_->ShowContentSettingsPage(content_type()); 174 delegate_->ShowContentSettingsPage(content_type());
176 } 175 }
177 176
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 } 566 }
568 567
569 void ContentSettingPopupBubbleModel::OnPopupClicked(int index) { 568 void ContentSettingPopupBubbleModel::OnPopupClicked(int index) {
570 if (web_contents()) { 569 if (web_contents()) {
571 PopupBlockerTabHelper::FromWebContents(web_contents())-> 570 PopupBlockerTabHelper::FromWebContents(web_contents())->
572 ShowBlockedPopup(bubble_content().popup_items[index].popup_id); 571 ShowBlockedPopup(bubble_content().popup_items[index].popup_id);
573 } 572 }
574 } 573 }
575 574
576 // The model for the save password bubble. 575 // The model for the save password bubble.
577 SavePasswordBubbleModel::SavePasswordBubbleModel(Delegate* delegate, 576 class SavePasswordBubbleModel : public ContentSettingBubbleModel {
578 WebContents* web_contents, 577 public:
578 SavePasswordBubbleModel(WebContents* web_contents, Profile* profile);
579 virtual ~SavePasswordBubbleModel() {}
580
581 private:
582 // Sets the title of the bubble.
583 void SetTitle();
584
585 TabSpecificContentSettings::PasswordSavingState state_;
586
587 DISALLOW_COPY_AND_ASSIGN(SavePasswordBubbleModel);
588 };
589
590 SavePasswordBubbleModel::SavePasswordBubbleModel(WebContents* web_contents,
579 Profile* profile) 591 Profile* profile)
580 : ContentSettingTitleAndLinkModel(delegate, web_contents, profile, 592 : ContentSettingBubbleModel(web_contents, profile,
581 CONTENT_SETTINGS_TYPE_SAVE_PASSWORD), 593 CONTENT_SETTINGS_TYPE_SAVE_PASSWORD),
582 state_(TabSpecificContentSettings::NO_PASSWORD_TO_BE_SAVED) { 594 state_(TabSpecificContentSettings::NO_PASSWORD_TO_BE_SAVED) {
583 DCHECK(profile); 595 DCHECK(profile);
584 TabSpecificContentSettings* content_settings = 596 TabSpecificContentSettings* content_settings =
585 TabSpecificContentSettings::FromWebContents(web_contents); 597 TabSpecificContentSettings::FromWebContents(web_contents);
586 state_ = content_settings->GetPasswordSavingState(); 598 state_ = content_settings->GetPasswordSavingState();
587 599
588 SetTitle(); 600 SetTitle();
589 } 601 }
590 602
591 void SavePasswordBubbleModel::SetTitle() { 603 void SavePasswordBubbleModel::SetTitle() {
592 int title_id = 0; 604 int title_id = 0;
593 // If the save password icon was accessed, the icon is displayed and the 605 // If the save password icon was accessed, the icon is displayed and the
594 // bubble is instantiated 606 // bubble is instantiated
595 if (state_ == TabSpecificContentSettings::PASSWORD_TO_BE_SAVED) 607 if (state_ == TabSpecificContentSettings::PASSWORD_TO_BE_SAVED)
596 title_id = IDS_SAVE_PASSWORD; 608 title_id = IDS_SAVE_PASSWORD;
597 609
598 set_title(l10n_util::GetStringUTF8(title_id)); 610 set_title(l10n_util::GetStringUTF8(title_id));
599 } 611 }
600 612
601 void SavePasswordBubbleModel::OnCancelClicked() {
602 TabSpecificContentSettings* content_settings =
603 TabSpecificContentSettings::FromWebContents(web_contents());
604 content_settings->PasswordFormBlacklisted();
605 }
606
607 void SavePasswordBubbleModel::OnSaveClicked() {
608 TabSpecificContentSettings* content_settings =
609 TabSpecificContentSettings::FromWebContents(web_contents());
610 content_settings->PasswordAccepted();
611 }
612
613 // The model of the content settings bubble for media settings. 613 // The model of the content settings bubble for media settings.
614 class ContentSettingMediaStreamBubbleModel 614 class ContentSettingMediaStreamBubbleModel
615 : public ContentSettingTitleAndLinkModel { 615 : public ContentSettingTitleAndLinkModel {
616 public: 616 public:
617 ContentSettingMediaStreamBubbleModel(Delegate* delegate, 617 ContentSettingMediaStreamBubbleModel(Delegate* delegate,
618 WebContents* web_contents, 618 WebContents* web_contents,
619 Profile* profile); 619 Profile* profile);
620 620
621 virtual ~ContentSettingMediaStreamBubbleModel(); 621 virtual ~ContentSettingMediaStreamBubbleModel();
622 622
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 } 1270 }
1271 1271
1272 // static 1272 // static
1273 ContentSettingBubbleModel* 1273 ContentSettingBubbleModel*
1274 ContentSettingBubbleModel::CreateContentSettingBubbleModel( 1274 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
1275 Delegate* delegate, 1275 Delegate* delegate,
1276 WebContents* web_contents, 1276 WebContents* web_contents,
1277 Profile* profile, 1277 Profile* profile,
1278 ContentSettingsType content_type) { 1278 ContentSettingsType content_type) {
1279 if (content_type == CONTENT_SETTINGS_TYPE_SAVE_PASSWORD) { 1279 if (content_type == CONTENT_SETTINGS_TYPE_SAVE_PASSWORD) {
1280 return new SavePasswordBubbleModel(delegate, web_contents, profile); 1280 return new SavePasswordBubbleModel(web_contents, profile);
1281 } 1281 }
1282 if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { 1282 if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) {
1283 return new ContentSettingCookiesBubbleModel(delegate, web_contents, profile, 1283 return new ContentSettingCookiesBubbleModel(delegate, web_contents, profile,
1284 content_type); 1284 content_type);
1285 } 1285 }
1286 if (content_type == CONTENT_SETTINGS_TYPE_POPUPS) { 1286 if (content_type == CONTENT_SETTINGS_TYPE_POPUPS) {
1287 return new ContentSettingPopupBubbleModel(delegate, web_contents, profile, 1287 return new ContentSettingPopupBubbleModel(delegate, web_contents, profile,
1288 content_type); 1288 content_type);
1289 } 1289 }
1290 if (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { 1290 if (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { 1361 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) {
1362 DCHECK_EQ(web_contents_, 1362 DCHECK_EQ(web_contents_,
1363 content::Source<WebContents>(source).ptr()); 1363 content::Source<WebContents>(source).ptr());
1364 web_contents_ = NULL; 1364 web_contents_ = NULL;
1365 } else { 1365 } else {
1366 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); 1366 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
1367 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); 1367 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr());
1368 profile_ = NULL; 1368 profile_ = NULL;
1369 } 1369 }
1370 } 1370 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698