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_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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
40 #include "chrome/browser/net/url_fixer_upper.h" | 40 #include "chrome/browser/net/url_fixer_upper.h" |
41 #include "chrome/browser/notifications/desktop_notification_service.h" | 41 #include "chrome/browser/notifications/desktop_notification_service.h" |
42 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 42 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
43 #include "chrome/browser/prefs/pref_service.h" | 43 #include "chrome/browser/prefs/pref_service.h" |
44 #include "chrome/browser/prefs/session_startup_pref.h" | 44 #include "chrome/browser/prefs/session_startup_pref.h" |
45 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 45 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
46 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" | 46 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" |
47 #include "chrome/browser/printing/print_dialog_cloud.h" | 47 #include "chrome/browser/printing/print_dialog_cloud.h" |
48 #include "chrome/browser/profiles/profile.h" | 48 #include "chrome/browser/profiles/profile.h" |
49 #include "chrome/browser/profiles/profile_io_data.h" | 49 #include "chrome/browser/profiles/profile_io_data.h" |
50 #include "chrome/browser/profiles/profile_manager.h" | |
50 #include "chrome/browser/search_engines/template_url.h" | 51 #include "chrome/browser/search_engines/template_url.h" |
51 #include "chrome/browser/search_engines/template_url_service.h" | 52 #include "chrome/browser/search_engines/template_url_service.h" |
52 #include "chrome/browser/search_engines/template_url_service_factory.h" | 53 #include "chrome/browser/search_engines/template_url_service_factory.h" |
53 #include "chrome/browser/sessions/session_restore.h" | 54 #include "chrome/browser/sessions/session_restore.h" |
54 #include "chrome/browser/sessions/session_service.h" | 55 #include "chrome/browser/sessions/session_service.h" |
55 #include "chrome/browser/sessions/session_service_factory.h" | 56 #include "chrome/browser/sessions/session_service_factory.h" |
56 #include "chrome/browser/shell_integration.h" | 57 #include "chrome/browser/shell_integration.h" |
57 #include "chrome/browser/tab_contents/link_infobar_delegate.h" | 58 #include "chrome/browser/tab_contents/link_infobar_delegate.h" |
58 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" | 59 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" |
59 #include "chrome/browser/tabs/pinned_tab_codec.h" | 60 #include "chrome/browser/tabs/pinned_tab_codec.h" |
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1489 if (!automation->InitializeChannel(channel_id)) | 1490 if (!automation->InitializeChannel(channel_id)) |
1490 return false; | 1491 return false; |
1491 automation->SetExpectedTabCount(expected_tabs); | 1492 automation->SetExpectedTabCount(expected_tabs); |
1492 | 1493 |
1493 AutomationProviderList* list = g_browser_process->GetAutomationProviderList(); | 1494 AutomationProviderList* list = g_browser_process->GetAutomationProviderList(); |
1494 DCHECK(list); | 1495 DCHECK(list); |
1495 list->AddProvider(automation); | 1496 list->AddProvider(automation); |
1496 | 1497 |
1497 return true; | 1498 return true; |
1498 } | 1499 } |
1500 | |
1501 // static | |
1502 void BrowserInit::ProcessCommandLineOnProfileCreated( | |
1503 const CommandLine& cmd_line, | |
1504 const FilePath& cur_dir, | |
1505 Profile* profile, | |
1506 Profile::CreateStatus status) { | |
1507 if (status == Profile::CREATE_STATUS_INITIALIZED) | |
1508 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL); | |
1509 } | |
1510 | |
1511 // static | |
1512 void BrowserInit::ProcessCommandLinePostStartup(const CommandLine& cmd_line, | |
1513 const FilePath& cur_dir) { | |
1514 if (cmd_line.HasSwitch(switches::kProfileDirectory)) { | |
1515 ProfileManager* profile_manager = g_browser_process->profile_manager(); | |
1516 FilePath path = cmd_line.GetSwitchValuePath(switches::kProfileDirectory); | |
1517 path = profile_manager->user_data_dir().Append(path); | |
1518 profile_manager->CreateProfileAsync(path, | |
1519 base::Bind(&BrowserInit::ProcessCommandLineOnProfileCreated, | |
1520 cmd_line, cur_dir)); | |
1521 return; | |
1522 } | |
1523 | |
1524 Profile* profile = ProfileManager::GetLastUsedProfile(); | |
1525 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL); | |
sky
2011/12/07 18:28:55
Seems like you need a if (!profile) NOTREACHED();r
sail
2011/12/07 18:35:01
Done.
| |
1526 } | |
OLD | NEW |