| 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 "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // The profile may not be valid yet if it is still being initialized. | 63 // The profile may not be valid yet if it is still being initialized. |
| 64 // In that case, defer loading, since it depends on an initialized profile. | 64 // In that case, defer loading, since it depends on an initialized profile. |
| 65 // Background hosts will be loaded later via NOTIFICATION_PROFILE_CREATED. | 65 // Background hosts will be loaded later via NOTIFICATION_PROFILE_CREATED. |
| 66 // http://crbug.com/222473 | 66 // http://crbug.com/222473 |
| 67 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) | 67 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) |
| 68 return true; | 68 return true; |
| 69 | 69 |
| 70 // There are no browser windows open and the browser process was | 70 // There are no browser windows open and the browser process was |
| 71 // started to show the app launcher. Background hosts will be loaded later | 71 // started to show the app launcher. Background hosts will be loaded later |
| 72 // via NOTIFICATION_BROWSER_WINDOW_READY. http://crbug.com/178260 | 72 // via NOTIFICATION_BROWSER_WINDOW_READY. http://crbug.com/178260 |
| 73 return chrome::GetTotalBrowserCountForProfile(profile) == 0 && | 73 return chrome::GetBrowserCount(profile) == 0 && |
| 74 base::CommandLine::ForCurrentProcess()->HasSwitch( | 74 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 75 switches::kShowAppList); | 75 switches::kShowAppList); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void ChromeProcessManagerDelegate::Observe( | 78 void ChromeProcessManagerDelegate::Observe( |
| 79 int type, | 79 int type, |
| 80 const content::NotificationSource& source, | 80 const content::NotificationSource& source, |
| 81 const content::NotificationDetails& details) { | 81 const content::NotificationDetails& details) { |
| 82 switch (type) { | 82 switch (type) { |
| 83 case chrome::NOTIFICATION_BROWSER_WINDOW_READY: { | 83 case chrome::NOTIFICATION_BROWSER_WINDOW_READY: { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 ProcessManager* incognito_manager = | 164 ProcessManager* incognito_manager = |
| 165 ProcessManagerFactory::GetForBrowserContextIfExists( | 165 ProcessManagerFactory::GetForBrowserContextIfExists( |
| 166 profile->GetOffTheRecordProfile()); | 166 profile->GetOffTheRecordProfile()); |
| 167 if (incognito_manager) { | 167 if (incognito_manager) { |
| 168 incognito_manager->CloseBackgroundHosts(); | 168 incognito_manager->CloseBackgroundHosts(); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace extensions | 173 } // namespace extensions |
| OLD | NEW |