OLD | NEW |
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/runtime_custom_bindings.h" | 5 #include "extensions/renderer/runtime_custom_bindings.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "content/public/child/v8_value_converter.h" | 10 #include "content/public/child/v8_value_converter.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (args.Length() != 2) | 118 if (args.Length() != 2) |
119 return; | 119 return; |
120 | 120 |
121 if (!args[0]->IsInt32() || !args[1]->IsString()) | 121 if (!args[0]->IsInt32() || !args[1]->IsString()) |
122 return; | 122 return; |
123 | 123 |
124 // |browser_window_id| == extension_misc::kUnknownWindowId means getting | 124 // |browser_window_id| == extension_misc::kUnknownWindowId means getting |
125 // all views for the current extension. | 125 // all views for the current extension. |
126 int browser_window_id = args[0]->Int32Value(); | 126 int browser_window_id = args[0]->Int32Value(); |
127 | 127 |
128 std::string view_type_string = *v8::String::Utf8Value(args[1]); | 128 std::string view_type_string = |
129 base::StringToUpperASCII(&view_type_string); | 129 base::ToUpperASCII(*v8::String::Utf8Value(args[1])); |
130 // |view_type| == VIEW_TYPE_INVALID means getting any type of | 130 // |view_type| == VIEW_TYPE_INVALID means getting any type of |
131 // views. | 131 // views. |
132 ViewType view_type = VIEW_TYPE_INVALID; | 132 ViewType view_type = VIEW_TYPE_INVALID; |
133 if (view_type_string == kViewTypeBackgroundPage) { | 133 if (view_type_string == kViewTypeBackgroundPage) { |
134 view_type = VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; | 134 view_type = VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; |
135 } else if (view_type_string == kViewTypeTabContents) { | 135 } else if (view_type_string == kViewTypeTabContents) { |
136 view_type = VIEW_TYPE_TAB_CONTENTS; | 136 view_type = VIEW_TYPE_TAB_CONTENTS; |
137 } else if (view_type_string == kViewTypePopup) { | 137 } else if (view_type_string == kViewTypePopup) { |
138 view_type = VIEW_TYPE_EXTENSION_POPUP; | 138 view_type = VIEW_TYPE_EXTENSION_POPUP; |
139 } else if (view_type_string == kViewTypeExtensionDialog) { | 139 } else if (view_type_string == kViewTypeExtensionDialog) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 v8::Local<v8::Value> window = context->Global(); | 171 v8::Local<v8::Value> window = context->Global(); |
172 DCHECK(!window.IsEmpty()); | 172 DCHECK(!window.IsEmpty()); |
173 v8_views->Set(v8::Integer::New(args.GetIsolate(), v8_index++), window); | 173 v8_views->Set(v8::Integer::New(args.GetIsolate(), v8_index++), window); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 args.GetReturnValue().Set(v8_views); | 177 args.GetReturnValue().Set(v8_views); |
178 } | 178 } |
179 | 179 |
180 } // namespace extensions | 180 } // namespace extensions |
OLD | NEW |