Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/ui/panels/panel_host.cc

Issue 1160073004: chrome/browser/ui: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check for task runner instead of current message loop. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 CloseContents(web_contents_.get()); 211 CloseContents(web_contents_.get());
210 } 212 }
211 213
212 void PanelHost::WebContentsDestroyed() { 214 void PanelHost::WebContentsDestroyed() {
213 // Web contents should only be destroyed by us. 215 // Web contents should only be destroyed by us.
214 CHECK(!web_contents_.get()); 216 CHECK(!web_contents_.get());
215 217
216 // Close the panel after we return to the message loop (not immediately, 218 // Close the panel after we return to the message loop (not immediately,
217 // otherwise, it may destroy this object before the stack has a chance 219 // otherwise, it may destroy this object before the stack has a chance
218 // to cleanly unwind.) 220 // to cleanly unwind.)
219 base::MessageLoop::current()->PostTask( 221 base::ThreadTaskRunnerHandle::Get()->PostTask(
220 FROM_HERE, 222 FROM_HERE,
221 base::Bind(&PanelHost::ClosePanel, weak_factory_.GetWeakPtr())); 223 base::Bind(&PanelHost::ClosePanel, weak_factory_.GetWeakPtr()));
222 } 224 }
223 225
224 void PanelHost::ClosePanel() { 226 void PanelHost::ClosePanel() {
225 panel_->Close(); 227 panel_->Close();
226 } 228 }
227 229
228 bool PanelHost::OnMessageReceived(const IPC::Message& message) { 230 bool PanelHost::OnMessageReceived(const IPC::Message& message) {
229 bool handled = true; 231 bool handled = true;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 263 }
262 264
263 void PanelHost::StopLoading() { 265 void PanelHost::StopLoading() {
264 content::RecordAction(UserMetricsAction("Stop")); 266 content::RecordAction(UserMetricsAction("Stop"));
265 web_contents_->Stop(); 267 web_contents_->Stop();
266 } 268 }
267 269
268 void PanelHost::Zoom(content::PageZoom zoom) { 270 void PanelHost::Zoom(content::PageZoom zoom) {
269 ui_zoom::PageZoom::Zoom(web_contents_.get(), zoom); 271 ui_zoom::PageZoom::Zoom(web_contents_.get(), zoom);
270 } 272 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698