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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 WindowOpenDisposition disposition) { | 614 WindowOpenDisposition disposition) { |
615 TabContents* tab = NULL; | 615 TabContents* tab = NULL; |
616 ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs(); | 616 ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs(); |
617 prefs->SetActiveBit(extension->id(), true); | 617 prefs->SetActiveBit(extension->id(), true); |
618 | 618 |
619 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunchContainer", container, 100); | 619 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunchContainer", container, 100); |
620 | 620 |
621 switch (container) { | 621 switch (container) { |
622 case extension_misc::LAUNCH_WINDOW: | 622 case extension_misc::LAUNCH_WINDOW: |
623 case extension_misc::LAUNCH_PANEL: | 623 case extension_misc::LAUNCH_PANEL: |
| 624 case extension_misc::LAUNCH_SHELL: |
624 tab = Browser::OpenApplicationWindow(profile, extension, container, | 625 tab = Browser::OpenApplicationWindow(profile, extension, container, |
625 override_url, NULL); | 626 override_url, NULL); |
626 break; | 627 break; |
627 case extension_misc::LAUNCH_TAB: { | 628 case extension_misc::LAUNCH_TAB: { |
628 tab = Browser::OpenApplicationTab(profile, extension, override_url, | 629 tab = Browser::OpenApplicationTab(profile, extension, override_url, |
629 disposition); | 630 disposition); |
630 break; | 631 break; |
631 } | 632 } |
632 default: | 633 default: |
633 NOTREACHED(); | 634 NOTREACHED(); |
(...skipping 10 matching lines...) Expand all Loading... |
644 const GURL& url_input, | 645 const GURL& url_input, |
645 Browser** app_browser) { | 646 Browser** app_browser) { |
646 DCHECK(!url_input.is_empty() || extension); | 647 DCHECK(!url_input.is_empty() || extension); |
647 GURL url = UrlForExtension(extension, url_input); | 648 GURL url = UrlForExtension(extension, url_input); |
648 | 649 |
649 std::string app_name; | 650 std::string app_name; |
650 app_name = extension ? | 651 app_name = extension ? |
651 web_app::GenerateApplicationNameFromExtensionId(extension->id()) : | 652 web_app::GenerateApplicationNameFromExtensionId(extension->id()) : |
652 web_app::GenerateApplicationNameFromURL(url); | 653 web_app::GenerateApplicationNameFromURL(url); |
653 | 654 |
654 Type type = extension && (container == extension_misc::LAUNCH_PANEL) ? | 655 Type type = TYPE_POPUP; |
655 TYPE_PANEL : TYPE_POPUP; | 656 if (extension) { |
| 657 switch (container) { |
| 658 case extension_misc::LAUNCH_PANEL: |
| 659 type = TYPE_PANEL; |
| 660 break; |
| 661 case extension_misc::LAUNCH_SHELL: |
| 662 type = TYPE_SHELL; |
| 663 break; |
| 664 default: break; |
| 665 } |
| 666 } |
656 | 667 |
657 gfx::Rect window_bounds; | 668 gfx::Rect window_bounds; |
658 if (extension) { | 669 if (extension) { |
659 window_bounds.set_width(extension->launch_width()); | 670 window_bounds.set_width(extension->launch_width()); |
660 window_bounds.set_height(extension->launch_height()); | 671 window_bounds.set_height(extension->launch_height()); |
661 } | 672 } |
662 | 673 |
663 Browser* browser = Browser::CreateForApp(type, app_name, window_bounds, | 674 Browser* browser = Browser::CreateForApp(type, app_name, window_bounds, |
664 profile); | 675 profile); |
665 | 676 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 switch (type_) { | 874 switch (type_) { |
864 case TYPE_TABBED: | 875 case TYPE_TABBED: |
865 return true; | 876 return true; |
866 case TYPE_POPUP: | 877 case TYPE_POPUP: |
867 // Only save the window placement of popups if they are restored, | 878 // Only save the window placement of popups if they are restored, |
868 // or the window belongs to DevTools. | 879 // or the window belongs to DevTools. |
869 return browser_defaults::kRestorePopups || is_devtools(); | 880 return browser_defaults::kRestorePopups || is_devtools(); |
870 case TYPE_PANEL: | 881 case TYPE_PANEL: |
871 // Do not save the window placement of panels. | 882 // Do not save the window placement of panels. |
872 return false; | 883 return false; |
| 884 case TYPE_SHELL: |
| 885 return true; |
873 default: | 886 default: |
874 return false; | 887 return false; |
875 } | 888 } |
876 } | 889 } |
877 | 890 |
878 void Browser::SaveWindowPlacement(const gfx::Rect& bounds, | 891 void Browser::SaveWindowPlacement(const gfx::Rect& bounds, |
879 ui::WindowShowState show_state) { | 892 ui::WindowShowState show_state) { |
880 // Save to the session storage service, used when reloading a past session. | 893 // Save to the session storage service, used when reloading a past session. |
881 // Note that we don't want to be the ones who cause lazy initialization of | 894 // Note that we don't want to be the ones who cause lazy initialization of |
882 // the session service. This function gets called during initial window | 895 // the session service. This function gets called during initial window |
(...skipping 4425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5308 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); | 5321 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); |
5309 } else { | 5322 } else { |
5310 GlobalErrorService* service = | 5323 GlobalErrorService* service = |
5311 GlobalErrorServiceFactory::GetForProfile(profile()); | 5324 GlobalErrorServiceFactory::GetForProfile(profile()); |
5312 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5325 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
5313 if (error) { | 5326 if (error) { |
5314 error->ShowBubbleView(this); | 5327 error->ShowBubbleView(this); |
5315 } | 5328 } |
5316 } | 5329 } |
5317 } | 5330 } |
OLD | NEW |