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/ui/panels/panel_host.h" | 5 #include "chrome/browser/ui/panels/panel_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/chrome_page_zoom.h" | 10 #include "chrome/browser/chrome_page_zoom.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 CloseContents(web_contents_.get()); | 197 CloseContents(web_contents_.get()); |
198 } | 198 } |
199 | 199 |
200 void PanelHost::WebContentsDestroyed(content::WebContents* web_contents) { | 200 void PanelHost::WebContentsDestroyed(content::WebContents* web_contents) { |
201 // Web contents should only be destroyed by us. | 201 // Web contents should only be destroyed by us. |
202 CHECK(!web_contents_.get()); | 202 CHECK(!web_contents_.get()); |
203 | 203 |
204 // Close the panel after we return to the message loop (not immediately, | 204 // Close the panel after we return to the message loop (not immediately, |
205 // otherwise, it may destroy this object before the stack has a chance | 205 // otherwise, it may destroy this object before the stack has a chance |
206 // to cleanly unwind.) | 206 // to cleanly unwind.) |
207 MessageLoop::current()->PostTask( | 207 base::MessageLoop::current()->PostTask( |
208 FROM_HERE, | 208 FROM_HERE, |
209 base::Bind(&PanelHost::ClosePanel, weak_factory_.GetWeakPtr())); | 209 base::Bind(&PanelHost::ClosePanel, weak_factory_.GetWeakPtr())); |
210 } | 210 } |
211 | 211 |
212 void PanelHost::ClosePanel() { | 212 void PanelHost::ClosePanel() { |
213 panel_->Close(); | 213 panel_->Close(); |
214 } | 214 } |
215 | 215 |
216 bool PanelHost::OnMessageReceived(const IPC::Message& message) { | 216 bool PanelHost::OnMessageReceived(const IPC::Message& message) { |
217 bool handled = true; | 217 bool handled = true; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 249 } |
250 | 250 |
251 void PanelHost::StopLoading() { | 251 void PanelHost::StopLoading() { |
252 content::RecordAction(UserMetricsAction("Stop")); | 252 content::RecordAction(UserMetricsAction("Stop")); |
253 web_contents_->Stop(); | 253 web_contents_->Stop(); |
254 } | 254 } |
255 | 255 |
256 void PanelHost::Zoom(content::PageZoom zoom) { | 256 void PanelHost::Zoom(content::PageZoom zoom) { |
257 chrome_page_zoom::Zoom(web_contents_.get(), zoom); | 257 chrome_page_zoom::Zoom(web_contents_.get(), zoom); |
258 } | 258 } |
OLD | NEW |