| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/cros_library.h" | 5 #include "chrome/browser/chromeos/cros_library.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
| 13 #include "third_party/cros/chromeos_cros_api.h" | 13 #include "third_party/cros/chromeos_cros_api.h" |
| 14 | 14 |
| 15 namespace chromeos { |
| 16 |
| 15 // static | 17 // static |
| 16 bool CrosLibrary::loaded_ = false; | 18 bool CrosLibrary::loaded_ = false; |
| 17 | 19 |
| 18 // static | 20 // static |
| 19 bool CrosLibrary::loaded() { | 21 bool CrosLibrary::loaded() { |
| 20 static bool initialized = false; | 22 static bool initialized = false; |
| 21 if (!initialized) { | 23 if (!initialized) { |
| 22 FilePath path; | 24 FilePath path; |
| 23 if (PathService::Get(chrome::FILE_CHROMEOS_API, &path)) | 25 if (PathService::Get(chrome::FILE_CHROMEOS_API, &path)) |
| 24 loaded_ = chromeos::LoadCros(path.value().c_str()); | 26 loaded_ = LoadCros(path.value().c_str()); |
| 25 | 27 |
| 26 if (!loaded_) { | 28 if (!loaded_) { |
| 27 char* error = dlerror(); | 29 char* error = dlerror(); |
| 28 if (error) | 30 if (error) |
| 29 LOG(ERROR) << "Problem loading chromeos shared object: " << error; | 31 LOG(ERROR) << "Problem loading chromeos shared object: " << error; |
| 30 } | 32 } |
| 31 initialized = true; | 33 initialized = true; |
| 32 } | 34 } |
| 33 return loaded_; | 35 return loaded_; |
| 34 } | 36 } |
| 37 |
| 38 } // namespace chromeos |
| OLD | NEW |