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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 void BalloonHost::OnRequest(const ExtensionHostMsg_Request_Params& params) { | 133 void BalloonHost::OnRequest(const ExtensionHostMsg_Request_Params& params) { |
134 extension_function_dispatcher_.Dispatch(params, | 134 extension_function_dispatcher_.Dispatch(params, |
135 web_contents_->GetRenderViewHost()); | 135 web_contents_->GetRenderViewHost()); |
136 } | 136 } |
137 | 137 |
138 void BalloonHost::Init() { | 138 void BalloonHost::Init() { |
139 DCHECK(!web_contents_.get()) << "BalloonViewHost already initialized."; | 139 DCHECK(!web_contents_.get()) << "BalloonViewHost already initialized."; |
140 web_contents_.reset(WebContents::Create( | 140 web_contents_.reset(WebContents::Create( |
141 WebContents::CreateParams(balloon_->profile(), site_instance_.get()))); | 141 WebContents::CreateParams(balloon_->profile(), site_instance_.get()))); |
142 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_NOTIFICATION); | 142 chrome::SetViewType(web_contents_.get(), extensions::VIEW_TYPE_NOTIFICATION); |
143 web_contents_->SetDelegate(this); | 143 web_contents_->SetDelegate(this); |
144 Observe(web_contents_.get()); | 144 Observe(web_contents_.get()); |
145 renderer_preferences_util::UpdateFromSystemSettings( | 145 renderer_preferences_util::UpdateFromSystemSettings( |
146 web_contents_->GetMutableRendererPrefs(), balloon_->profile()); | 146 web_contents_->GetMutableRendererPrefs(), balloon_->profile()); |
147 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); | 147 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); |
148 | 148 |
149 web_contents_->GetController().LoadURL( | 149 web_contents_->GetController().LoadURL( |
150 balloon_->notification().content_url(), content::Referrer(), | 150 balloon_->notification().content_url(), content::Referrer(), |
151 content::PAGE_TRANSITION_LINK, std::string()); | 151 content::PAGE_TRANSITION_LINK, std::string()); |
152 | 152 |
(...skipping 27 matching lines...) Expand all Loading... |
180 bool BalloonHost::CanLoadDataURLsInWebUI() const { | 180 bool BalloonHost::CanLoadDataURLsInWebUI() const { |
181 #if defined(OS_CHROMEOS) | 181 #if defined(OS_CHROMEOS) |
182 // Chrome OS uses data URLs in WebUI BalloonHosts. We normally do not allow | 182 // Chrome OS uses data URLs in WebUI BalloonHosts. We normally do not allow |
183 // data URLs in WebUI renderers, but normal pages cannot target BalloonHosts, | 183 // data URLs in WebUI renderers, but normal pages cannot target BalloonHosts, |
184 // so this should be safe. | 184 // so this should be safe. |
185 return true; | 185 return true; |
186 #else | 186 #else |
187 return false; | 187 return false; |
188 #endif | 188 #endif |
189 } | 189 } |
OLD | NEW |