summaryrefslogtreecommitdiffstats
path: root/webkit/support
diff options
context:
space:
mode:
authortkent@google.com <tkent@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-15 08:37:53 +0000
committertkent@google.com <tkent@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-15 08:37:53 +0000
commit62051603598a490e3b1180cffe99ec2441e2ae52 (patch)
tree1904d12fa6117d0cbc32bb80683625c43056abf8 /webkit/support
parent8d0e4c64539c94f9dfe4656d5bc214416cfeb65c (diff)
downloadchromium_src-62051603598a490e3b1180cffe99ec2441e2ae52.zip
chromium_src-62051603598a490e3b1180cffe99ec2441e2ae52.tar.gz
chromium_src-62051603598a490e3b1180cffe99ec2441e2ae52.tar.bz2
Create new function for the common part of GetWebKitRootDir() and
RewriteLayoutTestsURL(). BUG=none TEST=none. Just a refactoring. Review URL: http://codereview.chromium.org/2829001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49774 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support')
-rw-r--r--webkit/support/webkit_support.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc
index 523c0469..e68e021 100644
--- a/webkit/support/webkit_support.cc
+++ b/webkit/support/webkit_support.cc
@@ -95,6 +95,17 @@ class WebPluginImplWithPageDelegate
DISALLOW_COPY_AND_ASSIGN(WebPluginImplWithPageDelegate);
};
+FilePath GetWebKitRootDirFilePath() {
+ FilePath basePath;
+ PathService::Get(base::DIR_SOURCE_ROOT, &basePath);
+ FilePath path = basePath.Append(FILE_PATH_LITERAL("third_party/WebKit"));
+ if (!file_util::PathExists(path)) {
+ // WebKit/WebKit/chromium/ -> WebKit/
+ path = basePath.Append(FILE_PATH_LITERAL("../.."));
+ }
+ return path;
+}
+
} // namespace
namespace webkit_support {
@@ -203,13 +214,7 @@ WebKit::WebApplicationCacheHost* CreateApplicationCacheHost(
}
WebKit::WebString GetWebKitRootDir() {
- FilePath sourcePath;
- PathService::Get(base::DIR_SOURCE_ROOT, &sourcePath);
- FilePath path = sourcePath.Append(FILE_PATH_LITERAL("third_party/WebKit"));
- if (!file_util::PathExists(path)) {
- path = sourcePath.Append(FILE_PATH_LITERAL("../.."));
- DCHECK(file_util::PathExists(path));
- }
+ FilePath path = GetWebKitRootDirFilePath();
return WebKit::WebString::fromUTF8(WideToUTF8(path.ToWStringHack()).c_str());
}
@@ -285,14 +290,9 @@ WebURL RewriteLayoutTestsURL(const std::string& utf8_url) {
if (utf8_url.compare(0, kPrefixLen, kPrefix, kPrefixLen))
return WebURL(GURL(utf8_url));
- FilePath sourcePath;
- PathService::Get(base::DIR_SOURCE_ROOT, &sourcePath);
- FilePath replacePath
- = sourcePath.Append(FILE_PATH_LITERAL("third_party/WebKit/LayoutTests/"));
- if (!file_util::PathExists(replacePath)) {
- replacePath = sourcePath.Append(FILE_PATH_LITERAL("../../LayoutTests/"));
- DCHECK(file_util::PathExists(replacePath));
- }
+ FilePath replacePath =
+ GetWebKitRootDirFilePath().Append(FILE_PATH_LITERAL("LayoutTests/"));
+ CHECK(file_util::PathExists(replacePath));
#if defined(OS_WIN)
std::string utf8_path = WideToUTF8(replacePath.value());
#else