| 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" |
| 11 #include "chrome/browser/renderer_preferences_util.h" | 11 #include "chrome/browser/renderer_preferences_util.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
| 14 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 14 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
| 15 #include "chrome/browser/view_type_utils.h" |
| 15 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "chrome/common/chrome_view_type.h" | |
| 17 #include "chrome/common/extensions/extension_messages.h" | 17 #include "chrome/common/extensions/extension_messages.h" |
| 18 #include "chrome/common/render_messages.h" | 18 #include "chrome/common/render_messages.h" |
| 19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 20 #include "content/public/browser/navigation_controller.h" | 20 #include "content/public/browser/navigation_controller.h" |
| 21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
| 23 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
| 24 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
| 25 #include "content/public/browser/site_instance.h" | 25 #include "content/public/browser/site_instance.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 125 } |
| 126 | 126 |
| 127 void BalloonHost::Init() { | 127 void BalloonHost::Init() { |
| 128 DCHECK(!web_contents_.get()) << "BalloonViewHost already initialized."; | 128 DCHECK(!web_contents_.get()) << "BalloonViewHost already initialized."; |
| 129 web_contents_.reset(WebContents::Create( | 129 web_contents_.reset(WebContents::Create( |
| 130 balloon_->profile(), | 130 balloon_->profile(), |
| 131 site_instance_.get(), | 131 site_instance_.get(), |
| 132 MSG_ROUTING_NONE, | 132 MSG_ROUTING_NONE, |
| 133 NULL, | 133 NULL, |
| 134 NULL)); | 134 NULL)); |
| 135 web_contents_->SetViewType(chrome::VIEW_TYPE_NOTIFICATION); | 135 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_NOTIFICATION); |
| 136 web_contents_->SetDelegate(this); | 136 web_contents_->SetDelegate(this); |
| 137 Observe(web_contents_.get()); | 137 Observe(web_contents_.get()); |
| 138 | 138 |
| 139 web_contents_->GetController().LoadURL( | 139 web_contents_->GetController().LoadURL( |
| 140 balloon_->notification().content_url(), content::Referrer(), | 140 balloon_->notification().content_url(), content::Referrer(), |
| 141 content::PAGE_TRANSITION_LINK, std::string()); | 141 content::PAGE_TRANSITION_LINK, std::string()); |
| 142 | 142 |
| 143 initialized_ = true; | 143 initialized_ = true; |
| 144 } | 144 } |
| 145 | 145 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 170 bool BalloonHost::CanLoadDataURLsInWebUI() const { | 170 bool BalloonHost::CanLoadDataURLsInWebUI() const { |
| 171 #if defined(OS_CHROMEOS) | 171 #if defined(OS_CHROMEOS) |
| 172 // Chrome OS uses data URLs in WebUI BalloonHosts. We normally do not allow | 172 // Chrome OS uses data URLs in WebUI BalloonHosts. We normally do not allow |
| 173 // data URLs in WebUI renderers, but normal pages cannot target BalloonHosts, | 173 // data URLs in WebUI renderers, but normal pages cannot target BalloonHosts, |
| 174 // so this should be safe. | 174 // so this should be safe. |
| 175 return true; | 175 return true; |
| 176 #else | 176 #else |
| 177 return false; | 177 return false; |
| 178 #endif | 178 #endif |
| 179 } | 179 } |
| OLD | NEW |