Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/extensions/extension_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 webkit_prefs.allow_scripts_to_close_windows = true; | 508 webkit_prefs.allow_scripts_to_close_windows = true; |
| 509 | 509 |
| 510 // Disable anything that requires the GPU process for background pages. | 510 // Disable anything that requires the GPU process for background pages. |
| 511 // See http://crbug.com/64512 and http://crbug.com/64841. | 511 // See http://crbug.com/64512 and http://crbug.com/64841. |
| 512 if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) { | 512 if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) { |
| 513 webkit_prefs.experimental_webgl_enabled = false; | 513 webkit_prefs.experimental_webgl_enabled = false; |
| 514 webkit_prefs.accelerated_compositing_enabled = false; | 514 webkit_prefs.accelerated_compositing_enabled = false; |
| 515 webkit_prefs.accelerated_2d_canvas_enabled = false; | 515 webkit_prefs.accelerated_2d_canvas_enabled = false; |
| 516 } | 516 } |
| 517 | 517 |
| 518 // TODO(dcheng): incorporate this setting into kClipboardPermission check. | |
| 519 webkit_prefs.javascript_can_access_clipboard = true; | |
| 520 | |
| 521 // TODO(dcheng): check kClipboardPermission instead once it's implemented. | |
| 522 if (extension_->HasApiPermission(Extension::kExperimentalPermission)) | |
| 523 webkit_prefs.dom_paste_enabled = true; | |
| 524 return webkit_prefs; | 518 return webkit_prefs; |
| 525 } | 519 } |
| 526 | 520 |
| 527 void ExtensionHost::ProcessWebUIMessage( | 521 void ExtensionHost::ProcessWebUIMessage( |
| 528 const ViewHostMsg_DomMessage_Params& params) { | 522 const ViewHostMsg_DomMessage_Params& params) { |
| 529 if (extension_function_dispatcher_.get()) { | 523 if (extension_function_dispatcher_.get()) { |
| 530 extension_function_dispatcher_->HandleRequest(params); | 524 extension_function_dispatcher_->HandleRequest(params); |
| 531 } | 525 } |
| 532 } | 526 } |
| 533 | 527 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 663 #if defined(OS_MACOSX) | 657 #if defined(OS_MACOSX) |
| 664 PopupMenuHelper popup_menu_helper(render_view_host()); | 658 PopupMenuHelper popup_menu_helper(render_view_host()); |
| 665 popup_menu_helper.ShowPopupMenu(bounds, item_height, item_font_size, | 659 popup_menu_helper.ShowPopupMenu(bounds, item_height, item_font_size, |
| 666 selected_item, items, right_aligned); | 660 selected_item, items, right_aligned); |
| 667 #else | 661 #else |
| 668 // Only on Mac are select popup menus external. | 662 // Only on Mac are select popup menus external. |
| 669 NOTREACHED(); | 663 NOTREACHED(); |
| 670 #endif | 664 #endif |
| 671 } | 665 } |
| 672 | 666 |
| 667 bool ExtensionHost::IsCopyCutEnabled() { | |
| 668 // For backwards compatibility, extensions can always copy/cut items into the | |
| 669 // clipboard. | |
| 670 return true; | |
| 671 } | |
| 672 | |
| 673 bool ExtensionHost::IsPasteEnabled() { | |
| 674 return extension_->HasApiPermission(Extension::kClipboardPermission); | |
|
rniwa-cr
2011/02/16 03:41:50
Is extension_ origin controlled? i.e. only script
| |
| 675 } | |
| 676 | |
| 673 void ExtensionHost::StartDragging(const WebDropData& drop_data, | 677 void ExtensionHost::StartDragging(const WebDropData& drop_data, |
| 674 WebDragOperationsMask operation_mask, | 678 WebDragOperationsMask operation_mask, |
| 675 const SkBitmap& image, | 679 const SkBitmap& image, |
| 676 const gfx::Point& image_offset) { | 680 const gfx::Point& image_offset) { |
| 677 // We're not going to do any drag & drop, but we have to tell the renderer the | 681 // We're not going to do any drag & drop, but we have to tell the renderer the |
| 678 // drag & drop ended, othewise the renderer thinks the drag operation is | 682 // drag & drop ended, othewise the renderer thinks the drag operation is |
| 679 // underway and mouse events won't work. See bug 34061. | 683 // underway and mouse events won't work. See bug 34061. |
| 680 // TODO(twiz) Implement drag & drop support for ExtensionHost instances. | 684 // TODO(twiz) Implement drag & drop support for ExtensionHost instances. |
| 681 // See feature issue 36288. | 685 // See feature issue 36288. |
| 682 render_view_host()->DragSourceSystemDragEnded(); | 686 render_view_host()->DragSourceSystemDragEnded(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 813 } | 817 } |
| 814 return window_id; | 818 return window_id; |
| 815 } | 819 } |
| 816 | 820 |
| 817 void ExtensionHost::OnRunFileChooser( | 821 void ExtensionHost::OnRunFileChooser( |
| 818 const ViewHostMsg_RunFileChooser_Params& params) { | 822 const ViewHostMsg_RunFileChooser_Params& params) { |
| 819 if (file_select_helper_.get() == NULL) | 823 if (file_select_helper_.get() == NULL) |
| 820 file_select_helper_.reset(new FileSelectHelper(profile())); | 824 file_select_helper_.reset(new FileSelectHelper(profile())); |
| 821 file_select_helper_->RunFileChooser(render_view_host_, params); | 825 file_select_helper_->RunFileChooser(render_view_host_, params); |
| 822 } | 826 } |
| OLD | NEW |