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

Side by Side Diff: chrome/browser/extensions/extension_host.cc

Issue 12225076: Delete most web intents code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 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/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/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/browser_shutdown.h" 16 #include "chrome/browser/browser_shutdown.h"
17 #include "chrome/browser/extensions/event_router.h" 17 #include "chrome/browser/extensions/event_router.h"
18 #include "chrome/browser/extensions/extension_process_manager.h" 18 #include "chrome/browser/extensions/extension_process_manager.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/extension_system.h" 20 #include "chrome/browser/extensions/extension_system.h"
21 #include "chrome/browser/extensions/extension_tab_util.h" 21 #include "chrome/browser/extensions/extension_tab_util.h"
22 #include "chrome/browser/extensions/window_controller.h" 22 #include "chrome/browser/extensions/window_controller.h"
23 #include "chrome/browser/file_select_helper.h" 23 #include "chrome/browser/file_select_helper.h"
24 #include "chrome/browser/intents/web_intents_util.h"
25 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 24 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
26 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h" 26 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h"
28 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
30 #include "chrome/browser/ui/browser_list.h" 29 #include "chrome/browser/ui/browser_list.h"
31 #include "chrome/browser/ui/browser_window.h" 30 #include "chrome/browser/ui/browser_window.h"
32 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 31 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
33 #include "chrome/browser/view_type_utils.h" 32 #include "chrome/browser/view_type_utils.h"
34 #include "chrome/common/chrome_constants.h" 33 #include "chrome/common/chrome_constants.h"
35 #include "chrome/common/chrome_notification_types.h" 34 #include "chrome/common/chrome_notification_types.h"
36 #include "chrome/common/extensions/extension.h" 35 #include "chrome/common/extensions/extension.h"
37 #include "chrome/common/extensions/extension_constants.h" 36 #include "chrome/common/extensions/extension_constants.h"
38 #include "chrome/common/extensions/extension_messages.h" 37 #include "chrome/common/extensions/extension_messages.h"
39 #include "chrome/common/extensions/feature_switch.h" 38 #include "chrome/common/extensions/feature_switch.h"
40 #include "chrome/common/extensions/request_media_access_permission_helper.h" 39 #include "chrome/common/extensions/request_media_access_permission_helper.h"
41 #include "chrome/common/render_messages.h" 40 #include "chrome/common/render_messages.h"
42 #include "chrome/common/url_constants.h" 41 #include "chrome/common/url_constants.h"
43 #include "content/public/browser/content_browser_client.h" 42 #include "content/public/browser/content_browser_client.h"
44 #include "content/public/browser/native_web_keyboard_event.h" 43 #include "content/public/browser/native_web_keyboard_event.h"
45 #include "content/public/browser/notification_service.h" 44 #include "content/public/browser/notification_service.h"
46 #include "content/public/browser/render_process_host.h" 45 #include "content/public/browser/render_process_host.h"
47 #include "content/public/browser/render_view_host.h" 46 #include "content/public/browser/render_view_host.h"
48 #include "content/public/browser/site_instance.h" 47 #include "content/public/browser/site_instance.h"
49 #include "content/public/browser/web_contents.h" 48 #include "content/public/browser/web_contents.h"
50 #include "content/public/browser/web_contents_view.h" 49 #include "content/public/browser/web_contents_view.h"
51 #include "content/public/browser/web_intents_dispatcher.h"
52 #include "grit/browser_resources.h" 50 #include "grit/browser_resources.h"
53 #include "grit/chromium_strings.h" 51 #include "grit/chromium_strings.h"
54 #include "grit/generated_resources.h" 52 #include "grit/generated_resources.h"
55 #include "ui/base/keycodes/keyboard_codes.h" 53 #include "ui/base/keycodes/keyboard_codes.h"
56 #include "ui/base/l10n/l10n_util.h" 54 #include "ui/base/l10n/l10n_util.h"
57 #include "ui/base/resource/resource_bundle.h" 55 #include "ui/base/resource/resource_bundle.h"
58 56
59 using WebKit::WebDragOperation; 57 using WebKit::WebDragOperation;
60 using WebKit::WebDragOperationsMask; 58 using WebKit::WebDragOperationsMask;
61 using content::NativeWebKeyboardEvent; 59 using content::NativeWebKeyboardEvent;
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 void ExtensionHost::OnStartDownload( 415 void ExtensionHost::OnStartDownload(
418 content::WebContents* source, content::DownloadItem* download) { 416 content::WebContents* source, content::DownloadItem* download) {
419 // If |source| is in the context of a Browser, show the DownloadShelf on that 417 // If |source| is in the context of a Browser, show the DownloadShelf on that
420 // Browser. 418 // Browser.
421 if (!view() || !view()->browser()) 419 if (!view() || !view()->browser())
422 return; 420 return;
423 static_cast<content::WebContentsDelegate*>(view()->browser())-> 421 static_cast<content::WebContentsDelegate*>(view()->browser())->
424 OnStartDownload(source, download); 422 OnStartDownload(source, download);
425 } 423 }
426 424
427 void ExtensionHost::WebIntentDispatch(
428 content::WebContents* web_contents,
429 content::WebIntentsDispatcher* intents_dispatcher) {
430 #if !defined(OS_ANDROID)
431 scoped_ptr<content::WebIntentsDispatcher> dispatcher(intents_dispatcher);
432
433 Browser* browser = view() ? view()->browser()
434 : chrome::FindBrowserWithWebContents(web_contents);
435
436 // For background scripts/pages, there will be no view(). In this case, we
437 // want to treat the intent as a browser-initiated one and deliver it into the
438 // current browser. It probably came from a context menu click or similar.
439 if (!browser)
440 browser = web_intents::GetBrowserForBackgroundWebIntentDelivery(profile());
441
442 if (browser) {
443 static_cast<WebContentsDelegate*>(browser)->
444 WebIntentDispatch(NULL, dispatcher.release());
445 }
446 #endif
447 }
448
449 void ExtensionHost::WillRunJavaScriptDialog() { 425 void ExtensionHost::WillRunJavaScriptDialog() {
450 ExtensionProcessManager* pm = 426 ExtensionProcessManager* pm =
451 ExtensionSystem::Get(profile_)->process_manager(); 427 ExtensionSystem::Get(profile_)->process_manager();
452 if (pm) 428 if (pm)
453 pm->IncrementLazyKeepaliveCount(extension()); 429 pm->IncrementLazyKeepaliveCount(extension());
454 } 430 }
455 431
456 void ExtensionHost::DidCloseJavaScriptDialog() { 432 void ExtensionHost::DidCloseJavaScriptDialog() {
457 ExtensionProcessManager* pm = 433 ExtensionProcessManager* pm =
458 ExtensionSystem::Get(profile_)->process_manager(); 434 ExtensionSystem::Get(profile_)->process_manager();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 content::IsAudioMediaType(request.audio_type), 633 content::IsAudioMediaType(request.audio_type),
658 content::IsVideoMediaType(request.video_type), 634 content::IsVideoMediaType(request.video_type),
659 &devices); 635 &devices);
660 636
661 // For tab capture device, we require the tabCapture permission. 637 // For tab capture device, we require the tabCapture permission.
662 RequestMediaAccessPermissionHelper::AuthorizeRequest( 638 RequestMediaAccessPermissionHelper::AuthorizeRequest(
663 devices, request, callback, extension(), false); 639 devices, request, callback, extension(), false);
664 } 640 }
665 641
666 } // namespace extensions 642 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/extensions/extension_special_storage_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698