[M120][Tizen][Onscreen] Fix build errors for TV profile
[platform/framework/web/chromium-efl.git] / chrome / browser / exo_parts.cc
1 // Copyright 2015 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/exo_parts.h"
6
7 #include <memory>
8
9 #include "ash/constants/ash_switches.h"
10 #include "ash/public/cpp/external_arc/keyboard/arc_input_method_surface_manager.h"
11 #include "ash/public/cpp/external_arc/message_center/arc_notification_surface_manager_impl.h"
12 #include "ash/public/cpp/external_arc/overlay/arc_overlay_manager.h"
13 #include "ash/public/cpp/external_arc/toast/arc_toast_surface_manager.h"
14 #include "ash/public/cpp/keyboard/arc/arc_input_method_bounds_tracker.h"
15 #include "ash/shell.h"
16 #include "base/command_line.h"
17 #include "base/memory/ptr_util.h"
18 #include "chrome/browser/ash/exo/chrome_data_exchange_delegate.h"
19 #include "components/exo/server/wayland_server_controller.h"
20
21 // static
22 std::unique_ptr<ExoParts> ExoParts::CreateIfNecessary() {
23   if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
24           ash::switches::kAshEnableWaylandServer)) {
25     return nullptr;
26   }
27
28   return base::WrapUnique(new ExoParts());
29 }
30
31 ExoParts::~ExoParts() {
32   ash::Shell::Get()->UntrackTrackInputMethodBounds(
33       ash::ArcInputMethodBoundsTracker::Get());
34   wayland_server_.reset();
35 }
36
37 ExoParts::ExoParts()
38     : arc_overlay_manager_(std::make_unique<ash::ArcOverlayManager>()) {
39   wayland_server_ = exo::WaylandServerController::CreateIfNecessary(
40       std::make_unique<ash::ChromeDataExchangeDelegate>(),
41       std::make_unique<ash::ArcNotificationSurfaceManagerImpl>(),
42       std::make_unique<ash::ArcInputMethodSurfaceManager>(),
43       std::make_unique<ash::ArcToastSurfaceManager>());
44   ash::Shell::Get()->TrackInputMethodBounds(
45       ash::ArcInputMethodBoundsTracker::Get());
46 }