diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 4fdfc6cd39b8eb1ed7e77d0c3f277760794e5a1e..7df9860a11f9f68c42325a0c6a60d2bab0162539 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -252,31 +252,6 @@ void post_profile_image_coro(std::string cap_url, EProfileImageType type, std::s
     delete handle;
 }
 
-//////////////////////////////////////////////////////////////////////////
-// LLWebProfileHandler
-
-class LLWebProfileHandler : public LLCommandHandler
-{
-public:
-    // requires trusted browser to trigger
-    LLWebProfileHandler() : LLCommandHandler("profile", UNTRUSTED_THROTTLE) { }
-
-    bool handle(const LLSD& params,
-                const LLSD& query_map,
-                const std::string& grid,
-                LLMediaCtrl* web)
-    {
-        if (params.size() < 1) return false;
-        std::string agent_name = params[0];
-        LL_INFOS() << "Profile, agent_name " << agent_name << LL_ENDL;
-        std::string url = getProfileURL(agent_name);
-        LLWeb::loadURLInternal(url);
-
-        return true;
-    }
-};
-LLWebProfileHandler gWebProfileHandler;
-
 
 ///----------------------------------------------------------------------------
 /// LLFloaterProfilePermissions
diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp
index 8048745b1ce461c193aab56a82cd69cc75b96e60..23a0215d1e9504764d2c6d40894414f52025d837 100644
--- a/indra/newview/llwebprofile.cpp
+++ b/indra/newview/llwebprofile.cpp
@@ -31,17 +31,16 @@
 // libs
 #include "llbufferstream.h"
 #include "llimagepng.h"
-
 #include "llsdserialize.h"
 #include "llstring.h"
 
 // newview
 #include "llavataractions.h" // for getProfileURL()
-#include "llviewermedia.h" // FIXME: don't use LLViewerMedia internals
-
+#include "llcommandhandler.h"
 #include "llcorehttputil.h"
-
-#include "bufferstream.h"
+#include "llmediactrl.h"
+#include "llviewermedia.h" // FIXME: don't use LLViewerMedia internals
+#include "llweb.h"
 
 /*
  * Workflow:
@@ -273,3 +272,26 @@ std::string LLWebProfile::getAuthCookie()
     // This is needed to test image uploads on Linux viewer built with OpenSSL 1.0.0 (0.9.8 works fine).
     return LLStringUtil::getenv("LL_SNAPSHOT_COOKIE", sAuthCookie);
 }
+
+//////////////////////////////////////////////////////////////////////////
+// LLWebProfileHandler
+
+class LLWebProfileHandler : public LLCommandHandler
+{
+  public:
+    // requires trusted browser to trigger
+    LLWebProfileHandler() : LLCommandHandler("profile", UNTRUSTED_THROTTLE) {}
+
+    bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+    {
+        if (params.size() < 1)
+            return false;
+        std::string agent_name = params[0];
+        LL_INFOS() << "Profile, agent_name " << agent_name << LL_ENDL;
+        std::string url = getProfileURL(agent_name);
+        LLWeb::loadURLInternal(url);
+
+        return true;
+    }
+};
+LLWebProfileHandler gWebProfileHandler;