| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/global_error.h" | 109 #include "chrome/browser/ui/global_error.h" |
| 110 #include "chrome/browser/ui/global_error_service.h" | 110 #include "chrome/browser/ui/global_error_service.h" |
| 111 #include "chrome/browser/ui/global_error_service_factory.h" | 111 #include "chrome/browser/ui/global_error_service_factory.h" |
| 112 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 112 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
| 113 #include "chrome/browser/ui/omnibox/location_bar.h" | 113 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 114 #include "chrome/browser/ui/panels/panel.h" | 114 #include "chrome/browser/ui/panels/panel.h" |
| 115 #include "chrome/browser/ui/panels/panel_manager.h" | 115 #include "chrome/browser/ui/panels/panel_manager.h" |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 extension_misc::LaunchContainer container, | 626 extension_misc::LaunchContainer container, |
| 627 const GURL& override_url, | 627 const GURL& override_url, |
| 628 WindowOpenDisposition disposition) { | 628 WindowOpenDisposition disposition) { |
| 629 TabContents* tab = NULL; | 629 TabContents* tab = NULL; |
| 630 ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs(); | 630 ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs(); |
| 631 prefs->SetActiveBit(extension->id(), true); | 631 prefs->SetActiveBit(extension->id(), true); |
| 632 | 632 |
| 633 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunchContainer", container, 100); | 633 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunchContainer", container, 100); |
| 634 | 634 |
| 635 switch (container) { | 635 switch (container) { |
| 636 case extension_misc::LAUNCH_SHELL: { |
| 637 ShellWindow* shell_window = ShellWindow::Create( |
| 638 profile, |
| 639 extension, |
| 640 UrlForExtension(extension, override_url)); |
| 641 if (shell_window) |
| 642 tab = shell_window->tab_contents(); |
| 643 break; |
| 644 } |
| 636 case extension_misc::LAUNCH_WINDOW: | 645 case extension_misc::LAUNCH_WINDOW: |
| 637 case extension_misc::LAUNCH_PANEL: | 646 case extension_misc::LAUNCH_PANEL: |
| 638 case extension_misc::LAUNCH_SHELL: | |
| 639 tab = Browser::OpenApplicationWindow(profile, extension, container, | 647 tab = Browser::OpenApplicationWindow(profile, extension, container, |
| 640 override_url, NULL); | 648 override_url, NULL); |
| 641 break; | 649 break; |
| 642 case extension_misc::LAUNCH_TAB: { | 650 case extension_misc::LAUNCH_TAB: { |
| 643 tab = Browser::OpenApplicationTab(profile, extension, override_url, | 651 tab = Browser::OpenApplicationTab(profile, extension, override_url, |
| 644 disposition); | 652 disposition); |
| 645 break; | 653 break; |
| 646 } | 654 } |
| 647 default: | 655 default: |
| 648 NOTREACHED(); | 656 NOTREACHED(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 659 const GURL& url_input, | 667 const GURL& url_input, |
| 660 Browser** app_browser) { | 668 Browser** app_browser) { |
| 661 DCHECK(!url_input.is_empty() || extension); | 669 DCHECK(!url_input.is_empty() || extension); |
| 662 GURL url = UrlForExtension(extension, url_input); | 670 GURL url = UrlForExtension(extension, url_input); |
| 663 | 671 |
| 664 std::string app_name; | 672 std::string app_name; |
| 665 app_name = extension ? | 673 app_name = extension ? |
| 666 web_app::GenerateApplicationNameFromExtensionId(extension->id()) : | 674 web_app::GenerateApplicationNameFromExtensionId(extension->id()) : |
| 667 web_app::GenerateApplicationNameFromURL(url); | 675 web_app::GenerateApplicationNameFromURL(url); |
| 668 | 676 |
| 669 Type type = TYPE_POPUP; | 677 Type type = extension && (container == extension_misc::LAUNCH_PANEL) ? |
| 670 if (extension) { | 678 TYPE_PANEL : TYPE_POPUP; |
| 671 switch (container) { | |
| 672 case extension_misc::LAUNCH_PANEL: | |
| 673 type = TYPE_PANEL; | |
| 674 break; | |
| 675 case extension_misc::LAUNCH_SHELL: | |
| 676 type = TYPE_SHELL; | |
| 677 break; | |
| 678 default: break; | |
| 679 } | |
| 680 } | |
| 681 | 679 |
| 682 gfx::Rect window_bounds; | 680 gfx::Rect window_bounds; |
| 683 if (extension) { | 681 if (extension) { |
| 684 window_bounds.set_width(extension->launch_width()); | 682 window_bounds.set_width(extension->launch_width()); |
| 685 window_bounds.set_height(extension->launch_height()); | 683 window_bounds.set_height(extension->launch_height()); |
| 686 } | 684 } |
| 687 | 685 |
| 688 Browser* browser = Browser::CreateForApp(type, app_name, window_bounds, | 686 Browser* browser = Browser::CreateForApp(type, app_name, window_bounds, |
| 689 profile); | 687 profile); |
| 690 | 688 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 switch (type_) { | 889 switch (type_) { |
| 892 case TYPE_TABBED: | 890 case TYPE_TABBED: |
| 893 return true; | 891 return true; |
| 894 case TYPE_POPUP: | 892 case TYPE_POPUP: |
| 895 // Only save the window placement of popups if they are restored, | 893 // Only save the window placement of popups if they are restored, |
| 896 // or the window belongs to DevTools. | 894 // or the window belongs to DevTools. |
| 897 return browser_defaults::kRestorePopups || is_devtools(); | 895 return browser_defaults::kRestorePopups || is_devtools(); |
| 898 case TYPE_PANEL: | 896 case TYPE_PANEL: |
| 899 // Do not save the window placement of panels. | 897 // Do not save the window placement of panels. |
| 900 return false; | 898 return false; |
| 901 case TYPE_SHELL: | |
| 902 return true; | |
| 903 default: | 899 default: |
| 904 return false; | 900 return false; |
| 905 } | 901 } |
| 906 } | 902 } |
| 907 | 903 |
| 908 void Browser::SaveWindowPlacement(const gfx::Rect& bounds, | 904 void Browser::SaveWindowPlacement(const gfx::Rect& bounds, |
| 909 ui::WindowShowState show_state) { | 905 ui::WindowShowState show_state) { |
| 910 // Save to the session storage service, used when reloading a past session. | 906 // Save to the session storage service, used when reloading a past session. |
| 911 // Note that we don't want to be the ones who cause lazy initialization of | 907 // Note that we don't want to be the ones who cause lazy initialization of |
| 912 // the session service. This function gets called during initial window | 908 // the session service. This function gets called during initial window |
| (...skipping 4435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5348 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); | 5344 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); |
| 5349 } else { | 5345 } else { |
| 5350 GlobalErrorService* service = | 5346 GlobalErrorService* service = |
| 5351 GlobalErrorServiceFactory::GetForProfile(profile()); | 5347 GlobalErrorServiceFactory::GetForProfile(profile()); |
| 5352 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5348 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
| 5353 if (error) { | 5349 if (error) { |
| 5354 error->ShowBubbleView(this); | 5350 error->ShowBubbleView(this); |
| 5355 } | 5351 } |
| 5356 } | 5352 } |
| 5357 } | 5353 } |
| OLD | NEW |