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/browser_tabstrip.h" |
14 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 15 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
15 #include "chrome/browser/view_type_utils.h" | 16 #include "chrome/browser/view_type_utils.h" |
16 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
17 #include "chrome/common/extensions/extension_messages.h" | 18 #include "chrome/common/extensions/extension_messages.h" |
18 #include "chrome/common/render_messages.h" | 19 #include "chrome/common/render_messages.h" |
19 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
20 #include "content/public/browser/navigation_controller.h" | 21 #include "content/public/browser/navigation_controller.h" |
21 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
23 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 balloon_->ResizeDueToAutoResize(pref_size); | 76 balloon_->ResizeDueToAutoResize(pref_size); |
76 } | 77 } |
77 | 78 |
78 void BalloonHost::AddNewContents(WebContents* source, | 79 void BalloonHost::AddNewContents(WebContents* source, |
79 WebContents* new_contents, | 80 WebContents* new_contents, |
80 WindowOpenDisposition disposition, | 81 WindowOpenDisposition disposition, |
81 const gfx::Rect& initial_pos, | 82 const gfx::Rect& initial_pos, |
82 bool user_gesture) { | 83 bool user_gesture) { |
83 Browser* browser = browser::FindLastActiveWithProfile( | 84 Browser* browser = browser::FindLastActiveWithProfile( |
84 Profile::FromBrowserContext(new_contents->GetBrowserContext())); | 85 Profile::FromBrowserContext(new_contents->GetBrowserContext())); |
85 if (!browser) | 86 if (browser) { |
86 return; | 87 chrome::AddWebContents(browser, NULL, new_contents, disposition, |
87 browser->AddWebContents(new_contents, disposition, initial_pos, user_gesture); | 88 initial_pos, user_gesture); |
| 89 } |
88 } | 90 } |
89 | 91 |
90 void BalloonHost::RenderViewCreated(content::RenderViewHost* render_view_host) { | 92 void BalloonHost::RenderViewCreated(content::RenderViewHost* render_view_host) { |
91 gfx::Size min_size(BalloonCollectionImpl::min_balloon_width(), | 93 gfx::Size min_size(BalloonCollectionImpl::min_balloon_width(), |
92 BalloonCollectionImpl::min_balloon_height()); | 94 BalloonCollectionImpl::min_balloon_height()); |
93 gfx::Size max_size(BalloonCollectionImpl::max_balloon_width(), | 95 gfx::Size max_size(BalloonCollectionImpl::max_balloon_width(), |
94 BalloonCollectionImpl::max_balloon_height()); | 96 BalloonCollectionImpl::max_balloon_height()); |
95 render_view_host->EnableAutoResize(min_size, max_size); | 97 render_view_host->EnableAutoResize(min_size, max_size); |
96 | 98 |
97 if (enable_web_ui_) | 99 if (enable_web_ui_) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 bool BalloonHost::CanLoadDataURLsInWebUI() const { | 172 bool BalloonHost::CanLoadDataURLsInWebUI() const { |
171 #if defined(OS_CHROMEOS) | 173 #if defined(OS_CHROMEOS) |
172 // Chrome OS uses data URLs in WebUI BalloonHosts. We normally do not allow | 174 // 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, | 175 // data URLs in WebUI renderers, but normal pages cannot target BalloonHosts, |
174 // so this should be safe. | 176 // so this should be safe. |
175 return true; | 177 return true; |
176 #else | 178 #else |
177 return false; | 179 return false; |
178 #endif | 180 #endif |
179 } | 181 } |
OLD | NEW |