| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_init.h" | 5 #include "chrome/browser/browser_init.h" |
| 6 | 6 |
| 7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 ReplaceSubstringsAfterOffset(&url_string, 0, "\\x", "%"); | 631 ReplaceSubstringsAfterOffset(&url_string, 0, "\\x", "%"); |
| 632 #endif | 632 #endif |
| 633 GURL url(url_string); | 633 GURL url(url_string); |
| 634 | 634 |
| 635 // Restrict allowed URLs for --app switch. | 635 // Restrict allowed URLs for --app switch. |
| 636 if (!url.is_empty() && url.is_valid()) { | 636 if (!url.is_empty() && url.is_valid()) { |
| 637 ChildProcessSecurityPolicy *policy = | 637 ChildProcessSecurityPolicy *policy = |
| 638 ChildProcessSecurityPolicy::GetInstance(); | 638 ChildProcessSecurityPolicy::GetInstance(); |
| 639 if (policy->IsWebSafeScheme(url.scheme()) || | 639 if (policy->IsWebSafeScheme(url.scheme()) || |
| 640 url.SchemeIs(chrome::kFileScheme)) { | 640 url.SchemeIs(chrome::kFileScheme)) { |
| 641 Browser::OpenApplicationWindow(profile, url); | 641 Browser::OpenApplicationWindow(profile, url, NULL); |
| 642 return true; | 642 return true; |
| 643 } | 643 } |
| 644 } | 644 } |
| 645 return false; | 645 return false; |
| 646 } | 646 } |
| 647 | 647 |
| 648 void BrowserInit::LaunchWithProfile::ProcessLaunchURLs( | 648 void BrowserInit::LaunchWithProfile::ProcessLaunchURLs( |
| 649 bool process_startup, | 649 bool process_startup, |
| 650 const std::vector<GURL>& urls_to_open) { | 650 const std::vector<GURL>& urls_to_open) { |
| 651 // If we're starting up in "background mode" (no open browser window) then | 651 // If we're starting up in "background mode" (no open browser window) then |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 | 777 |
| 778 int add_types = first_tab ? TabStripModel::ADD_SELECTED : | 778 int add_types = first_tab ? TabStripModel::ADD_SELECTED : |
| 779 TabStripModel::ADD_NONE; | 779 TabStripModel::ADD_NONE; |
| 780 add_types |= TabStripModel::ADD_FORCE_INDEX; | 780 add_types |= TabStripModel::ADD_FORCE_INDEX; |
| 781 if (tabs[i].is_pinned) | 781 if (tabs[i].is_pinned) |
| 782 add_types |= TabStripModel::ADD_PINNED; | 782 add_types |= TabStripModel::ADD_PINNED; |
| 783 int index = browser->GetIndexForInsertionDuringRestore(i); | 783 int index = browser->GetIndexForInsertionDuringRestore(i); |
| 784 | 784 |
| 785 TabContents* tab = browser->AddTabWithURL( | 785 TabContents* tab = browser->AddTabWithURL( |
| 786 tabs[i].url, GURL(), PageTransition::START_PAGE, index, add_types, NULL, | 786 tabs[i].url, GURL(), PageTransition::START_PAGE, index, add_types, NULL, |
| 787 tabs[i].app_id); | 787 tabs[i].app_id, NULL); |
| 788 | 788 |
| 789 if (profile_ && first_tab && process_startup) { | 789 if (profile_ && first_tab && process_startup) { |
| 790 AddCrashedInfoBarIfNecessary(tab); | 790 AddCrashedInfoBarIfNecessary(tab); |
| 791 AddBadFlagsInfoBarIfNecessary(tab); | 791 AddBadFlagsInfoBarIfNecessary(tab); |
| 792 } | 792 } |
| 793 | 793 |
| 794 first_tab = false; | 794 first_tab = false; |
| 795 } | 795 } |
| 796 browser->window()->Show(); | 796 browser->window()->Show(); |
| 797 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial | 797 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 scoped_refptr<AutomationProviderClass> automation = | 1073 scoped_refptr<AutomationProviderClass> automation = |
| 1074 new AutomationProviderClass(profile); | 1074 new AutomationProviderClass(profile); |
| 1075 automation->ConnectToChannel(channel_id); | 1075 automation->ConnectToChannel(channel_id); |
| 1076 automation->SetExpectedTabCount(expected_tabs); | 1076 automation->SetExpectedTabCount(expected_tabs); |
| 1077 | 1077 |
| 1078 AutomationProviderList* list = | 1078 AutomationProviderList* list = |
| 1079 g_browser_process->InitAutomationProviderList(); | 1079 g_browser_process->InitAutomationProviderList(); |
| 1080 DCHECK(list); | 1080 DCHECK(list); |
| 1081 list->AddProvider(automation); | 1081 list->AddProvider(automation); |
| 1082 } | 1082 } |
| OLD | NEW |