1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44

ash / public / cpp / projector / projector_controller.cc [blame]

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/public/cpp/projector/projector_controller.h"

#include "ash/public/cpp/projector/speech_recognition_availability.h"
#include "base/check_op.h"
#include "base/command_line.h"

namespace ash {

namespace {
ProjectorController* g_instance = nullptr;

// Controls whether to enable the extended features of Projector. These include
// speech recognition and drivefs integration. Only used during development to
// disable extended features in X11 simulator.
constexpr char kExtendedProjectorFeaturesDisabled[] =
    "projector-extended-features-disabled";
}  // namespace

ProjectorController::ProjectorController() {
  DCHECK_EQ(nullptr, g_instance);
  g_instance = this;
}

ProjectorController::~ProjectorController() {
  DCHECK_EQ(g_instance, this);
  g_instance = nullptr;
}

// static
ProjectorController* ProjectorController::Get() {
  return g_instance;
}

// static
bool ProjectorController::AreExtendedProjectorFeaturesDisabled() {
  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
  return command_line->HasSwitch(kExtendedProjectorFeaturesDisabled);
}

}  // namespace ash