| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/notifications/balloon_host.h" | 5 #include "chrome/browser/notifications/balloon_host.h" |
| 6 | 6 |
| 7 #include "chrome/browser/notifications/balloon.h" | 7 #include "chrome/browser/notifications/balloon.h" |
| 8 #include "chrome/browser/notifications/balloon_collection_impl.h" | 8 #include "chrome/browser/notifications/balloon_collection_impl.h" |
| 9 #include "chrome/browser/notifications/notification.h" | 9 #include "chrome/browser/notifications/notification.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 extension_function_dispatcher_.Dispatch(params, | 126 extension_function_dispatcher_.Dispatch(params, |
| 127 web_contents_->GetRenderViewHost()); | 127 web_contents_->GetRenderViewHost()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void BalloonHost::Init() { | 130 void BalloonHost::Init() { |
| 131 DCHECK(!web_contents_.get()) << "BalloonViewHost already initialized."; | 131 DCHECK(!web_contents_.get()) << "BalloonViewHost already initialized."; |
| 132 web_contents_.reset(WebContents::Create( | 132 web_contents_.reset(WebContents::Create( |
| 133 balloon_->profile(), | 133 balloon_->profile(), |
| 134 site_instance_.get(), | 134 site_instance_.get(), |
| 135 MSG_ROUTING_NONE, | 135 MSG_ROUTING_NONE, |
| 136 NULL, | |
| 137 NULL)); | 136 NULL)); |
| 138 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_NOTIFICATION); | 137 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_NOTIFICATION); |
| 139 web_contents_->SetDelegate(this); | 138 web_contents_->SetDelegate(this); |
| 140 Observe(web_contents_.get()); | 139 Observe(web_contents_.get()); |
| 141 renderer_preferences_util::UpdateFromSystemSettings( | 140 renderer_preferences_util::UpdateFromSystemSettings( |
| 142 web_contents_->GetMutableRendererPrefs(), balloon_->profile()); | 141 web_contents_->GetMutableRendererPrefs(), balloon_->profile()); |
| 143 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); | 142 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); |
| 144 | 143 |
| 145 web_contents_->GetController().LoadURL( | 144 web_contents_->GetController().LoadURL( |
| 146 balloon_->notification().content_url(), content::Referrer(), | 145 balloon_->notification().content_url(), content::Referrer(), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 176 bool BalloonHost::CanLoadDataURLsInWebUI() const { | 175 bool BalloonHost::CanLoadDataURLsInWebUI() const { |
| 177 #if defined(OS_CHROMEOS) | 176 #if defined(OS_CHROMEOS) |
| 178 // Chrome OS uses data URLs in WebUI BalloonHosts. We normally do not allow | 177 // Chrome OS uses data URLs in WebUI BalloonHosts. We normally do not allow |
| 179 // data URLs in WebUI renderers, but normal pages cannot target BalloonHosts, | 178 // data URLs in WebUI renderers, but normal pages cannot target BalloonHosts, |
| 180 // so this should be safe. | 179 // so this should be safe. |
| 181 return true; | 180 return true; |
| 182 #else | 181 #else |
| 183 return false; | 182 return false; |
| 184 #endif | 183 #endif |
| 185 } | 184 } |
| OLD | NEW |