| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~ContentSettingTitleLinkAndCustomModel() {} |
| 183 | 183 |
| 184 private: | 184 private: |
| 185 void SetCustomLink(); | 185 void SetCustomLink(); |
| 186 virtual void OnCustomLinkClicked() OVERRIDE {} | 186 virtual 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 20 matching lines...) Expand all Loading... |
| 217 ContentSettingsType content_type); | 217 ContentSettingsType content_type); |
| 218 virtual ~ContentSettingSingleRadioGroup(); | 218 virtual ~ContentSettingSingleRadioGroup(); |
| 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 virtual 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~ContentSettingCookiesBubbleModel(); |
| 414 | 414 |
| 415 private: | 415 private: |
| 416 virtual void OnCustomLinkClicked() OVERRIDE; | 416 virtual 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 23 matching lines...) Expand all Loading... |
| 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 virtual ~ContentSettingPluginBubbleModel(); |
| 458 | 458 |
| 459 private: | 459 private: |
| 460 virtual void OnCustomLinkClicked() OVERRIDE; | 460 virtual 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 30 matching lines...) Expand all Loading... |
| 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 virtual ~ContentSettingPopupBubbleModel() {} |
| 508 | 508 |
| 509 private: | 509 private: |
| 510 void SetPopups(); | 510 void SetPopups(); |
| 511 virtual void OnPopupClicked(int index) OVERRIDE; | 511 virtual 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual void OnRadioClicked(int radio_index) override; |
| 578 virtual void OnMediaMenuClicked(content::MediaStreamType type, | 578 virtual 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~ContentSettingDomainListBubbleModel() {} |
| 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 virtual 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~ContentSettingMixedScriptBubbleModel() {} |
| 954 | 954 |
| 955 private: | 955 private: |
| 956 virtual void OnCustomLinkClicked() OVERRIDE; | 956 virtual 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~ContentSettingMidiSysExBubbleModel() {} |
| 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 virtual 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 Loading... |
| 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 } |
| OLD | NEW |