OLD | NEW |
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/extension_event_router.h" | 17 #include "chrome/browser/extensions/extension_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/extension_window_controller.h" | 22 #include "chrome/browser/extensions/extension_window_controller.h" |
| 23 #include "chrome/browser/file_select_helper.h" |
23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 25 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
25 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
26 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
27 #include "chrome/browser/ui/browser_list.h" | 28 #include "chrome/browser/ui/browser_list.h" |
28 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
29 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 30 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
30 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 31 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
31 #include "chrome/common/chrome_constants.h" | 32 #include "chrome/common/chrome_constants.h" |
32 #include "chrome/common/chrome_notification_types.h" | 33 #include "chrome/common/chrome_notification_types.h" |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 530 |
530 content::JavaScriptDialogCreator* ExtensionHost::GetJavaScriptDialogCreator() { | 531 content::JavaScriptDialogCreator* ExtensionHost::GetJavaScriptDialogCreator() { |
531 if (!dialog_creator_.get()) { | 532 if (!dialog_creator_.get()) { |
532 dialog_creator_.reset(CreateJavaScriptDialogCreatorInstance(this)); | 533 dialog_creator_.reset(CreateJavaScriptDialogCreatorInstance(this)); |
533 } | 534 } |
534 return dialog_creator_.get(); | 535 return dialog_creator_.get(); |
535 } | 536 } |
536 | 537 |
537 void ExtensionHost::RunFileChooser(WebContents* tab, | 538 void ExtensionHost::RunFileChooser(WebContents* tab, |
538 const content::FileChooserParams& params) { | 539 const content::FileChooserParams& params) { |
539 Browser::RunFileChooserHelper(tab, params); | 540 FileSelectHelper::RunFileChooser(tab, params); |
540 } | 541 } |
541 | 542 |
542 void ExtensionHost::AddNewContents(WebContents* source, | 543 void ExtensionHost::AddNewContents(WebContents* source, |
543 WebContents* new_contents, | 544 WebContents* new_contents, |
544 WindowOpenDisposition disposition, | 545 WindowOpenDisposition disposition, |
545 const gfx::Rect& initial_pos, | 546 const gfx::Rect& initial_pos, |
546 bool user_gesture) { | 547 bool user_gesture) { |
547 // First, if the creating extension view was associated with a tab contents, | 548 // First, if the creating extension view was associated with a tab contents, |
548 // use that tab content's delegate. We must be careful here that the | 549 // use that tab content's delegate. We must be careful here that the |
549 // associated tab contents has the same profile as the new tab contents. In | 550 // associated tab contents has the same profile as the new tab contents. In |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 params.user_gesture = user_gesture; | 589 params.user_gesture = user_gesture; |
589 browser::Navigate(¶ms); | 590 browser::Navigate(¶ms); |
590 } | 591 } |
591 | 592 |
592 void ExtensionHost::RenderViewReady() { | 593 void ExtensionHost::RenderViewReady() { |
593 content::NotificationService::current()->Notify( | 594 content::NotificationService::current()->Notify( |
594 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 595 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
595 content::Source<Profile>(profile_), | 596 content::Source<Profile>(profile_), |
596 content::Details<ExtensionHost>(this)); | 597 content::Details<ExtensionHost>(this)); |
597 } | 598 } |
OLD | NEW |