| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/chrome_process_manager_delegate.h" | 5 #include "chrome/browser/extensions/chrome_process_manager_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // In that case, defer loading, since it depends on an initialized profile. | 55 // In that case, defer loading, since it depends on an initialized profile. |
| 56 // Background hosts will be loaded later via NOTIFICATION_PROFILE_CREATED. | 56 // Background hosts will be loaded later via NOTIFICATION_PROFILE_CREATED. |
| 57 // http://crbug.com/222473 | 57 // http://crbug.com/222473 |
| 58 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) | 58 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) |
| 59 return true; | 59 return true; |
| 60 | 60 |
| 61 // There are no browser windows open and the browser process was | 61 // There are no browser windows open and the browser process was |
| 62 // started to show the app launcher. Background hosts will be loaded later | 62 // started to show the app launcher. Background hosts will be loaded later |
| 63 // via NOTIFICATION_BROWSER_WINDOW_READY. http://crbug.com/178260 | 63 // via NOTIFICATION_BROWSER_WINDOW_READY. http://crbug.com/178260 |
| 64 return chrome::GetTotalBrowserCountForProfile(profile) == 0 && | 64 return chrome::GetTotalBrowserCountForProfile(profile) == 0 && |
| 65 CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList); | 65 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 66 switches::kShowAppList); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void ChromeProcessManagerDelegate::Observe( | 69 void ChromeProcessManagerDelegate::Observe( |
| 69 int type, | 70 int type, |
| 70 const content::NotificationSource& source, | 71 const content::NotificationSource& source, |
| 71 const content::NotificationDetails& details) { | 72 const content::NotificationDetails& details) { |
| 72 switch (type) { | 73 switch (type) { |
| 73 case chrome::NOTIFICATION_BROWSER_WINDOW_READY: { | 74 case chrome::NOTIFICATION_BROWSER_WINDOW_READY: { |
| 74 Browser* browser = content::Source<Browser>(source).ptr(); | 75 Browser* browser = content::Source<Browser>(source).ptr(); |
| 75 OnBrowserWindowReady(browser); | 76 OnBrowserWindowReady(browser); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 ProcessManager* incognito_manager = | 155 ProcessManager* incognito_manager = |
| 155 ProcessManagerFactory::GetForBrowserContextIfExists( | 156 ProcessManagerFactory::GetForBrowserContextIfExists( |
| 156 profile->GetOffTheRecordProfile()); | 157 profile->GetOffTheRecordProfile()); |
| 157 if (incognito_manager) { | 158 if (incognito_manager) { |
| 158 incognito_manager->CloseBackgroundHosts(); | 159 incognito_manager->CloseBackgroundHosts(); |
| 159 } | 160 } |
| 160 } | 161 } |
| 161 } | 162 } |
| 162 | 163 |
| 163 } // namespace extensions | 164 } // namespace extensions |
| OLD | NEW |