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/insecure_content_infobar_delegate.h" | 9 #include "chrome/browser/infobars/insecure_content_infobar_delegate.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 InfoBarService::~InfoBarService() { | 54 InfoBarService::~InfoBarService() { |
55 ShutDown(); | 55 ShutDown(); |
56 } | 56 } |
57 | 57 |
58 int InfoBarService::GetActiveEntryID() { | 58 int InfoBarService::GetActiveEntryID() { |
59 content::NavigationEntry* active_entry = | 59 content::NavigationEntry* active_entry = |
60 web_contents()->GetController().GetActiveEntry(); | 60 web_contents()->GetController().GetActiveEntry(); |
61 return active_entry ? active_entry->GetUniqueID() : 0; | 61 return active_entry ? active_entry->GetUniqueID() : 0; |
62 } | 62 } |
63 | 63 |
| 64 // InfoBarService::CreateAutofillCCInfoBar() is implemented in platform-specific |
| 65 // files. |
| 66 |
64 void InfoBarService::NotifyInfoBarAdded(infobars::InfoBar* infobar) { | 67 void InfoBarService::NotifyInfoBarAdded(infobars::InfoBar* infobar) { |
65 infobars::InfoBarManager::NotifyInfoBarAdded(infobar); | 68 infobars::InfoBarManager::NotifyInfoBarAdded(infobar); |
66 // TODO(droger): Remove the notifications and have listeners change to be | 69 // TODO(droger): Remove the notifications and have listeners change to be |
67 // InfoBarManager::Observers instead. See http://crbug.com/354380 | 70 // InfoBarManager::Observers instead. See http://crbug.com/354380 |
68 content::NotificationService::current()->Notify( | 71 content::NotificationService::current()->Notify( |
69 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, | 72 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
70 content::Source<InfoBarService>(this), | 73 content::Source<InfoBarService>(this), |
71 content::Details<infobars::InfoBar::AddedDetails>(infobar)); | 74 content::Details<infobars::InfoBar::AddedDetails>(infobar)); |
72 } | 75 } |
73 | 76 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void InfoBarService::OpenURL(const GURL& url, | 136 void InfoBarService::OpenURL(const GURL& url, |
134 WindowOpenDisposition disposition) { | 137 WindowOpenDisposition disposition) { |
135 // A normal user click on an infobar URL will result in a CURRENT_TAB | 138 // A normal user click on an infobar URL will result in a CURRENT_TAB |
136 // disposition; turn that into a NEW_FOREGROUND_TAB so that we don't end up | 139 // disposition; turn that into a NEW_FOREGROUND_TAB so that we don't end up |
137 // smashing the page the user is looking at. | 140 // smashing the page the user is looking at. |
138 web_contents()->OpenURL(content::OpenURLParams( | 141 web_contents()->OpenURL(content::OpenURLParams( |
139 url, content::Referrer(), | 142 url, content::Referrer(), |
140 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 143 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
141 ui::PAGE_TRANSITION_LINK, false)); | 144 ui::PAGE_TRANSITION_LINK, false)); |
142 } | 145 } |
OLD | NEW |