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/ui/views/athena/chrome_browser_main_extra_parts_athena.
h" | 5 #include "chrome/browser/ui/views/athena/chrome_browser_main_extra_parts_athena.
h" |
6 | 6 |
7 #include "athena/extensions/public/extensions_delegate.h" | 7 #include "athena/extensions/public/extensions_delegate.h" |
8 #include "athena/main/public/athena_launcher.h" | 8 #include "athena/main/public/athena_launcher.h" |
| 9 #include "base/command_line.h" |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/chrome_browser_main_extra_parts.h" | 12 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
| 13 #include "chrome/browser/lifetime/application_lifetime.h" |
12 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 16 #include "chrome/common/chrome_switches.h" |
14 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
15 | 18 |
16 namespace { | 19 namespace { |
17 | 20 |
18 class ChromeBrowserMainExtraPartsAthena : public ChromeBrowserMainExtraParts { | 21 class ChromeBrowserMainExtraPartsAthena : public ChromeBrowserMainExtraParts { |
19 public: | 22 public: |
20 ChromeBrowserMainExtraPartsAthena() {} | 23 ChromeBrowserMainExtraPartsAthena() { |
| 24 } |
| 25 |
21 virtual ~ChromeBrowserMainExtraPartsAthena() {} | 26 virtual ~ChromeBrowserMainExtraPartsAthena() {} |
22 | 27 |
| 28 private: |
23 // Overridden from ChromeBrowserMainExtraParts: | 29 // Overridden from ChromeBrowserMainExtraParts: |
24 virtual void PreProfileInit() OVERRIDE { | 30 virtual void PreProfileInit() OVERRIDE { |
25 athena::StartAthenaEnv(content::BrowserThread::GetMessageLoopProxyForThread( | 31 athena::StartAthenaEnv(content::BrowserThread::GetMessageLoopProxyForThread( |
26 content::BrowserThread::FILE)); | 32 content::BrowserThread::FILE)); |
27 } | 33 } |
28 virtual void PostProfileInit() OVERRIDE { | 34 virtual void PostProfileInit() OVERRIDE { |
| 35 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 36 switches::kDisableZeroBrowsersOpenForTests)) { |
| 37 chrome::IncrementKeepAliveCount(); |
| 38 } |
29 Profile* profile = | 39 Profile* profile = |
30 g_browser_process->profile_manager()->GetActiveUserProfile(); | 40 g_browser_process->profile_manager()->GetActiveUserProfile(); |
31 // TODO(oshima|polukhin): Start OOBE/Login process. | 41 // TODO(oshima|polukhin): Start OOBE/Login process. |
32 athena::ExtensionsDelegate::CreateExtensionsDelegateForChrome(profile); | 42 athena::ExtensionsDelegate::CreateExtensionsDelegateForChrome(profile); |
33 athena::StartAthenaSessionWithContext(profile); | 43 athena::StartAthenaSessionWithContext(profile); |
34 } | 44 } |
35 virtual void PostMainMessageLoopRun() OVERRIDE { athena::ShutdownAthena(); } | 45 virtual void PostMainMessageLoopRun() OVERRIDE { athena::ShutdownAthena(); } |
36 | 46 |
37 private: | |
38 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsAthena); | 47 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsAthena); |
39 }; | 48 }; |
40 | 49 |
41 } // namespace | 50 } // namespace |
42 | 51 |
43 ChromeBrowserMainExtraParts* CreateChromeBrowserMainExtraPartsAthena() { | 52 ChromeBrowserMainExtraParts* CreateChromeBrowserMainExtraPartsAthena() { |
44 return new ChromeBrowserMainExtraPartsAthena(); | 53 return new ChromeBrowserMainExtraPartsAthena(); |
45 } | 54 } |
OLD | NEW |