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/renderer/render_view.h" | 10 #include "content/public/renderer/render_view.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return; | 124 return; |
125 | 125 |
126 if (!args[0]->IsInt32() || !args[1]->IsString()) | 126 if (!args[0]->IsInt32() || !args[1]->IsString()) |
127 return; | 127 return; |
128 | 128 |
129 // |browser_window_id| == extension_misc::kUnknownWindowId means getting | 129 // |browser_window_id| == extension_misc::kUnknownWindowId means getting |
130 // all views for the current extension. | 130 // all views for the current extension. |
131 int browser_window_id = args[0]->Int32Value(); | 131 int browser_window_id = args[0]->Int32Value(); |
132 | 132 |
133 std::string view_type_string = *v8::String::Utf8Value(args[1]->ToString()); | 133 std::string view_type_string = *v8::String::Utf8Value(args[1]->ToString()); |
134 StringToUpperASCII(&view_type_string); | 134 base::StringToUpperASCII(&view_type_string); |
135 // |view_type| == VIEW_TYPE_INVALID means getting any type of | 135 // |view_type| == VIEW_TYPE_INVALID means getting any type of |
136 // views. | 136 // views. |
137 ViewType view_type = VIEW_TYPE_INVALID; | 137 ViewType view_type = VIEW_TYPE_INVALID; |
138 if (view_type_string == kViewTypeBackgroundPage) { | 138 if (view_type_string == kViewTypeBackgroundPage) { |
139 view_type = VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; | 139 view_type = VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; |
140 } else if (view_type_string == kViewTypeInfobar) { | 140 } else if (view_type_string == kViewTypeInfobar) { |
141 view_type = VIEW_TYPE_EXTENSION_INFOBAR; | 141 view_type = VIEW_TYPE_EXTENSION_INFOBAR; |
142 } else if (view_type_string == kViewTypeTabContents) { | 142 } else if (view_type_string == kViewTypeTabContents) { |
143 view_type = VIEW_TYPE_TAB_CONTENTS; | 143 view_type = VIEW_TYPE_TAB_CONTENTS; |
144 } else if (view_type_string == kViewTypePopup) { | 144 } else if (view_type_string == kViewTypePopup) { |
(...skipping 25 matching lines...) Expand all Loading... |
170 v8::Local<v8::Value> window = context->Global(); | 170 v8::Local<v8::Value> window = context->Global(); |
171 DCHECK(!window.IsEmpty()); | 171 DCHECK(!window.IsEmpty()); |
172 v8_views->Set(v8::Integer::New(args.GetIsolate(), v8_index++), window); | 172 v8_views->Set(v8::Integer::New(args.GetIsolate(), v8_index++), window); |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 args.GetReturnValue().Set(v8_views); | 176 args.GetReturnValue().Set(v8_views); |
177 } | 177 } |
178 | 178 |
179 } // namespace extensions | 179 } // namespace extensions |
OLD | NEW |