diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 19:30:55 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 19:30:55 +0000 |
commit | 871da305e61696753db715bf68fedec2b071fde4 (patch) | |
tree | e485e66cd37a1f14d0e72adc29cdb6fbbe38267b | |
parent | 66149a5cbd355757e63a82b9d3280cc6e0d36da8 (diff) | |
download | chromium_src-871da305e61696753db715bf68fedec2b071fde4.zip chromium_src-871da305e61696753db715bf68fedec2b071fde4.tar.gz chromium_src-871da305e61696753db715bf68fedec2b071fde4.tar.bz2 |
RefCounted types should not have public destructors, content/ remaining bits
BUG=123295
TEST=none
TBR=jam
Review URL: https://chromiumcodereview.appspot.com/10069054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136631 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/plugin/plugin_channel.cc | 140 | ||||
-rw-r--r-- | content/plugin/plugin_channel.h | 10 | ||||
-rw-r--r-- | content/plugin/plugin_thread.cc | 7 | ||||
-rw-r--r-- | content/public/browser/browser_message_filter.cc | 96 | ||||
-rw-r--r-- | content/public/browser/browser_message_filter.h | 3 | ||||
-rw-r--r-- | content/public/browser/download_manager.h | 10 | ||||
-rw-r--r-- | content/public/browser/indexed_db_context.h | 6 | ||||
-rw-r--r-- | content/public/browser/resource_dispatcher_host_login_delegate.h | 6 | ||||
-rw-r--r-- | content/public/browser/speech_recognizer.h | 9 | ||||
-rw-r--r-- | content/shell/shell_browser_context.cc | 15 | ||||
-rw-r--r-- | content/shell/shell_login_dialog.cc | 68 | ||||
-rw-r--r-- | content/shell/shell_login_dialog.h | 6 | ||||
-rw-r--r-- | content/test/mock_download_manager.cc | 6 | ||||
-rw-r--r-- | content/test/mock_download_manager.h | 4 |
14 files changed, 200 insertions, 186 deletions
diff --git a/content/plugin/plugin_channel.cc b/content/plugin/plugin_channel.cc index 3f544da..0fa7a6f 100644 --- a/content/plugin/plugin_channel.cc +++ b/content/plugin/plugin_channel.cc @@ -41,13 +41,6 @@ const int kPluginReleaseTimeMinutes = 5; class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter { public: MessageFilter() : channel_(NULL) { } - ~MessageFilter() { - // Clean up in case of renderer crash. - for (ModalDialogEventMap::iterator i = modal_dialog_event_map_.begin(); - i != modal_dialog_event_map_.end(); ++i) { - delete i->second.event; - } - } base::WaitableEvent* GetModalDialogEvent( gfx::NativeViewId containing_window) { @@ -83,7 +76,7 @@ class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter { return channel_->Send(message); } - private: + // IPC::ChannelProxy::MessageFilter: void OnFilterAdded(IPC::Channel* channel) { channel_ = channel; } bool OnMessageReceived(const IPC::Message& message) { @@ -98,6 +91,18 @@ class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter { message.type() == PluginMsg_ResetModalDialogEvent::ID; } + + + protected: + virtual ~MessageFilter() { + // Clean up in case of renderer crash. + for (ModalDialogEventMap::iterator i = modal_dialog_event_map_.begin(); + i != modal_dialog_event_map_.end(); ++i) { + delete i->second.event; + } + } + + private: void OnInit(const PluginMsg_Init_Params& params, IPC::Message* reply_msg) { base::AutoLock auto_lock(modal_dialog_event_map_lock_); if (modal_dialog_event_map_.count(params.containing_window)) { @@ -160,24 +165,6 @@ void PluginChannel::NotifyRenderersOfPendingShutdown() { Broadcast(new PluginHostMsg_PluginShuttingDown()); } -PluginChannel::PluginChannel() - : renderer_id_(-1), - in_send_(0), - incognito_(false), - filter_(new MessageFilter()) { - set_send_unblocking_only_during_unblock_dispatch(); - ChildProcess::current()->AddRefProcess(); - const CommandLine* command_line = CommandLine::ForCurrentProcess(); - log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); -} - -PluginChannel::~PluginChannel() { - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&PluginReleaseCallback), - base::TimeDelta::FromMinutes(kPluginReleaseTimeMinutes)); -} - bool PluginChannel::Send(IPC::Message* msg) { in_send_++; if (log_messages_) { @@ -197,6 +184,65 @@ bool PluginChannel::OnMessageReceived(const IPC::Message& msg) { return NPChannelBase::OnMessageReceived(msg); } +void PluginChannel::OnChannelError() { + NPChannelBase::OnChannelError(); + CleanUp(); +} + +int PluginChannel::GenerateRouteID() { + static int last_id = 0; + return ++last_id; +} + +base::WaitableEvent* PluginChannel::GetModalDialogEvent( + gfx::NativeViewId containing_window) { + return filter_->GetModalDialogEvent(containing_window); +} + +PluginChannel::~PluginChannel() { + MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::Bind(&PluginReleaseCallback), + base::TimeDelta::FromMinutes(kPluginReleaseTimeMinutes)); +} + +void PluginChannel::CleanUp() { + // We need to clean up the stubs so that they call NPPDestroy. This will + // also lead to them releasing their reference on this object so that it can + // be deleted. + for (size_t i = 0; i < plugin_stubs_.size(); ++i) + RemoveRoute(plugin_stubs_[i]->instance_id()); + + // Need to addref this object temporarily because otherwise removing the last + // stub will cause the destructor of this object to be called, however at + // that point plugin_stubs_ will have one element and its destructor will be + // called twice. + scoped_refptr<PluginChannel> me(this); + + plugin_stubs_.clear(); +} + +bool PluginChannel::Init(base::MessageLoopProxy* ipc_message_loop, + bool create_pipe_now, + base::WaitableEvent* shutdown_event) { + if (!NPChannelBase::Init(ipc_message_loop, create_pipe_now, shutdown_event)) + return false; + + channel_->AddFilter(filter_.get()); + return true; +} + +PluginChannel::PluginChannel() + : renderer_id_(-1), + in_send_(0), + incognito_(false), + filter_(new MessageFilter()) { + set_send_unblocking_only_during_unblock_dispatch(); + ChildProcess::current()->AddRefProcess(); + const CommandLine* command_line = CommandLine::ForCurrentProcess(); + log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); +} + bool PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PluginChannel, msg) @@ -247,11 +293,6 @@ void PluginChannel::OnGenerateRouteID(int* route_id) { *route_id = GenerateRouteID(); } -int PluginChannel::GenerateRouteID() { - static int last_id = 0; - return ++last_id; -} - void PluginChannel::OnClearSiteData(const std::string& site, uint64 flags, uint64 max_age) { @@ -275,40 +316,3 @@ void PluginChannel::OnClearSiteData(const std::string& site, } Send(new PluginHostMsg_ClearSiteDataResult(success)); } - -base::WaitableEvent* PluginChannel::GetModalDialogEvent( - gfx::NativeViewId containing_window) { - return filter_->GetModalDialogEvent(containing_window); -} - -void PluginChannel::OnChannelError() { - NPChannelBase::OnChannelError(); - CleanUp(); -} - -void PluginChannel::CleanUp() { - // We need to clean up the stubs so that they call NPPDestroy. This will - // also lead to them releasing their reference on this object so that it can - // be deleted. - for (size_t i = 0; i < plugin_stubs_.size(); ++i) - RemoveRoute(plugin_stubs_[i]->instance_id()); - - // Need to addref this object temporarily because otherwise removing the last - // stub will cause the destructor of this object to be called, however at - // that point plugin_stubs_ will have one element and its destructor will be - // called twice. - scoped_refptr<PluginChannel> me(this); - - plugin_stubs_.clear(); -} - -bool PluginChannel::Init(base::MessageLoopProxy* ipc_message_loop, - bool create_pipe_now, - base::WaitableEvent* shutdown_event) { - if (!NPChannelBase::Init(ipc_message_loop, create_pipe_now, shutdown_event)) - return false; - - channel_->AddFilter(filter_.get()); - return true; -} - diff --git a/content/plugin/plugin_channel.h b/content/plugin/plugin_channel.h index 7be4d91..ed9e215 100644 --- a/content/plugin/plugin_channel.h +++ b/content/plugin/plugin_channel.h @@ -31,10 +31,10 @@ class PluginChannel : public NPChannelBase { // Send a message to all renderers that the process is going to shutdown. static void NotifyRenderersOfPendingShutdown(); - virtual ~PluginChannel(); - + // IPC::Channel::Listener: virtual bool Send(IPC::Message* msg) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void OnChannelError() OVERRIDE; int renderer_id() { return renderer_id_; } @@ -57,12 +57,10 @@ class PluginChannel : public NPChannelBase { #endif protected: - // IPC::Channel::Listener implementation: - virtual void OnChannelError() OVERRIDE; + virtual ~PluginChannel(); + // NPChannelBase:: virtual void CleanUp() OVERRIDE; - - // Overrides NPChannelBase::Init. virtual bool Init(base::MessageLoopProxy* ipc_message_loop, bool create_pipe_now, base::WaitableEvent* shutdown_event) OVERRIDE; diff --git a/content/plugin/plugin_thread.cc b/content/plugin/plugin_thread.cc index 9b88420..75a692e 100644 --- a/content/plugin/plugin_thread.cc +++ b/content/plugin/plugin_thread.cc @@ -44,9 +44,11 @@ namespace { class EnsureTerminateMessageFilter : public IPC::ChannelProxy::MessageFilter { public: EnsureTerminateMessageFilter() {} - ~EnsureTerminateMessageFilter() {} - private: + protected: + virtual ~EnsureTerminateMessageFilter() {} + + // IPC::ChannelProxy::MessageFilter: virtual void OnChannelError() { // How long we wait before forcibly shutting down the process. const base::TimeDelta kPluginProcessTerminateTimeout = @@ -60,6 +62,7 @@ class EnsureTerminateMessageFilter : public IPC::ChannelProxy::MessageFilter { kPluginProcessTerminateTimeout); } + private: void Terminate() { base::KillProcess(base::GetCurrentProcessHandle(), 0, false); } diff --git a/content/public/browser/browser_message_filter.cc b/content/public/browser/browser_message_filter.cc index 209f4a9..3d695ab 100644 --- a/content/public/browser/browser_message_filter.cc +++ b/content/public/browser/browser_message_filter.cc @@ -22,10 +22,6 @@ BrowserMessageFilter::BrowserMessageFilter() : channel_(NULL), peer_handle_(base::kNullProcessHandle) { } -BrowserMessageFilter::~BrowserMessageFilter() { - base::CloseProcessHandle(peer_handle_); -} - void BrowserMessageFilter::OnFilterAdded(IPC::Channel* channel) { channel_ = channel; } @@ -40,6 +36,32 @@ void BrowserMessageFilter::OnChannelConnected(int32 peer_pid) { } } +bool BrowserMessageFilter::OnMessageReceived(const IPC::Message& message) { + BrowserThread::ID thread = BrowserThread::IO; + OverrideThreadForMessage(message, &thread); + + if (thread == BrowserThread::IO) { + scoped_refptr<base::TaskRunner> runner = + OverrideTaskRunnerForMessage(message); + if (runner) { + runner->PostTask(FROM_HERE, + base::Bind(base::IgnoreResult(&BrowserMessageFilter::DispatchMessage), + this, message)); + return true; + } + return DispatchMessage(message); + } + + if (thread == BrowserThread::UI && !CheckCanDispatchOnUI(message, this)) + return true; + + BrowserThread::PostTask( + thread, FROM_HERE, + base::Bind(base::IgnoreResult(&BrowserMessageFilter::DispatchMessage), + this, message)); + return true; +} + bool BrowserMessageFilter::Send(IPC::Message* message) { if (message->is_sync()) { // We don't support sending synchronous messages from the browser. If we @@ -75,50 +97,6 @@ base::TaskRunner* BrowserMessageFilter::OverrideTaskRunnerForMessage( return NULL; } -bool BrowserMessageFilter::OnMessageReceived(const IPC::Message& message) { - BrowserThread::ID thread = BrowserThread::IO; - OverrideThreadForMessage(message, &thread); - - if (thread == BrowserThread::IO) { - scoped_refptr<base::TaskRunner> runner = - OverrideTaskRunnerForMessage(message); - if (runner) { - runner->PostTask(FROM_HERE, - base::Bind(base::IgnoreResult(&BrowserMessageFilter::DispatchMessage), - this, message)); - return true; - } - return DispatchMessage(message); - } - - if (thread == BrowserThread::UI && !CheckCanDispatchOnUI(message, this)) - return true; - - BrowserThread::PostTask( - thread, FROM_HERE, - base::Bind(base::IgnoreResult(&BrowserMessageFilter::DispatchMessage), - this, message)); - return true; -} - -bool BrowserMessageFilter::DispatchMessage(const IPC::Message& message) { - bool message_was_ok = true; - bool rv = OnMessageReceived(message, &message_was_ok); - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO) || rv) << - "Must handle messages that were dispatched to another thread!"; - if (!message_was_ok) { - content::RecordAction(UserMetricsAction("BadMessageTerminate_BMF")); - BadMessageReceived(); - } - - return rv; -} - -void BrowserMessageFilter::BadMessageReceived() { - base::KillProcess(peer_handle(), content::RESULT_CODE_KILLED_BAD_MESSAGE, - false); -} - bool BrowserMessageFilter::CheckCanDispatchOnUI(const IPC::Message& message, IPC::Message::Sender* sender) { #if defined(OS_WIN) && !defined(USE_AURA) @@ -144,4 +122,26 @@ bool BrowserMessageFilter::CheckCanDispatchOnUI(const IPC::Message& message, return true; } +BrowserMessageFilter::~BrowserMessageFilter() { + base::CloseProcessHandle(peer_handle_); +} + +void BrowserMessageFilter::BadMessageReceived() { + base::KillProcess(peer_handle(), content::RESULT_CODE_KILLED_BAD_MESSAGE, + false); +} + +bool BrowserMessageFilter::DispatchMessage(const IPC::Message& message) { + bool message_was_ok = true; + bool rv = OnMessageReceived(message, &message_was_ok); + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO) || rv) << + "Must handle messages that were dispatched to another thread!"; + if (!message_was_ok) { + content::RecordAction(UserMetricsAction("BadMessageTerminate_BMF")); + BadMessageReceived(); + } + + return rv; +} + } // namespace content diff --git a/content/public/browser/browser_message_filter.h b/content/public/browser/browser_message_filter.h index 32cfc90..441ad70 100644 --- a/content/public/browser/browser_message_filter.h +++ b/content/public/browser/browser_message_filter.h @@ -24,7 +24,6 @@ class CONTENT_EXPORT BrowserMessageFilter : public IPC::Message::Sender { public: BrowserMessageFilter(); - virtual ~BrowserMessageFilter(); // IPC::ChannelProxy::MessageFilter methods. If you override them, make sure // to call them as well. These are always called on the IO thread. @@ -73,6 +72,8 @@ class CONTENT_EXPORT BrowserMessageFilter : IPC::Message::Sender* sender); protected: + virtual ~BrowserMessageFilter(); + // Call this if a message couldn't be deserialized. This kills the renderer. // Can be called on any thread. virtual void BadMessageReceived(); diff --git a/content/public/browser/download_manager.h b/content/public/browser/download_manager.h index b0039bd..b405a55 100644 --- a/content/public/browser/download_manager.h +++ b/content/public/browser/download_manager.h @@ -60,8 +60,6 @@ class DownloadUrlParameters; class CONTENT_EXPORT DownloadManager : public base::RefCountedThreadSafe<DownloadManager> { public: - virtual ~DownloadManager() {} - static DownloadManager* Create( DownloadManagerDelegate* delegate, net::NetLog* net_log); @@ -247,11 +245,11 @@ class CONTENT_EXPORT DownloadManager virtual void SetDownloadManagerDelegate( DownloadManagerDelegate* delegate) = 0; + protected: + virtual ~DownloadManager() {} + private: - friend class base::RefCountedThreadSafe< - DownloadManager, BrowserThread::DeleteOnUIThread>; - friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; - friend class base::DeleteHelper<DownloadManager>; + friend class base::RefCountedThreadSafe<DownloadManager>; }; } // namespace content diff --git a/content/public/browser/indexed_db_context.h b/content/public/browser/indexed_db_context.h index 91b8664..8c51288 100644 --- a/content/public/browser/indexed_db_context.h +++ b/content/public/browser/indexed_db_context.h @@ -24,8 +24,6 @@ namespace content { // Call these methods only on the WebKit thread. class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> { public: - virtual ~IndexedDBContext() {} - // Methods used in response to QuotaManager requests. virtual std::vector<GURL> GetAllOrigins() = 0; virtual int64 GetOriginDiskUsage(const GURL& origin_url) = 0; @@ -36,6 +34,10 @@ class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> { // Get the file name of the local storage file for the given origin. virtual FilePath GetFilePathForTesting(const string16& origin_id) const = 0; + + protected: + friend class base::RefCountedThreadSafe<IndexedDBContext>; + virtual ~IndexedDBContext() {} }; } // namespace content diff --git a/content/public/browser/resource_dispatcher_host_login_delegate.h b/content/public/browser/resource_dispatcher_host_login_delegate.h index 0d99edb..d856686 100644 --- a/content/public/browser/resource_dispatcher_host_login_delegate.h +++ b/content/public/browser/resource_dispatcher_host_login_delegate.h @@ -20,11 +20,13 @@ namespace content { class CONTENT_EXPORT ResourceDispatcherHostLoginDelegate : public base::RefCountedThreadSafe<ResourceDispatcherHostLoginDelegate> { public: - virtual ~ResourceDispatcherHostLoginDelegate() {} - // Notify the login delegate that the request was cancelled. // This function can only be called from the IO thread. virtual void OnRequestCancelled() = 0; + + protected: + friend class base::RefCountedThreadSafe<ResourceDispatcherHostLoginDelegate>; + virtual ~ResourceDispatcherHostLoginDelegate() {} }; } // public content diff --git a/content/public/browser/speech_recognizer.h b/content/public/browser/speech_recognizer.h index a9cec70..4553952 100644 --- a/content/public/browser/speech_recognizer.h +++ b/content/public/browser/speech_recognizer.h @@ -25,7 +25,6 @@ class SpeechRecognitionEventListener; // extensions. class SpeechRecognizer : public base::RefCountedThreadSafe<SpeechRecognizer> { public: - CONTENT_EXPORT static SpeechRecognizer* Create( SpeechRecognitionEventListener* event_listener, int session_id, @@ -36,8 +35,6 @@ class SpeechRecognizer : public base::RefCountedThreadSafe<SpeechRecognizer> { const std::string& hardware_info, const std::string& origin_url); - virtual ~SpeechRecognizer() {} - // Starts audio recording and the recognition process. The same // SpeechRecognizer instance can be used multiple times for speech recognition // though each recognition request can be made only after the previous one @@ -56,8 +53,12 @@ class SpeechRecognizer : public base::RefCountedThreadSafe<SpeechRecognizer> { // or waiting for a result. virtual bool IsActive() const = 0; - // Checks wether the recognizer is capturing audio. + // Checks whether the recognizer is capturing audio. virtual bool IsCapturingAudio() const = 0; + + protected: + friend class base::RefCountedThreadSafe<SpeechRecognizer>; + virtual ~SpeechRecognizer() {} }; } // namespace content diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc index 8c82453..678edfc 100644 --- a/content/shell/shell_browser_context.cc +++ b/content/shell/shell_browser_context.cc @@ -39,8 +39,7 @@ const char kXdgConfigHomeEnvVar[] = "XDG_CONFIG_HOME"; class ShellGeolocationPermissionContext : public GeolocationPermissionContext { public: - ShellGeolocationPermissionContext() { - } + ShellGeolocationPermissionContext() {} // GeolocationPermissionContext implementation). virtual void RequestGeolocationPermission( @@ -60,22 +59,26 @@ class ShellGeolocationPermissionContext : public GeolocationPermissionContext { NOTIMPLEMENTED(); } + protected: + virtual ~ShellGeolocationPermissionContext() {}; + private: DISALLOW_COPY_AND_ASSIGN(ShellGeolocationPermissionContext); }; class ShellSpeechRecognitionPreferences : public SpeechRecognitionPreferences { public: - ShellSpeechRecognitionPreferences() { - } + ShellSpeechRecognitionPreferences() {} // Overridden from SpeechRecognitionPreferences: virtual bool FilterProfanities() const OVERRIDE { return false; } - virtual void SetFilterProfanities(bool filter_profanities) OVERRIDE { - } + virtual void SetFilterProfanities(bool filter_profanities) OVERRIDE {} + + protected: + virtual ~ShellSpeechRecognitionPreferences() {} private: DISALLOW_COPY_AND_ASSIGN(ShellSpeechRecognitionPreferences); diff --git a/content/shell/shell_login_dialog.cc b/content/shell/shell_login_dialog.cc index def2ba3..27dee82 100644 --- a/content/shell/shell_login_dialog.cc +++ b/content/shell/shell_login_dialog.cc @@ -27,11 +27,6 @@ ShellLoginDialog::ShellLoginDialog( UTF8ToUTF16(auth_info->realm))); } -ShellLoginDialog::~ShellLoginDialog() { - // Cannot post any tasks here; this object is going away and cannot be - // referenced/dereferenced. -} - void ShellLoginDialog::OnRequestCancelled() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); BrowserThread::PostTask( @@ -39,6 +34,40 @@ void ShellLoginDialog::OnRequestCancelled() { base::Bind(&ShellLoginDialog::PlatformRequestCancelled, this)); } +void ShellLoginDialog::UserAcceptedAuth(const string16& username, + const string16& password) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(&ShellLoginDialog::SendAuthToRequester, this, + true, username, password)); +} + +void ShellLoginDialog::UserCancelledAuth() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(&ShellLoginDialog::SendAuthToRequester, this, + false, string16(), string16())); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind(&ShellLoginDialog::PlatformCleanUp, this)); +} + +ShellLoginDialog::~ShellLoginDialog() { + // Cannot post any tasks here; this object is going away and cannot be + // referenced/dereferenced. +} + +#if !defined(OS_MACOSX) +// Bogus implementations for linking. They are never called because +// ResourceDispatcherHostDelegate::CreateLoginDelegate returns NULL. +// TODO: implement ShellLoginDialog for other platforms, drop this #if +void ShellLoginDialog::PlatformCreateDialog(const string16& message) {} +void ShellLoginDialog::PlatformCleanUp() {} +void ShellLoginDialog::PlatformRequestCancelled() {} +#endif + void ShellLoginDialog::PrepDialog(const string16& host, const string16& realm) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -60,26 +89,6 @@ void ShellLoginDialog::PrepDialog(const string16& host, PlatformCreateDialog(explanation); } -void ShellLoginDialog::UserAcceptedAuth(const string16& username, - const string16& password) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&ShellLoginDialog::SendAuthToRequester, this, - true, username, password)); -} - -void ShellLoginDialog::UserCancelledAuth() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&ShellLoginDialog::SendAuthToRequester, this, - false, string16(), string16())); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&ShellLoginDialog::PlatformCleanUp, this)); -} - void ShellLoginDialog::SendAuthToRequester(bool success, const string16& username, const string16& password) { @@ -95,13 +104,4 @@ void ShellLoginDialog::SendAuthToRequester(bool success, base::Bind(&ShellLoginDialog::PlatformCleanUp, this)); } -#if !defined(OS_MACOSX) -// Bogus implementations for linking. They are never called because -// ResourceDispatcherHostDelegate::CreateLoginDelegate returns NULL. -// TODO: implement ShellLoginDialog for other platforms, drop this #if -void ShellLoginDialog::PlatformCreateDialog(const string16& message) {} -void ShellLoginDialog::PlatformCleanUp() {} -void ShellLoginDialog::PlatformRequestCancelled() {} -#endif - } // namespace content diff --git a/content/shell/shell_login_dialog.h b/content/shell/shell_login_dialog.h index b944c19..ff259f9 100644 --- a/content/shell/shell_login_dialog.h +++ b/content/shell/shell_login_dialog.h @@ -31,8 +31,6 @@ class ShellLoginDialog : public ResourceDispatcherHostLoginDelegate { public: // Threading: IO thread. ShellLoginDialog(net::AuthChallengeInfo* auth_info, net::URLRequest* request); - // Threading: any - virtual ~ShellLoginDialog(); // ResourceDispatcherHostLoginDelegate implementation: // Threading: IO thread. @@ -45,6 +43,10 @@ class ShellLoginDialog : public ResourceDispatcherHostLoginDelegate { void UserAcceptedAuth(const string16& username, const string16& password); void UserCancelledAuth(); + protected: + // Threading: any + virtual ~ShellLoginDialog(); + private: // All the methods that begin with Platform need to be implemented by the // platform specific LoginDialog implementation. diff --git a/content/test/mock_download_manager.cc b/content/test/mock_download_manager.cc index 4052472..3a1c14c 100644 --- a/content/test/mock_download_manager.cc +++ b/content/test/mock_download_manager.cc @@ -6,10 +6,8 @@ namespace content { -MockDownloadManager::MockDownloadManager() { -} +MockDownloadManager::MockDownloadManager() {} -MockDownloadManager::~MockDownloadManager() { -} +MockDownloadManager::~MockDownloadManager() {} } diff --git a/content/test/mock_download_manager.h b/content/test/mock_download_manager.h index 4fb8512..6ced362 100644 --- a/content/test/mock_download_manager.h +++ b/content/test/mock_download_manager.h @@ -21,7 +21,6 @@ namespace content { class MockDownloadManager : public content::DownloadManager { public: MockDownloadManager(); - virtual ~MockDownloadManager(); // DownloadManager: MOCK_METHOD0(Shutdown, void()); @@ -91,6 +90,9 @@ class MockDownloadManager : public content::DownloadManager { const FilePath& chosen_file)); MOCK_METHOD1(GetActiveDownload, content::DownloadItem*(int32 download_id)); MOCK_METHOD1(SetFileManager, void(DownloadFileManager* file_manager)); + + protected: + virtual ~MockDownloadManager(); }; } // namespace content |