summaryrefslogtreecommitdiffstats
path: root/chrome/common/common_glue.cc
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-08-06 12:13:06 +0100
committerBen Murdoch <benm@google.com>2010-08-18 15:49:13 +0100
commit06741cbc25cd4227a9fba40dfd0273bfcc1a587a (patch)
treeca6f21dec86a8c4f6d3c50e78628c0cf31da0353 /chrome/common/common_glue.cc
parentaa0bf16ed53445f227734aee4274c7aef056f032 (diff)
downloadexternal_chromium-06741cbc25cd4227a9fba40dfd0273bfcc1a587a.zip
external_chromium-06741cbc25cd4227a9fba40dfd0273bfcc1a587a.tar.gz
external_chromium-06741cbc25cd4227a9fba40dfd0273bfcc1a587a.tar.bz2
Add chrome/common @ 52593
Needed by autofill Change-Id: Ibfea9ab92382af0bd0cfc6e94d21e4baa4b9d896
Diffstat (limited to 'chrome/common/common_glue.cc')
-rw-r--r--chrome/common/common_glue.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/chrome/common/common_glue.cc b/chrome/common/common_glue.cc
new file mode 100644
index 0000000..95417ab
--- /dev/null
+++ b/chrome/common/common_glue.cc
@@ -0,0 +1,49 @@
+// Copyright (c) 2006-2008 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 "app/app_switches.h"
+#include "app/l10n_util.h"
+#include "base/command_line.h"
+#include "base/path_service.h"
+#include "base/string16.h"
+#include "base/utf_string_conversions.h"
+#include "build/build_config.h"
+#include "chrome/common/chrome_paths.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/plugin/npobject_util.h"
+#include "googleurl/src/url_util.h"
+#include "webkit/glue/webkit_glue.h"
+
+namespace webkit_glue {
+
+bool GetExeDirectory(FilePath* path) {
+ return PathService::Get(base::DIR_EXE, path);
+}
+
+bool GetApplicationDirectory(FilePath* path) {
+ return PathService::Get(chrome::DIR_APP, path);
+}
+
+bool IsPluginRunningInRendererProcess() {
+ return !IsPluginProcess();
+}
+
+std::wstring GetWebKitLocale() {
+ // The browser process should have passed the locale to the renderer via the
+ // --lang command line flag. In single process mode, this will return the
+ // wrong value. TODO(tc): Fix this for single process mode.
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
+ const std::wstring& lang =
+ parsed_command_line.GetSwitchValue(switches::kLang);
+ DCHECK(!lang.empty() ||
+ (!parsed_command_line.HasSwitch(switches::kRendererProcess) &&
+ !parsed_command_line.HasSwitch(switches::kPluginProcess)));
+ return lang;
+}
+
+string16 GetLocalizedString(int message_id) {
+ return WideToUTF16(l10n_util::GetString(message_id));
+}
+
+} // namespace webkit_glue