cef/libcef/common/resource_bundle_impl.cc
Marshall Greenblatt 49a34d9160 Apply new Chromium style for #include sorting
Add "cef/" prefix for CEF #includes in libcef/ directory.

Sort #includes by following
https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes
2024-05-01 14:34:32 -04:00

46 lines
1.4 KiB
C++

// Copyright (c) 2015 The Chromium Embedded Framework 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 "cef/libcef/common/resource_bundle_impl.h"
#include "base/memory/ref_counted_memory.h"
#include "ui/base/resource/resource_bundle.h"
CefResourceBundleImpl::CefResourceBundleImpl() = default;
CefString CefResourceBundleImpl::GetLocalizedString(int string_id) {
if (!ui::ResourceBundle::HasSharedInstance()) {
return CefString();
}
return ui::ResourceBundle::GetSharedInstance().GetLocalizedString(string_id);
}
CefRefPtr<CefBinaryValue> CefResourceBundleImpl::GetDataResource(
int resource_id) {
return GetDataResourceForScale(resource_id, SCALE_FACTOR_NONE);
}
CefRefPtr<CefBinaryValue> CefResourceBundleImpl::GetDataResourceForScale(
int resource_id,
ScaleFactor scale_factor) {
if (!ui::ResourceBundle::HasSharedInstance()) {
return nullptr;
}
base::RefCountedMemory* result =
ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
resource_id, static_cast<ui::ResourceScaleFactor>(scale_factor));
if (!result) {
return nullptr;
}
return CefBinaryValue::Create(result->data(), result->size());
}
// static
CefRefPtr<CefResourceBundle> CefResourceBundle::GetGlobal() {
return new CefResourceBundleImpl();
}