Fix API changes of Chrome58

This commit is contained in:
Cheng Zhao 2017-04-04 13:50:44 +09:00
parent 453cb2c0b4
commit fc2d62d5cb
28 changed files with 73 additions and 105 deletions

View file

@ -93,9 +93,9 @@ content::PepperPluginInfo CreateWidevineCdmInfo(const base::FilePath& path,
std::vector<std::string> codecs;
codecs.push_back(kCdmSupportedCodecVp8);
codecs.push_back(kCdmSupportedCodecVp9);
#if defined(USE_PROPRIETARY_CODECS)
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
codecs.push_back(kCdmSupportedCodecAvc1);
#endif // defined(USE_PROPRIETARY_CODECS)
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
std::string codec_string = base::JoinString(
codecs, std::string(1, kCdmSupportedCodecsValueDelimiter));
widevine_cdm_mime_type.additional_param_names.push_back(
@ -198,11 +198,19 @@ base::string16 AtomContentClient::GetLocalizedString(int message_id) const {
return l10n_util::GetStringUTF16(message_id);
}
void AtomContentClient::AddAdditionalSchemes(
std::vector<url::SchemeWithType>* standard_schemes,
std::vector<url::SchemeWithType>* referrer_schemes,
std::vector<std::string>* savable_schemes) {
standard_schemes->push_back({"chrome-extension", url::SCHEME_WITHOUT_PORT});
void AtomContentClient::AddAdditionalSchemes(Schemes* schemes) {
schemes->standard_schemes.push_back("chrome-extension");
std::vector<std::string> splited;
ConvertStringWithSeparatorToVector(&splited, ",",
switches::kRegisterServiceWorkerSchemes);
for (const std::string& scheme : splited)
schemes->service_worker_schemes.push_back(scheme);
schemes->service_worker_schemes.push_back(url::kFileScheme);
ConvertStringWithSeparatorToVector(&splited, ",", switches::kSecureSchemes);
for (const std::string& scheme : splited)
schemes->secure_schemes.push_back(scheme);
}
void AtomContentClient::AddPepperPlugins(
@ -214,25 +222,4 @@ void AtomContentClient::AddPepperPlugins(
ComputeBuiltInPlugins(plugins);
}
void AtomContentClient::AddServiceWorkerSchemes(
std::set<std::string>* service_worker_schemes) {
std::vector<std::string> schemes;
ConvertStringWithSeparatorToVector(&schemes, ",",
switches::kRegisterServiceWorkerSchemes);
for (const std::string& scheme : schemes)
service_worker_schemes->insert(scheme);
service_worker_schemes->insert(url::kFileScheme);
}
void AtomContentClient::AddSecureSchemesAndOrigins(
std::set<std::string>* secure_schemes,
std::set<GURL>* secure_origins) {
std::vector<std::string> schemes;
ConvertStringWithSeparatorToVector(&schemes, ",", switches::kSecureSchemes);
for (const std::string& scheme : schemes)
secure_schemes->insert(scheme);
}
} // namespace atom

View file

@ -23,17 +23,9 @@ class AtomContentClient : public brightray::ContentClient {
std::string GetProduct() const override;
std::string GetUserAgent() const override;
base::string16 GetLocalizedString(int message_id) const override;
void AddAdditionalSchemes(
std::vector<url::SchemeWithType>* standard_schemes,
std::vector<url::SchemeWithType>* referrer_schemes,
std::vector<std::string>* savable_schemes) override;
void AddAdditionalSchemes(Schemes* schemes) override;
void AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) override;
void AddServiceWorkerSchemes(
std::set<std::string>* service_worker_schemes) override;
void AddSecureSchemesAndOrigins(
std::set<std::string>* secure_schemes,
std::set<GURL>* secure_origins) override;
private:
DISALLOW_COPY_AND_ASSIGN(AtomContentClient);

View file

@ -228,8 +228,8 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
GetCookieStore(getter)->SetCookieWithDetailsAsync(
GURL(url), name, value, domain, path, creation_time,
expiration_time, last_access_time, secure, http_only,
net::CookieSameSite::DEFAULT_MODE, false,
net::COOKIE_PRIORITY_DEFAULT, base::Bind(OnSetCookie, callback));
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT,
base::Bind(OnSetCookie, callback));
}
} // namespace

