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

Unified Diff: chrome/browser/views/shell_dialogs_win.cc

Issue 345037: Fifth patch in getting rid of caching MessageLoop pointers. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/shell_dialogs_win.cc
===================================================================
--- chrome/browser/views/shell_dialogs_win.cc (revision 30691)
+++ chrome/browser/views/shell_dialogs_win.cc (working copy)
@@ -19,7 +19,7 @@
#include "base/scoped_comptr_win.h"
#include "base/string_util.h"
#include "base/thread.h"
-#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chrome_thread.h"
#include "grit/generated_resources.h"
// Helpers to show certain types of Windows shell dialogs in a way that doesn't
@@ -90,9 +90,6 @@
// returns.
void DisableOwner(HWND owner);
- // The UI thread's message loop.
- MessageLoop* ui_loop_;
-
private:
// Creates a thread to run a shell dialog on. Each dialog requires its own
// thread otherwise in some situations where a singleton owns a single
@@ -126,8 +123,7 @@
BaseShellDialogImpl::Owners BaseShellDialogImpl::owners_;
int BaseShellDialogImpl::instance_count_ = 0;
-BaseShellDialogImpl::BaseShellDialogImpl()
- : ui_loop_(MessageLoop::current()) {
+BaseShellDialogImpl::BaseShellDialogImpl() {
++instance_count_;
}
@@ -372,21 +368,27 @@
std::vector<FilePath> paths;
if (RunOpenMultiFileDialog(params.title, filter,
params.run_state.owner, &paths)) {
- ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
- &SelectFileDialogImpl::MultiFilesSelected,
- paths, params.params, params.run_state));
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(
+ this, &SelectFileDialogImpl::MultiFilesSelected, paths,
+ params.params, params.run_state));
return;
}
}
if (success) {
- ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
- &SelectFileDialogImpl::FileSelected, path, filter_index,
- params.params, params.run_state));
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(
+ this, &SelectFileDialogImpl::FileSelected, path, filter_index,
+ params.params, params.run_state));
} else {
- ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
- &SelectFileDialogImpl::FileNotSelected, params.params,
- params.run_state));
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(
+ this, &SelectFileDialogImpl::FileNotSelected, params.params,
+ params.run_state));
}
}
@@ -657,11 +659,16 @@
bool success = !!ChooseFont(&cf);
DisableOwner(run_state.owner);
if (success) {
- ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
- &SelectFontDialogImpl::FontSelected, logfont, params, run_state));
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(
+ this, &SelectFontDialogImpl::FontSelected, logfont, params,
+ run_state));
} else {
- ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
- &SelectFontDialogImpl::FontNotSelected, params, run_state));
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(
+ this, &SelectFontDialogImpl::FontNotSelected, params, run_state));
}
}
@@ -715,11 +722,16 @@
bool success = !!ChooseFont(&cf);
DisableOwner(run_state.owner);
if (success) {
- ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
- &SelectFontDialogImpl::FontSelected, logfont, params, run_state));
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(
+ this, &SelectFontDialogImpl::FontSelected, logfont, params,
+ run_state));
} else {
- ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
- &SelectFontDialogImpl::FontNotSelected, params, run_state));
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(this, &SelectFontDialogImpl::FontNotSelected, params,
+ run_state));
}
}

Powered by Google App Engine
This is Rietveld 408576698