Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: extensions/renderer/i18n_custom_bindings.cc

Issue 1866103002: [Extensions] Expand bindings access checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/renderer/i18n_custom_bindings.h" 5 #include "extensions/renderer/i18n_custom_bindings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 detected_languages->push_back( 113 detected_languages->push_back(
114 make_scoped_ptr(new DetectedLanguage(language_code, percents[i]))); 114 make_scoped_ptr(new DetectedLanguage(language_code, percents[i])));
115 } 115 }
116 } 116 }
117 117
118 } // namespace 118 } // namespace
119 119
120 I18NCustomBindings::I18NCustomBindings(ScriptContext* context) 120 I18NCustomBindings::I18NCustomBindings(ScriptContext* context)
121 : ObjectBackedNativeHandler(context) { 121 : ObjectBackedNativeHandler(context) {
122 RouteFunction( 122 RouteFunction(
123 "GetL10nMessage", 123 "GetL10nMessage", "i18n",
124 base::Bind(&I18NCustomBindings::GetL10nMessage, base::Unretained(this))); 124 base::Bind(&I18NCustomBindings::GetL10nMessage, base::Unretained(this)));
125 RouteFunction("GetL10nUILanguage", 125 RouteFunction("GetL10nUILanguage", "i18n",
126 base::Bind(&I18NCustomBindings::GetL10nUILanguage, 126 base::Bind(&I18NCustomBindings::GetL10nUILanguage,
127 base::Unretained(this))); 127 base::Unretained(this)));
128 RouteFunction("DetectTextLanguage", 128 RouteFunction("DetectTextLanguage", "i18n",
129 base::Bind(&I18NCustomBindings::DetectTextLanguage, 129 base::Bind(&I18NCustomBindings::DetectTextLanguage,
130 base::Unretained(this))); 130 base::Unretained(this)));
131 } 131 }
132 132
133 void I18NCustomBindings::GetL10nMessage( 133 void I18NCustomBindings::GetL10nMessage(
134 const v8::FunctionCallbackInfo<v8::Value>& args) { 134 const v8::FunctionCallbackInfo<v8::Value>& args) {
135 if (args.Length() != 3 || !args[0]->IsString()) { 135 if (args.Length() != 3 || !args[0]->IsString()) {
136 NOTREACHED() << "Bad arguments"; 136 NOTREACHED() << "Bad arguments";
137 return; 137 return;
138 } 138 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 237
238 LanguageDetectionResult result(is_reliable); 238 LanguageDetectionResult result(is_reliable);
239 // populate LanguageDetectionResult with languages and percents 239 // populate LanguageDetectionResult with languages and percents
240 InitDetectedLanguages(languages, percents, &result.languages); 240 InitDetectedLanguages(languages, percents, &result.languages);
241 241
242 args.GetReturnValue().Set(result.ToValue(context())); 242 args.GetReturnValue().Set(result.ToValue(context()));
243 } 243 }
244 244
245 } // namespace extensions 245 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/display_source_custom_bindings.cc ('k') | extensions/renderer/lazy_background_page_native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698