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/env/public/athena_env.h" | 7 #include "athena/env/public/athena_env.h" |
8 #include "athena/extensions/public/extensions_delegate.h" | 8 #include "athena/extensions/public/extensions_delegate.h" |
9 #include "athena/main/public/athena_launcher.h" | 9 #include "athena/main/public/athena_launcher.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chrome_browser_main_extra_parts.h" | 13 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/lifetime/application_lifetime.h" | 15 #include "chrome/browser/lifetime/application_lifetime.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "chromeos/chromeos_switches.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
22 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 class ChromeBrowserMainExtraPartsAthena : public ChromeBrowserMainExtraParts, | 27 class ChromeBrowserMainExtraPartsAthena : public ChromeBrowserMainExtraParts, |
27 public content::NotificationObserver { | 28 public content::NotificationObserver { |
28 public: | 29 public: |
(...skipping 11 matching lines...) Expand all Loading... |
40 athena::StartAthenaEnv(content::BrowserThread::GetMessageLoopProxyForThread( | 41 athena::StartAthenaEnv(content::BrowserThread::GetMessageLoopProxyForThread( |
41 content::BrowserThread::FILE)); | 42 content::BrowserThread::FILE)); |
42 } | 43 } |
43 virtual void PostProfileInit() OVERRIDE { | 44 virtual void PostProfileInit() OVERRIDE { |
44 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 45 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
45 switches::kDisableZeroBrowsersOpenForTests)) { | 46 switches::kDisableZeroBrowsersOpenForTests)) { |
46 chrome::IncrementKeepAliveCount(); | 47 chrome::IncrementKeepAliveCount(); |
47 } | 48 } |
48 Profile* profile = | 49 Profile* profile = |
49 g_browser_process->profile_manager()->GetActiveUserProfile(); | 50 g_browser_process->profile_manager()->GetActiveUserProfile(); |
50 // TODO(oshima|polukhin): Start OOBE/Login process. | 51 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
51 athena::ExtensionsDelegate::CreateExtensionsDelegateForChrome(profile); | 52 chromeos::switches::kLoginManager)) { |
52 athena::StartAthenaSessionWithContext(profile); | 53 athena::ExtensionsDelegate::CreateExtensionsDelegateForChrome(profile); |
| 54 athena::StartAthenaSessionWithContext(profile); |
| 55 } else { |
| 56 // Only initialize virtual keyboard with login profile, user session will |
| 57 // start after login. |
| 58 athena::CreateVirtualKeyboardWithContext(profile); |
| 59 } |
53 } | 60 } |
54 virtual void PostMainMessageLoopRun() OVERRIDE { athena::ShutdownAthena(); } | 61 virtual void PostMainMessageLoopRun() OVERRIDE { athena::ShutdownAthena(); } |
55 | 62 |
56 // content::NotificationObserver: | 63 // content::NotificationObserver: |
57 virtual void Observe(int type, | 64 virtual void Observe(int type, |
58 const content::NotificationSource& source, | 65 const content::NotificationSource& source, |
59 const content::NotificationDetails& details) OVERRIDE { | 66 const content::NotificationDetails& details) OVERRIDE { |
60 switch (type) { | 67 switch (type) { |
61 case chrome::NOTIFICATION_APP_TERMINATING: | 68 case chrome::NOTIFICATION_APP_TERMINATING: |
62 athena::AthenaEnv::Get()->OnTerminating(); | 69 athena::AthenaEnv::Get()->OnTerminating(); |
63 break; | 70 break; |
64 } | 71 } |
65 } | 72 } |
66 | 73 |
67 content::NotificationRegistrar registrar_; | 74 content::NotificationRegistrar registrar_; |
68 | 75 |
69 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsAthena); | 76 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsAthena); |
70 }; | 77 }; |
71 | 78 |
72 } // namespace | 79 } // namespace |
73 | 80 |
74 ChromeBrowserMainExtraParts* CreateChromeBrowserMainExtraPartsAthena() { | 81 ChromeBrowserMainExtraParts* CreateChromeBrowserMainExtraPartsAthena() { |
75 return new ChromeBrowserMainExtraPartsAthena(); | 82 return new ChromeBrowserMainExtraPartsAthena(); |
76 } | 83 } |
OLD | NEW |