1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "frameworks/bridge/common/manifest/manifest_window.h" 17 18 #include "base/log/log.h" 19 20 namespace OHOS::Ace::Framework { 21 WindowParse(const std::unique_ptr<JsonValue> & root)22void ManifestWindow::WindowParse(const std::unique_ptr<JsonValue>& root) 23 { 24 if (!root) { 25 LOGE("the root manifest is nullptr"); 26 return; 27 } 28 auto window = root->GetObject("window"); 29 if (!window || window->IsNull()) { 30 LOGD("No window config found."); 31 return; 32 } 33 auto designWidth = window->GetInt("designWidth", DEFAULT_DESIGN_WIDTH); 34 if (designWidth <= 0) { 35 designWidth = DEFAULT_DESIGN_WIDTH; 36 } 37 windowConfig_.designWidth = designWidth; 38 windowConfig_.autoDesignWidth = window->GetBool("autoDesignWidth", false); 39 } 40 PrintInfo()41void ManifestWindow::PrintInfo() 42 { 43 LOGD("window: {"); 44 LOGD(" designWidth: %{private}d", windowConfig_.designWidth); 45 LOGD(" autoDesignWidth: %{private}d", windowConfig_.autoDesignWidth); 46 LOGD("}"); 47 } 48 49 } // namespace OHOS::Ace::Framework 50