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

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

Issue 2471033005: Adds DesktopWindowTreeHostMus (Closed)
Patch Set: fix Created 4 years, 1 month 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 | « ui/views/mus/aura_init.h ('k') | ui/views/mus/desktop_window_tree_host_mus.h » ('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 #include "ui/views/mus/aura_init.h" 5 #include "ui/views/mus/aura_init.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "services/catalog/public/cpp/resource_loader.h" 13 #include "services/catalog/public/cpp/resource_loader.h"
14 #include "services/service_manager/public/cpp/connector.h" 14 #include "services/service_manager/public/cpp/connector.h"
15 #include "ui/aura/env.h" 15 #include "ui/aura/env.h"
16 #include "ui/aura/mus/window_port_mus.h"
17 #include "ui/aura/window_port_local.h"
16 #include "ui/base/ime/input_method_initializer.h" 18 #include "ui/base/ime/input_method_initializer.h"
17 #include "ui/base/material_design/material_design_controller.h" 19 #include "ui/base/material_design/material_design_controller.h"
18 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/base/ui_base_paths.h" 21 #include "ui/base/ui_base_paths.h"
22 #include "ui/views/mus/mus_client.h"
20 #include "ui/views/views_delegate.h" 23 #include "ui/views/views_delegate.h"
21 24
22 #if defined(OS_LINUX) 25 #if defined(OS_LINUX)
23 #include "components/font_service/public/cpp/font_loader.h" 26 #include "components/font_service/public/cpp/font_loader.h"
24 #endif 27 #endif
25 28
26 namespace views { 29 namespace views {
27 30
28 namespace { 31 namespace {
29 32
30 class MusViewsDelegate : public ViewsDelegate { 33 class MusViewsDelegate : public ViewsDelegate {
31 public: 34 public:
32 MusViewsDelegate() {} 35 MusViewsDelegate() {}
33 ~MusViewsDelegate() override {} 36 ~MusViewsDelegate() override {}
34 37
35 private: 38 private:
36 #if defined(OS_WIN) 39 #if defined(OS_WIN)
37 HICON GetSmallWindowIcon() const override { return nullptr; } 40 HICON GetSmallWindowIcon() const override { return nullptr; }
38 #endif 41 #endif
39 void OnBeforeWidgetInit( 42 void OnBeforeWidgetInit(
40 Widget::InitParams* params, 43 Widget::InitParams* params,
41 internal::NativeWidgetDelegate* delegate) override {} 44 internal::NativeWidgetDelegate* delegate) override {}
42 45
43 DISALLOW_COPY_AND_ASSIGN(MusViewsDelegate); 46 DISALLOW_COPY_AND_ASSIGN(MusViewsDelegate);
44 }; 47 };
45 48
46 } // namespace 49 } // namespace
47 50
48 AuraInit::AuraInit(service_manager::Connector* connector, 51 AuraInit::AuraInit(service_manager::Connector* connector,
52 const service_manager::Identity& identity,
49 const std::string& resource_file, 53 const std::string& resource_file,
50 const std::string& resource_file_200, 54 const std::string& resource_file_200,
51 const aura::Env::WindowPortFactory& window_port_factory) 55 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
56 Mode mode)
52 : resource_file_(resource_file), 57 : resource_file_(resource_file),
53 resource_file_200_(resource_file_200), 58 resource_file_200_(resource_file_200),
54 env_(aura::Env::CreateInstance(window_port_factory)), 59 env_(aura::Env::CreateInstance(
60 base::Bind(&AuraInit::CreateWindowPort, base::Unretained(this)))),
55 views_delegate_(new MusViewsDelegate) { 61 views_delegate_(new MusViewsDelegate) {
62 if (mode == Mode::AURA_MUS) {
63 mus_client_ =
64 base::WrapUnique(new MusClient(connector, identity, io_task_runner));
Elliot Glaysher 2016/11/03 00:21:43 MakeUnique<MusClient>?
sky 2016/11/03 03:07:52 The constructor is private (AuraInit is friended),
65 }
56 ui::MaterialDesignController::Initialize(); 66 ui::MaterialDesignController::Initialize();
57 InitializeResources(connector); 67 InitializeResources(connector);
58 68
59 // Initialize the skia font code to go ask fontconfig underneath. 69 // Initialize the skia font code to go ask fontconfig underneath.
60 #if defined(OS_LINUX) 70 #if defined(OS_LINUX)
61 font_loader_ = sk_make_sp<font_service::FontLoader>(connector); 71 font_loader_ = sk_make_sp<font_service::FontLoader>(connector);
62 SkFontConfigInterface::SetGlobal(font_loader_.get()); 72 SkFontConfigInterface::SetGlobal(font_loader_.get());
63 #endif 73 #endif
64 74
65 // There is a bunch of static state in gfx::Font, by running this now, 75 // There is a bunch of static state in gfx::Font, by running this now,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 base::File pak_file_2 = pak_file.Duplicate(); 110 base::File pak_file_2 = pak_file.Duplicate();
101 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( 111 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion(
102 std::move(pak_file), base::MemoryMappedFile::Region::kWholeFile); 112 std::move(pak_file), base::MemoryMappedFile::Region::kWholeFile);
103 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( 113 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile(
104 std::move(pak_file_2), ui::SCALE_FACTOR_100P); 114 std::move(pak_file_2), ui::SCALE_FACTOR_100P);
105 if (!resource_file_200_.empty()) 115 if (!resource_file_200_.empty())
106 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( 116 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile(
107 loader.TakeFile(resource_file_200_), ui::SCALE_FACTOR_200P); 117 loader.TakeFile(resource_file_200_), ui::SCALE_FACTOR_200P);
108 } 118 }
109 119
120 std::unique_ptr<aura::WindowPort> AuraInit::CreateWindowPort(
121 aura::Window* window) {
122 if (mus_client_) {
123 std::unique_ptr<aura::WindowPortMus> window_port =
124 base::MakeUnique<aura::WindowPortMus>(mus_client_->window_tree_client(),
125 aura::WindowMusType::LOCAL);
126 return std::move(window_port);
Elliot Glaysher 2016/11/03 00:21:43 Are you able to just return the output of MakeUniq
sky 2016/11/03 03:07:52 Because the types differ, no. By that I mean uniqu
127 }
128 std::unique_ptr<aura::WindowPortLocal> window_port =
129 base::MakeUnique<aura::WindowPortLocal>(window);
130 return std::move(window_port);
131 }
132
110 } // namespace views 133 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/aura_init.h ('k') | ui/views/mus/desktop_window_tree_host_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698