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

Side by Side Diff: chrome/renderer/sandbox_status_extension_android.cc

Issue 2847573002: Fix about:sandbox display on Android. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 v8::HandleScope handle_scope(isolate); 68 v8::HandleScope handle_scope(isolate);
69 v8::Local<v8::Context> context = 69 v8::Local<v8::Context> context =
70 render_frame()->GetWebFrame()->MainWorldScriptContext(); 70 render_frame()->GetWebFrame()->MainWorldScriptContext();
71 if (context.IsEmpty()) 71 if (context.IsEmpty())
72 return; 72 return;
73 73
74 v8::Context::Scope context_scope(context); 74 v8::Context::Scope context_scope(context);
75 75
76 v8::Local<v8::Object> chrome = 76 v8::Local<v8::Object> chrome =
77 content::GetOrCreateChromeObject(isolate, context->Global()); 77 content::GetOrCreateChromeObject(isolate, context->Global());
78 DCHECK(chrome->Set( 78 bool success = chrome->Set(
79 gin::StringToSymbol(isolate, "getAndroidSandboxStatus"), 79 gin::StringToSymbol(isolate, "getAndroidSandboxStatus"),
80 gin::CreateFunctionTemplate( 80 gin::CreateFunctionTemplate(
81 isolate, base::Bind(&SandboxStatusExtension::GetSandboxStatus, this)) 81 isolate, base::Bind(&SandboxStatusExtension::GetSandboxStatus, this))
82 ->GetFunction())); 82 ->GetFunction());
83 DCHECK(success);
83 } 84 }
84 85
85 void SandboxStatusExtension::GetSandboxStatus(gin::Arguments* args) { 86 void SandboxStatusExtension::GetSandboxStatus(gin::Arguments* args) {
86 if (!render_frame()) 87 if (!render_frame())
87 return; 88 return;
88 89
89 if (render_frame()->GetWebFrame()->GetSecurityOrigin().Host() != 90 if (render_frame()->GetWebFrame()->GetSecurityOrigin().Host() !=
90 chrome::kChromeUISandboxHost) { 91 chrome::kChromeUISandboxHost) {
91 args->ThrowTypeError("Not allowed on this origin"); 92 args->ThrowTypeError("Not allowed on this origin");
92 return; 93 return;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 v8::Local<v8::Function> callback_local = 148 v8::Local<v8::Function> callback_local =
148 v8::Local<v8::Function>::New(isolate, *callback); 149 v8::Local<v8::Function>::New(isolate, *callback);
149 150
150 std::unique_ptr<content::V8ValueConverter> converter( 151 std::unique_ptr<content::V8ValueConverter> converter(
151 content::V8ValueConverter::create()); 152 content::V8ValueConverter::create());
152 153
153 v8::Local<v8::Value> argv[] = {converter->ToV8Value(status.get(), context)}; 154 v8::Local<v8::Value> argv[] = {converter->ToV8Value(status.get(), context)};
154 render_frame()->GetWebFrame()->CallFunctionEvenIfScriptDisabled( 155 render_frame()->GetWebFrame()->CallFunctionEvenIfScriptDisabled(
155 callback_local, v8::Object::New(isolate), 1, argv); 156 callback_local, v8::Object::New(isolate), 1, argv);
156 } 157 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698