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/common/wm_shell.h" | 5 #include "ash/common/wm_shell.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
10 #include "ash/common/accelerators/ash_focus_manager_factory.h" | 10 #include "ash/common/accelerators/ash_focus_manager_factory.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 #include "ash/common/wm/overview/window_selector_controller.h" | 38 #include "ash/common/wm/overview/window_selector_controller.h" |
39 #include "ash/common/wm/root_window_finder.h" | 39 #include "ash/common/wm/root_window_finder.h" |
40 #include "ash/common/wm/system_modal_container_layout_manager.h" | 40 #include "ash/common/wm/system_modal_container_layout_manager.h" |
41 #include "ash/common/wm/window_cycle_controller.h" | 41 #include "ash/common/wm/window_cycle_controller.h" |
42 #include "ash/common/wm_root_window_controller.h" | 42 #include "ash/common/wm_root_window_controller.h" |
43 #include "ash/common/wm_window.h" | 43 #include "ash/common/wm_window.h" |
44 #include "ash/public/cpp/shell_window_ids.h" | 44 #include "ash/public/cpp/shell_window_ids.h" |
45 #include "base/bind.h" | 45 #include "base/bind.h" |
46 #include "base/logging.h" | 46 #include "base/logging.h" |
47 #include "base/memory/ptr_util.h" | 47 #include "base/memory/ptr_util.h" |
48 #include "services/catalog/public/interfaces/constants.mojom.h" | |
49 #include "services/preferences/public/cpp/pref_observer_store.h" | |
50 #include "services/preferences/public/interfaces/preferences.mojom.h" | |
51 #include "services/service_manager/public/cpp/connector.h" | |
48 #include "ui/app_list/presenter/app_list_presenter.h" | 52 #include "ui/app_list/presenter/app_list_presenter.h" |
49 #include "ui/display/display.h" | 53 #include "ui/display/display.h" |
50 #include "ui/views/focus/focus_manager_factory.h" | 54 #include "ui/views/focus/focus_manager_factory.h" |
51 | 55 |
52 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
53 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h " | 57 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h " |
54 #include "ash/common/system/chromeos/keyboard_brightness_controller.h" | 58 #include "ash/common/system/chromeos/keyboard_brightness_controller.h" |
55 #include "ash/common/system/chromeos/network/vpn_list.h" | 59 #include "ash/common/system/chromeos/network/vpn_list.h" |
56 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" | 60 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" |
57 #endif | 61 #endif |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), | 264 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), |
261 wallpaper_delegate_(delegate_->CreateWallpaperDelegate()), | 265 wallpaper_delegate_(delegate_->CreateWallpaperDelegate()), |
262 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), | 266 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), |
263 window_selector_controller_( | 267 window_selector_controller_( |
264 base::MakeUnique<WindowSelectorController>()) { | 268 base::MakeUnique<WindowSelectorController>()) { |
265 #if defined(OS_CHROMEOS) | 269 #if defined(OS_CHROMEOS) |
266 brightness_control_delegate_.reset(new system::BrightnessControllerChromeos); | 270 brightness_control_delegate_.reset(new system::BrightnessControllerChromeos); |
267 keyboard_brightness_control_delegate_.reset(new KeyboardBrightnessController); | 271 keyboard_brightness_control_delegate_.reset(new KeyboardBrightnessController); |
268 vpn_list_ = base::MakeUnique<VpnList>(); | 272 vpn_list_ = base::MakeUnique<VpnList>(); |
269 #endif | 273 #endif |
274 delegate_->GetShellConnector()->ConnectToInterface( | |
275 catalog::mojom::kServiceName, &catalog_); | |
276 catalog_->GetEntriesProvidingCapability( | |
277 prefs::mojom::kServiceName, | |
278 base::Bind(&WmShell::OnGotCatalogEntries, base::Unretained(this))); | |
270 } | 279 } |
271 | 280 |
272 WmShell::~WmShell() {} | 281 WmShell::~WmShell() {} |
273 | 282 |
274 WmRootWindowController* WmShell::GetPrimaryRootWindowController() { | 283 WmRootWindowController* WmShell::GetPrimaryRootWindowController() { |
275 return GetPrimaryRootWindow()->GetRootWindowController(); | 284 return GetPrimaryRootWindow()->GetRootWindowController(); |
276 } | 285 } |
277 | 286 |
278 WmWindow* WmShell::GetRootWindowForNewWindows() { | 287 WmWindow* WmShell::GetRootWindowForNewWindows() { |
279 if (scoped_root_window_for_new_windows_) | 288 if (scoped_root_window_for_new_windows_) |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 | 412 |
404 void WmShell::DeleteToastManager() { | 413 void WmShell::DeleteToastManager() { |
405 toast_manager_.reset(); | 414 toast_manager_.reset(); |
406 } | 415 } |
407 | 416 |
408 void WmShell::SetAcceleratorController( | 417 void WmShell::SetAcceleratorController( |
409 std::unique_ptr<AcceleratorController> accelerator_controller) { | 418 std::unique_ptr<AcceleratorController> accelerator_controller) { |
410 accelerator_controller_ = std::move(accelerator_controller); | 419 accelerator_controller_ = std::move(accelerator_controller); |
411 } | 420 } |
412 | 421 |
422 void WmShell::OnGotCatalogEntries( | |
423 std::vector<catalog::mojom::EntryPtr> entries) { | |
424 DCHECK(!entries.empty()); | |
sadrul
2016/12/06 18:34:29
Maybe actually DCHECK that size() == 1?
jonross
2016/12/06 21:09:32
From discussions about a full standalone prefs ser
sadrul
2016/12/07 04:11:58
Indeed. That's why I want this to be a DCHECK(), s
jonross
2016/12/07 15:46:39
Oh... I follow now, sorry. Done.
| |
425 // TODO(jonross): Update this if we end up with more than one | |
426 // PreferencesManager service. | |
427 prefs::mojom::PreferencesManagerPtr pref_manager_ptr; | |
428 delegate_->GetShellConnector()->ConnectToInterface((*entries.begin())->name, | |
429 &pref_manager_ptr); | |
430 pref_store_ = new PrefObserverStore(std::move(pref_manager_ptr)); | |
431 } | |
432 | |
413 } // namespace ash | 433 } // namespace ash |
OLD | NEW |