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

Side by Side Diff: chrome/browser/ui/browser_init.cc

Issue 8526017: Append parameters to webstore URL to indicate launch source. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile fixes Created 9 years, 1 month 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) 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_init.h" 5 #include "chrome/browser/ui/browser_init.h"
6 6
7 #include <algorithm> // For max(). 7 #include <algorithm> // For max().
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 const Extension* extension; 806 const Extension* extension;
807 if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container)) 807 if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container))
808 return false; 808 return false;
809 809
810 // If the user doesn't want to open a tab, fail. 810 // If the user doesn't want to open a tab, fail.
811 if (launch_container != extension_misc::LAUNCH_TAB) 811 if (launch_container != extension_misc::LAUNCH_TAB)
812 return false; 812 return false;
813 813
814 RecordCmdLineAppHistogram(); 814 RecordCmdLineAppHistogram();
815 815
816 TabContents* app_tab = Browser::OpenApplicationTab(profile, extension, 816 TabContents* app_tab = Browser::OpenApplicationTab(profile, extension, GURL(),
817 NEW_FOREGROUND_TAB); 817 NEW_FOREGROUND_TAB);
818 return (app_tab != NULL); 818 return (app_tab != NULL);
819 } 819 }
820 820
821 bool BrowserInit::LaunchWithProfile::OpenApplicationWindow(Profile* profile) { 821 bool BrowserInit::LaunchWithProfile::OpenApplicationWindow(Profile* profile) {
822 std::string url_string, app_id; 822 std::string url_string, app_id;
823 if (!IsAppLaunch(&url_string, &app_id)) 823 if (!IsAppLaunch(&url_string, &app_id))
824 return false; 824 return false;
825 825
826 // This can fail if the app_id is invalid. It can also fail if the 826 // This can fail if the app_id is invalid. It can also fail if the
827 // extension is external, and has not yet been installed. 827 // extension is external, and has not yet been installed.
828 // TODO(skerner): Do something reasonable here. Pop up a warning panel? 828 // TODO(skerner): Do something reasonable here. Pop up a warning panel?
829 // Open an URL to the gallery page of the extension id? 829 // Open an URL to the gallery page of the extension id?
830 if (!app_id.empty()) { 830 if (!app_id.empty()) {
831 extension_misc::LaunchContainer launch_container; 831 extension_misc::LaunchContainer launch_container;
832 const Extension* extension; 832 const Extension* extension;
833 if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container)) 833 if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container))
834 return false; 834 return false;
835 835
836 // TODO(skerner): Could pass in |extension| and |launch_container|, 836 // TODO(skerner): Could pass in |extension| and |launch_container|,
837 // and avoid calling GetAppLaunchContainer() both here and in 837 // and avoid calling GetAppLaunchContainer() both here and in
838 // OpenApplicationTab(). 838 // OpenApplicationTab().
839 839
840 if (launch_container == extension_misc::LAUNCH_TAB) 840 if (launch_container == extension_misc::LAUNCH_TAB)
841 return false; 841 return false;
842 842
843 RecordCmdLineAppHistogram(); 843 RecordCmdLineAppHistogram();
844 TabContents* tab_in_app_window = Browser::OpenApplication( 844 TabContents* tab_in_app_window = Browser::OpenApplication(
845 profile, extension, launch_container, NEW_WINDOW); 845 profile, extension, launch_container, GURL(), NEW_WINDOW);
846 return (tab_in_app_window != NULL); 846 return (tab_in_app_window != NULL);
847 } 847 }
848 848
849 if (url_string.empty()) 849 if (url_string.empty())
850 return false; 850 return false;
851 851
852 #if defined(OS_WIN) // Fix up Windows shortcuts. 852 #if defined(OS_WIN) // Fix up Windows shortcuts.
853 ReplaceSubstringsAfterOffset(&url_string, 0, "\\x", "%"); 853 ReplaceSubstringsAfterOffset(&url_string, 0, "\\x", "%");
854 #endif 854 #endif
855 GURL url(url_string); 855 GURL url(url_string);
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 if (!automation->InitializeChannel(channel_id)) 1549 if (!automation->InitializeChannel(channel_id))
1550 return false; 1550 return false;
1551 automation->SetExpectedTabCount(expected_tabs); 1551 automation->SetExpectedTabCount(expected_tabs);
1552 1552
1553 AutomationProviderList* list = g_browser_process->GetAutomationProviderList(); 1553 AutomationProviderList* list = g_browser_process->GetAutomationProviderList();
1554 DCHECK(list); 1554 DCHECK(list);
1555 list->AddProvider(automation); 1555 list->AddProvider(automation);
1556 1556
1557 return true; 1557 return true;
1558 } 1558 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | chrome/browser/ui/panels/panel_app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698