OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/autoclick/mus/autoclick_application.h" | 5 #include "ash/autoclick/mus/autoclick_application.h" |
6 | 6 |
7 #include "ash/public/interfaces/container.mojom.h" | 7 #include "ash/public/interfaces/container.mojom.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "services/service_manager/public/cpp/connector.h" | 10 #include "services/service_manager/public/cpp/connector.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 AutoclickControllerCommon* autoclick_controller_common_; | 68 AutoclickControllerCommon* autoclick_controller_common_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(AutoclickUI); | 70 DISALLOW_COPY_AND_ASSIGN(AutoclickUI); |
71 }; | 71 }; |
72 | 72 |
73 AutoclickApplication::AutoclickApplication() | 73 AutoclickApplication::AutoclickApplication() |
74 : launchable_binding_(this), autoclick_binding_(this) {} | 74 : launchable_binding_(this), autoclick_binding_(this) {} |
75 | 75 |
76 AutoclickApplication::~AutoclickApplication() {} | 76 AutoclickApplication::~AutoclickApplication() {} |
77 | 77 |
78 void AutoclickApplication::OnStart(const shell::Identity& identity) { | 78 void AutoclickApplication::OnStart(const service_manager::Identity& identity) { |
79 aura_init_.reset(new views::AuraInit(connector(), "views_mus_resources.pak")); | 79 aura_init_.reset(new views::AuraInit(connector(), "views_mus_resources.pak")); |
80 window_manager_connection_ = | 80 window_manager_connection_ = |
81 views::WindowManagerConnection::Create(connector(), identity); | 81 views::WindowManagerConnection::Create(connector(), identity); |
82 autoclick_controller_common_.reset(new AutoclickControllerCommon( | 82 autoclick_controller_common_.reset(new AutoclickControllerCommon( |
83 base::TimeDelta::FromMilliseconds(kDefaultAutoclickDelayMs), this)); | 83 base::TimeDelta::FromMilliseconds(kDefaultAutoclickDelayMs), this)); |
84 } | 84 } |
85 | 85 |
86 bool AutoclickApplication::OnConnect(const shell::Identity& remote_identity, | 86 bool AutoclickApplication::OnConnect( |
87 shell::InterfaceRegistry* registry) { | 87 const service_manager::Identity& remote_identity, |
| 88 service_manager::InterfaceRegistry* registry) { |
88 registry->AddInterface<mash::mojom::Launchable>(this); | 89 registry->AddInterface<mash::mojom::Launchable>(this); |
89 registry->AddInterface<mojom::AutoclickController>(this); | 90 registry->AddInterface<mojom::AutoclickController>(this); |
90 return true; | 91 return true; |
91 } | 92 } |
92 | 93 |
93 void AutoclickApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) { | 94 void AutoclickApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) { |
94 if (!widget_) { | 95 if (!widget_) { |
95 widget_.reset(new views::Widget); | 96 widget_.reset(new views::Widget); |
96 views::Widget::InitParams params( | 97 views::Widget::InitParams params( |
97 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 98 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
(...skipping 20 matching lines...) Expand all Loading... |
118 widget_->Close(); | 119 widget_->Close(); |
119 base::MessageLoop::current()->QuitWhenIdle(); | 120 base::MessageLoop::current()->QuitWhenIdle(); |
120 } | 121 } |
121 } | 122 } |
122 | 123 |
123 void AutoclickApplication::SetAutoclickDelay(uint32_t delay_in_milliseconds) { | 124 void AutoclickApplication::SetAutoclickDelay(uint32_t delay_in_milliseconds) { |
124 autoclick_controller_common_->SetAutoclickDelay( | 125 autoclick_controller_common_->SetAutoclickDelay( |
125 base::TimeDelta::FromMilliseconds(delay_in_milliseconds)); | 126 base::TimeDelta::FromMilliseconds(delay_in_milliseconds)); |
126 } | 127 } |
127 | 128 |
128 void AutoclickApplication::Create(const shell::Identity& remote_identity, | 129 void AutoclickApplication::Create( |
129 mash::mojom::LaunchableRequest request) { | 130 const service_manager::Identity& remote_identity, |
| 131 mash::mojom::LaunchableRequest request) { |
130 launchable_binding_.Close(); | 132 launchable_binding_.Close(); |
131 launchable_binding_.Bind(std::move(request)); | 133 launchable_binding_.Bind(std::move(request)); |
132 } | 134 } |
133 | 135 |
134 void AutoclickApplication::Create(const shell::Identity& remote_identity, | 136 void AutoclickApplication::Create( |
135 mojom::AutoclickControllerRequest request) { | 137 const service_manager::Identity& remote_identity, |
| 138 mojom::AutoclickControllerRequest request) { |
136 autoclick_binding_.Close(); | 139 autoclick_binding_.Close(); |
137 autoclick_binding_.Bind(std::move(request)); | 140 autoclick_binding_.Bind(std::move(request)); |
138 } | 141 } |
139 | 142 |
140 views::Widget* AutoclickApplication::CreateAutoclickRingWidget( | 143 views::Widget* AutoclickApplication::CreateAutoclickRingWidget( |
141 const gfx::Point& event_location) { | 144 const gfx::Point& event_location) { |
142 return widget_.get(); | 145 return widget_.get(); |
143 } | 146 } |
144 | 147 |
145 void AutoclickApplication::UpdateAutoclickRingWidget( | 148 void AutoclickApplication::UpdateAutoclickRingWidget( |
146 views::Widget* widget, | 149 views::Widget* widget, |
147 const gfx::Point& event_location) { | 150 const gfx::Point& event_location) { |
148 // Not used in mus. | 151 // Not used in mus. |
149 } | 152 } |
150 | 153 |
151 void AutoclickApplication::DoAutoclick(const gfx::Point& event_location, | 154 void AutoclickApplication::DoAutoclick(const gfx::Point& event_location, |
152 const int mouse_event_flags) { | 155 const int mouse_event_flags) { |
153 // TODO(riajiang): Currently not working. Need to know how to generate events | 156 // TODO(riajiang): Currently not working. Need to know how to generate events |
154 // in mus world (crbug.com/628665). | 157 // in mus world (crbug.com/628665). |
155 } | 158 } |
156 | 159 |
157 void AutoclickApplication::OnAutoclickCanceled() { | 160 void AutoclickApplication::OnAutoclickCanceled() { |
158 // Not used in mus. | 161 // Not used in mus. |
159 } | 162 } |
160 | 163 |
161 } // namespace autoclick | 164 } // namespace autoclick |
162 } // namespace ash | 165 } // namespace ash |
OLD | NEW |