diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/chrome_browser_main.cc | 30 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main_mac.mm | 2 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main_win.cc | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/boot_times_loader.cc | 12 | ||||
-rw-r--r-- | chrome/browser/chromeos/boot_times_loader.h | 4 | ||||
-rw-r--r-- | chrome/browser/chromeos/chrome_browser_main_chromeos.cc | 10 | ||||
-rw-r--r-- | chrome/browser/download/download_prefs.cc | 1 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_service_unittest.cc | 1 | ||||
-rw-r--r-- | chrome/browser/history/history_backend.cc | 2 | ||||
-rw-r--r-- | chrome/browser/omnibox_search_hint.cc | 1 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc | 125 | ||||
-rw-r--r-- | chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options2/certificate_manager_handler2.cc | 30 | ||||
-rw-r--r-- | chrome/test/base/view_event_test_base.h | 2 | ||||
-rw-r--r-- | chrome/utility/chrome_content_utility_client.cc | 8 |
15 files changed, 105 insertions, 128 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 3a84656..9547b16 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -415,8 +415,7 @@ Profile* CreateProfile(const content::MainFunctionParams& parameters, // http://code.google.com/p/chromium/issues/detail?id=11510 FilePath new_user_data_dir = UserDataDirDialog::RunUserDataDirDialog( user_data_dir); - if (parameters.ui_task.is_null() && - browser_shutdown::delete_resources_on_shutdown) { + if (!parameters.ui_task && browser_shutdown::delete_resources_on_shutdown) { // Only delete the resources if we're not running tests. If we're running // tests the resources need to be reused as many places in the UI cache // SkBitmaps from the ResourceBundle. @@ -587,7 +586,7 @@ ChromeBrowserMainParts::ChromeBrowserMainParts( local_state_(NULL), restart_last_session_(false) { // If we're running tests (ui_task is non-null). - if (!parameters.ui_task.is_null()) + if (parameters.ui_task) browser_defaults::enable_help_app = false; } @@ -616,9 +615,9 @@ MetricsService* ChromeBrowserMainParts::SetupMetricsAndFieldTrials( prefs::kMaxConnectionsPerProxy)); // Initialize FieldTrialSynchronizer system. This is a singleton and is used - // for posting tasks via base::Bind(). Its deleted when it goes out of - // scope. Even though base::Bind() does AddRef and Release, the object - // will not be deleted after the Task is executed. + // for posting tasks via base::Bind. Its deleted when it goes out of scope. + // Even though base::Bind does AddRef and Release, the object will not be + // deleted after the Task is executed. field_trial_synchronizer_ = new FieldTrialSynchronizer(); return metrics; @@ -1167,7 +1166,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { // If we're running tests (ui_task is non-null), then the ResourceBundle // has already been initialized. - if (!parameters().ui_task.is_null()) { + if (parameters().ui_task) { g_browser_process->SetApplicationLocale("en-US"); } else { // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is @@ -1283,9 +1282,9 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { InitializeURLRequestThrottlerManager(browser_process_->net_log()); // Initialize histogram synchronizer system. This is a singleton and is used - // for posting tasks via base::Bind(). Its deleted when it goes out of - // scope. Even though base::Bind() does AddRef and Release, the object - // will not be deleted after the Task is executed. + // for posting tasks via base::Bind. Its deleted when it goes out of scope. + // Even though base::Bind does AddRef and Release, the object will not + // be deleted after the Task is executed. histogram_synchronizer_ = new HistogramSynchronizer(); tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); @@ -1359,7 +1358,7 @@ void ChromeBrowserMainParts::PreMainMessageLoopRun() { // PostProfileInit() // ... additional setup // PreBrowserStart() -// ... browser_init_->Start (OR parameters().ui_task.Run()) +// ... browser_init_->Start (OR parameters().ui_task->Run()) // PostBrowserStart() void ChromeBrowserMainParts::PreProfileInit() { @@ -1752,13 +1751,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { // http://crbug.com/105065. g_browser_process->notification_ui_manager(); - if (!parameters().ui_task.is_null()) { + if (parameters().ui_task) { // We are in test mode. Run one task and enter the main message loop. #if defined(OS_MACOSX) if (parameters().autorelease_pool) parameters().autorelease_pool->Recycle(); #endif - parameters().ui_task.Run(); + parameters().ui_task->Run(); + delete parameters().ui_task; run_message_loop_ = false; } else { // Most general initialization is behind us, but opening a @@ -1804,7 +1804,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { #if !defined(OS_CHROMEOS) // If we're running tests (ui_task is non-null), then we don't want to // call FetchLanguageListFromTranslateServer - if (parameters().ui_task.is_null() && translate_manager_ != NULL) { + if (parameters().ui_task == NULL && translate_manager_ != NULL) { // TODO(willchan): Get rid of this after TranslateManager doesn't use // the default request context. http://crbug.com/89396. // This is necessary to force |default_request_context_| to be @@ -1912,7 +1912,7 @@ void ChromeBrowserMainParts::PostMainMessageLoopRun() { // Some tests don't set parameters.ui_task, so they started translate // language fetch that was never completed so we need to cleanup here // otherwise it will be done by the destructor in a wrong thread. - if (parameters().ui_task.is_null() && translate_manager_ != NULL) + if (parameters().ui_task == NULL && translate_manager_ != NULL) translate_manager_->CleanupPendingUlrFetcher(); if (notify_result_ == ProcessSingleton::PROCESS_NONE) diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm index d77d1d3..b8aaf29 100644 --- a/chrome/browser/chrome_browser_main_mac.mm +++ b/chrome/browser/chrome_browser_main_mac.mm @@ -75,7 +75,7 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() { // If ui_task is not NULL, the app is actually a browser_test, so startup is // handled outside of BrowserMain (which is what called this). - if (parameters().ui_task.is_null()) { + if (!parameters().ui_task) { // The browser process only wants to support the language Cocoa will use, // so force the app locale to be overriden with that value. l10n_util::OverrideLocaleWithCocoaLocale(); diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index 92b6734..246ff34 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc @@ -174,7 +174,7 @@ void ChromeBrowserMainPartsWin::ToolkitInitialized() { void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { ChromeBrowserMainParts::PreMainMessageLoopStart(); - if (parameters().ui_task.is_null()) { + if (!parameters().ui_task) { // Make sure that we know how to handle exceptions from the message loop. InitializeWindowProcExceptions(); } diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index f601332..ca821444 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -212,7 +212,7 @@ static void SendBootTimesToUMA(const BootTimesLoader::BootTimes& boot_times) { } void BootTimesLoader::Backend::GetBootTimes( - const scoped_refptr<GetBootTimesRequest>& request) { + scoped_refptr<GetBootTimesRequest> request) { const FilePath::CharType kFirmwareBootTime[] = FPL("firmware-boot-time"); const FilePath::CharType kPreStartup[] = FPL("pre-startup"); const FilePath::CharType kChromeExec[] = FPL("chrome-exec"); @@ -356,7 +356,13 @@ void BootTimesLoader::LoginDone() { // Don't swamp the FILE thread right away. BrowserThread::PostDelayedTask( BrowserThread::FILE, FROM_HERE, - base::Bind(&WriteTimes, kLoginTimes, kUmaLogin, kUmaLoginPrefix, + // This doesn't compile without std::string(...), as base::Bind doesn't + // accept arrays. + // TODO(jhawkins): Verify this is true for base::Bind. + base::Bind(WriteTimes, + std::string(kLoginTimes), + std::string(kUmaLogin), + std::string(kUmaLoginPrefix), login_time_markers_), kLoginTimeWriteDelayMs); } @@ -371,7 +377,7 @@ void BootTimesLoader::WriteLogoutTimes() { void BootTimesLoader::RecordStats(const std::string& name, const Stats& stats) { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - base::Bind(&RecordStatsDelayed, name, stats.uptime, stats.disk)); + base::Bind(RecordStatsDelayed, name, stats.uptime, stats.disk)); } BootTimesLoader::Stats BootTimesLoader::GetCurrentStats() { diff --git a/chrome/browser/chromeos/boot_times_loader.h b/chrome/browser/chromeos/boot_times_loader.h index 0cae34f..0e56fdd 100644 --- a/chrome/browser/chromeos/boot_times_loader.h +++ b/chrome/browser/chromeos/boot_times_loader.h @@ -10,7 +10,7 @@ #include <string> #include "base/atomic_sequence_num.h" -#include "base/callback_forward.h" +#include "base/callback_old.h" #include "base/compiler_specific.h" #include "base/time.h" #include "chrome/browser/cancelable_request.h" @@ -120,7 +120,7 @@ class BootTimesLoader public: Backend() {} - void GetBootTimes(const scoped_refptr<GetBootTimesRequest>& request); + void GetBootTimes(scoped_refptr<GetBootTimesRequest> request); private: friend class base::RefCountedThreadSafe<Backend>; diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 7e65ac8..1043798 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc @@ -222,7 +222,7 @@ ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { chromeos::DBusThreadManager::Shutdown(); - if (parameters().ui_task.is_null() && chromeos::CrosLibrary::Get()) + if (!parameters().ui_task && chromeos::CrosLibrary::Get()) chromeos::CrosLibrary::Shutdown(); // To be precise, logout (browser shutdown) is not yet done, but the @@ -249,7 +249,7 @@ void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { // Initialize CrosLibrary only for the browser, unless running tests // (which do their own CrosLibrary setup). - if (parameters().ui_task.is_null()) { + if (!parameters().ui_task) { bool use_stub = parameters().command_line.HasSwitch(switches::kStubCros); chromeos::CrosLibrary::Initialize(use_stub); } @@ -341,7 +341,7 @@ void ChromeBrowserMainPartsChromeos::PostProfileInit() { // Tests should be able to tune login manager before showing it. // Thus only show login manager in normal (non-testing) mode. - if (parameters().ui_task.is_null()) + if (!parameters().ui_task) OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); ChromeBrowserMainPartsLinux::PostProfileInit(); @@ -359,10 +359,8 @@ void ChromeBrowserMainPartsChromeos::PreBrowserStart() { // Listen for system key events so that the user will be able to adjust the // volume on the login screen, if Chrome is running on Chrome OS // (i.e. not Linux desktop), and in non-test mode. - // - // ui_task is non-NULL when running tests. if (chromeos::system::runtime_environment::IsRunningOnChromeOS() && - parameters().ui_task.is_null()) { + !parameters().ui_task) { // ui_task is non-NULL when running tests. chromeos::SystemKeyEventListener::Initialize(); } diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc index e6e127b..6096ac5 100644 --- a/chrome/browser/download/download_prefs.cc +++ b/chrome/browser/download/download_prefs.cc @@ -5,7 +5,6 @@ #include "chrome/browser/download/download_prefs.h" #include "base/bind.h" -#include "base/bind_helpers.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_split.h" diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 5877b2a..094088e 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -15,7 +15,6 @@ #include "base/json/json_reader.h" #include "base/json/json_value_serializer.h" #include "base/memory/scoped_ptr.h" -#include "base/memory/weak_ptr.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/scoped_temp_dir.h" diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index 3e44f24..1d86061 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -9,7 +9,7 @@ #include <set> #include <vector> -#include "base/bind.h" +#include "base/callback.h" #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/file_util.h" diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc index 8762d61..92532a1 100644 --- a/chrome/browser/omnibox_search_hint.cc +++ b/chrome/browser/omnibox_search_hint.cc @@ -9,6 +9,7 @@ #include "base/memory/weak_ptr.h" #include "base/message_loop.h" #include "base/metrics/histogram.h" +#include "base/task.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_match.h" diff --git a/chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc b/chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc index da93e54..10026d3 100644 --- a/chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc +++ b/chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc @@ -58,29 +58,6 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { private: virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; - struct KDialogParams { - KDialogParams(const std::string& type, const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent, - bool file_operation, bool multiple_selection, - void* kdialog_params, - void (SelectFileDialogImplKDE::*callback)(const std::string&, - int, void*)) - : type(type), title(title), default_path(default_path), parent(parent), - file_operation(file_operation), - multiple_selection(multiple_selection), - kdialog_params(kdialog_params), callback(callback) { - } - - std::string type; - std::string title; - FilePath default_path; - gfx::NativeWindow parent; - bool file_operation; - bool multiple_selection; - void* kdialog_params; - void (SelectFileDialogImplKDE::*callback)(const std::string&, int, void*); - }; - // Get the filters from |file_types_| and concatenate them into // |filter_string|. std::string GetMimeTypeFilterString(); @@ -91,7 +68,11 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { bool file_operation, bool multiple_selection, CommandLine* command_line); // Call KDialog on the FILE thread and post results back to the UI thread. - void CallKDialogOutput(const KDialogParams& params); + void CallKDialogOutput(const std::string& type, const std::string& title, + const FilePath& default_path, gfx::NativeWindow parent, + bool file_operation, bool multiple_selection, void* params, + void (SelectFileDialogImplKDE::*callback)(const std::string&, + int, void*)); // Notifies the listener that a single file was chosen. void FileSelected(const FilePath& path, void* params); @@ -235,12 +216,15 @@ std::string SelectFileDialogImplKDE::GetMimeTypeFilterString() { return filter_string; } -void SelectFileDialogImplKDE::CallKDialogOutput(const KDialogParams& params) { +void SelectFileDialogImplKDE::CallKDialogOutput( + const std::string& type, const std::string& title, + const FilePath& default_path, gfx::NativeWindow parent, + bool file_operation, bool multiple_selection, void* params, + void (SelectFileDialogImplKDE::*callback)(const std::string&, int, void*)) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); CommandLine command_line(FilePath("kdialog")); - GetKDialogCommandLine(params.type, params.title, params.default_path, - params.parent, params.file_operation, - params.multiple_selection, &command_line); + GetKDialogCommandLine(type, title, default_path, parent, file_operation, + multiple_selection, &command_line); std::string output; int exit_code; // Get output from KDialog @@ -249,13 +233,12 @@ void SelectFileDialogImplKDE::CallKDialogOutput(const KDialogParams& params) { output.erase(output.size() - 1); // Now the dialog is no longer showing. We can erase its parent from the // parent set. - std::set<GtkWindow*>::iterator iter = parents_.find(params.parent); + std::set<GtkWindow*>::iterator iter = parents_.find(parent); if (iter != parents_.end()) parents_.erase(iter); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(params.callback, this, output, exit_code, - params.kdialog_params)); + base::Bind(callback, this, output, exit_code, params)); } void SelectFileDialogImplKDE::GetKDialogCommandLine(const std::string& type, @@ -324,65 +307,57 @@ void SelectFileDialogImplKDE::FileNotSelected(void* params) { void SelectFileDialogImplKDE::CreateSelectFolderDialog( const std::string& title, const FilePath& default_path, gfx::NativeWindow parent, void *params) { - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - base::Bind( - &SelectFileDialogImplKDE::CallKDialogOutput, - this, - KDialogParams( - "--getexistingdirectory", - GetTitle(title, IDS_SELECT_FOLDER_DIALOG_TITLE), - default_path.empty() ? *last_opened_path_ : default_path, - parent, false, false, params, - &SelectFileDialogImplKDE::OnSelectSingleFolderDialogResponse))); + Task* dialog_task = + NewRunnableMethod( + this, &SelectFileDialogImplKDE::CallKDialogOutput, + std::string("--getexistingdirectory"), + GetTitle(title, IDS_SELECT_FOLDER_DIALOG_TITLE), + default_path.empty() ? *last_opened_path_ : default_path, + parent, false, false, params, + &SelectFileDialogImplKDE::OnSelectSingleFolderDialogResponse); + BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, dialog_task); } void SelectFileDialogImplKDE::CreateFileOpenDialog( const std::string& title, const FilePath& default_path, gfx::NativeWindow parent, void* params) { - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - base::Bind( - &SelectFileDialogImplKDE::CallKDialogOutput, - this, - KDialogParams( - "--getopenfilename", - GetTitle(title, IDS_OPEN_FILE_DIALOG_TITLE), - default_path.empty() ? *last_opened_path_ : default_path, - parent, true, false, params, - &SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse))); + Task* dialog_task = + NewRunnableMethod( + this, &SelectFileDialogImplKDE::CallKDialogOutput, + std::string("--getopenfilename"), + GetTitle(title, IDS_OPEN_FILE_DIALOG_TITLE), + default_path.empty() ? *last_opened_path_ : default_path, + parent, true, false, params, + &SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse); + BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, dialog_task); } void SelectFileDialogImplKDE::CreateMultiFileOpenDialog( const std::string& title, const FilePath& default_path, gfx::NativeWindow parent, void* params) { - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - base::Bind( - &SelectFileDialogImplKDE::CallKDialogOutput, - this, - KDialogParams( - "--getopenfilename", - GetTitle(title, IDS_OPEN_FILES_DIALOG_TITLE), - default_path.empty() ? *last_opened_path_ : default_path, - parent, true, true, params, - &SelectFileDialogImplKDE::OnSelectMultiFileDialogResponse))); + Task* dialog_task = + NewRunnableMethod( + this, &SelectFileDialogImplKDE::CallKDialogOutput, + std::string("--getopenfilename"), + GetTitle(title, IDS_OPEN_FILES_DIALOG_TITLE), + default_path.empty() ? *last_opened_path_ : default_path, + parent, true, true, params, + &SelectFileDialogImplKDE::OnSelectMultiFileDialogResponse); + BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, dialog_task); } void SelectFileDialogImplKDE::CreateSaveAsDialog( const std::string& title, const FilePath& default_path, gfx::NativeWindow parent, void* params) { - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - base::Bind( - &SelectFileDialogImplKDE::CallKDialogOutput, - this, - KDialogParams( - "--getsavefilename", - GetTitle(title, IDS_SAVE_AS_DIALOG_TITLE), - default_path.empty() ? *last_saved_path_ : default_path, - parent, true, false, params, - &SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse))); + Task* dialog_task = + NewRunnableMethod( + this, &SelectFileDialogImplKDE::CallKDialogOutput, + std::string("--getsavefilename"), + GetTitle(title, IDS_SAVE_AS_DIALOG_TITLE), + default_path.empty() ? *last_saved_path_ : default_path, + parent, true, false, params, + &SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse); + BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, dialog_task); } void SelectFileDialogImplKDE::SelectSingleFileHelper(const std::string& output, diff --git a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc index c17b283..8801370 100644 --- a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc +++ b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc @@ -466,4 +466,5 @@ void Downloader::DownloadStarted(bool success, const GURL& url) { listeners_.erase(listener_range.first, listener_range.second); } -} // namespace imageburner +} // namespace imageburner. + diff --git a/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc b/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc index 960e7fe..1bf972d 100644 --- a/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc +++ b/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc @@ -155,19 +155,19 @@ class FileAccessProvider // TODO(mattm): don't pass std::string by value.. could use RefCountedBytes // but it's a vector. Maybe do the derive from CancelableRequest thing // described in cancelable_request.h? - typedef base::Callback<void(int, std::string)> ReadCallback; + typedef Callback2<int, std::string>::Type ReadCallback; // Reports 0 on success or errno on failure, and the number of bytes written, // on success. - typedef base::Callback<void(int, int)> WriteCallback; + typedef Callback2<int, int>::Type WriteCallback; Handle StartRead(const FilePath& path, CancelableRequestConsumerBase* consumer, - const ReadCallback& callback); + ReadCallback* callback); Handle StartWrite(const FilePath& path, const std::string& data, CancelableRequestConsumerBase* consumer, - const WriteCallback& callback); + WriteCallback* callback); private: void DoRead(scoped_refptr<CancelableRequest<ReadCallback> > request, @@ -180,7 +180,7 @@ class FileAccessProvider CancelableRequestProvider::Handle FileAccessProvider::StartRead( const FilePath& path, CancelableRequestConsumerBase* consumer, - const FileAccessProvider::ReadCallback& callback) { + FileAccessProvider::ReadCallback* callback) { scoped_refptr<CancelableRequest<ReadCallback> > request( new CancelableRequest<ReadCallback>(callback)); AddRequest(request, consumer); @@ -198,7 +198,7 @@ CancelableRequestProvider::Handle FileAccessProvider::StartWrite( const FilePath& path, const std::string& data, CancelableRequestConsumerBase* consumer, - const WriteCallback& callback) { + WriteCallback* callback) { scoped_refptr<CancelableRequest<WriteCallback> > request( new CancelableRequest<WriteCallback>(callback)); AddRequest(request, consumer); @@ -223,7 +223,7 @@ void FileAccessProvider::DoRead( bool success = file_util::ReadFileToString(path, &data); int saved_errno = success ? 0 : errno; VLOG(1) << "DoRead done read: " << success << " " << data.size(); - request->ForwardResult(saved_errno, data); + request->ForwardResult(ReadCallback::TupleType(saved_errno, data)); } void FileAccessProvider::DoWrite( @@ -238,14 +238,14 @@ void FileAccessProvider::DoWrite( if (request->canceled()) return; - request->ForwardResult(saved_errno, bytes_written); + request->ForwardResult(WriteCallback::TupleType(saved_errno, bytes_written)); } /////////////////////////////////////////////////////////////////////////////// // CertificateManagerHandler CertificateManagerHandler::CertificateManagerHandler() - : file_access_provider_(new FileAccessProvider()) { + : file_access_provider_(new FileAccessProvider) { certificate_manager_model_.reset(new CertificateManagerModel(this)); } @@ -623,8 +623,7 @@ void CertificateManagerHandler::ExportPersonalSlotsUnlocked() { file_path_, output, &consumer_, - base::Bind(&CertificateManagerHandler::ExportPersonalFileWritten, - base::Unretained(this))); + NewCallback(this, &CertificateManagerHandler::ExportPersonalFileWritten)); } void CertificateManagerHandler::ExportPersonalFileWritten(int write_errno, @@ -678,8 +677,7 @@ void CertificateManagerHandler::ImportPersonalPasswordSelected( file_access_provider_->StartRead( file_path_, &consumer_, - base::Bind(&CertificateManagerHandler::ImportPersonalFileRead, - base::Unretained(this))); + NewCallback(this, &CertificateManagerHandler::ImportPersonalFileRead)); } void CertificateManagerHandler::ImportPersonalFileRead( @@ -785,8 +783,7 @@ void CertificateManagerHandler::ImportServerFileSelected(const FilePath& path) { file_access_provider_->StartRead( file_path_, &consumer_, - base::Bind(&CertificateManagerHandler::ImportServerFileRead, - base::Unretained(this))); + NewCallback(this, &CertificateManagerHandler::ImportServerFileRead)); } void CertificateManagerHandler::ImportServerFileRead(int read_errno, @@ -841,8 +838,7 @@ void CertificateManagerHandler::ImportCAFileSelected(const FilePath& path) { file_access_provider_->StartRead( file_path_, &consumer_, - base::Bind(&CertificateManagerHandler::ImportCAFileRead, - base::Unretained(this))); + NewCallback(this, &CertificateManagerHandler::ImportCAFileRead)); } void CertificateManagerHandler::ImportCAFileRead(int read_errno, diff --git a/chrome/test/base/view_event_test_base.h b/chrome/test/base/view_event_test_base.h index e0bc18b..b4eda60 100644 --- a/chrome/test/base/view_event_test_base.h +++ b/chrome/test/base/view_event_test_base.h @@ -57,7 +57,7 @@ class Size; // // Schedule the mouse move at a location slightly different from where // // you really want to move to. // ui_controls::SendMouseMoveNotifyWhenDone(loc.x + 10, loc.y, -// base::Bind(&YYY, this)); +// NewRunnableMethod(this, YYY)); // // Then use this to schedule another mouse move. // ScheduleMouseMoveInBackground(loc.x, loc.y); diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc index 4211de7..e5962d5 100644 --- a/chrome/utility/chrome_content_utility_client.cc +++ b/chrome/utility/chrome_content_utility_client.cc @@ -4,7 +4,6 @@ #include "chrome/utility/chrome_content_utility_client.h" -#include "base/bind.h" #include "base/base64.h" #include "base/command_line.h" #include "base/json/json_reader.h" @@ -395,8 +394,11 @@ void ChromeContentUtilityClient::OnImportStart( ImporterCleanup(); } import_thread_->message_loop()->PostTask( - FROM_HERE, base::Bind(&Importer::StartImport, importer_.get(), - source_profile, items, bridge_)); + FROM_HERE, NewRunnableMethod(importer_.get(), + &Importer::StartImport, + source_profile, + items, + bridge_)); } void ChromeContentUtilityClient::OnImportCancel() { |