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" | 12 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 15 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
16 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" | 16 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 18 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 20 #include "chrome/common/chrome_notification_types.h" |
20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
21 #include "chrome/common/render_messages.h" | 22 #include "chrome/common/render_messages.h" |
22 #include "content/browser/renderer_host/render_view_host.h" | 23 #include "content/browser/renderer_host/render_view_host.h" |
23 #include "content/browser/tab_contents/tab_contents.h" | 24 #include "content/browser/tab_contents/tab_contents.h" |
24 #include "content/browser/tab_contents/tab_contents_delegate.h" | 25 #include "content/browser/tab_contents/tab_contents_delegate.h" |
25 #include "content/browser/user_metrics.h" | 26 #include "content/browser/user_metrics.h" |
26 #include "content/common/notification_service.h" | 27 #include "content/common/notification_service.h" |
27 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
28 #include "net/base/net_util.h" | 29 #include "net/base/net_util.h" |
29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 tab_contents()->AddInfoBar( | 321 tab_contents()->AddInfoBar( |
321 new CollectedCookiesInfoBarDelegate(tab_contents()->tab_contents())); | 322 new CollectedCookiesInfoBarDelegate(tab_contents()->tab_contents())); |
322 } | 323 } |
323 } | 324 } |
324 | 325 |
325 private: | 326 private: |
326 virtual void OnCustomLinkClicked() OVERRIDE { | 327 virtual void OnCustomLinkClicked() OVERRIDE { |
327 if (!tab_contents()) | 328 if (!tab_contents()) |
328 return; | 329 return; |
329 NotificationService::current()->Notify( | 330 NotificationService::current()->Notify( |
330 NotificationType::COLLECTED_COOKIES_SHOWN, | 331 chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, |
331 Source<TabSpecificContentSettings>(tab_contents()->content_settings()), | 332 Source<TabSpecificContentSettings>(tab_contents()->content_settings()), |
332 NotificationService::NoDetails()); | 333 NotificationService::NoDetails()); |
333 browser()->ShowCollectedCookiesDialog(tab_contents()->tab_contents()); | 334 browser()->ShowCollectedCookiesDialog(tab_contents()->tab_contents()); |
334 } | 335 } |
335 }; | 336 }; |
336 | 337 |
337 class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup { | 338 class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup { |
338 public: | 339 public: |
339 ContentSettingPluginBubbleModel(Browser* browser, | 340 ContentSettingPluginBubbleModel(Browser* browser, |
340 TabContentsWrapper* tab_contents, | 341 TabContentsWrapper* tab_contents, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 content_type); | 500 content_type); |
500 } | 501 } |
501 | 502 |
502 ContentSettingBubbleModel::ContentSettingBubbleModel( | 503 ContentSettingBubbleModel::ContentSettingBubbleModel( |
503 TabContentsWrapper* tab_contents, | 504 TabContentsWrapper* tab_contents, |
504 Profile* profile, | 505 Profile* profile, |
505 ContentSettingsType content_type) | 506 ContentSettingsType content_type) |
506 : tab_contents_(tab_contents), | 507 : tab_contents_(tab_contents), |
507 profile_(profile), | 508 profile_(profile), |
508 content_type_(content_type) { | 509 content_type_(content_type) { |
509 registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, | 510 registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, |
510 Source<TabContents>(tab_contents->tab_contents())); | 511 Source<TabContents>(tab_contents->tab_contents())); |
511 registrar_.Add(this, NotificationType::PROFILE_DESTROYED, | 512 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
512 Source<Profile>(profile_)); | 513 Source<Profile>(profile_)); |
513 } | 514 } |
514 | 515 |
515 ContentSettingBubbleModel::~ContentSettingBubbleModel() { | 516 ContentSettingBubbleModel::~ContentSettingBubbleModel() { |
516 } | 517 } |
517 | 518 |
518 ContentSettingBubbleModel::RadioGroup::RadioGroup() : default_item(0) {} | 519 ContentSettingBubbleModel::RadioGroup::RadioGroup() : default_item(0) {} |
519 | 520 |
520 ContentSettingBubbleModel::RadioGroup::~RadioGroup() {} | 521 ContentSettingBubbleModel::RadioGroup::~RadioGroup() {} |
521 | 522 |
522 ContentSettingBubbleModel::DomainList::DomainList() {} | 523 ContentSettingBubbleModel::DomainList::DomainList() {} |
523 | 524 |
524 ContentSettingBubbleModel::DomainList::~DomainList() {} | 525 ContentSettingBubbleModel::DomainList::~DomainList() {} |
525 | 526 |
526 ContentSettingBubbleModel::BubbleContent::BubbleContent() | 527 ContentSettingBubbleModel::BubbleContent::BubbleContent() |
527 : custom_link_enabled(false) { | 528 : custom_link_enabled(false) { |
528 } | 529 } |
529 | 530 |
530 ContentSettingBubbleModel::BubbleContent::~BubbleContent() {} | 531 ContentSettingBubbleModel::BubbleContent::~BubbleContent() {} |
531 | 532 |
532 | 533 |
533 void ContentSettingBubbleModel::AddBlockedResource( | 534 void ContentSettingBubbleModel::AddBlockedResource( |
534 const std::string& resource_identifier) { | 535 const std::string& resource_identifier) { |
535 bubble_content_.resource_identifiers.insert(resource_identifier); | 536 bubble_content_.resource_identifiers.insert(resource_identifier); |
536 } | 537 } |
537 | 538 |
538 void ContentSettingBubbleModel::Observe(NotificationType type, | 539 void ContentSettingBubbleModel::Observe(int type, |
539 const NotificationSource& source, | 540 const NotificationSource& source, |
540 const NotificationDetails& details) { | 541 const NotificationDetails& details) { |
541 switch (type.value) { | 542 switch (type) { |
542 case NotificationType::TAB_CONTENTS_DESTROYED: | 543 case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: |
543 DCHECK(source == Source<TabContents>(tab_contents_->tab_contents())); | 544 DCHECK(source == Source<TabContents>(tab_contents_->tab_contents())); |
544 tab_contents_ = NULL; | 545 tab_contents_ = NULL; |
545 break; | 546 break; |
546 case NotificationType::PROFILE_DESTROYED: | 547 case chrome::NOTIFICATION_PROFILE_DESTROYED: |
547 DCHECK(source == Source<Profile>(profile_)); | 548 DCHECK(source == Source<Profile>(profile_)); |
548 profile_ = NULL; | 549 profile_ = NULL; |
549 break; | 550 break; |
550 default: | 551 default: |
551 NOTREACHED(); | 552 NOTREACHED(); |
552 } | 553 } |
553 } | 554 } |
OLD | NEW |