| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/infobars/infobar_service.h" | 5 #include "chrome/browser/infobars/infobar_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/infobars/infobar.h" | 9 #include "chrome/browser/infobars/infobar.h" |
| 10 #include "chrome/browser/infobars/insecure_content_infobar_delegate.h" | 10 #include "chrome/browser/infobars/insecure_content_infobar_delegate.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 InfoBarService::InfoBarService(content::WebContents* web_contents) | 49 InfoBarService::InfoBarService(content::WebContents* web_contents) |
| 50 : content::WebContentsObserver(web_contents) { | 50 : content::WebContentsObserver(web_contents) { |
| 51 DCHECK(web_contents); | 51 DCHECK(web_contents); |
| 52 } | 52 } |
| 53 | 53 |
| 54 InfoBarService::~InfoBarService() { | 54 InfoBarService::~InfoBarService() { |
| 55 ShutDown(); | 55 ShutDown(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 int InfoBarService::GetActiveEntryID() { |
| 59 content::NavigationEntry* active_entry = |
| 60 web_contents()->GetController().GetActiveEntry(); |
| 61 return active_entry ? active_entry->GetUniqueID() : 0; |
| 62 } |
| 63 |
| 58 void InfoBarService::NotifyInfoBarAdded(InfoBar* infobar) { | 64 void InfoBarService::NotifyInfoBarAdded(InfoBar* infobar) { |
| 59 InfoBarManager::NotifyInfoBarAdded(infobar); | 65 InfoBarManager::NotifyInfoBarAdded(infobar); |
| 60 // TODO(droger): Remove the notifications and have listeners change to be | 66 // TODO(droger): Remove the notifications and have listeners change to be |
| 61 // NavigationManager::Observers instead. See http://crbug.com/354380 | 67 // NavigationManager::Observers instead. See http://crbug.com/354380 |
| 62 content::NotificationService::current()->Notify( | 68 content::NotificationService::current()->Notify( |
| 63 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, | 69 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
| 64 content::Source<InfoBarService>(this), | 70 content::Source<InfoBarService>(this), |
| 65 content::Details<InfoBar::AddedDetails>(infobar)); | 71 content::Details<InfoBar::AddedDetails>(infobar)); |
| 66 } | 72 } |
| 67 | 73 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 126 |
| 121 void InfoBarService::OnDidBlockDisplayingInsecureContent() { | 127 void InfoBarService::OnDidBlockDisplayingInsecureContent() { |
| 122 InsecureContentInfoBarDelegate::Create( | 128 InsecureContentInfoBarDelegate::Create( |
| 123 this, InsecureContentInfoBarDelegate::DISPLAY); | 129 this, InsecureContentInfoBarDelegate::DISPLAY); |
| 124 } | 130 } |
| 125 | 131 |
| 126 void InfoBarService::OnDidBlockRunningInsecureContent() { | 132 void InfoBarService::OnDidBlockRunningInsecureContent() { |
| 127 InsecureContentInfoBarDelegate::Create(this, | 133 InsecureContentInfoBarDelegate::Create(this, |
| 128 InsecureContentInfoBarDelegate::RUN); | 134 InsecureContentInfoBarDelegate::RUN); |
| 129 } | 135 } |
| OLD | NEW |