| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 void InfoBarService::WebContentsDestroyed() { | 109 void InfoBarService::WebContentsDestroyed() { |
| 110 // The WebContents is going away; be aggressively paranoid and delete | 110 // The WebContents is going away; be aggressively paranoid and delete |
| 111 // ourselves lest other parts of the system attempt to add infobars or use | 111 // ourselves lest other parts of the system attempt to add infobars or use |
| 112 // us otherwise during the destruction. | 112 // us otherwise during the destruction. |
| 113 web_contents()->RemoveUserData(UserDataKey()); | 113 web_contents()->RemoveUserData(UserDataKey()); |
| 114 // That was the equivalent of "delete this". This object is now destroyed; | 114 // That was the equivalent of "delete this". This object is now destroyed; |
| 115 // returning from this function is the only safe thing to do. | 115 // returning from this function is the only safe thing to do. |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool InfoBarService::OnMessageReceived(const IPC::Message& message) { | 118 bool InfoBarService::OnMessageReceived( |
| 119 const IPC::Message& message, |
| 120 content::RenderFrameHost* render_frame_host) { |
| 119 bool handled = true; | 121 bool handled = true; |
| 120 IPC_BEGIN_MESSAGE_MAP(InfoBarService, message) | 122 IPC_BEGIN_MESSAGE_MAP(InfoBarService, message) |
| 121 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidBlockDisplayingInsecureContent, | 123 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidBlockDisplayingInsecureContent, |
| 122 OnDidBlockDisplayingInsecureContent) | 124 OnDidBlockDisplayingInsecureContent) |
| 123 IPC_MESSAGE_UNHANDLED(handled = false) | 125 IPC_MESSAGE_UNHANDLED(handled = false) |
| 124 IPC_END_MESSAGE_MAP() | 126 IPC_END_MESSAGE_MAP() |
| 125 return handled; | 127 return handled; |
| 126 } | 128 } |
| 127 | 129 |
| 128 void InfoBarService::OnDidBlockDisplayingInsecureContent() { | 130 void InfoBarService::OnDidBlockDisplayingInsecureContent() { |
| 129 InsecureContentInfoBarDelegate::Create(this); | 131 InsecureContentInfoBarDelegate::Create(this); |
| 130 } | 132 } |
| 131 | 133 |
| 132 void InfoBarService::OpenURL(const GURL& url, | 134 void InfoBarService::OpenURL(const GURL& url, |
| 133 WindowOpenDisposition disposition) { | 135 WindowOpenDisposition disposition) { |
| 134 // A normal user click on an infobar URL will result in a CURRENT_TAB | 136 // A normal user click on an infobar URL will result in a CURRENT_TAB |
| 135 // disposition; turn that into a NEW_FOREGROUND_TAB so that we don't end up | 137 // disposition; turn that into a NEW_FOREGROUND_TAB so that we don't end up |
| 136 // smashing the page the user is looking at. | 138 // smashing the page the user is looking at. |
| 137 web_contents()->OpenURL(content::OpenURLParams( | 139 web_contents()->OpenURL(content::OpenURLParams( |
| 138 url, content::Referrer(), | 140 url, content::Referrer(), |
| 139 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 141 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 140 ui::PAGE_TRANSITION_LINK, false)); | 142 ui::PAGE_TRANSITION_LINK, false)); |
| 141 } | 143 } |
| OLD | NEW |