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

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: @r177662 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 574
574 // Custom bindings. 575 // Custom bindings.
575 module_system->RegisterNativeHandler("app", 576 module_system->RegisterNativeHandler("app",
576 scoped_ptr<NativeHandler>(new AppBindings(this, context))); 577 scoped_ptr<NativeHandler>(new AppBindings(this, context)));
577 module_system->RegisterNativeHandler("app_runtime", 578 module_system->RegisterNativeHandler("app_runtime",
578 scoped_ptr<NativeHandler>(new AppRuntimeCustomBindings())); 579 scoped_ptr<NativeHandler>(new AppRuntimeCustomBindings()));
579 module_system->RegisterNativeHandler("app_window", 580 module_system->RegisterNativeHandler("app_window",
580 scoped_ptr<NativeHandler>(new AppWindowCustomBindings(this))); 581 scoped_ptr<NativeHandler>(new AppWindowCustomBindings(this)));
581 module_system->RegisterNativeHandler("context_menus", 582 module_system->RegisterNativeHandler("context_menus",
582 scoped_ptr<NativeHandler>(new ContextMenusCustomBindings())); 583 scoped_ptr<NativeHandler>(new ContextMenusCustomBindings()));
584 module_system->RegisterNativeHandler("downloads",
585 scoped_ptr<NativeHandler>(new DownloadsCustomBindings()));
583 module_system->RegisterNativeHandler("extension", 586 module_system->RegisterNativeHandler("extension",
584 scoped_ptr<NativeHandler>( 587 scoped_ptr<NativeHandler>(
585 new ExtensionCustomBindings(this))); 588 new ExtensionCustomBindings(this)));
586 module_system->RegisterNativeHandler("sync_file_system",
587 scoped_ptr<NativeHandler>(new SyncFileSystemCustomBindings()));
588 module_system->RegisterNativeHandler("file_browser_handler", 589 module_system->RegisterNativeHandler("file_browser_handler",
589 scoped_ptr<NativeHandler>(new FileBrowserHandlerCustomBindings())); 590 scoped_ptr<NativeHandler>(new FileBrowserHandlerCustomBindings()));
590 module_system->RegisterNativeHandler("file_browser_private", 591 module_system->RegisterNativeHandler("file_browser_private",
591 scoped_ptr<NativeHandler>(new FileBrowserPrivateCustomBindings())); 592 scoped_ptr<NativeHandler>(new FileBrowserPrivateCustomBindings()));
592 module_system->RegisterNativeHandler("i18n", 593 module_system->RegisterNativeHandler("i18n",
593 scoped_ptr<NativeHandler>(new I18NCustomBindings())); 594 scoped_ptr<NativeHandler>(new I18NCustomBindings()));
594 module_system->RegisterNativeHandler("mediaGalleries", 595 module_system->RegisterNativeHandler("mediaGalleries",
595 scoped_ptr<NativeHandler>(new MediaGalleriesCustomBindings())); 596 scoped_ptr<NativeHandler>(new MediaGalleriesCustomBindings()));
596 module_system->RegisterNativeHandler("page_actions", 597 module_system->RegisterNativeHandler("page_actions",
597 scoped_ptr<NativeHandler>( 598 scoped_ptr<NativeHandler>(
598 new PageActionsCustomBindings(this))); 599 new PageActionsCustomBindings(this)));
599 module_system->RegisterNativeHandler("page_capture", 600 module_system->RegisterNativeHandler("page_capture",
600 scoped_ptr<NativeHandler>(new PageCaptureCustomBindings())); 601 scoped_ptr<NativeHandler>(new PageCaptureCustomBindings()));
601 module_system->RegisterNativeHandler("runtime", 602 module_system->RegisterNativeHandler("runtime",
602 scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context))); 603 scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context)));
604 module_system->RegisterNativeHandler("sync_file_system",
605 scoped_ptr<NativeHandler>(new SyncFileSystemCustomBindings()));
603 module_system->RegisterNativeHandler("tabs", 606 module_system->RegisterNativeHandler("tabs",
604 scoped_ptr<NativeHandler>(new TabsCustomBindings())); 607 scoped_ptr<NativeHandler>(new TabsCustomBindings()));
605 module_system->RegisterNativeHandler("tts", 608 module_system->RegisterNativeHandler("tts",
606 scoped_ptr<NativeHandler>(new TTSCustomBindings())); 609 scoped_ptr<NativeHandler>(new TTSCustomBindings()));
607 module_system->RegisterNativeHandler("web_request", 610 module_system->RegisterNativeHandler("web_request",
608 scoped_ptr<NativeHandler>(new WebRequestCustomBindings())); 611 scoped_ptr<NativeHandler>(new WebRequestCustomBindings()));
609 module_system->RegisterNativeHandler("webstore", 612 module_system->RegisterNativeHandler("webstore",
610 scoped_ptr<NativeHandler>(new WebstoreBindings(this, context))); 613 scoped_ptr<NativeHandler>(new WebstoreBindings(this, context)));
611 } 614 }
612 615
(...skipping 20 matching lines...) Expand all
633 source_map_.RegisterSource("app.window", IDR_APP_WINDOW_CUSTOM_BINDINGS_JS); 636 source_map_.RegisterSource("app.window", IDR_APP_WINDOW_CUSTOM_BINDINGS_JS);
634 source_map_.RegisterSource("bluetooth", IDR_BLUETOOTH_CUSTOM_BINDINGS_JS); 637 source_map_.RegisterSource("bluetooth", IDR_BLUETOOTH_CUSTOM_BINDINGS_JS);
635 source_map_.RegisterSource("browserAction", 638 source_map_.RegisterSource("browserAction",
636 IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS); 639 IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS);
637 source_map_.RegisterSource("contentSettings", 640 source_map_.RegisterSource("contentSettings",
638 IDR_CONTENT_SETTINGS_CUSTOM_BINDINGS_JS); 641 IDR_CONTENT_SETTINGS_CUSTOM_BINDINGS_JS);
639 source_map_.RegisterSource("contextMenus", 642 source_map_.RegisterSource("contextMenus",
640 IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS); 643 IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS);
641 source_map_.RegisterSource("declarativeWebRequest", 644 source_map_.RegisterSource("declarativeWebRequest",
642 IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS); 645 IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS);
646 source_map_.RegisterSource("downloads",
647 IDR_DOWNLOADS_CUSTOM_BINDINGS_JS);
643 source_map_.RegisterSource( 648 source_map_.RegisterSource(
644 "experimental.mediaGalleries", 649 "experimental.mediaGalleries",
645 IDR_EXPERIMENTAL_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS); 650 IDR_EXPERIMENTAL_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS);
646 source_map_.RegisterSource("experimental.offscreen", 651 source_map_.RegisterSource("experimental.offscreen",
647 IDR_EXPERIMENTAL_OFFSCREENTABS_CUSTOM_BINDINGS_JS); 652 IDR_EXPERIMENTAL_OFFSCREENTABS_CUSTOM_BINDINGS_JS);
648 source_map_.RegisterSource("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS); 653 source_map_.RegisterSource("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS);
649 source_map_.RegisterSource("fileBrowserHandler", 654 source_map_.RegisterSource("fileBrowserHandler",
650 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS); 655 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS);
651 source_map_.RegisterSource("fileBrowserPrivate", 656 source_map_.RegisterSource("fileBrowserPrivate",
652 IDR_FILE_BROWSER_PRIVATE_CUSTOM_BINDINGS_JS); 657 IDR_FILE_BROWSER_PRIVATE_CUSTOM_BINDINGS_JS);
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); 1138 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str());
1134 v8::ThrowException( 1139 v8::ThrowException(
1135 v8::Exception::Error(v8::String::New(error_msg.c_str()))); 1140 v8::Exception::Error(v8::String::New(error_msg.c_str())));
1136 return false; 1141 return false;
1137 } 1142 }
1138 1143
1139 return true; 1144 return true;
1140 } 1145 }
1141 1146
1142 } // namespace extensions 1147 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698