| 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.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/high_contrast/high_contrast_controller.h" | 9 #include "ash/high_contrast/high_contrast_controller.h" |
| 10 #include "ash/magnifier/magnification_controller.h" | 10 #include "ash/magnifier/magnification_controller.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.blocking_pool = content::BrowserThread::GetBlockingPool(); | 66 shell_init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
| 67 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
| 68 shell_init_params.remote_hwnd = remote_window; | 68 shell_init_params.remote_hwnd = remote_window; |
| 69 #endif | 69 #endif |
| 70 | 70 |
| 71 ash::Shell* shell = ash::Shell::CreateInstance(shell_init_params); | 71 ash::Shell* shell = ash::Shell::CreateInstance(shell_init_params); |
| 72 shell->accelerator_controller()->SetScreenshotDelegate( | 72 shell->accelerator_controller()->SetScreenshotDelegate( |
| 73 scoped_ptr<ash::ScreenshotDelegate>(new ChromeScreenshotGrabber)); | 73 std::unique_ptr<ash::ScreenshotDelegate>(new ChromeScreenshotGrabber)); |
| 74 #if defined(OS_CHROMEOS) | 74 #if defined(OS_CHROMEOS) |
| 75 // TODO(flackr): Investigate exposing a blocking pool task runner to chromeos. | 75 // TODO(flackr): Investigate exposing a blocking pool task runner to chromeos. |
| 76 chromeos::AccelerometerReader::GetInstance()->Initialize( | 76 chromeos::AccelerometerReader::GetInstance()->Initialize( |
| 77 content::BrowserThread::GetBlockingPool() | 77 content::BrowserThread::GetBlockingPool() |
| 78 ->GetSequencedTaskRunnerWithShutdownBehavior( | 78 ->GetSequencedTaskRunnerWithShutdownBehavior( |
| 79 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), | 79 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), |
| 80 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 80 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 81 shell->accelerator_controller()->SetImeControlDelegate( | 81 shell->accelerator_controller()->SetImeControlDelegate( |
| 82 scoped_ptr<ash::ImeControlDelegate>(new ImeController)); | 82 std::unique_ptr<ash::ImeControlDelegate>(new ImeController)); |
| 83 shell->high_contrast_controller()->SetEnabled( | 83 shell->high_contrast_controller()->SetEnabled( |
| 84 chromeos::AccessibilityManager::Get()->IsHighContrastEnabled()); | 84 chromeos::AccessibilityManager::Get()->IsHighContrastEnabled()); |
| 85 | 85 |
| 86 DCHECK(chromeos::MagnificationManager::Get()); | 86 DCHECK(chromeos::MagnificationManager::Get()); |
| 87 bool magnifier_enabled = | 87 bool magnifier_enabled = |
| 88 chromeos::MagnificationManager::Get()->IsMagnifierEnabled(); | 88 chromeos::MagnificationManager::Get()->IsMagnifierEnabled(); |
| 89 ui::MagnifierType magnifier_type = | 89 ui::MagnifierType magnifier_type = |
| 90 chromeos::MagnificationManager::Get()->GetMagnifierType(); | 90 chromeos::MagnificationManager::Get()->GetMagnifierType(); |
| 91 shell->magnification_controller()-> | 91 shell->magnification_controller()-> |
| 92 SetEnabled(magnifier_enabled && magnifier_type == ui::MAGNIFIER_FULL); | 92 SetEnabled(magnifier_enabled && magnifier_type == ui::MAGNIFIER_FULL); |
| 93 shell->partial_magnification_controller()-> | 93 shell->partial_magnification_controller()-> |
| 94 SetEnabled(magnifier_enabled && magnifier_type == ui::MAGNIFIER_PARTIAL); | 94 SetEnabled(magnifier_enabled && magnifier_type == ui::MAGNIFIER_PARTIAL); |
| 95 | 95 |
| 96 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 96 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 97 switches::kDisableZeroBrowsersOpenForTests)) { | 97 switches::kDisableZeroBrowsersOpenForTests)) { |
| 98 g_browser_process->platform_part()->RegisterKeepAlive(); | 98 g_browser_process->platform_part()->RegisterKeepAlive(); |
| 99 } | 99 } |
| 100 #endif | 100 #endif |
| 101 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 101 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void CloseAsh() { | 104 void CloseAsh() { |
| 105 if (ash::Shell::HasInstance()) { | 105 if (ash::Shell::HasInstance()) { |
| 106 ash::Shell::DeleteInstance(); | 106 ash::Shell::DeleteInstance(); |
| 107 ash::ShellContentState::DestroyInstance(); | 107 ash::ShellContentState::DestroyInstance(); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace chrome | 111 } // namespace chrome |
| OLD | NEW |