| 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 "chrome/browser/chromeos/chrome_interface_factory.h" | 5 #include "chrome/browser/chromeos/chrome_interface_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 9 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h" | 9 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h" |
| 10 #include "chrome/browser/ui/ash/chrome_wallpaper_helper.h" |
| 10 #include "chrome/browser/ui/ash/keyboard_ui_service.h" | 11 #include "chrome/browser/ui/ash/keyboard_ui_service.h" |
| 11 #include "chrome/browser/ui/browser_commands.h" | 12 #include "chrome/browser/ui/browser_commands.h" |
| 12 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
| 13 #include "services/shell/public/cpp/connection.h" | 14 #include "services/shell/public/cpp/connection.h" |
| 14 | 15 |
| 15 class ChromeLaunchable : public mash::mojom::Launchable { | 16 class ChromeLaunchable : public mash::mojom::Launchable { |
| 16 public: | 17 public: |
| 17 ChromeLaunchable() {} | 18 ChromeLaunchable() {} |
| 18 ~ChromeLaunchable() override {} | 19 ~ChromeLaunchable() override {} |
| 19 | 20 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 namespace chromeos { | 60 namespace chromeos { |
| 60 | 61 |
| 61 ChromeInterfaceFactory::ChromeInterfaceFactory() {} | 62 ChromeInterfaceFactory::ChromeInterfaceFactory() {} |
| 62 ChromeInterfaceFactory::~ChromeInterfaceFactory() {} | 63 ChromeInterfaceFactory::~ChromeInterfaceFactory() {} |
| 63 | 64 |
| 64 bool ChromeInterfaceFactory::AcceptConnection(shell::Connection* connection) { | 65 bool ChromeInterfaceFactory::AcceptConnection(shell::Connection* connection) { |
| 65 connection->AddInterface<keyboard::mojom::Keyboard>(this); | 66 connection->AddInterface<keyboard::mojom::Keyboard>(this); |
| 66 connection->AddInterface<mash::mojom::Launchable>(this); | 67 connection->AddInterface<mash::mojom::Launchable>(this); |
| 68 connection->AddInterface<mash::mojom::WallpaperHelper>(this); |
| 67 connection->AddInterface<app_list::mojom::AppListPresenter>(this); | 69 connection->AddInterface<app_list::mojom::AppListPresenter>(this); |
| 68 return true; | 70 return true; |
| 69 } | 71 } |
| 70 | 72 |
| 71 void ChromeInterfaceFactory::Create( | 73 void ChromeInterfaceFactory::Create( |
| 72 shell::Connection* connection, | 74 shell::Connection* connection, |
| 73 mojo::InterfaceRequest<keyboard::mojom::Keyboard> request) { | 75 mojo::InterfaceRequest<keyboard::mojom::Keyboard> request) { |
| 74 if (!keyboard_ui_service_) | 76 if (!keyboard_ui_service_) |
| 75 keyboard_ui_service_.reset(new KeyboardUIService); | 77 keyboard_ui_service_.reset(new KeyboardUIService); |
| 76 keyboard_bindings_.AddBinding(keyboard_ui_service_.get(), std::move(request)); | 78 keyboard_bindings_.AddBinding(keyboard_ui_service_.get(), std::move(request)); |
| 77 } | 79 } |
| 78 | 80 |
| 79 void ChromeInterfaceFactory::Create(shell::Connection* connection, | 81 void ChromeInterfaceFactory::Create(shell::Connection* connection, |
| 80 mash::mojom::LaunchableRequest request) { | 82 mash::mojom::LaunchableRequest request) { |
| 81 if (!launchable_) | 83 if (!launchable_) |
| 82 launchable_.reset(new ChromeLaunchable); | 84 launchable_.reset(new ChromeLaunchable); |
| 83 launchable_->ProcessRequest(std::move(request)); | 85 launchable_->ProcessRequest(std::move(request)); |
| 84 } | 86 } |
| 85 | 87 |
| 86 void ChromeInterfaceFactory::Create( | 88 void ChromeInterfaceFactory::Create( |
| 87 shell::Connection* connection, | 89 shell::Connection* connection, |
| 90 mash::mojom::WallpaperHelperRequest request) { |
| 91 if (!wallpaper_helper_) |
| 92 wallpaper_helper_.reset(new ChromeWallpaperHelper); |
| 93 wallpaper_helper_->ProcessRequest(std::move(request)); |
| 94 } |
| 95 |
| 96 void ChromeInterfaceFactory::Create( |
| 97 shell::Connection* connection, |
| 88 mojo::InterfaceRequest<app_list::mojom::AppListPresenter> request) { | 98 mojo::InterfaceRequest<app_list::mojom::AppListPresenter> request) { |
| 89 if (!app_list_presenter_service_) | 99 if (!app_list_presenter_service_) |
| 90 app_list_presenter_service_.reset(new AppListPresenterService); | 100 app_list_presenter_service_.reset(new AppListPresenterService); |
| 91 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(), | 101 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(), |
| 92 std::move(request)); | 102 std::move(request)); |
| 93 } | 103 } |
| 94 | 104 |
| 95 } // namespace chromeos | 105 } // namespace chromeos |
| OLD | NEW |