View file

@ -46,7 +46,7 @@ void Debugger::DispatchProtocolMessage(DevToolsAgentHost* agent_host,
DCHECK(agent_host == agent_host_.get());
std::unique_ptr<base::Value> parsed_message(base::JSONReader::Read(message));
if (!parsed_message->IsType(base::Value::TYPE_DICTIONARY))
if (!parsed_message->IsType(base::Value::Type::DICTIONARY))
return;
base::DictionaryValue* dict =

View file

@ -4,6 +4,8 @@
#include "atom/browser/api/atom_api_desktop_capturer.h"
using base::PlatformThreadRef;
#include "atom/common/api/atom_api_native_image.h"
#include "atom/common/native_mate_converters/gfx_converter.h"
#include "base/strings/utf_string_conversions.h"

View file

@ -432,7 +432,8 @@ void DownloadIdCallback(content::DownloadManager* download_manager,
last_modified, offset, length, std::string(),
content::DownloadItem::INTERRUPTED,
content::DownloadDangerType::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
content::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT, false);
content::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT, false,
std::vector<content::DownloadItem::ReceivedSlice>());
}
} // namespace

View file

@ -296,27 +296,26 @@ void AtomBrowserClient::ResourceDispatcherHostCreated() {
}
bool AtomBrowserClient::CanCreateWindow(
int opener_render_process_id,
int opener_render_frame_id,
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
WindowContainerType container_type,
content::mojom::WindowContainerType container_type,
const GURL& target_url,
const content::Referrer& referrer,
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
const blink::mojom::WindowFeatures& features,
const std::vector<std::string>& additional_features,
const scoped_refptr<content::ResourceRequestBodyImpl>& body,
bool user_gesture,
bool opener_suppressed,
content::ResourceContext* context,
int render_process_id,
int opener_render_view_id,
int opener_render_frame_id,
bool* no_javascript_access) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (IsRendererSandboxed(render_process_id)) {
if (IsRendererSandboxed(opener_render_process_id)) {
*no_javascript_access = false;
return true;
}
@ -330,7 +329,7 @@ bool AtomBrowserClient::CanCreateWindow(
disposition,
additional_features,
body,
render_process_id,
opener_render_process_id,
opener_render_frame_id));
}

View file

@ -80,23 +80,22 @@ class AtomBrowserClient : public brightray::BrowserClient,
std::unique_ptr<content::ClientCertificateDelegate> delegate) override;
void ResourceDispatcherHostCreated() override;
bool CanCreateWindow(
int opener_render_process_id,
int opener_render_frame_id,
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
WindowContainerType container_type,
content::mojom::WindowContainerType container_type,
const GURL& target_url,
const content::Referrer& referrer,
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
const blink::mojom::WindowFeatures& features,
const std::vector<std::string>& additional_features,
const scoped_refptr<content::ResourceRequestBodyImpl>& body,
bool user_gesture,
bool opener_suppressed,
content::ResourceContext* context,
int render_process_id,
int opener_render_view_id,
int opener_render_frame_id,
bool* no_javascript_access) override;
void GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* schemes) override;

View file

