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

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

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 delegate_->ShowLearnMorePage(content_type()); 172 delegate_->ShowLearnMorePage(content_type());
173 } 173 }
174 174
175 class ContentSettingTitleLinkAndCustomModel 175 class ContentSettingTitleLinkAndCustomModel
176 : public ContentSettingTitleAndLinkModel { 176 : public ContentSettingTitleAndLinkModel {
177 public: 177 public:
178 ContentSettingTitleLinkAndCustomModel(Delegate* delegate, 178 ContentSettingTitleLinkAndCustomModel(Delegate* delegate,
179 WebContents* web_contents, 179 WebContents* web_contents,
180 Profile* profile, 180 Profile* profile,
181 ContentSettingsType content_type); 181 ContentSettingsType content_type);
182 virtual ~ContentSettingTitleLinkAndCustomModel() {} 182 ~ContentSettingTitleLinkAndCustomModel() override {}
183 183
184 private: 184 private:
185 void SetCustomLink(); 185 void SetCustomLink();
186 virtual void OnCustomLinkClicked() override {} 186 void OnCustomLinkClicked() override {}
187 }; 187 };
188 188
189 ContentSettingTitleLinkAndCustomModel::ContentSettingTitleLinkAndCustomModel( 189 ContentSettingTitleLinkAndCustomModel::ContentSettingTitleLinkAndCustomModel(
190 Delegate* delegate, 190 Delegate* delegate,
191 WebContents* web_contents, 191 WebContents* web_contents,
192 Profile* profile, 192 Profile* profile,
193 ContentSettingsType content_type) 193 ContentSettingsType content_type)
194 : ContentSettingTitleAndLinkModel( 194 : ContentSettingTitleAndLinkModel(
195 delegate, web_contents, profile, content_type) { 195 delegate, web_contents, profile, content_type) {
196 SetCustomLink(); 196 SetCustomLink();
(...skipping 11 matching lines...) Expand all
208 set_custom_link(l10n_util::GetStringUTF8(custom_link_id)); 208 set_custom_link(l10n_util::GetStringUTF8(custom_link_id));
209 } 209 }
210 210
211 class ContentSettingSingleRadioGroup 211 class ContentSettingSingleRadioGroup
212 : public ContentSettingTitleLinkAndCustomModel { 212 : public ContentSettingTitleLinkAndCustomModel {
213 public: 213 public:
214 ContentSettingSingleRadioGroup(Delegate* delegate, 214 ContentSettingSingleRadioGroup(Delegate* delegate,
215 WebContents* web_contents, 215 WebContents* web_contents,
216 Profile* profile, 216 Profile* profile,
217 ContentSettingsType content_type); 217 ContentSettingsType content_type);
218 virtual ~ContentSettingSingleRadioGroup(); 218 ~ContentSettingSingleRadioGroup() override;
219 219
220 protected: 220 protected:
221 bool settings_changed() const; 221 bool settings_changed() const;
222 int selected_item() const { return selected_item_; } 222 int selected_item() const { return selected_item_; }
223 223
224 private: 224 private:
225 void SetRadioGroup(); 225 void SetRadioGroup();
226 void AddException(ContentSetting setting); 226 void AddException(ContentSetting setting);
227 virtual void OnRadioClicked(int radio_index) override; 227 void OnRadioClicked(int radio_index) override;
228 228
229 ContentSetting block_setting_; 229 ContentSetting block_setting_;
230 int selected_item_; 230 int selected_item_;
231 }; 231 };
232 232
233 ContentSettingSingleRadioGroup::ContentSettingSingleRadioGroup( 233 ContentSettingSingleRadioGroup::ContentSettingSingleRadioGroup(
234 Delegate* delegate, 234 Delegate* delegate,
235 WebContents* web_contents, 235 WebContents* web_contents,
236 Profile* profile, 236 Profile* profile,
237 ContentSettingsType content_type) 237 ContentSettingsType content_type)
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 selected_item_ = radio_index; 403 selected_item_ = radio_index;
404 } 404 }
405 405
406 class ContentSettingCookiesBubbleModel : public ContentSettingSingleRadioGroup { 406 class ContentSettingCookiesBubbleModel : public ContentSettingSingleRadioGroup {
407 public: 407 public:
408 ContentSettingCookiesBubbleModel(Delegate* delegate, 408 ContentSettingCookiesBubbleModel(Delegate* delegate,
409 WebContents* web_contents, 409 WebContents* web_contents,
410 Profile* profile, 410 Profile* profile,
411 ContentSettingsType content_type); 411 ContentSettingsType content_type);
412 412
413 virtual ~ContentSettingCookiesBubbleModel(); 413 ~ContentSettingCookiesBubbleModel() override;
414 414
415 private: 415 private:
416 virtual void OnCustomLinkClicked() override; 416 void OnCustomLinkClicked() override;
417 }; 417 };
418 418
419 ContentSettingCookiesBubbleModel::ContentSettingCookiesBubbleModel( 419 ContentSettingCookiesBubbleModel::ContentSettingCookiesBubbleModel(
420 Delegate* delegate, 420 Delegate* delegate,
421 WebContents* web_contents, 421 WebContents* web_contents,
422 Profile* profile, 422 Profile* profile,
423 ContentSettingsType content_type) 423 ContentSettingsType content_type)
424 : ContentSettingSingleRadioGroup( 424 : ContentSettingSingleRadioGroup(
425 delegate, web_contents, profile, content_type) { 425 delegate, web_contents, profile, content_type) {
426 DCHECK_EQ(CONTENT_SETTINGS_TYPE_COOKIES, content_type); 426 DCHECK_EQ(CONTENT_SETTINGS_TYPE_COOKIES, content_type);
(...skipping 20 matching lines...) Expand all
447 delegate()->ShowCollectedCookiesDialog(web_contents()); 447 delegate()->ShowCollectedCookiesDialog(web_contents());
448 } 448 }
449 449
450 class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup { 450 class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup {
451 public: 451 public:
452 ContentSettingPluginBubbleModel(Delegate* delegate, 452 ContentSettingPluginBubbleModel(Delegate* delegate,
453 WebContents* web_contents, 453 WebContents* web_contents,
454 Profile* profile, 454 Profile* profile,
455 ContentSettingsType content_type); 455 ContentSettingsType content_type);
456 456
457 virtual ~ContentSettingPluginBubbleModel(); 457 ~ContentSettingPluginBubbleModel() override;
458 458
459 private: 459 private:
460 virtual void OnCustomLinkClicked() override; 460 void OnCustomLinkClicked() override;
461 }; 461 };
462 462
463 ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel( 463 ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel(
464 Delegate* delegate, 464 Delegate* delegate,
465 WebContents* web_contents, 465 WebContents* web_contents,
466 Profile* profile, 466 Profile* profile,
467 ContentSettingsType content_type) 467 ContentSettingsType content_type)
468 : ContentSettingSingleRadioGroup( 468 : ContentSettingSingleRadioGroup(
469 delegate, web_contents, profile, content_type) { 469 delegate, web_contents, profile, content_type) {
470 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); 470 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS);
(...skipping 26 matching lines...) Expand all
497 TabSpecificContentSettings::FromWebContents(web_contents())-> 497 TabSpecificContentSettings::FromWebContents(web_contents())->
498 set_load_plugins_link_enabled(false); 498 set_load_plugins_link_enabled(false);
499 } 499 }
500 500
501 class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup { 501 class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup {
502 public: 502 public:
503 ContentSettingPopupBubbleModel(Delegate* delegate, 503 ContentSettingPopupBubbleModel(Delegate* delegate,
504 WebContents* web_contents, 504 WebContents* web_contents,
505 Profile* profile, 505 Profile* profile,
506 ContentSettingsType content_type); 506 ContentSettingsType content_type);
507 virtual ~ContentSettingPopupBubbleModel() {} 507 ~ContentSettingPopupBubbleModel() override {}
508 508
509 private: 509 private:
510 void SetPopups(); 510 void SetPopups();
511 virtual void OnPopupClicked(int index) override; 511 void OnPopupClicked(int index) override;
512 }; 512 };
513 513
514 ContentSettingPopupBubbleModel::ContentSettingPopupBubbleModel( 514 ContentSettingPopupBubbleModel::ContentSettingPopupBubbleModel(
515 Delegate* delegate, 515 Delegate* delegate,
516 WebContents* web_contents, 516 WebContents* web_contents,
517 Profile* profile, 517 Profile* profile,
518 ContentSettingsType content_type) 518 ContentSettingsType content_type)
519 : ContentSettingSingleRadioGroup( 519 : ContentSettingSingleRadioGroup(
520 delegate, web_contents, profile, content_type) { 520 delegate, web_contents, profile, content_type) {
521 SetPopups(); 521 SetPopups();
(...skipping 28 matching lines...) Expand all
550 } 550 }
551 551
552 // The model of the content settings bubble for media settings. 552 // The model of the content settings bubble for media settings.
553 class ContentSettingMediaStreamBubbleModel 553 class ContentSettingMediaStreamBubbleModel
554 : public ContentSettingTitleAndLinkModel { 554 : public ContentSettingTitleAndLinkModel {
555 public: 555 public:
556 ContentSettingMediaStreamBubbleModel(Delegate* delegate, 556 ContentSettingMediaStreamBubbleModel(Delegate* delegate,
557 WebContents* web_contents, 557 WebContents* web_contents,
558 Profile* profile); 558 Profile* profile);
559 559
560 virtual ~ContentSettingMediaStreamBubbleModel(); 560 ~ContentSettingMediaStreamBubbleModel() override;
561 561
562 private: 562 private:
563 void SetTitle(); 563 void SetTitle();
564 // Sets the data for the radio buttons of the bubble. 564 // Sets the data for the radio buttons of the bubble.
565 void SetRadioGroup(); 565 void SetRadioGroup();
566 // Sets the data for the media menus of the bubble. 566 // Sets the data for the media menus of the bubble.
567 void SetMediaMenus(); 567 void SetMediaMenus();
568 void SetCustomLink(); 568 void SetCustomLink();
569 // Updates the camera and microphone setting with the passed |setting|. 569 // Updates the camera and microphone setting with the passed |setting|.
570 void UpdateSettings(ContentSetting setting); 570 void UpdateSettings(ContentSetting setting);
571 // Updates the camera and microphone default device with the passed |type| 571 // Updates the camera and microphone default device with the passed |type|
572 // and device. 572 // and device.
573 void UpdateDefaultDeviceForType(content::MediaStreamType type, 573 void UpdateDefaultDeviceForType(content::MediaStreamType type,
574 const std::string& device); 574 const std::string& device);
575 575
576 // ContentSettingBubbleModel implementation. 576 // ContentSettingBubbleModel implementation.
577 virtual void OnRadioClicked(int radio_index) override; 577 void OnRadioClicked(int radio_index) override;
578 virtual void OnMediaMenuClicked(content::MediaStreamType type, 578 void OnMediaMenuClicked(content::MediaStreamType type,
579 const std::string& selected_device) override; 579 const std::string& selected_device) override;
580 580
581 // The index of the selected radio item. 581 // The index of the selected radio item.
582 int selected_item_; 582 int selected_item_;
583 // The content settings that are associated with the individual radio 583 // The content settings that are associated with the individual radio
584 // buttons. 584 // buttons.
585 ContentSetting radio_item_setting_[2]; 585 ContentSetting radio_item_setting_[2];
586 // The state of the microphone and camera access. 586 // The state of the microphone and camera access.
587 TabSpecificContentSettings::MicrophoneCameraState state_; 587 TabSpecificContentSettings::MicrophoneCameraState state_;
588 }; 588 };
589 589
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 set_selected_device(GetMediaDeviceById(selected_device_id, devices)); 854 set_selected_device(GetMediaDeviceById(selected_device_id, devices));
855 } 855 }
856 856
857 class ContentSettingDomainListBubbleModel 857 class ContentSettingDomainListBubbleModel
858 : public ContentSettingTitleAndLinkModel { 858 : public ContentSettingTitleAndLinkModel {
859 public: 859 public:
860 ContentSettingDomainListBubbleModel(Delegate* delegate, 860 ContentSettingDomainListBubbleModel(Delegate* delegate,
861 WebContents* web_contents, 861 WebContents* web_contents,
862 Profile* profile, 862 Profile* profile,
863 ContentSettingsType content_type); 863 ContentSettingsType content_type);
864 virtual ~ContentSettingDomainListBubbleModel() {} 864 ~ContentSettingDomainListBubbleModel() override {}
865 865
866 private: 866 private:
867 void MaybeAddDomainList(const std::set<std::string>& hosts, int title_id); 867 void MaybeAddDomainList(const std::set<std::string>& hosts, int title_id);
868 void SetDomainsAndCustomLink(); 868 void SetDomainsAndCustomLink();
869 virtual void OnCustomLinkClicked() override; 869 void OnCustomLinkClicked() override;
870 }; 870 };
871 871
872 ContentSettingDomainListBubbleModel::ContentSettingDomainListBubbleModel( 872 ContentSettingDomainListBubbleModel::ContentSettingDomainListBubbleModel(
873 Delegate* delegate, 873 Delegate* delegate,
874 WebContents* web_contents, 874 WebContents* web_contents,
875 Profile* profile, 875 Profile* profile,
876 ContentSettingsType content_type) 876 ContentSettingsType content_type)
877 : ContentSettingTitleAndLinkModel( 877 : ContentSettingTitleAndLinkModel(
878 delegate, web_contents, profile, content_type) { 878 delegate, web_contents, profile, content_type) {
879 DCHECK_EQ(CONTENT_SETTINGS_TYPE_GEOLOCATION, content_type) << 879 DCHECK_EQ(CONTENT_SETTINGS_TYPE_GEOLOCATION, content_type) <<
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 } 943 }
944 944
945 class ContentSettingMixedScriptBubbleModel 945 class ContentSettingMixedScriptBubbleModel
946 : public ContentSettingTitleLinkAndCustomModel { 946 : public ContentSettingTitleLinkAndCustomModel {
947 public: 947 public:
948 ContentSettingMixedScriptBubbleModel(Delegate* delegate, 948 ContentSettingMixedScriptBubbleModel(Delegate* delegate,
949 WebContents* web_contents, 949 WebContents* web_contents,
950 Profile* profile, 950 Profile* profile,
951 ContentSettingsType content_type); 951 ContentSettingsType content_type);
952 952
953 virtual ~ContentSettingMixedScriptBubbleModel() {} 953 ~ContentSettingMixedScriptBubbleModel() override {}
954 954
955 private: 955 private:
956 virtual void OnCustomLinkClicked() override; 956 void OnCustomLinkClicked() override;
957 }; 957 };
958 958
959 ContentSettingMixedScriptBubbleModel::ContentSettingMixedScriptBubbleModel( 959 ContentSettingMixedScriptBubbleModel::ContentSettingMixedScriptBubbleModel(
960 Delegate* delegate, 960 Delegate* delegate,
961 WebContents* web_contents, 961 WebContents* web_contents,
962 Profile* profile, 962 Profile* profile,
963 ContentSettingsType content_type) 963 ContentSettingsType content_type)
964 : ContentSettingTitleLinkAndCustomModel( 964 : ContentSettingTitleLinkAndCustomModel(
965 delegate, web_contents, profile, content_type) { 965 delegate, web_contents, profile, content_type) {
966 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_MIXEDSCRIPT); 966 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_MIXEDSCRIPT);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 } 1107 }
1108 } 1108 }
1109 1109
1110 class ContentSettingMidiSysExBubbleModel 1110 class ContentSettingMidiSysExBubbleModel
1111 : public ContentSettingTitleAndLinkModel { 1111 : public ContentSettingTitleAndLinkModel {
1112 public: 1112 public:
1113 ContentSettingMidiSysExBubbleModel(Delegate* delegate, 1113 ContentSettingMidiSysExBubbleModel(Delegate* delegate,
1114 WebContents* web_contents, 1114 WebContents* web_contents,
1115 Profile* profile, 1115 Profile* profile,
1116 ContentSettingsType content_type); 1116 ContentSettingsType content_type);
1117 virtual ~ContentSettingMidiSysExBubbleModel() {} 1117 ~ContentSettingMidiSysExBubbleModel() override {}
1118 1118
1119 private: 1119 private:
1120 void MaybeAddDomainList(const std::set<std::string>& hosts, int title_id); 1120 void MaybeAddDomainList(const std::set<std::string>& hosts, int title_id);
1121 void SetDomainsAndCustomLink(); 1121 void SetDomainsAndCustomLink();
1122 virtual void OnCustomLinkClicked() override; 1122 void OnCustomLinkClicked() override;
1123 }; 1123 };
1124 1124
1125 ContentSettingMidiSysExBubbleModel::ContentSettingMidiSysExBubbleModel( 1125 ContentSettingMidiSysExBubbleModel::ContentSettingMidiSysExBubbleModel(
1126 Delegate* delegate, 1126 Delegate* delegate,
1127 WebContents* web_contents, 1127 WebContents* web_contents,
1128 Profile* profile, 1128 Profile* profile,
1129 ContentSettingsType content_type) 1129 ContentSettingsType content_type)
1130 : ContentSettingTitleAndLinkModel( 1130 : ContentSettingTitleAndLinkModel(
1131 delegate, web_contents, profile, content_type) { 1131 delegate, web_contents, profile, content_type) {
1132 DCHECK_EQ(CONTENT_SETTINGS_TYPE_MIDI_SYSEX, content_type); 1132 DCHECK_EQ(CONTENT_SETTINGS_TYPE_MIDI_SYSEX, content_type);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { 1281 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) {
1282 DCHECK_EQ(web_contents_, 1282 DCHECK_EQ(web_contents_,
1283 content::Source<WebContents>(source).ptr()); 1283 content::Source<WebContents>(source).ptr());
1284 web_contents_ = NULL; 1284 web_contents_ = NULL;
1285 } else { 1285 } else {
1286 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); 1286 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
1287 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); 1287 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr());
1288 profile_ = NULL; 1288 profile_ = NULL;
1289 } 1289 }
1290 } 1290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698