diff -r 3ab5c078b490 -r 0b3699f6c654 taskswitcher/server/src/tsscreenshotprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/server/src/tsscreenshotprovider.cpp Fri Sep 17 08:32:18 2010 +0300 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include + +#include "tsscreenshotprovider.h" +#include "tstaskmonitorglobals.h" +#include "tsscreenshotmsg.h" + + +const TUid KPluginUID = {0x200267AE}; +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CTsScreenshotProvider* CTsScreenshotProvider::NewL( MTsDataStorage& aStorage ) + { + CTsScreenshotProvider *self = new (ELeave)CTsScreenshotProvider( aStorage ); + CleanupStack::PushL( self ); + self->BaseConstructL(KPluginUID, KNullDesC8); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CTsScreenshotProvider::CTsScreenshotProvider( MTsDataStorage& aStorage ) +: + iStorage(aStorage) + { + //No implementation required + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotProvider::HandleMessage( const TDesC8& aMsg ) + { + TRAP_IGNORE( HandleMessageL( aMsg ) ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotProvider::HandleMessageL( const TDesC8& aMsg ) + { + RDesReadStream msgStream( aMsg ); + CleanupClosePushL( msgStream ); + switch ( msgStream.ReadInt32L() ) + { + case RegisterScreenshotMessage: + { + //parse msg to ACK provider ASAP and be sure that bitmap still exists + CTsScreenshotMsg* screenshotMsg = CTsScreenshotMsg::NewLC(msgStream); + SendMessage(aMsg); + + //reset stream + msgStream.Close(); + msgStream.Open(aMsg); + + //forward stream to storage + iStorage.HandleDataL(msgStream.ReadInt32L(), msgStream); + + CleanupStack::PopAndDestroy(screenshotMsg); + break; + } + + case WindowGroupToBackgroundMessage: + { + //reset stream + msgStream.Close(); + msgStream.Open(aMsg); + + //forward stream to storage + iStorage.HandleDataL(msgStream.ReadInt32L(), msgStream); + break; + } + + default: User::Leave(KErrNotSupported); + } + + CleanupStack::PopAndDestroy(&msgStream); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotProvider::OnReplace() + { + //No implementation required + }