Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: chrome/renderer/extensions/dispatcher.cc

Issue 11574006: Implement chrome.downloads.onDeterminingFilename() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r176065 Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/dispatcher.h" 5 #include "chrome/renderer/extensions/dispatcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
11 #include "chrome/common/child_process_logging.h" 11 #include "chrome/common/child_process_logging.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/chrome_version_info.h" 13 #include "chrome/common/chrome_version_info.h"
14 #include "chrome/common/extensions/api/extension_api.h" 14 #include "chrome/common/extensions/api/extension_api.h"
15 #include "chrome/common/extensions/extension.h" 15 #include "chrome/common/extensions/extension.h"
16 #include "chrome/common/extensions/extension_messages.h" 16 #include "chrome/common/extensions/extension_messages.h"
17 #include "chrome/common/extensions/permissions/permission_set.h" 17 #include "chrome/common/extensions/permissions/permission_set.h"
18 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
19 #include "chrome/common/view_type.h" 19 #include "chrome/common/view_type.h"
20 #include "chrome/renderer/chrome_render_process_observer.h" 20 #include "chrome/renderer/chrome_render_process_observer.h"
21 #include "chrome/renderer/extensions/api_definitions_natives.h" 21 #include "chrome/renderer/extensions/api_definitions_natives.h"
22 #include "chrome/renderer/extensions/app_bindings.h" 22 #include "chrome/renderer/extensions/app_bindings.h"
23 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" 23 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h"
24 #include "chrome/renderer/extensions/app_window_custom_bindings.h" 24 #include "chrome/renderer/extensions/app_window_custom_bindings.h"
25 #include "chrome/renderer/extensions/chrome_v8_context.h" 25 #include "chrome/renderer/extensions/chrome_v8_context.h"
26 #include "chrome/renderer/extensions/chrome_v8_extension.h" 26 #include "chrome/renderer/extensions/chrome_v8_extension.h"
27 #include "chrome/renderer/extensions/context_menus_custom_bindings.h" 27 #include "chrome/renderer/extensions/context_menus_custom_bindings.h"
28 #include "chrome/renderer/extensions/downloads_custom_bindings.h"
28 #include "chrome/renderer/extensions/event_bindings.h" 29 #include "chrome/renderer/extensions/event_bindings.h"
29 #include "chrome/renderer/extensions/extension_custom_bindings.h" 30 #include "chrome/renderer/extensions/extension_custom_bindings.h"
30 #include "chrome/renderer/extensions/extension_groups.h" 31 #include "chrome/renderer/extensions/extension_groups.h"
31 #include "chrome/renderer/extensions/extension_helper.h" 32 #include "chrome/renderer/extensions/extension_helper.h"
32 #include "chrome/renderer/extensions/file_browser_handler_custom_bindings.h" 33 #include "chrome/renderer/extensions/file_browser_handler_custom_bindings.h"
33 #include "chrome/renderer/extensions/file_browser_private_custom_bindings.h" 34 #include "chrome/renderer/extensions/file_browser_private_custom_bindings.h"
34 #include "chrome/renderer/extensions/file_system_natives.h" 35 #include "chrome/renderer/extensions/file_system_natives.h"
35 #include "chrome/renderer/extensions/i18n_custom_bindings.h" 36 #include "chrome/renderer/extensions/i18n_custom_bindings.h"
36 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h" 37 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h"
37 #include "chrome/renderer/extensions/miscellaneous_bindings.h" 38 #include "chrome/renderer/extensions/miscellaneous_bindings.h"
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 572
572 // Custom bindings. 573 // Custom bindings.
573 module_system->RegisterNativeHandler("app", 574 module_system->RegisterNativeHandler("app",
574 scoped_ptr<NativeHandler>(new AppBindings(this, context))); 575 scoped_ptr<NativeHandler>(new AppBindings(this, context)));
575 module_system->RegisterNativeHandler("app_runtime", 576 module_system->RegisterNativeHandler("app_runtime",
576 scoped_ptr<NativeHandler>(new AppRuntimeCustomBindings())); 577 scoped_ptr<NativeHandler>(new AppRuntimeCustomBindings()));
577 module_system->RegisterNativeHandler("app_window", 578 module_system->RegisterNativeHandler("app_window",
578 scoped_ptr<NativeHandler>(new AppWindowCustomBindings(this))); 579 scoped_ptr<NativeHandler>(new AppWindowCustomBindings(this)));
579 module_system->RegisterNativeHandler("context_menus", 580 module_system->RegisterNativeHandler("context_menus",
580 scoped_ptr<NativeHandler>(new ContextMenusCustomBindings())); 581 scoped_ptr<NativeHandler>(new ContextMenusCustomBindings()));
582 module_system->RegisterNativeHandler("downloads",
583 scoped_ptr<NativeHandler>(new DownloadsCustomBindings()));
581 module_system->RegisterNativeHandler("extension", 584 module_system->RegisterNativeHandler("extension",
582 scoped_ptr<NativeHandler>( 585 scoped_ptr<NativeHandler>(
583 new ExtensionCustomBindings(this))); 586 new ExtensionCustomBindings(this)));
584 module_system->RegisterNativeHandler("sync_file_system",
585 scoped_ptr<NativeHandler>(new SyncFileSystemCustomBindings()));
586 module_system->RegisterNativeHandler("file_browser_handler", 587 module_system->RegisterNativeHandler("file_browser_handler",
587 scoped_ptr<NativeHandler>(new FileBrowserHandlerCustomBindings())); 588 scoped_ptr<NativeHandler>(new FileBrowserHandlerCustomBindings()));
588 module_system->RegisterNativeHandler("file_browser_private", 589 module_system->RegisterNativeHandler("file_browser_private",
589 scoped_ptr<NativeHandler>(new FileBrowserPrivateCustomBindings())); 590 scoped_ptr<NativeHandler>(new FileBrowserPrivateCustomBindings()));
590 module_system->RegisterNativeHandler("i18n", 591 module_system->RegisterNativeHandler("i18n",
591 scoped_ptr<NativeHandler>(new I18NCustomBindings())); 592 scoped_ptr<NativeHandler>(new I18NCustomBindings()));
592 module_system->RegisterNativeHandler("mediaGalleries", 593 module_system->RegisterNativeHandler("mediaGalleries",
593 scoped_ptr<NativeHandler>(new MediaGalleriesCustomBindings())); 594 scoped_ptr<NativeHandler>(new MediaGalleriesCustomBindings()));
594 module_system->RegisterNativeHandler("page_actions", 595 module_system->RegisterNativeHandler("page_actions",
595 scoped_ptr<NativeHandler>( 596 scoped_ptr<NativeHandler>(
596 new PageActionsCustomBindings(this))); 597 new PageActionsCustomBindings(this)));
597 module_system->RegisterNativeHandler("page_capture", 598 module_system->RegisterNativeHandler("page_capture",
598 scoped_ptr<NativeHandler>(new PageCaptureCustomBindings())); 599 scoped_ptr<NativeHandler>(new PageCaptureCustomBindings()));
599 module_system->RegisterNativeHandler("runtime", 600 module_system->RegisterNativeHandler("runtime",
600 scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context))); 601 scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context)));
602 module_system->RegisterNativeHandler("sync_file_system",
603 scoped_ptr<NativeHandler>(new SyncFileSystemCustomBindings()));
601 module_system->RegisterNativeHandler("tabs", 604 module_system->RegisterNativeHandler("tabs",
602 scoped_ptr<NativeHandler>(new TabsCustomBindings())); 605 scoped_ptr<NativeHandler>(new TabsCustomBindings()));
603 module_system->RegisterNativeHandler("tts", 606 module_system->RegisterNativeHandler("tts",
604 scoped_ptr<NativeHandler>(new TTSCustomBindings())); 607 scoped_ptr<NativeHandler>(new TTSCustomBindings()));
605 module_system->RegisterNativeHandler("web_request", 608 module_system->RegisterNativeHandler("web_request",
606 scoped_ptr<NativeHandler>(new WebRequestCustomBindings())); 609 scoped_ptr<NativeHandler>(new WebRequestCustomBindings()));
607 module_system->RegisterNativeHandler("webstore", 610 module_system->RegisterNativeHandler("webstore",
608 scoped_ptr<NativeHandler>(new WebstoreBindings(this, context))); 611 scoped_ptr<NativeHandler>(new WebstoreBindings(this, context)));
609 } 612 }
610 613
(...skipping 19 matching lines...) Expand all
630 source_map_.RegisterSource("app.window", IDR_APP_WINDOW_CUSTOM_BINDINGS_JS); 633 source_map_.RegisterSource("app.window", IDR_APP_WINDOW_CUSTOM_BINDINGS_JS);
631 source_map_.RegisterSource("bluetooth", IDR_BLUETOOTH_CUSTOM_BINDINGS_JS); 634 source_map_.RegisterSource("bluetooth", IDR_BLUETOOTH_CUSTOM_BINDINGS_JS);
632 source_map_.RegisterSource("browserAction", 635 source_map_.RegisterSource("browserAction",
633 IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS); 636 IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS);
634 source_map_.RegisterSource("contentSettings", 637 source_map_.RegisterSource("contentSettings",
635 IDR_CONTENT_SETTINGS_CUSTOM_BINDINGS_JS); 638 IDR_CONTENT_SETTINGS_CUSTOM_BINDINGS_JS);
636 source_map_.RegisterSource("contextMenus", 639 source_map_.RegisterSource("contextMenus",
637 IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS); 640 IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS);
638 source_map_.RegisterSource("declarativeWebRequest", 641 source_map_.RegisterSource("declarativeWebRequest",
639 IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS); 642 IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS);
643 source_map_.RegisterSource("downloads",
644 IDR_DOWNLOADS_CUSTOM_BINDINGS_JS);
640 source_map_.RegisterSource( 645 source_map_.RegisterSource(
641 "experimental.mediaGalleries", 646 "experimental.mediaGalleries",
642 IDR_EXPERIMENTAL_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS); 647 IDR_EXPERIMENTAL_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS);
643 source_map_.RegisterSource("experimental.offscreen", 648 source_map_.RegisterSource("experimental.offscreen",
644 IDR_EXPERIMENTAL_OFFSCREENTABS_CUSTOM_BINDINGS_JS); 649 IDR_EXPERIMENTAL_OFFSCREENTABS_CUSTOM_BINDINGS_JS);
645 source_map_.RegisterSource("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS); 650 source_map_.RegisterSource("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS);
646 source_map_.RegisterSource("fileBrowserHandler", 651 source_map_.RegisterSource("fileBrowserHandler",
647 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS); 652 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS);
648 source_map_.RegisterSource("fileBrowserPrivate", 653 source_map_.RegisterSource("fileBrowserPrivate",
649 IDR_FILE_BROWSER_PRIVATE_CUSTOM_BINDINGS_JS); 654 IDR_FILE_BROWSER_PRIVATE_CUSTOM_BINDINGS_JS);
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); 1135 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str());
1131 v8::ThrowException( 1136 v8::ThrowException(
1132 v8::Exception::Error(v8::String::New(error_msg.c_str()))); 1137 v8::Exception::Error(v8::String::New(error_msg.c_str())));
1133 return false; 1138 return false;
1134 } 1139 }
1135 1140
1136 return true; 1141 return true;
1137 } 1142 }
1138 1143
1139 } // namespace extensions 1144 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698