| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/notifications/balloon.h" | 6 #include "chrome/browser/notifications/balloon.h" |
| 7 #include "chrome/browser/notifications/notification.h" | 7 #include "chrome/browser/notifications/notification.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/renderer_preferences_util.h" | 9 #include "chrome/browser/renderer_preferences_util.h" |
| 10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 balloon_->profile(), | 115 balloon_->profile(), |
| 116 site_instance_.get(), | 116 site_instance_.get(), |
| 117 MSG_ROUTING_NONE, | 117 MSG_ROUTING_NONE, |
| 118 NULL, | 118 NULL, |
| 119 NULL)); | 119 NULL)); |
| 120 tab_contents_->set_view_type(chrome::VIEW_TYPE_NOTIFICATION); | 120 tab_contents_->set_view_type(chrome::VIEW_TYPE_NOTIFICATION); |
| 121 tab_contents_->set_delegate(this); | 121 tab_contents_->set_delegate(this); |
| 122 Observe(tab_contents_.get()); | 122 Observe(tab_contents_.get()); |
| 123 | 123 |
| 124 tab_contents_->controller().LoadURL( | 124 tab_contents_->controller().LoadURL( |
| 125 balloon_->notification().content_url(), GURL(), | 125 balloon_->notification().content_url(), content::Referrer(), |
| 126 content::PAGE_TRANSITION_LINK, std::string()); | 126 content::PAGE_TRANSITION_LINK, std::string()); |
| 127 | 127 |
| 128 initialized_ = true; | 128 initialized_ = true; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void BalloonHost::EnableWebUI() { | 131 void BalloonHost::EnableWebUI() { |
| 132 DCHECK(!tab_contents_.get()) << | 132 DCHECK(!tab_contents_.get()) << |
| 133 "EnableWebUI has to be called before a renderer is created."; | 133 "EnableWebUI has to be called before a renderer is created."; |
| 134 enable_web_ui_ = true; | 134 enable_web_ui_ = true; |
| 135 } | 135 } |
| 136 | 136 |
| 137 BalloonHost::~BalloonHost() { | 137 BalloonHost::~BalloonHost() { |
| 138 } | 138 } |
| 139 | 139 |
| 140 void BalloonHost::NotifyDisconnect() { | 140 void BalloonHost::NotifyDisconnect() { |
| 141 if (!should_notify_on_disconnect_) | 141 if (!should_notify_on_disconnect_) |
| 142 return; | 142 return; |
| 143 | 143 |
| 144 should_notify_on_disconnect_ = false; | 144 should_notify_on_disconnect_ = false; |
| 145 content::NotificationService::current()->Notify( | 145 content::NotificationService::current()->Notify( |
| 146 chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, | 146 chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, |
| 147 content::Source<BalloonHost>(this), | 147 content::Source<BalloonHost>(this), |
| 148 content::NotificationService::NoDetails()); | 148 content::NotificationService::NoDetails()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool BalloonHost::IsRenderViewReady() const { | 151 bool BalloonHost::IsRenderViewReady() const { |
| 152 return should_notify_on_disconnect_; | 152 return should_notify_on_disconnect_; |
| 153 } | 153 } |
| OLD | NEW |