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 if (!web_contents()) | |
Peter Kasting
2014/04/10 00:17:20
Again, I don't think this conditional is supposed
droger
2014/04/10 17:18:07
Done.
| |
60 return 0; | |
61 content::NavigationEntry* active_entry = | |
62 web_contents()->GetController().GetActiveEntry(); | |
63 return active_entry ? active_entry->GetUniqueID() : 0; | |
64 } | |
65 | |
58 void InfoBarService::NotifyInfoBarAdded(InfoBar* infobar) { | 66 void InfoBarService::NotifyInfoBarAdded(InfoBar* infobar) { |
59 InfoBarManager::NotifyInfoBarAdded(infobar); | 67 InfoBarManager::NotifyInfoBarAdded(infobar); |
60 // TODO(droger): Remove the notifications and have listeners change to be | 68 // TODO(droger): Remove the notifications and have listeners change to be |
61 // NavigationManager::Observers instead. See http://crbug.com/354380 | 69 // NavigationManager::Observers instead. See http://crbug.com/354380 |
62 content::NotificationService::current()->Notify( | 70 content::NotificationService::current()->Notify( |
63 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, | 71 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
64 content::Source<InfoBarService>(this), | 72 content::Source<InfoBarService>(this), |
65 content::Details<InfoBar::AddedDetails>(infobar)); | 73 content::Details<InfoBar::AddedDetails>(infobar)); |
66 } | 74 } |
67 | 75 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 | 128 |
121 void InfoBarService::OnDidBlockDisplayingInsecureContent() { | 129 void InfoBarService::OnDidBlockDisplayingInsecureContent() { |
122 InsecureContentInfoBarDelegate::Create( | 130 InsecureContentInfoBarDelegate::Create( |
123 this, InsecureContentInfoBarDelegate::DISPLAY); | 131 this, InsecureContentInfoBarDelegate::DISPLAY); |
124 } | 132 } |
125 | 133 |
126 void InfoBarService::OnDidBlockRunningInsecureContent() { | 134 void InfoBarService::OnDidBlockRunningInsecureContent() { |
127 InsecureContentInfoBarDelegate::Create(this, | 135 InsecureContentInfoBarDelegate::Create(this, |
128 InsecureContentInfoBarDelegate::RUN); | 136 InsecureContentInfoBarDelegate::RUN); |
129 } | 137 } |
OLD | NEW |