| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 UI_VIEWS_MUS_AURA_INIT_H_ | 5 #ifndef UI_VIEWS_MUS_AURA_INIT_H_ |
| 6 #define UI_VIEWS_MUS_AURA_INIT_H_ | 6 #define UI_VIEWS_MUS_AURA_INIT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "third_party/skia/include/core/SkRefCnt.h" | 13 #include "third_party/skia/include/core/SkRefCnt.h" |
| 14 #include "ui/aura/env.h" | 14 #include "ui/aura/env.h" |
| 15 #include "ui/views/mus/mus_export.h" | 15 #include "ui/views/mus/mus_export.h" |
| 16 | 16 |
| 17 namespace aura { | 17 namespace aura { |
| 18 class Env; | 18 class Env; |
| 19 class WindowPort; |
| 20 } |
| 21 |
| 22 namespace base { |
| 23 class SingleThreadTaskRunner; |
| 19 } | 24 } |
| 20 | 25 |
| 21 namespace font_service { | 26 namespace font_service { |
| 22 class FontLoader; | 27 class FontLoader; |
| 23 } | 28 } |
| 24 | 29 |
| 25 namespace service_manager { | 30 namespace service_manager { |
| 26 class Connector; | 31 class Connector; |
| 32 class Identity; |
| 27 } | 33 } |
| 28 | 34 |
| 29 namespace views { | 35 namespace views { |
| 36 class MusClient; |
| 30 class ViewsDelegate; | 37 class ViewsDelegate; |
| 31 | 38 |
| 32 // Sets up necessary state for aura when run with the viewmanager. | 39 // Sets up necessary state for aura when run with the viewmanager. |
| 33 // |resource_file| is the path to the apk file containing the resources. | 40 // |resource_file| is the path to the apk file containing the resources. |
| 34 class VIEWS_MUS_EXPORT AuraInit { | 41 class VIEWS_MUS_EXPORT AuraInit { |
| 35 public: | 42 public: |
| 43 enum class Mode { |
| 44 // Indicates AuraInit should target using aura with mus. |
| 45 AURA_MUS, |
| 46 |
| 47 // Indicates AuraInit should target using ui::Window. |
| 48 UI, |
| 49 }; |
| 50 |
| 36 // |resource_file| is the file to load strings and 1x icons from. | 51 // |resource_file| is the file to load strings and 1x icons from. |
| 37 // |resource_file_200| can be an empty string, otherwise it is the file to | 52 // |resource_file_200| can be an empty string, otherwise it is the file to |
| 38 // load 2x icons from. | 53 // load 2x icons from. |
| 39 AuraInit(service_manager::Connector* connector, | 54 AuraInit(service_manager::Connector* connector, |
| 55 const service_manager::Identity& identity, |
| 40 const std::string& resource_file, | 56 const std::string& resource_file, |
| 41 const std::string& resource_file_200 = std::string(), | 57 const std::string& resource_file_200 = std::string(), |
| 42 const aura::Env::WindowPortFactory& window_port_factory = | 58 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr, |
| 43 aura::Env::WindowPortFactory()); | 59 Mode mode = Mode::UI); |
| 60 ~AuraInit(); |
| 44 | 61 |
| 45 ~AuraInit(); | 62 // Only valid if Mode::AURA_MUS was passed to constructor. |
| 63 MusClient* mus_client() { return mus_client_.get(); } |
| 46 | 64 |
| 47 private: | 65 private: |
| 48 void InitializeResources(service_manager::Connector* connector); | 66 void InitializeResources(service_manager::Connector* connector); |
| 49 | 67 |
| 68 std::unique_ptr<aura::WindowPort> CreateWindowPort(aura::Window* window); |
| 69 |
| 50 #if defined(OS_LINUX) | 70 #if defined(OS_LINUX) |
| 51 sk_sp<font_service::FontLoader> font_loader_; | 71 sk_sp<font_service::FontLoader> font_loader_; |
| 52 #endif | 72 #endif |
| 53 | 73 |
| 54 const std::string resource_file_; | 74 const std::string resource_file_; |
| 55 const std::string resource_file_200_; | 75 const std::string resource_file_200_; |
| 56 | 76 |
| 77 std::unique_ptr<MusClient> mus_client_; |
| 57 std::unique_ptr<aura::Env> env_; | 78 std::unique_ptr<aura::Env> env_; |
| 58 std::unique_ptr<ViewsDelegate> views_delegate_; | 79 std::unique_ptr<ViewsDelegate> views_delegate_; |
| 59 | 80 |
| 60 DISALLOW_COPY_AND_ASSIGN(AuraInit); | 81 DISALLOW_COPY_AND_ASSIGN(AuraInit); |
| 61 }; | 82 }; |
| 62 | 83 |
| 63 } // namespace views | 84 } // namespace views |
| 64 | 85 |
| 65 #endif // UI_VIEWS_MUS_AURA_INIT_H_ | 86 #endif // UI_VIEWS_MUS_AURA_INIT_H_ |
| OLD | NEW |