@ -13,27 +13,27 @@
#include "base/strings/utf_string_conversions.h"
#include "ui/gfx/image/image_skia.h"
using content::JavaScriptMessageType;
using content::JavaScriptDialogType;
namespace atom {
void AtomJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents,
const GURL& origin_url,
JavaScriptMessageType message_type,
JavaScriptDialogType dialog_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback,
bool* did_suppress_message) {
if (message_type != JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_ALERT &&
message_type != JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_CONFIRM) {
if (dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_ALERT &&
dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_CONFIRM) {
callback.Run(false, base::string16());
return;
}
std::vector<std::string> buttons = {"OK"};
if (message_type == JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_CONFIRM) {
if (dialog_type == JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_CONFIRM) {
buttons.push_back("Cancel");
}
@ -55,7 +55,6 @@ void AtomJavaScriptDialogManager::RunBeforeUnloadDialog(
void AtomJavaScriptDialogManager::CancelDialogs(
content::WebContents* web_contents,
bool suppress_callbacks,
bool reset_state) {
}

View file

@ -17,7 +17,7 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
void RunJavaScriptDialog(
content::WebContents* web_contents,
const GURL& origin_url,
content::JavaScriptMessageType javascript_message_type,
content::JavaScriptDialogType dialog_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback,
@ -27,7 +27,6 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
bool is_reload,
const DialogClosedCallback& callback) override;
void CancelDialogs(content::WebContents* web_contents,
bool suppress_callbacks,
bool reset_state) override;
private:

View file

@ -131,7 +131,7 @@ int AtomPermissionManager::RequestPermissions(
auto web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host);
int request_id = pending_requests_.Add(new PendingRequest(
int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>(
render_frame_host, permissions, response_callback));
for (size_t i = 0; i < permissions.size(); ++i) {
@ -187,12 +187,6 @@ blink::mojom::PermissionStatus AtomPermissionManager::GetPermissionStatus(
return blink::mojom::PermissionStatus::GRANTED;
}
void AtomPermissionManager::RegisterPermissionUsage(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
}
int AtomPermissionManager::SubscribePermissionStatusChange(
content::PermissionType permission,
const GURL& requesting_origin,

View file

@ -66,9 +66,6 @@ class AtomPermissionManager : public content::PermissionManager {
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
void RegisterPermissionUsage(content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
int SubscribePermissionStatusChange(
content::PermissionType permission,
const GURL& requesting_origin,
@ -79,7 +76,7 @@ class AtomPermissionManager : public content::PermissionManager {
private:
class PendingRequest;
using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
using PendingRequestsMap = IDMap<std::unique_ptr<PendingRequest>>;
RequestHandler request_handler_;

View file

@ -20,7 +20,7 @@ void CommonWebContentsDelegate::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
if (event.skip_in_browser ||
event.type == content::NativeWebKeyboardEvent::Char)
event.type() == content::NativeWebKeyboardEvent::Char)
return;
// Escape exits tabbed fullscreen mode.

View file

@ -50,15 +50,16 @@ bool AtomURLRequestJobFactory::InterceptProtocol(
return false;
ProtocolHandler* original_protocol_handler = protocol_handler_map_[scheme];
protocol_handler_map_[scheme] = protocol_handler.release();
original_protocols_.set(scheme, base::WrapUnique(original_protocol_handler));
original_protocols_[scheme] = std::move(original_protocol_handler);
return true;
}
bool AtomURLRequestJobFactory::UninterceptProtocol(const std::string& scheme) {
if (!original_protocols_.contains(scheme))
auto it = original_protocols_.find(scheme);
if (it == original_protocols_.end())
return false;
protocol_handler_map_[scheme] =
original_protocols_.take_and_erase(scheme).release();
protocol_handler_map_[scheme] = std::move(it->second);
original_protocols_.erase(it);
return true;
}

View file

@ -9,9 +9,9 @@
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "base/containers/scoped_ptr_hash_map.h"
#include "net/url_request/url_request_job_factory.h"
namespace atom {
@ -64,7 +64,7 @@ class AtomURLRequestJobFactory : public net::URLRequestJobFactory {
ProtocolHandlerMap protocol_handler_map_;
// Map that stores the original protocols of schemes.
using OriginalProtocolsMap = base::ScopedPtrHashMap<
using OriginalProtocolsMap = std::unordered_map<
std::string, std::unique_ptr<ProtocolHandler>>;
// Can only be accessed in IO thread.
OriginalProtocolsMap original_protocols_;

View file

@ -59,7 +59,7 @@ void AskForOptions(v8::Isolate* isolate,
}
bool IsErrorOptions(base::Value* value, int* error) {
if (value->IsType(base::Value::TYPE_DICTIONARY)) {
if (value->IsType(base::Value::TYPE::DICTIONARY)) {
base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(value);
if (dict->GetInteger("error", error))
return true;

View file

@ -18,7 +18,7 @@ URLRequestAsyncAsarJob::URLRequestAsyncAsarJob(
void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr<base::Value> options) {
base::FilePath::StringType file_path;
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
if (options->IsType(base::Value::TYPE::DICTIONARY)) {
static_cast<base::DictionaryValue*>(options.get())->GetString(
"path", &file_path);
} else if (options->IsType(base::Value::TYPE_STRING)) {

View file

@ -34,7 +34,7 @@ URLRequestBufferJob::URLRequestBufferJob(
void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) {
const base::BinaryValue* binary = nullptr;
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
if (options->IsType(base::Value::TYPE::DICTIONARY)) {
base::DictionaryValue* dict =
static_cast<base::DictionaryValue*>(options.get());
dict->GetString("mimeType", &mime_type_);

View file

@ -112,7 +112,7 @@ void URLRequestFetchJob::BeforeStartInUI(
}
void URLRequestFetchJob::StartAsync(std::unique_ptr<base::Value> options) {
if (!options->IsType(base::Value::TYPE_DICTIONARY)) {
if (!options->IsType(base::Value::TYPE::DICTIONARY)) {
NotifyStartError(net::URLRequestStatus(
net::URLRequestStatus::FAILED, net::ERR_NOT_IMPLEMENTED));
return;

View file

@ -17,7 +17,7 @@ URLRequestStringJob::URLRequestStringJob(
}
void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options) {
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
if (options->IsType(base::Value::TYPE::DICTIONARY)) {
base::DictionaryValue* dict =
static_cast<base::DictionaryValue*>(options.get());
dict->GetString("mimeType", &mime_type_);

View file

@ -181,7 +181,7 @@ bool Archive::Init() {
std::string error;
base::JSONReader reader;
std::unique_ptr<base::Value> value(reader.ReadToValue(header));
if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) {
if (!value || !value->IsType(base::Value::TYPE::DICTIONARY)) {
LOG(ERROR) << "Failed to parse header: " << error;
return false;
}
@ -269,8 +269,9 @@ bool Archive::Realpath(const base::FilePath& path, base::FilePath* realpath) {
}
bool Archive::CopyFileOut(const base::FilePath& path, base::FilePath* out) {
if (external_files_.contains(path)) {
*out = external_files_.get(path)->path();
auto it = external_files_.find(path.value());
if (it != external_files_.end()) {
*out = it->second->path();
return true;
}
@ -296,7 +297,7 @@ bool Archive::CopyFileOut(const base::FilePath& path, base::FilePath* out) {
#endif
*out = temp_file->path();
external_files_.set(path, std::move(temp_file));
external_files_[path.value()] = std::move(temp_file);
return true;
}

View file

@ -6,9 +6,9 @@
#define ATOM_COMMON_ASAR_ARCHIVE_H_
#include <memory>
#include <unordered_map>
#include <vector>
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
@ -75,8 +75,8 @@ class Archive {
std::unique_ptr<base::DictionaryValue> header_;
// Cached external temporary files.
base::ScopedPtrHashMap<base::FilePath, std::unique_ptr<ScopedTemporaryFile>>
external_files_;
std::unordered_map<base::FilePath::StringType,
std::unique_ptr<ScopedTemporaryFile>> external_files_;
DISALLOW_COPY_AND_ASSIGN(Archive);
};

View file

@ -198,7 +198,7 @@ v8::Local<v8::Value> V8ValueConverter::ToV8ValueImpl(
case base::Value::TYPE_LIST:
return ToV8Array(isolate, static_cast<const base::ListValue*>(value));
case base::Value::TYPE_DICTIONARY:
case base::Value::TYPE::DICTIONARY:
return ToV8Object(isolate,
static_cast<const base::DictionaryValue*>(value));

View file

@ -15,7 +15,7 @@ bool Converter<base::DictionaryValue>::FromV8(v8::Isolate* isolate,
std::unique_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
std::unique_ptr<base::Value> value(converter->FromV8Value(
val, isolate->GetCurrentContext()));
if (value && value->IsType(base::Value::TYPE_DICTIONARY)) {
if (value && value->IsType(base::Value::TYPE::DICTIONARY)) {
out->Swap(static_cast<base::DictionaryValue*>(value.get()));
return true;
} else {

View file

@ -66,11 +66,11 @@ class ExternalClearKeyProperties : public KeySystemProperties {
return true;
case media::EmeInitDataType::CENC:
#if defined(USE_PROPRIETARY_CODECS)
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
return true;
#else
return false;
#endif // defined(USE_PROPRIETARY_CODECS)
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
case media::EmeInitDataType::UNKNOWN:
return false;
@ -80,7 +80,7 @@ class ExternalClearKeyProperties : public KeySystemProperties {
}
SupportedCodecs GetSupportedCodecs() const override {
#if defined(USE_PROPRIETARY_CODECS)
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
return media::EME_CODEC_MP4_ALL | media::EME_CODEC_WEBM_ALL;
#else
return media::EME_CODEC_WEBM_ALL;
@ -224,21 +224,21 @@ static void AddPepperBasedWidevine(
// as those may offer a higher level of protection.
supported_codecs |= media::EME_CODEC_WEBM_OPUS;
supported_codecs |= media::EME_CODEC_WEBM_VORBIS;
#if defined(USE_PROPRIETARY_CODECS)
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
supported_codecs |= media::EME_CODEC_MP4_AAC;
#endif // defined(USE_PROPRIETARY_CODECS)
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
for (size_t i = 0; i < codecs.size(); ++i) {
if (codecs[i] == kCdmSupportedCodecVp8)
supported_codecs |= media::EME_CODEC_WEBM_VP8;
if (codecs[i] == kCdmSupportedCodecVp9)
supported_codecs |= media::EME_CODEC_WEBM_VP9;
#if defined(USE_PROPRIETARY_CODECS)
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
if (codecs[i] == kCdmSupportedCodecAvc1)
supported_codecs |= media::EME_CODEC_MP4_AVC1;
if (codecs[i] == kCdmSupportedCodecVp9)
supported_codecs |= media::EME_CODEC_MP4_VP9;
#endif // defined(USE_PROPRIETARY_CODECS)
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
}
using Robustness = cdm::WidevineKeySystemProperties::Robustness;

View file

@ -237,9 +237,6 @@
'USING_V8_SHARED',
'USING_V8_PLATFORM_SHARED',
'USING_V8_BASE_SHARED',
# Remove this after enable_plugins becomes a feature flag.
'ENABLE_PLUGINS',
'USE_PROPRIETARY_CODECS',
],
'sources': [
'<@(lib_sources)',

2
vendor/crashpad vendored

@ -1 +1 @@
Subproject commit eeac857dfb5b255c899c8763d62654863b4c8890
Subproject commit 4054e6cba3ba023d9c00260518ec2912607ae17c

2
vendor/node vendored

@ -1 +1 @@
Subproject commit 3fe90cfcf54dd946980e59daf550a7cdb2317c8f
Subproject commit 42eee8a69267191ac20505bf929bb39a688d7385