blob: 6b342e02eb595a23ba1b7a550fa0de48468df2a3 (
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
36
37
38
|
// Copyright (c) 2009 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 "chrome/browser/chromeos/cros_library.h"
#include <dlfcn.h>
#include "base/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "chrome/common/chrome_paths.h"
#include "third_party/cros/chromeos_cros_api.h"
namespace chromeos {
// static
bool CrosLibrary::loaded_ = false;
// static
bool CrosLibrary::EnsureLoaded() {
static bool initialized = false;
if (!initialized) {
FilePath path;
if (PathService::Get(chrome::FILE_CHROMEOS_API, &path))
loaded_ = LoadCros(path.value().c_str());
if (!loaded_) {
char* error = dlerror();
if (error)
LOG(ERROR) << "Problem loading chromeos shared object: " << error;
}
initialized = true;
}
return loaded_;
}
} // namespace chromeos
|