Chromium Code Reviews| Index: content/browser/devtools/devtools_remote_frontend_util.cc |
| diff --git a/content/browser/devtools/devtools_remote_frontend_util.cc b/content/browser/devtools/devtools_remote_frontend_util.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dbfb4f7a0e0a37462fa6aaecf49aada5c2f5af5e |
| --- /dev/null |
| +++ b/content/browser/devtools/devtools_remote_frontend_util.cc |
| @@ -0,0 +1,50 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/public/browser/devtools_remote_frontend_util.h" |
| + |
| +#include "base/strings/stringprintf.h" |
| +#include "googleurl/src/gurl.h" |
| +#include "webkit/common/user_agent/user_agent_util.h" |
| + |
| +namespace { |
| + |
| +const char kRemoteFrontendDomain[] = "chrome-devtools-frontend.appspot.com"; |
| +const char kRemoteFrontendBaseURL[] = "https://%s/%s"; |
| +const char kRemoteFrontendMainURL[] = "https://%s/serve_rev/%s/devtools.html"; |
| + |
| +const char kServerSocketNameSuffix[] = "devtools_remote"; |
|
pfeldman
2013/06/18 17:20:01
Does not belong to content imo.
mnaganov (inactive)
2013/06/19 10:53:55
OK, I've created a component for these functions a
|
| +const char kServerSocketNameFormat[] = "%s_%s"; |
| + |
| +} |
| + |
| +namespace content { |
| + |
| +std::string GetDevToolsFrontendResourceURL(const std::string& path) { |
| + return base::StringPrintf(kRemoteFrontendBaseURL, |
| + kRemoteFrontendDomain, |
| + path.c_str()); |
| +} |
| + |
| +std::string GetDevToolsFrontendMainResourceURL() { |
| + return base::StringPrintf(kRemoteFrontendMainURL, |
| + kRemoteFrontendDomain, |
| + webkit_glue::GetWebKitRevision().c_str()); |
| +} |
| + |
| +bool IsDevToolsFrontendHost(const GURL& url) { |
| + return url.host() == kRemoteFrontendDomain; |
| +} |
| + |
| +std::string GetDevToolsServerSocketName(const std::string& prefix) { |
| + return base::StringPrintf(kServerSocketNameFormat, |
| + prefix.c_str(), |
| + kServerSocketNameSuffix); |
| +} |
| + |
| +std::string GetDevToolsServerSocketSuffix() { |
| + return kServerSocketNameSuffix; |
| +} |
| + |
| +} // namespace content |