| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 11 #include "chrome/browser/favicon/favicon_tab_helper.h" | 11 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 12 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | |
| 13 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 14 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 16 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" | 15 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" |
| 17 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 17 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 20 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
| 21 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/common/render_messages.h" | 21 #include "chrome/common/render_messages.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 39 int GetIdForContentType(const ContentSettingsTypeIdEntry* entries, | 38 int GetIdForContentType(const ContentSettingsTypeIdEntry* entries, |
| 40 size_t num_entries, | 39 size_t num_entries, |
| 41 ContentSettingsType type) { | 40 ContentSettingsType type) { |
| 42 for (size_t i = 0; i < num_entries; ++i) { | 41 for (size_t i = 0; i < num_entries; ++i) { |
| 43 if (entries[i].type == type) | 42 if (entries[i].type == type) |
| 44 return entries[i].id; | 43 return entries[i].id; |
| 45 } | 44 } |
| 46 return 0; | 45 return 0; |
| 47 } | 46 } |
| 48 | 47 |
| 49 } | 48 } // namespace |
| 50 | 49 |
| 51 class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel { | 50 class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel { |
| 52 public: | 51 public: |
| 53 ContentSettingTitleAndLinkModel(Browser* browser, | 52 ContentSettingTitleAndLinkModel(Browser* browser, |
| 54 TabContentsWrapper* tab_contents, | 53 TabContentsWrapper* tab_contents, |
| 55 Profile* profile, | 54 Profile* profile, |
| 56 ContentSettingsType content_type) | 55 ContentSettingsType content_type) |
| 57 : ContentSettingBubbleModel(tab_contents, profile, content_type), | 56 : ContentSettingBubbleModel(tab_contents, profile, content_type), |
| 58 browser_(browser) { | 57 browser_(browser) { |
| 59 // Notifications do not have a bubble. | 58 // Notifications do not have a bubble. |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 virtual void OnCustomLinkClicked() OVERRIDE { | 455 virtual void OnCustomLinkClicked() OVERRIDE { |
| 457 if (!tab_contents()) | 456 if (!tab_contents()) |
| 458 return; | 457 return; |
| 459 // Reset this embedder's entry to default for each of the requesting | 458 // Reset this embedder's entry to default for each of the requesting |
| 460 // origins currently on the page. | 459 // origins currently on the page. |
| 461 const GURL& embedder_url = tab_contents()->tab_contents()->GetURL(); | 460 const GURL& embedder_url = tab_contents()->tab_contents()->GetURL(); |
| 462 TabSpecificContentSettings* content_settings = | 461 TabSpecificContentSettings* content_settings = |
| 463 tab_contents()->content_settings(); | 462 tab_contents()->content_settings(); |
| 464 const GeolocationSettingsState::StateMap& state_map = | 463 const GeolocationSettingsState::StateMap& state_map = |
| 465 content_settings->geolocation_settings_state().state_map(); | 464 content_settings->geolocation_settings_state().state_map(); |
| 466 GeolocationContentSettingsMap* settings_map = | 465 HostContentSettingsMap* settings_map = |
| 467 profile()->GetGeolocationContentSettingsMap(); | 466 profile()->GetHostContentSettingsMap(); |
| 467 |
| 468 for (GeolocationSettingsState::StateMap::const_iterator it = | 468 for (GeolocationSettingsState::StateMap::const_iterator it = |
| 469 state_map.begin(); it != state_map.end(); ++it) { | 469 state_map.begin(); it != state_map.end(); ++it) { |
| 470 settings_map->SetContentSetting(it->first, embedder_url, | 470 settings_map->SetContentSetting( |
| 471 CONTENT_SETTING_DEFAULT); | 471 ContentSettingsPattern::FromURLNoWildcard(it->first), |
| 472 ContentSettingsPattern::FromURLNoWildcard(embedder_url), |
| 473 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
| 474 std::string(), |
| 475 CONTENT_SETTING_DEFAULT); |
| 472 } | 476 } |
| 473 } | 477 } |
| 474 }; | 478 }; |
| 475 | 479 |
| 476 // static | 480 // static |
| 477 ContentSettingBubbleModel* | 481 ContentSettingBubbleModel* |
| 478 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 482 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| 479 Browser* browser, | 483 Browser* browser, |
| 480 TabContentsWrapper* tab_contents, | 484 TabContentsWrapper* tab_contents, |
| 481 Profile* profile, | 485 Profile* profile, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 tab_contents_ = NULL; | 549 tab_contents_ = NULL; |
| 546 break; | 550 break; |
| 547 case chrome::NOTIFICATION_PROFILE_DESTROYED: | 551 case chrome::NOTIFICATION_PROFILE_DESTROYED: |
| 548 DCHECK(source == Source<Profile>(profile_)); | 552 DCHECK(source == Source<Profile>(profile_)); |
| 549 profile_ = NULL; | 553 profile_ = NULL; |
| 550 break; | 554 break; |
| 551 default: | 555 default: |
| 552 NOTREACHED(); | 556 NOTREACHED(); |
| 553 } | 557 } |
| 554 } | 558 } |
| OLD | NEW |