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/location.h" |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 13 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
12 #include "chrome/browser/extensions/window_controller.h" | 14 #include "chrome/browser/extensions/window_controller.h" |
13 #include "chrome/browser/favicon/favicon_helper.h" | 15 #include "chrome/browser/favicon/favicon_helper.h" |
14 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/sessions/session_tab_helper.h" | 17 #include "chrome/browser/sessions/session_tab_helper.h" |
16 #include "chrome/browser/ui/browser_navigator.h" | 18 #include "chrome/browser/ui/browser_navigator.h" |
17 #include "chrome/browser/ui/panels/panel.h" | 19 #include "chrome/browser/ui/panels/panel.h" |
18 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 20 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
19 #include "components/favicon/content/content_favicon_driver.h" | 21 #include "components/favicon/content/content_favicon_driver.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 CloseContents(web_contents_.get()); | 212 CloseContents(web_contents_.get()); |
211 } | 213 } |
212 | 214 |
213 void PanelHost::WebContentsDestroyed() { | 215 void PanelHost::WebContentsDestroyed() { |
214 // Web contents should only be destroyed by us. | 216 // Web contents should only be destroyed by us. |
215 CHECK(!web_contents_.get()); | 217 CHECK(!web_contents_.get()); |
216 | 218 |
217 // Close the panel after we return to the message loop (not immediately, | 219 // Close the panel after we return to the message loop (not immediately, |
218 // otherwise, it may destroy this object before the stack has a chance | 220 // otherwise, it may destroy this object before the stack has a chance |
219 // to cleanly unwind.) | 221 // to cleanly unwind.) |
220 base::MessageLoop::current()->PostTask( | 222 base::ThreadTaskRunnerHandle::Get()->PostTask( |
221 FROM_HERE, | 223 FROM_HERE, |
222 base::Bind(&PanelHost::ClosePanel, weak_factory_.GetWeakPtr())); | 224 base::Bind(&PanelHost::ClosePanel, weak_factory_.GetWeakPtr())); |
223 } | 225 } |
224 | 226 |
225 void PanelHost::ClosePanel() { | 227 void PanelHost::ClosePanel() { |
226 panel_->Close(); | 228 panel_->Close(); |
227 } | 229 } |
228 | 230 |
229 extensions::WindowController* PanelHost::GetExtensionWindowController() const { | 231 extensions::WindowController* PanelHost::GetExtensionWindowController() const { |
230 return panel_->extension_window_controller(); | 232 return panel_->extension_window_controller(); |
(...skipping 14 matching lines...) Expand all Loading... |
245 } | 247 } |
246 | 248 |
247 void PanelHost::StopLoading() { | 249 void PanelHost::StopLoading() { |
248 content::RecordAction(UserMetricsAction("Stop")); | 250 content::RecordAction(UserMetricsAction("Stop")); |
249 web_contents_->Stop(); | 251 web_contents_->Stop(); |
250 } | 252 } |
251 | 253 |
252 void PanelHost::Zoom(content::PageZoom zoom) { | 254 void PanelHost::Zoom(content::PageZoom zoom) { |
253 ui_zoom::PageZoom::Zoom(web_contents_.get(), zoom); | 255 ui_zoom::PageZoom::Zoom(web_contents_.get(), zoom); |
254 } | 256 } |
OLD | NEW |