2013-06-04 19:41:37 +02:00
|
|
|
// Copyright (c) 2013 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 "libcef/common/scheme_registration.h"
|
2013-06-05 01:37:26 +02:00
|
|
|
#include "libcef/common/content_client.h"
|
2013-06-04 19:41:37 +02:00
|
|
|
|
|
|
|
#include "content/public/common/url_constants.h"
|
|
|
|
|
|
|
|
namespace scheme {
|
|
|
|
|
2013-06-05 01:37:26 +02:00
|
|
|
void AddInternalSchemes(std::vector<std::string>* standard_schemes) {
|
|
|
|
static CefContentClient::SchemeInfo schemes[] = {
|
2014-02-19 17:27:54 +01:00
|
|
|
{ content::kChromeUIScheme, true, true, true },
|
|
|
|
{ content::kChromeDevToolsScheme, true, false, true }
|
2013-06-04 19:41:37 +02:00
|
|
|
};
|
|
|
|
|
2013-06-05 01:37:26 +02:00
|
|
|
CefContentClient* client = CefContentClient::Get();
|
2013-06-04 19:41:37 +02:00
|
|
|
for (size_t i = 0; i < sizeof(schemes) / sizeof(schemes[0]); ++i) {
|
2013-06-05 01:37:26 +02:00
|
|
|
if (schemes[0].is_standard)
|
|
|
|
standard_schemes->push_back(schemes[i].scheme_name);
|
|
|
|
client->AddCustomScheme(schemes[i]);
|
2013-06-04 19:41:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsInternalHandledScheme(const std::string& scheme) {
|
|
|
|
static const char* schemes[] = {
|
2014-04-04 18:50:38 +02:00
|
|
|
content::kBlobScheme,
|
2014-02-19 17:27:54 +01:00
|
|
|
content::kChromeDevToolsScheme,
|
|
|
|
content::kChromeUIScheme,
|
2014-02-05 21:35:45 +01:00
|
|
|
content::kDataScheme,
|
2014-01-02 23:41:11 +01:00
|
|
|
content::kFileScheme,
|
|
|
|
content::kFileSystemScheme,
|
2013-06-04 19:41:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
for (size_t i = 0; i < sizeof(schemes) / sizeof(schemes[0]); ++i) {
|
|
|
|
if (scheme == schemes[i])
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsInternalProtectedScheme(const std::string& scheme) {
|
|
|
|
// Some of these values originate from StoragePartitionImplMap::Get() in
|
|
|
|
// content/browser/storage_partition_impl_map.cc and are modified by
|
|
|
|
// InstallInternalProtectedHandlers().
|
|
|
|
static const char* schemes[] = {
|
2014-04-04 18:50:38 +02:00
|
|
|
content::kBlobScheme,
|
2014-02-19 17:27:54 +01:00
|
|
|
content::kChromeUIScheme,
|
2014-02-05 21:35:45 +01:00
|
|
|
content::kDataScheme,
|
2014-01-02 23:41:11 +01:00
|
|
|
content::kFileScheme,
|
|
|
|
content::kFileSystemScheme,
|
2013-06-24 20:57:05 +02:00
|
|
|
#if !defined(DISABLE_FTP_SUPPORT)
|
2013-12-17 23:04:35 +01:00
|
|
|
content::kFtpScheme,
|
2013-06-24 20:57:05 +02:00
|
|
|
#endif
|
2013-06-04 19:41:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
for (size_t i = 0; i < sizeof(schemes) / sizeof(schemes[0]); ++i) {
|
|
|
|
if (scheme == schemes[i])
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace scheme
|