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

ash / public / cpp / locale_update_controller.cc [blame]

// Copyright 2019 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/locale_update_controller.h"

#include "base/check_op.h"

namespace ash {

namespace {

LocaleUpdateController* g_instance = nullptr;

}  // namespace

LocaleInfo::LocaleInfo() = default;
LocaleInfo::LocaleInfo(const std::string& iso_code,
                       const std::u16string& display_name)
    : iso_code(iso_code), display_name(display_name) {}
LocaleInfo::LocaleInfo(const LocaleInfo& rhs) = default;
LocaleInfo::LocaleInfo(LocaleInfo&& rhs) = default;
LocaleInfo::~LocaleInfo() = default;

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

LocaleUpdateController::LocaleUpdateController() {
  DCHECK(!g_instance);
  g_instance = this;
}

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

}  // namespace ash