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

Side by Side Diff: ash/autoclick/mus/autoclick_application.cc

Issue 2476063002: Service Manager: Rework Service and ServiceContext lifetime (Closed)
Patch Set: . 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 | « ash/autoclick/mus/autoclick_application.h ('k') | ash/mus/window_manager_application.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 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/cpp/shell_window_ids.h" 7 #include "ash/public/cpp/shell_window_ids.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "services/service_manager/public/cpp/connector.h" 11 #include "services/service_manager/public/cpp/connector.h"
12 #include "services/service_manager/public/cpp/service_context.h"
12 #include "services/ui/public/cpp/property_type_converters.h" 13 #include "services/ui/public/cpp/property_type_converters.h"
13 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" 14 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
14 #include "ui/views/mus/aura_init.h" 15 #include "ui/views/mus/aura_init.h"
15 #include "ui/views/mus/native_widget_mus.h" 16 #include "ui/views/mus/native_widget_mus.h"
16 #include "ui/views/mus/pointer_watcher_event_router.h" 17 #include "ui/views/mus/pointer_watcher_event_router.h"
17 #include "ui/views/mus/window_manager_connection.h" 18 #include "ui/views/mus/window_manager_connection.h"
18 #include "ui/views/pointer_watcher.h" 19 #include "ui/views/pointer_watcher.h"
19 #include "ui/views/widget/widget.h" 20 #include "ui/views/widget/widget.h"
20 #include "ui/views/widget/widget_delegate.h" 21 #include "ui/views/widget/widget_delegate.h"
21 22
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 AutoclickControllerCommon* autoclick_controller_common_; 70 AutoclickControllerCommon* autoclick_controller_common_;
70 71
71 DISALLOW_COPY_AND_ASSIGN(AutoclickUI); 72 DISALLOW_COPY_AND_ASSIGN(AutoclickUI);
72 }; 73 };
73 74
74 AutoclickApplication::AutoclickApplication() 75 AutoclickApplication::AutoclickApplication()
75 : launchable_binding_(this), autoclick_binding_(this) {} 76 : launchable_binding_(this), autoclick_binding_(this) {}
76 77
77 AutoclickApplication::~AutoclickApplication() {} 78 AutoclickApplication::~AutoclickApplication() {}
78 79
79 void AutoclickApplication::OnStart(const service_manager::ServiceInfo& info) { 80 void AutoclickApplication::OnStart(service_manager::ServiceContext* context) {
80 aura_init_ = base::MakeUnique<views::AuraInit>(connector(), info.identity, 81 aura_init_ = base::MakeUnique<views::AuraInit>(
81 "views_mus_resources.pak"); 82 context->connector(), context->identity(), "views_mus_resources.pak");
82 window_manager_connection_ = 83 window_manager_connection_ = views::WindowManagerConnection::Create(
83 views::WindowManagerConnection::Create(connector(), info.identity); 84 context->connector(), context->identity());
84 autoclick_controller_common_.reset(new AutoclickControllerCommon( 85 autoclick_controller_common_.reset(new AutoclickControllerCommon(
85 base::TimeDelta::FromMilliseconds(kDefaultAutoclickDelayMs), this)); 86 base::TimeDelta::FromMilliseconds(kDefaultAutoclickDelayMs), this));
86 } 87 }
87 88
88 bool AutoclickApplication::OnConnect( 89 bool AutoclickApplication::OnConnect(
89 const service_manager::ServiceInfo& remote_info, 90 const service_manager::ServiceInfo& remote_info,
90 service_manager::InterfaceRegistry* registry) { 91 service_manager::InterfaceRegistry* registry) {
91 registry->AddInterface<mash::mojom::Launchable>(this); 92 registry->AddInterface<mash::mojom::Launchable>(this);
92 registry->AddInterface<mojom::AutoclickController>(this); 93 registry->AddInterface<mojom::AutoclickController>(this);
93 return true; 94 return true;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // TODO(riajiang): Currently not working. Need to know how to generate events 159 // TODO(riajiang): Currently not working. Need to know how to generate events
159 // in mus world (crbug.com/628665). 160 // in mus world (crbug.com/628665).
160 } 161 }
161 162
162 void AutoclickApplication::OnAutoclickCanceled() { 163 void AutoclickApplication::OnAutoclickCanceled() {
163 // Not used in mus. 164 // Not used in mus.
164 } 165 }
165 166
166 } // namespace autoclick 167 } // namespace autoclick
167 } // namespace ash 168 } // namespace ash
OLDNEW
« no previous file with comments | « ash/autoclick/mus/autoclick_application.h ('k') | ash/mus/window_manager_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698