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