当前位置: 首页>>代码示例>>C++>>正文


C++ MessageHandler::Suc方法代码示例

本文整理汇总了C++中MessageHandler::Suc方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageHandler::Suc方法的具体用法?C++ MessageHandler::Suc怎么用?C++ MessageHandler::Suc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MessageHandler的用法示例。


在下文中一共展示了MessageHandler::Suc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Execute

// Methods used by instantiator/creator and/or self
OP_BOOLEAN TransferManagerDownloadCallback::Execute()
{
	OP_STATUS status;
	BOOL done = FALSE;

	if (!cancelled)
	{
		if (called)
		{
			switch (download_action_mode)
			{
			case DOWNLOAD_UNDECIDED:
				// TODO: This should not be possible, need to test......
				// Use this to throw things back at document manager
				done = TRUE;
				break;
			case DOWNLOAD_ABORT:
				if (keep_loading)
				{
					if (document_manager)
						document_manager->SetLoadStatus(WAIT_FOR_LOADING_FINISHED);
				}
				else
				{
					if (document_manager)
						document_manager->StopLoading(FALSE);
					if (!download_url.GetRep()->GetUsedCount()) // These two lines belong in the url module
						download_url.Unload();					// rfz 20071028
				}
				EnableWindowClose();
				done = TRUE;
				break;
			case DOWNLOAD_SAVE:
			case DOWNLOAD_RUN:
				if (!dont_add_to_transfers)
				{
					BOOL show_transfer = TRUE;
					if (download_context)
						show_transfer = download_context->IsShownDownload();

					TransferItem* newitem = 0;
					// Put the download object into TransferManager
					status = ((TransferManager*)g_transferManager)->AddTransferItem(download_url,
							download_filename.CStr(),
							OpTransferItem::ACTION_UNKNOWN,
							FALSE,
							0,
							TransferItem::TRANSFERTYPE_DOWNLOAD,
							NULL,
							NULL,
							FALSE,
							show_transfer,
							m_privacy_mode,
							&newitem);
					if (status == OpStatus::OK)
					{
						if (download_context && download_context->GetTransferListener())
							newitem->SetTransferListener(download_context->GetTransferListener());

						if (download_action_mode == DOWNLOAD_SAVE)
							newitem->SetAction(OpTransferItem::ACTION_SAVE);
						else if (download_action_mode == DOWNLOAD_RUN)
							newitem->SetAction(OpTransferItem::ACTION_RUN_WHEN_FINISHED);

						newitem->SetViewer(viewer);

						if (need_copy_when_downloaded)
							newitem->SetCopyWhenDownloaded(download_filename);

						MessageHandler *oldHandler = download_url.GetFirstMessageHandler();

						// Check if this URL is already being downloaded to some file
						// (the same file or another file - who knows?). The Opera core
						// doesn't handle concurrent downloading of the same URL properly.
						// So just give up.
						//
						// The result will be that the transfer already in progress completes
						// without problems, while the new transfer that was attempted added,
						// will hang (the progress bar in the window that triggered the transfer
						// will stay there until the user aborts it somehow).
						MessageHandler *currentHandler = oldHandler;
						BOOL transfer_in_progress = FALSE;
						while (currentHandler && !transfer_in_progress)
						{
							if (currentHandler == g_main_message_handler)
								transfer_in_progress = TRUE;
							else
								currentHandler = static_cast<MessageHandler *>(currentHandler->Suc());
						}

						if (!transfer_in_progress)
						{
							FramesDocument *doc = document_manager ? document_manager->GetCurrentDoc() : NULL;

							URLStatus ust = download_url.Status(FALSE);
							switch (ust)
							{
							case URL_UNLOADED:
								download_url.Load(g_main_message_handler, doc ? doc->GetURL() : URL());
//.........这里部分代码省略.........
开发者ID:prestocore,项目名称:browser,代码行数:101,代码来源:TransferManagerDownload.cpp


注:本文中的MessageHandler::Suc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。