| 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 #ifndef CHROME_BROWSER_UI_ASH_ASH_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_ASH_UTIL_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_ASH_UTIL_H_ | 6 #define CHROME_BROWSER_UI_ASH_ASH_UTIL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/public/cpp/config.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 12 | 13 |
| 13 namespace service_manager { | 14 namespace service_manager { |
| 14 class Service; | 15 class Service; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace ui { | 18 namespace ui { |
| 18 class Accelerator; | 19 class Accelerator; |
| 19 class KeyEvent; | 20 class KeyEvent; |
| 20 } // namespace ui | 21 } // namespace ui |
| 21 | 22 |
| 22 namespace ash_util { | 23 namespace ash_util { |
| 23 | 24 |
| 24 enum class Config { | |
| 25 // Classic mode does not use mus. | |
| 26 CLASSIC, | |
| 27 | |
| 28 // Aura is backed by mus, but chrome and ash are still in the same process. | |
| 29 MUS, | |
| 30 | |
| 31 // Aura is backed by mus and chrome and ash are in separate processes. In this | |
| 32 // mode chrome code can only use ash code in ash/public/cpp. | |
| 33 MASH, | |
| 34 }; | |
| 35 | |
| 36 // Creates an in-process Service instance of which can host common ash | 25 // Creates an in-process Service instance of which can host common ash |
| 37 // interfaces. | 26 // interfaces. |
| 38 std::unique_ptr<service_manager::Service> CreateEmbeddedAshService( | 27 std::unique_ptr<service_manager::Service> CreateEmbeddedAshService( |
| 39 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 28 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| 40 | 29 |
| 41 // Returns true if Ash should be run at startup. | 30 // Returns true if Ash should be run at startup. |
| 42 bool ShouldOpenAshOnStartup(); | 31 bool ShouldOpenAshOnStartup(); |
| 43 | 32 |
| 44 // Returns true if Chrome is running in the mash shell. | 33 // Returns true if Chrome is running in the mash shell. |
| 45 // TODO(sky): convert to GetConfig(). | 34 // TODO(sky): convert to chromeos::GetConfig() and remove. |
| 46 bool IsRunningInMash(); | 35 bool IsRunningInMash(); |
| 47 | 36 |
| 48 Config GetConfig(); | |
| 49 | |
| 50 // Returns true if the given |accelerator| has been deprecated and hence can | 37 // Returns true if the given |accelerator| has been deprecated and hence can |
| 51 // be consumed by web contents if needed. | 38 // be consumed by web contents if needed. |
| 52 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator); | 39 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator); |
| 53 | 40 |
| 54 // Returns true if ash has an accelerator for |key_event| that is enabled. | 41 // Returns true if ash has an accelerator for |key_event| that is enabled. |
| 55 bool WillAshProcessAcceleratorForEvent(const ui::KeyEvent& key_event); | 42 bool WillAshProcessAcceleratorForEvent(const ui::KeyEvent& key_event); |
| 56 | 43 |
| 57 } // namespace ash_util | 44 } // namespace ash_util |
| 58 | 45 |
| 59 #endif // CHROME_BROWSER_UI_ASH_ASH_UTIL_H_ | 46 #endif // CHROME_BROWSER_UI_ASH_ASH_UTIL_H_ |
| OLD | NEW |