| 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/main/public/athena_launcher.h" | 8 #include "athena/main/public/athena_launcher.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 ChromeBrowserMainExtraPartsAthena() { | 30 ChromeBrowserMainExtraPartsAthena() { |
| 31 registrar_.Add(this, | 31 registrar_.Add(this, |
| 32 chrome::NOTIFICATION_APP_TERMINATING, | 32 chrome::NOTIFICATION_APP_TERMINATING, |
| 33 content::NotificationService::AllSources()); | 33 content::NotificationService::AllSources()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 virtual ~ChromeBrowserMainExtraPartsAthena() {} | 36 virtual ~ChromeBrowserMainExtraPartsAthena() {} |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // Overridden from ChromeBrowserMainExtraParts: | 39 // Overridden from ChromeBrowserMainExtraParts: |
| 40 virtual void PreProfileInit() OVERRIDE { | 40 virtual void PreProfileInit() override { |
| 41 athena::StartAthenaEnv(content::BrowserThread::GetBlockingPool()-> | 41 athena::StartAthenaEnv(content::BrowserThread::GetBlockingPool()-> |
| 42 GetTaskRunnerWithShutdownBehavior( | 42 GetTaskRunnerWithShutdownBehavior( |
| 43 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 43 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 44 | 44 |
| 45 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory); | 45 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory); |
| 46 } | 46 } |
| 47 virtual void PostProfileInit() OVERRIDE { | 47 virtual void PostProfileInit() override { |
| 48 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 48 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 49 switches::kDisableZeroBrowsersOpenForTests)) { | 49 switches::kDisableZeroBrowsersOpenForTests)) { |
| 50 chrome::IncrementKeepAliveCount(); | 50 chrome::IncrementKeepAliveCount(); |
| 51 } | 51 } |
| 52 Profile* profile = | 52 Profile* profile = |
| 53 g_browser_process->profile_manager()->GetActiveUserProfile(); | 53 g_browser_process->profile_manager()->GetActiveUserProfile(); |
| 54 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 54 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 55 chromeos::switches::kLoginManager)) { | 55 chromeos::switches::kLoginManager)) { |
| 56 athena::CreateVirtualKeyboardWithContext(profile); | 56 athena::CreateVirtualKeyboardWithContext(profile); |
| 57 athena::StartAthenaSessionWithContext(profile); | 57 athena::StartAthenaSessionWithContext(profile); |
| 58 } else { | 58 } else { |
| 59 // Only initialize virtual keyboard with login profile, user session will | 59 // Only initialize virtual keyboard with login profile, user session will |
| 60 // start after login. | 60 // start after login. |
| 61 athena::CreateVirtualKeyboardWithContext(profile); | 61 athena::CreateVirtualKeyboardWithContext(profile); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 virtual void PostMainMessageLoopRun() OVERRIDE { athena::ShutdownAthena(); } | 64 virtual void PostMainMessageLoopRun() override { athena::ShutdownAthena(); } |
| 65 | 65 |
| 66 // content::NotificationObserver: | 66 // content::NotificationObserver: |
| 67 virtual void Observe(int type, | 67 virtual void Observe(int type, |
| 68 const content::NotificationSource& source, | 68 const content::NotificationSource& source, |
| 69 const content::NotificationDetails& details) OVERRIDE { | 69 const content::NotificationDetails& details) override { |
| 70 switch (type) { | 70 switch (type) { |
| 71 case chrome::NOTIFICATION_APP_TERMINATING: | 71 case chrome::NOTIFICATION_APP_TERMINATING: |
| 72 athena::AthenaEnv::Get()->OnTerminating(); | 72 athena::AthenaEnv::Get()->OnTerminating(); |
| 73 break; | 73 break; |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 content::NotificationRegistrar registrar_; | 77 content::NotificationRegistrar registrar_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsAthena); | 79 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsAthena); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace | 82 } // namespace |
| 83 | 83 |
| 84 ChromeBrowserMainExtraParts* CreateChromeBrowserMainExtraPartsAthena() { | 84 ChromeBrowserMainExtraParts* CreateChromeBrowserMainExtraPartsAthena() { |
| 85 return new ChromeBrowserMainExtraPartsAthena(); | 85 return new ChromeBrowserMainExtraPartsAthena(); |
| 86 } | 86 } |
| OLD | NEW |