| 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/mus/keyboard_ui_mus.h" | 5 #include "ash/mus/keyboard_ui_mus.h" |
| 6 | 6 |
| 7 #include "ash/common/keyboard/keyboard_ui_observer.h" | 7 #include "ash/common/keyboard/keyboard_ui_observer.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "content/public/common/service_names.mojom.h" | 9 #include "content/public/common/service_names.mojom.h" |
| 10 #include "services/service_manager/public/cpp/connector.h" | 10 #include "services/service_manager/public/cpp/connector.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 | 13 |
| 14 KeyboardUIMus::KeyboardUIMus(service_manager::Connector* connector) | 14 KeyboardUIMus::KeyboardUIMus(service_manager::Connector* connector) |
| 15 : is_enabled_(false), observer_binding_(this) { | 15 : is_enabled_(false), observer_binding_(this) { |
| 16 if (connector) { | 16 if (connector) { |
| 17 // TODO(sky): should be something like mojo:keyboard, but need mapping. | 17 // TODO(sky): should be something like mojo:keyboard, but need mapping. |
| 18 connector->ConnectToInterface(content::mojom::kBrowserServiceName, | 18 connector->BindInterface(content::mojom::kBrowserServiceName, &keyboard_); |
| 19 &keyboard_); | |
| 20 keyboard_->AddObserver(observer_binding_.CreateInterfacePtrAndBind()); | 19 keyboard_->AddObserver(observer_binding_.CreateInterfacePtrAndBind()); |
| 21 } | 20 } |
| 22 } | 21 } |
| 23 | 22 |
| 24 KeyboardUIMus::~KeyboardUIMus() {} | 23 KeyboardUIMus::~KeyboardUIMus() {} |
| 25 | 24 |
| 26 // static | 25 // static |
| 27 std::unique_ptr<KeyboardUI> KeyboardUIMus::Create( | 26 std::unique_ptr<KeyboardUI> KeyboardUIMus::Create( |
| 28 service_manager::Connector* connector) { | 27 service_manager::Connector* connector) { |
| 29 return base::MakeUnique<KeyboardUIMus>(connector); | 28 return base::MakeUnique<KeyboardUIMus>(connector); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 53 const gfx::Rect& bounds) { | 52 const gfx::Rect& bounds) { |
| 54 if (is_enabled_ == is_enabled) | 53 if (is_enabled_ == is_enabled) |
| 55 return; | 54 return; |
| 56 | 55 |
| 57 is_enabled_ = is_enabled; | 56 is_enabled_ = is_enabled; |
| 58 for (auto& observer : *observers()) | 57 for (auto& observer : *observers()) |
| 59 observer.OnKeyboardEnabledStateChanged(is_enabled); | 58 observer.OnKeyboardEnabledStateChanged(is_enabled); |
| 60 } | 59 } |
| 61 | 60 |
| 62 } // namespace ash | 61 } // namespace ash |
| OLD | NEW |