summaryrefslogtreecommitdiff
path: root/chromium/extensions/renderer/i18n_hooks_util.h
blob: 5b5c64d1f3e266f1c932c8ad82ec3a05767cd230 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2018 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.

#ifndef EXTENSIONS_RENDERER_I18N_HOOKS_UTIL_H_
#define EXTENSIONS_RENDERER_I18N_HOOKS_UTIL_H_

#include <string>

#include "v8/include/v8.h"

namespace content {
class RenderFrame;
}

namespace extensions {
namespace i18n_hooks {

// Returns the localized method for the given |message_name| and
// substitutions. This can result in a synchronous IPC being sent to the browser
// for the first call related to an extension in this process.
v8::Local<v8::Value> GetI18nMessage(const std::string& message_name,
                                    const std::string& extension_id,
                                    v8::Local<v8::Value> v8_substitutions,
                                    content::RenderFrame* render_frame,
                                    v8::Local<v8::Context> context);

// Returns the detected language for the sample |text|.
v8::Local<v8::Value> DetectTextLanguage(v8::Local<v8::Context> context,
                                        const std::string& text);

}  // namespace i18n_hooks
}  // namespace extensions

#endif  // EXTENSIONS_RENDERER_I18N_HOOKS_UTIL_H_