| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 if (extension_id.empty()) | 290 if (extension_id.empty()) |
| 291 return v8::Undefined(); | 291 return v8::Undefined(); |
| 292 | 292 |
| 293 ExtensionViewAccumulator popup_matcher(extension_id, | 293 ExtensionViewAccumulator popup_matcher(extension_id, |
| 294 browser_window_id, | 294 browser_window_id, |
| 295 viewtype_to_find); | 295 viewtype_to_find); |
| 296 RenderView::ForEach(&popup_matcher); | 296 RenderView::ForEach(&popup_matcher); |
| 297 | 297 |
| 298 if (0 == popup_matcher.views()->Length()) | 298 if (0 == popup_matcher.views()->Length()) |
| 299 return v8::Undefined(); | 299 return v8::Undefined(); |
| 300 DCHECK(popup_matcher.views()->Has(0)); | 300 DCHECK(1 == popup_matcher.views()->Length()); |
| 301 | 301 |
| 302 // Return the first view found. | 302 // Return the first view found. |
| 303 return popup_matcher.views()->Get(v8::Integer::New(0)); | 303 return popup_matcher.views()->Get(v8::Integer::New(0)); |
| 304 } | 304 } |
| 305 | 305 |
| 306 static v8::Handle<v8::Value> GetPopupView(const v8::Arguments& args) { | 306 static v8::Handle<v8::Value> GetPopupView(const v8::Arguments& args) { |
| 307 return PopupViewFinder(args, ViewType::EXTENSION_POPUP); | 307 return PopupViewFinder(args, ViewType::EXTENSION_POPUP); |
| 308 } | 308 } |
| 309 | 309 |
| 310 static v8::Handle<v8::Value> GetPopupParentWindow(const v8::Arguments& args) { | 310 static v8::Handle<v8::Value> GetPopupParentWindow(const v8::Arguments& args) { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 return; | 682 return; |
| 683 | 683 |
| 684 v8::HandleScope handle_scope; | 684 v8::HandleScope handle_scope; |
| 685 WebFrame* frame = view->mainFrame(); | 685 WebFrame* frame = view->mainFrame(); |
| 686 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); | 686 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); |
| 687 v8::Handle<v8::Value> argv[1]; | 687 v8::Handle<v8::Value> argv[1]; |
| 688 argv[0] = v8::String::New(type_str); | 688 argv[0] = v8::String::New(type_str); |
| 689 bindings_utils::CallFunctionInContext(context, "setViewType", | 689 bindings_utils::CallFunctionInContext(context, "setViewType", |
| 690 arraysize(argv), argv); | 690 arraysize(argv), argv); |
| 691 } | 691 } |
| OLD | NEW |