summaryrefslogtreecommitdiffstats
path: root/remoting/base/resources.cc
blob: a43e32815d2287c4fe882b14ecab6fce784e95cf (plain)
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
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/base/resources.h"

#include "base/file_path.h"
#include "base/path_service.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"

namespace remoting {

namespace {
const char kLocaleResourcesDirName[] = "remoting_locales";
const char kCommonResourcesFileName[] = "chrome_remote_desktop.pak";
}  // namespace

// Loads chromoting resources.
bool LoadResources(const std::string& pref_locale) {
  FilePath path;
  if (!PathService::Get(base::DIR_MODULE, &path))
    return false;

  PathService::Override(ui::DIR_LOCALES,
                        path.AppendASCII(kLocaleResourcesDirName));
  ui::ResourceBundle::InitSharedInstanceLocaleOnly(pref_locale, NULL);

  ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
      path.AppendASCII(kCommonResourcesFileName), ui::SCALE_FACTOR_100P);

  return true;
}

}  // namespace remoting