1 // Copyright (c) 2014 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "xwalk/application/common/manifest_handlers/tizen_navigation_handler.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "xwalk/application/common/application_manifest_constants.h"
12 namespace keys = application_widget_keys;
14 namespace application {
17 const char navigation_separator = ' ';
21 TizenNavigationInfo::TizenNavigationInfo(const std::string& allowed_domains) {
22 base::SplitString(allowed_domains, navigation_separator, &allowed_domains_);
25 TizenNavigationInfo::~TizenNavigationInfo() {
28 TizenNavigationHandler::TizenNavigationHandler() {
31 TizenNavigationHandler::~TizenNavigationHandler() {
34 bool TizenNavigationHandler::Parse(
35 scoped_refptr<ApplicationData> application_data,
36 base::string16* error) {
37 if (!application_data->GetManifest()->HasPath(keys::kAllowNavigationKey))
39 std::string allowed_domains;
40 if (!application_data->GetManifest()->GetString(keys::kAllowNavigationKey,
42 *error = base::ASCIIToUTF16("Invalid value of allow-navigation.");
45 if (allowed_domains.empty())
48 application_data->SetManifestData(keys::kAllowNavigationKey,
49 new TizenNavigationInfo(allowed_domains));
54 std::vector<std::string> TizenNavigationHandler::Keys() const {
55 return std::vector<std::string>(1, keys::kAllowNavigationKey);
58 } // namespace application