| 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/browser/ui/views/select_file_dialog_extension_factory.h" |
| 18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 19 #include "chromeos/chromeos_switches.h" | 20 #include "chromeos/chromeos_switches.h" |
| 20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
| 23 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 class ChromeBrowserMainExtraPartsAthena : public ChromeBrowserMainExtraParts, | 28 class ChromeBrowserMainExtraPartsAthena : public ChromeBrowserMainExtraParts, |
| 28 public content::NotificationObserver { | 29 public content::NotificationObserver { |
| 29 public: | 30 public: |
| 30 ChromeBrowserMainExtraPartsAthena() { | 31 ChromeBrowserMainExtraPartsAthena() { |
| 31 registrar_.Add(this, | 32 registrar_.Add(this, |
| 32 chrome::NOTIFICATION_APP_TERMINATING, | 33 chrome::NOTIFICATION_APP_TERMINATING, |
| 33 content::NotificationService::AllSources()); | 34 content::NotificationService::AllSources()); |
| 34 } | 35 } |
| 35 | 36 |
| 36 virtual ~ChromeBrowserMainExtraPartsAthena() {} | 37 virtual ~ChromeBrowserMainExtraPartsAthena() {} |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 // Overridden from ChromeBrowserMainExtraParts: | 40 // Overridden from ChromeBrowserMainExtraParts: |
| 40 virtual void PreProfileInit() OVERRIDE { | 41 virtual void PreProfileInit() OVERRIDE { |
| 41 athena::StartAthenaEnv(content::BrowserThread::GetBlockingPool()-> | 42 athena::StartAthenaEnv(content::BrowserThread::GetBlockingPool()-> |
| 42 GetTaskRunnerWithShutdownBehavior( | 43 GetTaskRunnerWithShutdownBehavior( |
| 43 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 44 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 45 |
| 46 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory); |
| 44 } | 47 } |
| 45 virtual void PostProfileInit() OVERRIDE { | 48 virtual void PostProfileInit() OVERRIDE { |
| 46 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 49 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 47 switches::kDisableZeroBrowsersOpenForTests)) { | 50 switches::kDisableZeroBrowsersOpenForTests)) { |
| 48 chrome::IncrementKeepAliveCount(); | 51 chrome::IncrementKeepAliveCount(); |
| 49 } | 52 } |
| 50 Profile* profile = | 53 Profile* profile = |
| 51 g_browser_process->profile_manager()->GetActiveUserProfile(); | 54 g_browser_process->profile_manager()->GetActiveUserProfile(); |
| 52 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 55 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 53 chromeos::switches::kLoginManager)) { | 56 chromeos::switches::kLoginManager)) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 76 content::NotificationRegistrar registrar_; | 79 content::NotificationRegistrar registrar_; |
| 77 | 80 |
| 78 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsAthena); | 81 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsAthena); |
| 79 }; | 82 }; |
| 80 | 83 |
| 81 } // namespace | 84 } // namespace |
| 82 | 85 |
| 83 ChromeBrowserMainExtraParts* CreateChromeBrowserMainExtraPartsAthena() { | 86 ChromeBrowserMainExtraParts* CreateChromeBrowserMainExtraPartsAthena() { |
| 84 return new ChromeBrowserMainExtraPartsAthena(); | 87 return new ChromeBrowserMainExtraPartsAthena(); |
| 85 } | 88 } |
| OLD | NEW |