OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/dom_distiller/content/renderer/distiller_native_javascript.
h" | 5 #include "components/dom_distiller/content/renderer/distiller_native_javascript.
h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 v8::Local<v8::Object> GetOrCreateDistillerObject(v8::Isolate* isolate, | 64 v8::Local<v8::Object> GetOrCreateDistillerObject(v8::Isolate* isolate, |
65 v8::Local<v8::Object> global) { | 65 v8::Local<v8::Object> global) { |
66 v8::Local<v8::Object> distiller_obj; | 66 v8::Local<v8::Object> distiller_obj; |
67 v8::Local<v8::Value> distiller_value = | 67 v8::Local<v8::Value> distiller_value = |
68 global->Get(gin::StringToV8(isolate, "distiller")); | 68 global->Get(gin::StringToV8(isolate, "distiller")); |
69 if (distiller_value.IsEmpty() || !distiller_value->IsObject()) { | 69 if (distiller_value.IsEmpty() || !distiller_value->IsObject()) { |
70 distiller_obj = v8::Object::New(isolate); | 70 distiller_obj = v8::Object::New(isolate); |
71 global->Set(gin::StringToSymbol(isolate, "distiller"), distiller_obj); | 71 global->Set(gin::StringToSymbol(isolate, "distiller"), distiller_obj); |
72 } else { | 72 } else { |
73 distiller_obj = v8::Local<v8::Object>::Cast(distiller_value); | 73 distiller_obj = distiller_value.As<v8::Object>(); |
74 } | 74 } |
75 return distiller_obj; | 75 return distiller_obj; |
76 } | 76 } |
77 | 77 |
78 } // namespace dom_distiller | 78 } // namespace dom_distiller |
OLD | NEW |