OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions/extension_process_bindings.h" | 5 #include "chrome/renderer/extensions/extension_process_bindings.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 if (extension_id.empty()) | 292 if (extension_id.empty()) |
293 return v8::Undefined(); | 293 return v8::Undefined(); |
294 | 294 |
295 ExtensionViewAccumulator popup_matcher(extension_id, | 295 ExtensionViewAccumulator popup_matcher(extension_id, |
296 browser_window_id, | 296 browser_window_id, |
297 viewtype_to_find); | 297 viewtype_to_find); |
298 RenderView::ForEach(&popup_matcher); | 298 RenderView::ForEach(&popup_matcher); |
299 | 299 |
300 if (0 == popup_matcher.views()->Length()) | 300 if (0 == popup_matcher.views()->Length()) |
301 return v8::Undefined(); | 301 return v8::Undefined(); |
302 DCHECK(popup_matcher.views()->Has(0)); | 302 DCHECK(1 == popup_matcher.views()->Length()); |
303 | 303 |
304 // Return the first view found. | 304 // Return the first view found. |
305 return popup_matcher.views()->Get(v8::Integer::New(0)); | 305 return popup_matcher.views()->Get(v8::Integer::New(0)); |
306 } | 306 } |
307 | 307 |
308 static v8::Handle<v8::Value> GetPopupView(const v8::Arguments& args) { | 308 static v8::Handle<v8::Value> GetPopupView(const v8::Arguments& args) { |
309 return PopupViewFinder(args, ViewType::EXTENSION_POPUP); | 309 return PopupViewFinder(args, ViewType::EXTENSION_POPUP); |
310 } | 310 } |
311 | 311 |
312 static v8::Handle<v8::Value> GetPopupParentWindow(const v8::Arguments& args) { | 312 static v8::Handle<v8::Value> GetPopupParentWindow(const v8::Arguments& args) { |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 return; | 684 return; |
685 | 685 |
686 v8::HandleScope handle_scope; | 686 v8::HandleScope handle_scope; |
687 WebFrame* frame = view->mainFrame(); | 687 WebFrame* frame = view->mainFrame(); |
688 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); | 688 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); |
689 v8::Handle<v8::Value> argv[1]; | 689 v8::Handle<v8::Value> argv[1]; |
690 argv[0] = v8::String::New(type_str); | 690 argv[0] = v8::String::New(type_str); |
691 bindings_utils::CallFunctionInContext(context, "setViewType", | 691 bindings_utils::CallFunctionInContext(context, "setViewType", |
692 arraysize(argv), argv); | 692 arraysize(argv), argv); |
693 } | 693 } |
OLD | NEW |