OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/renderer/sandbox_status_extension_android.h" | 5 #include "chrome/renderer/sandbox_status_extension_android.h" |
6 | 6 |
7 #include "base/android/build_info.h" | 7 #include "base/android/build_info.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 v8::Local<v8::Function> callback; | 98 v8::Local<v8::Function> callback; |
99 if (!args->GetNext(&callback)) { | 99 if (!args->GetNext(&callback)) { |
100 args->ThrowError(); | 100 args->ThrowError(); |
101 return; | 101 return; |
102 } | 102 } |
103 | 103 |
104 auto global_callback = | 104 auto global_callback = |
105 base::MakeUnique<v8::Global<v8::Function>>(args->isolate(), callback); | 105 base::MakeUnique<v8::Global<v8::Function>>(args->isolate(), callback); |
106 | 106 |
107 base::PostTaskWithTraitsAndReplyWithResult( | 107 base::PostTaskWithTraitsAndReplyWithResult( |
108 FROM_HERE, base::TaskTraits().MayBlock(), | 108 FROM_HERE, {base::MayBlock()}, |
109 base::Bind(&SandboxStatusExtension::ReadSandboxStatus, this), | 109 base::Bind(&SandboxStatusExtension::ReadSandboxStatus, this), |
110 base::Bind(&SandboxStatusExtension::RunCallback, this, | 110 base::Bind(&SandboxStatusExtension::RunCallback, this, |
111 base::Passed(&global_callback))); | 111 base::Passed(&global_callback))); |
112 } | 112 } |
113 | 113 |
114 std::unique_ptr<base::Value> SandboxStatusExtension::ReadSandboxStatus() { | 114 std::unique_ptr<base::Value> SandboxStatusExtension::ReadSandboxStatus() { |
115 std::string secontext; | 115 std::string secontext; |
116 base::FilePath path(FILE_PATH_LITERAL("/proc/self/attr/current")); | 116 base::FilePath path(FILE_PATH_LITERAL("/proc/self/attr/current")); |
117 base::ReadFileToString(path, &secontext); | 117 base::ReadFileToString(path, &secontext); |
118 | 118 |
(...skipping 29 matching lines...) Expand all Loading... |
148 v8::Local<v8::Function> callback_local = | 148 v8::Local<v8::Function> callback_local = |
149 v8::Local<v8::Function>::New(isolate, *callback); | 149 v8::Local<v8::Function>::New(isolate, *callback); |
150 | 150 |
151 std::unique_ptr<content::V8ValueConverter> converter( | 151 std::unique_ptr<content::V8ValueConverter> converter( |
152 content::V8ValueConverter::create()); | 152 content::V8ValueConverter::create()); |
153 | 153 |
154 v8::Local<v8::Value> argv[] = {converter->ToV8Value(status.get(), context)}; | 154 v8::Local<v8::Value> argv[] = {converter->ToV8Value(status.get(), context)}; |
155 render_frame()->GetWebFrame()->CallFunctionEvenIfScriptDisabled( | 155 render_frame()->GetWebFrame()->CallFunctionEvenIfScriptDisabled( |
156 callback_local, v8::Object::New(isolate), 1, argv); | 156 callback_local, v8::Object::New(isolate), 1, argv); |
157 } | 157 } |
OLD | NEW |