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

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

Issue 2795883002: Eliminate OnConnect usage (Closed)
Patch Set: . Created 3 years, 8 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 | « ash/autoclick/mus/autoclick_application.h ('k') | ash/common/mojo_interface_factory.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"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 } 72 }
73 } 73 }
74 74
75 AutoclickControllerCommon* autoclick_controller_common_; 75 AutoclickControllerCommon* autoclick_controller_common_;
76 76
77 DISALLOW_COPY_AND_ASSIGN(AutoclickUI); 77 DISALLOW_COPY_AND_ASSIGN(AutoclickUI);
78 }; 78 };
79 79
80 AutoclickApplication::AutoclickApplication() 80 AutoclickApplication::AutoclickApplication()
81 : launchable_binding_(this), autoclick_binding_(this) {} 81 : launchable_binding_(this), autoclick_binding_(this) {
82 registry_.AddInterface<mash::mojom::Launchable>(this);
83 registry_.AddInterface<mojom::AutoclickController>(this);
84 }
82 85
83 AutoclickApplication::~AutoclickApplication() {} 86 AutoclickApplication::~AutoclickApplication() {}
84 87
85 void AutoclickApplication::OnStart() { 88 void AutoclickApplication::OnStart() {
86 aura_init_ = base::MakeUnique<views::AuraInit>( 89 aura_init_ = base::MakeUnique<views::AuraInit>(
87 context()->connector(), context()->identity(), "views_mus_resources.pak", 90 context()->connector(), context()->identity(), "views_mus_resources.pak",
88 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); 91 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS);
89 autoclick_controller_common_.reset(new AutoclickControllerCommon( 92 autoclick_controller_common_.reset(new AutoclickControllerCommon(
90 base::TimeDelta::FromMilliseconds(kDefaultAutoclickDelayMs), this)); 93 base::TimeDelta::FromMilliseconds(kDefaultAutoclickDelayMs), this));
91 } 94 }
92 95
93 bool AutoclickApplication::OnConnect( 96 void AutoclickApplication::OnBindInterface(
94 const service_manager::ServiceInfo& remote_info, 97 const service_manager::ServiceInfo& remote_info,
95 service_manager::InterfaceRegistry* registry) { 98 const std::string& interface_name,
96 registry->AddInterface<mash::mojom::Launchable>(this); 99 mojo::ScopedMessagePipeHandle interface_pipe) {
97 registry->AddInterface<mojom::AutoclickController>(this); 100 registry_.BindInterface(remote_info.identity, interface_name,
98 return true; 101 std::move(interface_pipe));
99 } 102 }
100 103
101 void AutoclickApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) { 104 void AutoclickApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) {
102 if (!widget_) { 105 if (!widget_) {
103 widget_.reset(new views::Widget); 106 widget_.reset(new views::Widget);
104 views::Widget::InitParams params( 107 views::Widget::InitParams params(
105 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 108 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
106 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 109 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
107 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 110 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
108 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; 111 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // TODO(riajiang): Currently not working. Need to know how to generate events 158 // TODO(riajiang): Currently not working. Need to know how to generate events
156 // in mus world (crbug.com/628665). 159 // in mus world (crbug.com/628665).
157 } 160 }
158 161
159 void AutoclickApplication::OnAutoclickCanceled() { 162 void AutoclickApplication::OnAutoclickCanceled() {
160 // Not used in mus. 163 // Not used in mus.
161 } 164 }
162 165
163 } // namespace autoclick 166 } // namespace autoclick
164 } // namespace ash 167 } // namespace ash
OLDNEW
« no previous file with comments | « ash/autoclick/mus/autoclick_application.h ('k') | ash/common/mojo_interface_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698