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

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

Issue 2967943002: 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 ~AuraInit();
56
57 // Returns true if AuraInit was able to successfully complete initialization.
58 // If this returns false, then Aura is in an unusable state, and calling
59 // services should shutdown.
54 // |resource_file| is the file to load strings and 1x icons from. 60 // |resource_file| is the file to load strings and 1x icons from.
55 // |resource_file_200| can be an empty string, otherwise it is the file to 61 // |resource_file_200| can be an empty string, otherwise it is the file to
56 // load 2x icons from. 62 // load 2x icons from.
57 AuraInit(service_manager::Connector* connector, 63 bool Init(
sadrul 2017/07/05 14:49:25 What do you think of making the ctor private, and
jonross 2017/07/05 14:54:13 SGTM
58 const service_manager::Identity& identity, 64 service_manager::Connector* connector,
59 const std::string& resource_file, 65 const service_manager::Identity& identity,
60 const std::string& resource_file_200 = std::string(), 66 const std::string& resource_file,
61 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr, 67 const std::string& resource_file_200 = std::string(),
62 Mode mode = Mode::UI); 68 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr,
63 ~AuraInit(); 69 Mode mode = Mode::UI);
64 70
65 // Only valid if Mode::AURA_MUS was passed to constructor. 71 // Only valid if Mode::AURA_MUS was passed to constructor.
66 MusClient* mus_client() { return mus_client_.get(); } 72 MusClient* mus_client() { return mus_client_.get(); }
67 73
68 // Returns true if AuraInit was able to successfully complete initialization.
69 // If this returns false, then Aura is in an unusable state, and calling
70 // services should shutdown.
71 bool initialized() { return initialized_; }
72
73 private: 74 private:
74 bool InitializeResources(service_manager::Connector* connector); 75 bool InitializeResources(service_manager::Connector* connector,
76 const std::string& resource_file_,
77 const std::string& resource_file_200_);
sadrul 2017/07/05 14:49:24 no _ at the end
jonross 2017/07/05 17:51:31 Done.
75 78
76 #if defined(OS_LINUX) 79 #if defined(OS_LINUX)
77 sk_sp<font_service::FontLoader> font_loader_; 80 sk_sp<font_service::FontLoader> font_loader_;
78 #endif 81 #endif
79 82
80 const std::string resource_file_;
81 const std::string resource_file_200_;
82
83 std::unique_ptr<aura::Env> env_; 83 std::unique_ptr<aura::Env> env_;
84 std::unique_ptr<MusClient> mus_client_; 84 std::unique_ptr<MusClient> mus_client_;
85 std::unique_ptr<ViewsDelegate> views_delegate_; 85 std::unique_ptr<ViewsDelegate> views_delegate_;
86 86
87 // Whether or not initialization succeeds.
88 bool initialized_ = false;
89
90 DISALLOW_COPY_AND_ASSIGN(AuraInit); 87 DISALLOW_COPY_AND_ASSIGN(AuraInit);
91 }; 88 };
92 89
93 } // namespace views 90 } // namespace views
94 91
95 #endif // UI_VIEWS_MUS_AURA_INIT_H_ 92 #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