| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ash/ash_init.h" | 5 #include "chrome/browser/ui/ash/ash_init.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
| 8 #include "ash/aura/wm_shell_aura.h" |
| 8 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
| 9 #include "ash/common/accessibility_types.h" | 10 #include "ash/common/accessibility_types.h" |
| 10 #include "ash/common/wm_shell.h" | |
| 11 #include "ash/high_contrast/high_contrast_controller.h" | 11 #include "ash/high_contrast/high_contrast_controller.h" |
| 12 #include "ash/magnifier/magnification_controller.h" | 12 #include "ash/magnifier/magnification_controller.h" |
| 13 #include "ash/magnifier/partial_magnification_controller.h" | 13 #include "ash/magnifier/partial_magnification_controller.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/shell_init_params.h" | 15 #include "ash/shell_init_params.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
| 18 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 ash::ShellInitParams shell_init_params; | 62 ash::ShellInitParams shell_init_params; |
| 63 // Shell takes ownership of ChromeShellDelegate. | 63 // Shell takes ownership of ChromeShellDelegate. |
| 64 shell_init_params.delegate = new ChromeShellDelegate; | 64 shell_init_params.delegate = new ChromeShellDelegate; |
| 65 shell_init_params.context_factory = content::GetContextFactory(); | 65 shell_init_params.context_factory = content::GetContextFactory(); |
| 66 shell_init_params.context_factory_private = | 66 shell_init_params.context_factory_private = |
| 67 content::GetContextFactoryPrivate(); | 67 content::GetContextFactoryPrivate(); |
| 68 shell_init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); | 68 shell_init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
| 69 | 69 |
| 70 ash::Shell* shell = ash::Shell::CreateInstance(shell_init_params); | 70 ash::Shell* shell = ash::Shell::CreateInstance(shell_init_params); |
| 71 shell->accelerator_controller_delegate()->SetScreenshotDelegate( | 71 ash::WmShellAura::Get() |
| 72 std::unique_ptr<ash::ScreenshotDelegate>(new ChromeScreenshotGrabber)); | 72 ->accelerator_controller_delegate() |
| 73 ->SetScreenshotDelegate(std::unique_ptr<ash::ScreenshotDelegate>( |
| 74 new ChromeScreenshotGrabber)); |
| 73 // TODO(flackr): Investigate exposing a blocking pool task runner to chromeos. | 75 // TODO(flackr): Investigate exposing a blocking pool task runner to chromeos. |
| 74 chromeos::AccelerometerReader::GetInstance()->Initialize( | 76 chromeos::AccelerometerReader::GetInstance()->Initialize( |
| 75 content::BrowserThread::GetBlockingPool() | 77 content::BrowserThread::GetBlockingPool() |
| 76 ->GetSequencedTaskRunnerWithShutdownBehavior( | 78 ->GetSequencedTaskRunnerWithShutdownBehavior( |
| 77 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), | 79 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), |
| 78 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 80 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 79 ash::WmShell::Get()->accelerator_controller()->SetImeControlDelegate( | 81 shell->accelerator_controller()->SetImeControlDelegate( |
| 80 std::unique_ptr<ash::ImeControlDelegate>(new ImeController)); | 82 std::unique_ptr<ash::ImeControlDelegate>(new ImeController)); |
| 81 shell->high_contrast_controller()->SetEnabled( | 83 shell->high_contrast_controller()->SetEnabled( |
| 82 chromeos::AccessibilityManager::Get()->IsHighContrastEnabled()); | 84 chromeos::AccessibilityManager::Get()->IsHighContrastEnabled()); |
| 83 | 85 |
| 84 DCHECK(chromeos::MagnificationManager::Get()); | 86 DCHECK(chromeos::MagnificationManager::Get()); |
| 85 bool magnifier_enabled = | 87 bool magnifier_enabled = |
| 86 chromeos::MagnificationManager::Get()->IsMagnifierEnabled(); | 88 chromeos::MagnificationManager::Get()->IsMagnifierEnabled(); |
| 87 ash::MagnifierType magnifier_type = | 89 ash::MagnifierType magnifier_type = |
| 88 chromeos::MagnificationManager::Get()->GetMagnifierType(); | 90 chromeos::MagnificationManager::Get()->GetMagnifierType(); |
| 89 shell->magnification_controller()->SetEnabled( | 91 shell->magnification_controller()->SetEnabled( |
| 90 magnifier_enabled && magnifier_type == ash::MAGNIFIER_FULL); | 92 magnifier_enabled && magnifier_type == ash::MAGNIFIER_FULL); |
| 91 shell->partial_magnification_controller()->SetEnabled( | 93 shell->partial_magnification_controller()->SetEnabled( |
| 92 magnifier_enabled && magnifier_type == ash::MAGNIFIER_PARTIAL); | 94 magnifier_enabled && magnifier_type == ash::MAGNIFIER_PARTIAL); |
| 93 | 95 |
| 94 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 96 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 95 switches::kDisableZeroBrowsersOpenForTests)) { | 97 switches::kDisableZeroBrowsersOpenForTests)) { |
| 96 g_browser_process->platform_part()->RegisterKeepAlive(); | 98 g_browser_process->platform_part()->RegisterKeepAlive(); |
| 97 } | 99 } |
| 98 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 100 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
| 99 } | 101 } |
| 100 | 102 |
| 101 void CloseAsh() { | 103 void CloseAsh() { |
| 102 if (ash::Shell::HasInstance()) { | 104 if (ash::Shell::HasInstance()) { |
| 103 ash::Shell::DeleteInstance(); | 105 ash::Shell::DeleteInstance(); |
| 104 ash::ShellContentState::DestroyInstance(); | 106 ash::ShellContentState::DestroyInstance(); |
| 105 } | 107 } |
| 106 } | 108 } |
| 107 | 109 |
| 108 } // namespace chrome | 110 } // namespace chrome |
| OLD | NEW |