Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: ui/views/mus/aura_init.h

Issue 2973103002: Revert of Update AuraInit to handle failed initialization (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mash/task_viewer/task_viewer.cc ('k') | ui/views/mus/aura_init.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 AURA_MUS, 44 AURA_MUS,
45 45
46 // Indicates AuraInit should target using aura with mus, for a Window 46 // Indicates AuraInit should target using aura with mus, for a Window
47 // Manager client. 47 // Manager client.
48 AURA_MUS_WINDOW_MANAGER, 48 AURA_MUS_WINDOW_MANAGER,
49 49
50 // Indicates AuraInit should target using ui::Window. 50 // Indicates AuraInit should target using ui::Window.
51 UI 51 UI
52 }; 52 };
53 53
54 ~AuraInit();
55
56 // Returns an AuraInit if initialization can be completed successfully,
57 // otherwise a nullptr is returned. If initialization fails then Aura is in an
58 // unusable state, and calling services should shutdown.
59 // |resource_file| is the file to load strings and 1x icons from. 54 // |resource_file| is the file to load strings and 1x icons from.
60 // |resource_file_200| can be an empty string, otherwise it is the file to 55 // |resource_file_200| can be an empty string, otherwise it is the file to
61 // load 2x icons from. 56 // load 2x icons from.
62 static std::unique_ptr<AuraInit> Create( 57 AuraInit(service_manager::Connector* connector,
63 service_manager::Connector* connector, 58 const service_manager::Identity& identity,
64 const service_manager::Identity& identity, 59 const std::string& resource_file,
65 const std::string& resource_file, 60 const std::string& resource_file_200 = std::string(),
66 const std::string& resource_file_200 = std::string(), 61 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr,
67 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr, 62 Mode mode = Mode::UI);
68 Mode mode = Mode::UI); 63 ~AuraInit();
69 64
70 // Only valid if Mode::AURA_MUS was passed to constructor. 65 // Only valid if Mode::AURA_MUS was passed to constructor.
71 MusClient* mus_client() { return mus_client_.get(); } 66 MusClient* mus_client() { return mus_client_.get(); }
72 67
73 private:
74 AuraInit();
75
76 // Returns true if AuraInit was able to successfully complete initialization. 68 // Returns true if AuraInit was able to successfully complete initialization.
77 // If this returns false, then Aura is in an unusable state, and calling 69 // If this returns false, then Aura is in an unusable state, and calling
78 // services should shutdown. 70 // services should shutdown.
79 bool Init( 71 bool initialized() { return initialized_; }
80 service_manager::Connector* connector,
81 const service_manager::Identity& identity,
82 const std::string& resource_file,
83 const std::string& resource_file_200 = std::string(),
84 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr,
85 Mode mode = Mode::UI);
86 72
87 bool InitializeResources(service_manager::Connector* connector, 73 private:
88 const std::string& resource_file, 74 bool InitializeResources(service_manager::Connector* connector);
89 const std::string& resource_file_200);
90 75
91 #if defined(OS_LINUX) 76 #if defined(OS_LINUX)
92 sk_sp<font_service::FontLoader> font_loader_; 77 sk_sp<font_service::FontLoader> font_loader_;
93 #endif 78 #endif
94 79
80 const std::string resource_file_;
81 const std::string resource_file_200_;
82
95 std::unique_ptr<aura::Env> env_; 83 std::unique_ptr<aura::Env> env_;
96 std::unique_ptr<MusClient> mus_client_; 84 std::unique_ptr<MusClient> mus_client_;
97 std::unique_ptr<ViewsDelegate> views_delegate_; 85 std::unique_ptr<ViewsDelegate> views_delegate_;
98 86
87 // Whether or not initialization succeeds.
88 bool initialized_ = false;
89
99 DISALLOW_COPY_AND_ASSIGN(AuraInit); 90 DISALLOW_COPY_AND_ASSIGN(AuraInit);
100 }; 91 };
101 92
102 } // namespace views 93 } // namespace views
103 94
104 #endif // UI_VIEWS_MUS_AURA_INIT_H_ 95 #endif // UI_VIEWS_MUS_AURA_INIT_H_
OLDNEW
« no previous file with comments | « mash/task_viewer/task_viewer.cc ('k') | ui/views/mus/aura_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698