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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/browser/debugger/devtools_window.h" | 42 #include "chrome/browser/debugger/devtools_window.h" |
43 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 43 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
44 #include "chrome/browser/download/download_item_model.h" | 44 #include "chrome/browser/download/download_item_model.h" |
45 #include "chrome/browser/download/download_service.h" | 45 #include "chrome/browser/download/download_service.h" |
46 #include "chrome/browser/download/download_service_factory.h" | 46 #include "chrome/browser/download/download_service_factory.h" |
47 #include "chrome/browser/download/download_started_animation.h" | 47 #include "chrome/browser/download/download_started_animation.h" |
48 #include "chrome/browser/extensions/crx_installer.h" | 48 #include "chrome/browser/extensions/crx_installer.h" |
49 #include "chrome/browser/extensions/default_apps_trial.h" | 49 #include "chrome/browser/extensions/default_apps_trial.h" |
50 #include "chrome/browser/extensions/extension_browser_event_router.h" | 50 #include "chrome/browser/extensions/extension_browser_event_router.h" |
51 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" | 51 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" |
52 #include "chrome/browser/extensions/extension_host.h" | |
53 #include "chrome/browser/extensions/extension_prefs.h" | 52 #include "chrome/browser/extensions/extension_prefs.h" |
54 #include "chrome/browser/extensions/extension_service.h" | 53 #include "chrome/browser/extensions/extension_service.h" |
55 #include "chrome/browser/extensions/extension_tab_helper.h" | 54 #include "chrome/browser/extensions/extension_tab_helper.h" |
56 #include "chrome/browser/extensions/extension_tabs_module.h" | 55 #include "chrome/browser/extensions/extension_tabs_module.h" |
57 #include "chrome/browser/favicon/favicon_tab_helper.h" | 56 #include "chrome/browser/favicon/favicon_tab_helper.h" |
58 #include "chrome/browser/file_select_helper.h" | 57 #include "chrome/browser/file_select_helper.h" |
59 #include "chrome/browser/first_run/first_run.h" | 58 #include "chrome/browser/first_run/first_run.h" |
60 #include "chrome/browser/google/google_url_tracker.h" | 59 #include "chrome/browser/google/google_url_tracker.h" |
61 #include "chrome/browser/google/google_util.h" | 60 #include "chrome/browser/google/google_util.h" |
62 #include "chrome/browser/infobars/infobar_tab_helper.h" | 61 #include "chrome/browser/infobars/infobar_tab_helper.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 #include "chrome/browser/themes/theme_service_factory.h" | 95 #include "chrome/browser/themes/theme_service_factory.h" |
97 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 96 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
98 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 97 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
99 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 98 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
100 #include "chrome/browser/ui/browser_dialogs.h" | 99 #include "chrome/browser/ui/browser_dialogs.h" |
101 #include "chrome/browser/ui/browser_list.h" | 100 #include "chrome/browser/ui/browser_list.h" |
102 #include "chrome/browser/ui/browser_navigator.h" | 101 #include "chrome/browser/ui/browser_navigator.h" |
103 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" | 102 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" |
104 #include "chrome/browser/ui/browser_window.h" | 103 #include "chrome/browser/ui/browser_window.h" |
105 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 104 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
| 105 #include "chrome/browser/ui/extensions/shell_window.h" |
106 #include "chrome/browser/ui/find_bar/find_bar.h" | 106 #include "chrome/browser/ui/find_bar/find_bar.h" |
107 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 107 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
108 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 108 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
109 #include "chrome/browser/ui/fullscreen_controller.h" | 109 #include "chrome/browser/ui/fullscreen_controller.h" |
110 #include "chrome/browser/ui/global_error.h" | 110 #include "chrome/browser/ui/global_error.h" |
111 #include "chrome/browser/ui/global_error_service.h" | 111 #include "chrome/browser/ui/global_error_service.h" |
112 #include "chrome/browser/ui/global_error_service_factory.h" | 112 #include "chrome/browser/ui/global_error_service_factory.h" |
113 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 113 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
114 #include "chrome/browser/ui/omnibox/location_bar.h" | 114 #include "chrome/browser/ui/omnibox/location_bar.h" |
115 #include "chrome/browser/ui/panels/panel.h" | 115 #include "chrome/browser/ui/panels/panel.h" |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 extension_misc::LaunchContainer container, | 642 extension_misc::LaunchContainer container, |
643 const GURL& override_url, | 643 const GURL& override_url, |
644 WindowOpenDisposition disposition) { | 644 WindowOpenDisposition disposition) { |
645 WebContents* tab = NULL; | 645 WebContents* tab = NULL; |
646 ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs(); | 646 ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs(); |
647 prefs->SetActiveBit(extension->id(), true); | 647 prefs->SetActiveBit(extension->id(), true); |
648 | 648 |
649 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunchContainer", container, 100); | 649 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunchContainer", container, 100); |
650 | 650 |
651 switch (container) { | 651 switch (container) { |
| 652 case extension_misc::LAUNCH_SHELL: { |
| 653 ShellWindow* shell_window = ShellWindow::Create( |
| 654 profile, |
| 655 extension, |
| 656 UrlForExtension(extension, override_url)); |
| 657 if (shell_window) |
| 658 tab = shell_window->web_contents(); |
| 659 break; |
| 660 } |
652 case extension_misc::LAUNCH_WINDOW: | 661 case extension_misc::LAUNCH_WINDOW: |
653 case extension_misc::LAUNCH_PANEL: | 662 case extension_misc::LAUNCH_PANEL: |
654 case extension_misc::LAUNCH_SHELL: | |
655 tab = Browser::OpenApplicationWindow(profile, extension, container, | 663 tab = Browser::OpenApplicationWindow(profile, extension, container, |
656 override_url, NULL); | 664 override_url, NULL); |
657 break; | 665 break; |
658 case extension_misc::LAUNCH_TAB: { | 666 case extension_misc::LAUNCH_TAB: { |
659 tab = Browser::OpenApplicationTab(profile, extension, override_url, | 667 tab = Browser::OpenApplicationTab(profile, extension, override_url, |
660 disposition); | 668 disposition); |
661 break; | 669 break; |
662 } | 670 } |
663 default: | 671 default: |
664 NOTREACHED(); | 672 NOTREACHED(); |
(...skipping 10 matching lines...) Expand all Loading... |
675 const GURL& url_input, | 683 const GURL& url_input, |
676 Browser** app_browser) { | 684 Browser** app_browser) { |
677 DCHECK(!url_input.is_empty() || extension); | 685 DCHECK(!url_input.is_empty() || extension); |
678 GURL url = UrlForExtension(extension, url_input); | 686 GURL url = UrlForExtension(extension, url_input); |
679 | 687 |
680 std::string app_name; | 688 std::string app_name; |
681 app_name = extension ? | 689 app_name = extension ? |
682 web_app::GenerateApplicationNameFromExtensionId(extension->id()) : | 690 web_app::GenerateApplicationNameFromExtensionId(extension->id()) : |
683 web_app::GenerateApplicationNameFromURL(url); | 691 web_app::GenerateApplicationNameFromURL(url); |
684 | 692 |
685 Type type = TYPE_POPUP; | 693 Type type = extension && (container == extension_misc::LAUNCH_PANEL) ? |
686 if (extension) { | 694 TYPE_PANEL : TYPE_POPUP; |
687 switch (container) { | |
688 case extension_misc::LAUNCH_PANEL: | |
689 type = TYPE_PANEL; | |
690 break; | |
691 case extension_misc::LAUNCH_SHELL: | |
692 type = TYPE_SHELL; | |
693 break; | |
694 default: break; | |
695 } | |
696 } | |
697 | 695 |
698 gfx::Rect window_bounds; | 696 gfx::Rect window_bounds; |
699 if (extension) { | 697 if (extension) { |
700 window_bounds.set_width(extension->launch_width()); | 698 window_bounds.set_width(extension->launch_width()); |
701 window_bounds.set_height(extension->launch_height()); | 699 window_bounds.set_height(extension->launch_height()); |
702 } | 700 } |
703 | 701 |
704 Browser* browser = Browser::CreateForApp(type, app_name, window_bounds, | 702 Browser* browser = Browser::CreateForApp(type, app_name, window_bounds, |
705 profile); | 703 profile); |
706 | 704 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 switch (type_) { | 905 switch (type_) { |
908 case TYPE_TABBED: | 906 case TYPE_TABBED: |
909 return true; | 907 return true; |
910 case TYPE_POPUP: | 908 case TYPE_POPUP: |
911 // Only save the window placement of popups if they are restored, | 909 // Only save the window placement of popups if they are restored, |
912 // or the window belongs to DevTools. | 910 // or the window belongs to DevTools. |
913 return browser_defaults::kRestorePopups || is_devtools(); | 911 return browser_defaults::kRestorePopups || is_devtools(); |
914 case TYPE_PANEL: | 912 case TYPE_PANEL: |
915 // Do not save the window placement of panels. | 913 // Do not save the window placement of panels. |
916 return false; | 914 return false; |
917 case TYPE_SHELL: | |
918 return true; | |
919 default: | 915 default: |
920 return false; | 916 return false; |
921 } | 917 } |
922 } | 918 } |
923 | 919 |
924 void Browser::SaveWindowPlacement(const gfx::Rect& bounds, | 920 void Browser::SaveWindowPlacement(const gfx::Rect& bounds, |
925 ui::WindowShowState show_state) { | 921 ui::WindowShowState show_state) { |
926 // Save to the session storage service, used when reloading a past session. | 922 // Save to the session storage service, used when reloading a past session. |
927 // Note that we don't want to be the ones who cause lazy initialization of | 923 // Note that we don't want to be the ones who cause lazy initialization of |
928 // the session service. This function gets called during initial window | 924 // the session service. This function gets called during initial window |
(...skipping 4477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5406 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); | 5402 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); |
5407 } else { | 5403 } else { |
5408 GlobalErrorService* service = | 5404 GlobalErrorService* service = |
5409 GlobalErrorServiceFactory::GetForProfile(profile()); | 5405 GlobalErrorServiceFactory::GetForProfile(profile()); |
5410 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5406 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
5411 if (error) { | 5407 if (error) { |
5412 error->ShowBubbleView(this); | 5408 error->ShowBubbleView(this); |
5413 } | 5409 } |
5414 } | 5410 } |
5415 } | 5411 } |
OLD | NEW |