PageRenderTime 579ms CodeModel.GetById 184ms app.highlight 4ms RepoModel.GetById 288ms app.codeStats 0ms

/indra/newview/llbrowsernotification.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 58 lines | 27 code | 6 blank | 25 comment | 6 complexity | 17986ee591d99300c548d2dd39734964 MD5 | raw file
 1/**
 2 * @file llbrowsernotification.cpp
 3 * @brief Notification Handler Class for browser popups
 4 *
 5 * $LicenseInfo:firstyear=2000&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27
28#include "llviewerprecompiledheaders.h" // must be first include
29
30#include "llnotificationhandler.h"
31#include "llnotifications.h"
32#include "llmediactrl.h"
33#include "llviewermedia.h"
34#include "llviewermediafocus.h"
35
36using namespace LLNotificationsUI;
37
38bool LLBrowserNotification::processNotification(const LLSD& notify)
39{
40	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
41	if (!notification) return false;
42
43	LLUUID media_id = notification->getPayload()["media_id"].asUUID();
44	LLMediaCtrl* media_instance = LLMediaCtrl::getInstance(media_id);
45	if (media_instance)
46	{
47		media_instance->showNotification(notification);
48	}
49	else if (LLViewerMediaFocus::instance().getControlsMediaID() == media_id)
50	{
51		LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(media_id);
52		if (impl)
53		{
54			impl->showNotification(notification);
55		}
56	}
57	return false;
58}