Home | History | Annotate | Download | only in common
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "base/command_line.h"
      6 #include "base/path_service.h"
      7 #include "base/string16.h"
      8 #include "base/utf_string_conversions.h"
      9 #include "build/build_config.h"
     10 #include "chrome/common/chrome_paths.h"
     11 #include "chrome/common/chrome_switches.h"
     12 #include "content/plugin/npobject_util.h"
     13 #include "googleurl/src/url_util.h"
     14 #include "ui/base/l10n/l10n_util.h"
     15 #include "ui/base/ui_base_switches.h"
     16 #include "webkit/glue/webkit_glue.h"
     17 
     18 namespace webkit_glue {
     19 
     20 bool GetExeDirectory(FilePath* path) {
     21   return PathService::Get(base::DIR_EXE, path);
     22 }
     23 
     24 bool GetApplicationDirectory(FilePath* path) {
     25   return PathService::Get(chrome::DIR_APP, path);
     26 }
     27 
     28 bool IsPluginRunningInRendererProcess() {
     29   return !IsPluginProcess();
     30 }
     31 
     32 std::string GetWebKitLocale() {
     33   // The browser process should have passed the locale to the renderer via the
     34   // --lang command line flag.  In single process mode, this will return the
     35   // wrong value.  TODO(tc): Fix this for single process mode.
     36   const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
     37   const std::string& lang =
     38       parsed_command_line.GetSwitchValueASCII(switches::kLang);
     39   DCHECK(!lang.empty() ||
     40       (!parsed_command_line.HasSwitch(switches::kRendererProcess) &&
     41        !parsed_command_line.HasSwitch(switches::kPluginProcess)));
     42   return lang;
     43 }
     44 
     45 string16 GetLocalizedString(int message_id) {
     46   return l10n_util::GetStringUTF16(message_id);
     47 }
     48 
     49 }  // namespace webkit_glue
     50