Merge pull request #7104 from electron/chrome53

Upgrade to Chrome 53 and Node 6.5.0
This commit is contained in:
Cheng Zhao 2016-09-14 22:18:08 +09:00 committed by GitHub
commit 4627311c34
69 changed files with 512 additions and 288 deletions

View file

@ -7,12 +7,13 @@
#include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/file_path_converter.h" #include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/node_includes.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "content/public/browser/tracing_controller.h" #include "content/public/browser/tracing_controller.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
using content::TracingController; using content::TracingController;
namespace mate { namespace mate {

View file

@ -9,7 +9,6 @@
#include "atom/browser/atom_browser_main_parts.h" #include "atom/browser/atom_browser_main_parts.h"
#include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
#include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_agent_host.h"
@ -17,6 +16,8 @@
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h" #include "native_mate/object_template_builder.h"
#include "atom/common/node_includes.h"
using content::DevToolsAgentHost; using content::DevToolsAgentHost;
namespace atom { namespace atom {
@ -107,7 +108,7 @@ bool Debugger::IsAttached() {
void Debugger::Detach() { void Debugger::Detach() {
if (!agent_host_.get()) if (!agent_host_.get())
return; return;
agent_host_->DetachClient(); agent_host_->DetachClient(this);
AgentHostClosed(agent_host_.get(), false); AgentHostClosed(agent_host_.get(), false);
agent_host_ = nullptr; agent_host_ = nullptr;
} }
@ -136,7 +137,7 @@ void Debugger::SendCommand(mate::Arguments* args) {
std::string json_args; std::string json_args;
base::JSONWriter::Write(request, &json_args); base::JSONWriter::Write(request, &json_args);
agent_host_->DispatchProtocolMessage(json_args); agent_host_->DispatchProtocolMessage(this, json_args);
} }
// static // static

View file

@ -10,12 +10,13 @@
#include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/file_path_converter.h" #include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/node_includes.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "net/base/filename_util.h" #include "net/base/filename_util.h"
#include "atom/common/node_includes.h"
namespace mate { namespace mate {
template<> template<>

View file

@ -5,11 +5,12 @@
#include "atom/browser/api/atom_api_power_monitor.h" #include "atom/browser/api/atom_api_power_monitor.h"
#include "atom/browser/browser.h" #include "atom/browser/browser.h"
#include "atom/common/node_includes.h"
#include "base/power_monitor/power_monitor.h" #include "base/power_monitor/power_monitor.h"
#include "base/power_monitor/power_monitor_device_source.h" #include "base/power_monitor/power_monitor_device_source.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
namespace atom { namespace atom {
namespace api { namespace api {

View file

@ -6,18 +6,19 @@
#include <string> #include <string>
#include "atom/common/node_includes.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/power_save_blocker.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
namespace mate { namespace mate {
template<> template<>
struct Converter<content::PowerSaveBlocker::PowerSaveBlockerType> { struct Converter<device::PowerSaveBlocker::PowerSaveBlockerType> {
static bool FromV8(v8::Isolate* isolate, static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val, v8::Local<v8::Value> val,
content::PowerSaveBlocker::PowerSaveBlockerType* out) { device::PowerSaveBlocker::PowerSaveBlockerType* out) {
using content::PowerSaveBlocker; using device::PowerSaveBlocker;
std::string type; std::string type;
if (!ConvertFromV8(isolate, val, &type)) if (!ConvertFromV8(isolate, val, &type))
return false; return false;
@ -39,7 +40,7 @@ namespace api {
PowerSaveBlocker::PowerSaveBlocker(v8::Isolate* isolate) PowerSaveBlocker::PowerSaveBlocker(v8::Isolate* isolate)
: current_blocker_type_( : current_blocker_type_(
content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension) { device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension) {
Init(isolate); Init(isolate);
} }
@ -58,30 +59,34 @@ void PowerSaveBlocker::UpdatePowerSaveBlocker() {
// higher precedence level than |kPowerSaveBlockPreventAppSuspension|. // higher precedence level than |kPowerSaveBlockPreventAppSuspension|.
// //
// Only the highest-precedence blocker type takes effect. // Only the highest-precedence blocker type takes effect.
content::PowerSaveBlocker::PowerSaveBlockerType new_blocker_type = device::PowerSaveBlocker::PowerSaveBlockerType new_blocker_type =
content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension; device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension;
for (const auto& element : power_save_blocker_types_) { for (const auto& element : power_save_blocker_types_) {
if (element.second == if (element.second ==
content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep) { device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep) {
new_blocker_type = new_blocker_type =
content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep; device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep;
break; break;
} }
} }
if (!power_save_blocker_ || new_blocker_type != current_blocker_type_) { if (!power_save_blocker_ || new_blocker_type != current_blocker_type_) {
std::unique_ptr<content::PowerSaveBlocker> new_blocker = std::unique_ptr<device::PowerSaveBlocker> new_blocker(
content::PowerSaveBlocker::Create( new device::PowerSaveBlocker(
new_blocker_type, new_blocker_type,
content::PowerSaveBlocker::kReasonOther, device::PowerSaveBlocker::kReasonOther,
ATOM_PRODUCT_NAME); ATOM_PRODUCT_NAME,
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::UI),
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::FILE)));
power_save_blocker_.swap(new_blocker); power_save_blocker_.swap(new_blocker);
current_blocker_type_ = new_blocker_type; current_blocker_type_ = new_blocker_type;
} }
} }
int PowerSaveBlocker::Start( int PowerSaveBlocker::Start(
content::PowerSaveBlocker::PowerSaveBlockerType type) { device::PowerSaveBlocker::PowerSaveBlockerType type) {
static int count = 0; static int count = 0;
power_save_blocker_types_[count] = type; power_save_blocker_types_[count] = type;
UpdatePowerSaveBlocker(); UpdatePowerSaveBlocker();

View file

@ -9,7 +9,7 @@
#include <memory> #include <memory>
#include "atom/browser/api/trackable_object.h" #include "atom/browser/api/trackable_object.h"
#include "content/public/browser/power_save_blocker.h" #include "device/power_save_blocker/power_save_blocker.h"
#include "native_mate/handle.h" #include "native_mate/handle.h"
namespace mate { namespace mate {
@ -33,18 +33,18 @@ class PowerSaveBlocker : public mate::TrackableObject<PowerSaveBlocker> {
private: private:
void UpdatePowerSaveBlocker(); void UpdatePowerSaveBlocker();
int Start(content::PowerSaveBlocker::PowerSaveBlockerType type); int Start(device::PowerSaveBlocker::PowerSaveBlockerType type);
bool Stop(int id); bool Stop(int id);
bool IsStarted(int id); bool IsStarted(int id);
std::unique_ptr<content::PowerSaveBlocker> power_save_blocker_; std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_;
// Currnet blocker type used by |power_save_blocker_| // Currnet blocker type used by |power_save_blocker_|
content::PowerSaveBlocker::PowerSaveBlockerType current_blocker_type_; device::PowerSaveBlocker::PowerSaveBlockerType current_blocker_type_;
// Map from id to the corresponding blocker type for each request. // Map from id to the corresponding blocker type for each request.
using PowerSaveBlockerTypeMap = using PowerSaveBlockerTypeMap =
std::map<int, content::PowerSaveBlocker::PowerSaveBlockerType>; std::map<int, device::PowerSaveBlocker::PowerSaveBlockerType>;
PowerSaveBlockerTypeMap power_save_blocker_types_; PowerSaveBlockerTypeMap power_save_blocker_types_;
DISALLOW_COPY_AND_ASSIGN(PowerSaveBlocker); DISALLOW_COPY_AND_ASSIGN(PowerSaveBlocker);

View file

@ -7,11 +7,12 @@
#include "atom/browser/api/atom_api_web_contents.h" #include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/atom_browser_client.h" #include "atom/browser/atom_browser_client.h"
#include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h" #include "native_mate/object_template_builder.h"
#include "atom/common/node_includes.h"
namespace atom { namespace atom {
namespace api { namespace api {

View file

@ -37,7 +37,6 @@
#include "atom/common/native_mate_converters/image_converter.h" #include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "atom/common/options_switches.h" #include "atom/common/options_switches.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
@ -77,6 +76,8 @@
#include "ui/aura/window.h" #include "ui/aura/window.h"
#endif #endif
#include "atom/common/node_includes.h"
namespace { namespace {
struct PrintSettings { struct PrintSettings {
@ -527,22 +528,18 @@ void WebContents::FindReply(content::WebContents* web_contents,
const gfx::Rect& selection_rect, const gfx::Rect& selection_rect,
int active_match_ordinal, int active_match_ordinal,
bool final_update) { bool final_update) {
if (!final_update)
return;
v8::Locker locker(isolate()); v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate()); v8::HandleScope handle_scope(isolate());
mate::Dictionary result = mate::Dictionary::CreateEmpty(isolate()); mate::Dictionary result = mate::Dictionary::CreateEmpty(isolate());
if (number_of_matches == -1) { result.Set("requestId", request_id);
result.Set("requestId", request_id); result.Set("matches", number_of_matches);
result.Set("selectionArea", selection_rect); result.Set("selectionArea", selection_rect);
result.Set("finalUpdate", final_update); result.Set("activeMatchOrdinal", active_match_ordinal);
result.Set("activeMatchOrdinal", active_match_ordinal); result.Set("finalUpdate", final_update); // Deprecate after 2.0
Emit("found-in-page", result); Emit("found-in-page", result);
} else if (final_update) {
result.Set("requestId", request_id);
result.Set("matches", number_of_matches);
result.Set("finalUpdate", final_update);
Emit("found-in-page", result);
}
} }
bool WebContents::CheckMediaAccessPermission( bool WebContents::CheckMediaAccessPermission(
@ -871,7 +868,8 @@ void WebContents::DownloadURL(const GURL& url) {
content::BrowserContext::GetDownloadManager(browser_context); content::BrowserContext::GetDownloadManager(browser_context);
download_manager->DownloadUrl( download_manager->DownloadUrl(
content::DownloadUrlParameters::FromWebContents(web_contents(), url)); content::DownloadUrlParameters::CreateForWebContentsMainFrame(
web_contents(), url));
} }
GURL WebContents::GetURL() const { GURL WebContents::GetURL() const {
@ -1177,7 +1175,7 @@ void WebContents::ShowDefinitionForSelection() {
} }
void WebContents::CopyImageAt(int x, int y) { void WebContents::CopyImageAt(int x, int y) {
const auto host = web_contents()->GetRenderViewHost(); const auto host = web_contents()->GetMainFrame();
if (host) if (host)
host->CopyImageAt(x, y); host->CopyImageAt(x, y);
} }

View file

@ -14,7 +14,6 @@
#include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/image_converter.h" #include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/node_includes.h"
#include "atom/common/options_switches.h" #include "atom/common/options_switches.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
@ -31,6 +30,8 @@
#include "atom/browser/ui/win/taskbar_host.h" #include "atom/browser/ui/win/taskbar_host.h"
#endif #endif
#include "atom/common/node_includes.h"
#if defined(OS_WIN) #if defined(OS_WIN)
namespace mate { namespace mate {

View file

@ -5,10 +5,11 @@
#include "atom/browser/api/frame_subscriber.h" #include "atom/browser/api/frame_subscriber.h"
#include "atom/common/native_mate_converters/gfx_converter.h" #include "atom/common/native_mate_converters/gfx_converter.h"
#include "atom/common/node_includes.h"
#include "base/bind.h" #include "base/bind.h"
#include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host.h"
#include "atom/common/node_includes.h"
namespace atom { namespace atom {
namespace api { namespace api {

View file

@ -11,6 +11,8 @@
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/geolocation_provider.h" #include "content/public/browser/geolocation_provider.h"
using content::BrowserThread;
namespace atom { namespace atom {
namespace { namespace {
@ -22,6 +24,49 @@ const char* kGeolocationProviderURL =
"https://www.googleapis.com/geolocation/v1/geolocate?key=" "https://www.googleapis.com/geolocation/v1/geolocate?key="
GOOGLEAPIS_API_KEY; GOOGLEAPIS_API_KEY;
// Loads access tokens and other necessary data on the UI thread, and
// calls back to the originator on the originating thread.
class TokenLoadingJob : public base::RefCountedThreadSafe<TokenLoadingJob> {
public:
explicit TokenLoadingJob(
const content::AccessTokenStore::LoadAccessTokensCallback& callback)
: callback_(callback), request_context_getter_(nullptr) {}
void Run() {
BrowserThread::PostTaskAndReply(
BrowserThread::UI,
FROM_HERE,
base::Bind(&TokenLoadingJob::PerformWorkOnUIThread, this),
base::Bind(&TokenLoadingJob::RespondOnOriginatingThread, this));
}
private:
friend class base::RefCountedThreadSafe<TokenLoadingJob>;
~TokenLoadingJob() {}
void PerformWorkOnUIThread() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto browser_context = AtomBrowserContext::From("", false);
request_context_getter_ = browser_context->GetRequestContext();
}
void RespondOnOriginatingThread() {
// Equivelent to access_token_map[kGeolocationProviderURL].
// Somehow base::string16 is causing compilation errors when used in a pair
// of std::map on Linux, this can work around it.
content::AccessTokenStore::AccessTokenMap access_token_map;
std::pair<GURL, base::string16> token_pair;
token_pair.first = GURL(kGeolocationProviderURL);
access_token_map.insert(token_pair);
callback_.Run(access_token_map, request_context_getter_);
}
content::AccessTokenStore::LoadAccessTokensCallback callback_;
net::URLRequestContextGetter* request_context_getter_;
};
} // namespace } // namespace
AtomAccessTokenStore::AtomAccessTokenStore() { AtomAccessTokenStore::AtomAccessTokenStore() {
@ -33,35 +78,12 @@ AtomAccessTokenStore::~AtomAccessTokenStore() {
void AtomAccessTokenStore::LoadAccessTokens( void AtomAccessTokenStore::LoadAccessTokens(
const LoadAccessTokensCallback& callback) { const LoadAccessTokensCallback& callback) {
content::BrowserThread::PostTaskAndReply( scoped_refptr<TokenLoadingJob> job(new TokenLoadingJob(callback));
content::BrowserThread::UI, job->Run();
FROM_HERE,
base::Bind(&AtomAccessTokenStore::GetRequestContextOnUIThread, this),
base::Bind(&AtomAccessTokenStore::RespondOnOriginatingThread,
this, callback));
} }
void AtomAccessTokenStore::SaveAccessToken(const GURL& server_url, void AtomAccessTokenStore::SaveAccessToken(const GURL& server_url,
const base::string16& access_token) { const base::string16& access_token) {
} }
void AtomAccessTokenStore::GetRequestContextOnUIThread() {
auto browser_context = AtomBrowserContext::From("", false);
request_context_getter_ = browser_context->GetRequestContext();
}
void AtomAccessTokenStore::RespondOnOriginatingThread(
const LoadAccessTokensCallback& callback) {
// Equivelent to access_token_map[kGeolocationProviderURL].
// Somehow base::string16 is causing compilation errors when used in a pair
// of std::map on Linux, this can work around it.
AccessTokenMap access_token_map;
std::pair<GURL, base::string16> token_pair;
token_pair.first = GURL(kGeolocationProviderURL);
access_token_map.insert(token_pair);
callback.Run(access_token_map, request_context_getter_.get());
request_context_getter_ = nullptr;
}
} // namespace atom } // namespace atom

View file

@ -21,11 +21,6 @@ class AtomAccessTokenStore : public content::AccessTokenStore {
const base::string16& access_token) override; const base::string16& access_token) override;
private: private:
void GetRequestContextOnUIThread();
void RespondOnOriginatingThread(const LoadAccessTokensCallback& callback);
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
DISALLOW_COPY_AND_ASSIGN(AtomAccessTokenStore); DISALLOW_COPY_AND_ASSIGN(AtomAccessTokenStore);
}; };

View file

@ -32,6 +32,7 @@
#include "chrome/browser/speech/tts_message_filter.h" #include "chrome/browser/speech/tts_message_filter.h"
#include "content/public/browser/browser_ppapi_host.h" #include "content/public/browser/browser_ppapi_host.h"
#include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/geolocation_delegate.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/resource_dispatcher_host.h"
@ -53,6 +54,19 @@ bool g_suppress_renderer_process_restart = false;
// Custom schemes to be registered to handle service worker. // Custom schemes to be registered to handle service worker.
std::string g_custom_service_worker_schemes = ""; std::string g_custom_service_worker_schemes = "";
// A provider of Geolocation services to override AccessTokenStore.
class AtomGeolocationDelegate : public content::GeolocationDelegate {
public:
AtomGeolocationDelegate() = default;
content::AccessTokenStore* CreateAccessTokenStore() final {
return new AtomAccessTokenStore();
}
private:
DISALLOW_COPY_AND_ASSIGN(AtomGeolocationDelegate);
};
void Noop(scoped_refptr<content::SiteInstance>) { void Noop(scoped_refptr<content::SiteInstance>) {
} }
@ -99,8 +113,9 @@ content::SpeechRecognitionManagerDelegate*
return new AtomSpeechRecognitionManagerDelegate; return new AtomSpeechRecognitionManagerDelegate;
} }
content::AccessTokenStore* AtomBrowserClient::CreateAccessTokenStore() { content::GeolocationDelegate*
return new AtomAccessTokenStore; AtomBrowserClient::CreateGeolocationDelegate() {
return new AtomGeolocationDelegate();
} }
void AtomBrowserClient::OverrideWebkitPrefs( void AtomBrowserClient::OverrideWebkitPrefs(

View file

@ -49,7 +49,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
void RenderProcessWillLaunch(content::RenderProcessHost* host) override; void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
content::SpeechRecognitionManagerDelegate* content::SpeechRecognitionManagerDelegate*
CreateSpeechRecognitionManagerDelegate() override; CreateSpeechRecognitionManagerDelegate() override;
content::AccessTokenStore* CreateAccessTokenStore() override; content::GeolocationDelegate* CreateGeolocationDelegate() override;
void OverrideWebkitPrefs(content::RenderViewHost* render_view_host, void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
content::WebPreferences* prefs) override; content::WebPreferences* prefs) override;
std::string GetApplicationLocale() override; std::string GetApplicationLocale() override;

View file

@ -10,8 +10,17 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "net/base/escape.h" #include "net/base/escape.h"
#include "net/ssl/client_cert_store.h"
#include "url/gurl.h" #include "url/gurl.h"
#if defined(USE_NSS_CERTS)
#include "net/ssl/client_cert_store_nss.h"
#elif defined(OS_WIN)
#include "net/ssl/client_cert_store_win.h"
#elif defined(OS_MACOSX)
#include "net/ssl/client_cert_store_mac.h"
#endif
using content::BrowserThread; using content::BrowserThread;
namespace atom { namespace atom {
@ -59,7 +68,8 @@ bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol(
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
bool is_main_frame, bool is_main_frame,
ui::PageTransition transition, ui::PageTransition transition,
bool has_user_gesture) { bool has_user_gesture,
content::ResourceContext* resource_context) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&HandleExternalProtocolInUI, base::Bind(&HandleExternalProtocolInUI,
url, url,
@ -75,4 +85,19 @@ AtomResourceDispatcherHostDelegate::CreateLoginDelegate(
return new LoginHandler(auth_info, request); return new LoginHandler(auth_info, request);
} }
std::unique_ptr<net::ClientCertStore>
AtomResourceDispatcherHostDelegate::CreateClientCertStore(
content::ResourceContext* resource_context) {
#if defined(USE_NSS_CERTS)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(
net::ClientCertStoreNSS::PasswordDelegateFactory()));
#elif defined(OS_WIN)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
#elif defined(OS_MACOSX)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac());
#elif defined(USE_OPENSSL)
return std::unique_ptr<net::ClientCertStore>();
#endif
}
} // namespace atom } // namespace atom

View file

@ -21,10 +21,13 @@ class AtomResourceDispatcherHostDelegate
const content::ResourceRequestInfo::WebContentsGetter&, const content::ResourceRequestInfo::WebContentsGetter&,
bool is_main_frame, bool is_main_frame,
ui::PageTransition transition, ui::PageTransition transition,
bool has_user_gesture) override; bool has_user_gesture,
content::ResourceContext* resource_context) override;
content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
net::URLRequest* request) override; net::URLRequest* request) override;
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
content::ResourceContext* resource_context) override;
}; };
} // namespace atom } // namespace atom

View file

@ -27,7 +27,7 @@ bool BridgeTaskRunner::PostDelayedTask(
base::TimeDelta delay) { base::TimeDelta delay) {
auto message_loop = base::MessageLoop::current(); auto message_loop = base::MessageLoop::current();
if (!message_loop) { if (!message_loop) {
tasks_.push_back(base::MakeTuple(from_here, task, delay)); tasks_.push_back(std::make_tuple(from_here, task, delay));
return true; return true;
} }
@ -48,7 +48,7 @@ bool BridgeTaskRunner::PostNonNestableDelayedTask(
base::TimeDelta delay) { base::TimeDelta delay) {
auto message_loop = base::MessageLoop::current(); auto message_loop = base::MessageLoop::current();
if (!message_loop) { if (!message_loop) {
non_nestable_tasks_.push_back(base::MakeTuple(from_here, task, delay)); non_nestable_tasks_.push_back(std::make_tuple(from_here, task, delay));
return true; return true;
} }

View file

@ -5,6 +5,7 @@
#ifndef ATOM_BROWSER_BRIDGE_TASK_RUNNER_H_ #ifndef ATOM_BROWSER_BRIDGE_TASK_RUNNER_H_
#define ATOM_BROWSER_BRIDGE_TASK_RUNNER_H_ #define ATOM_BROWSER_BRIDGE_TASK_RUNNER_H_
#include <tuple>
#include <vector> #include <vector>
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
@ -33,7 +34,7 @@ class BridgeTaskRunner : public base::SingleThreadTaskRunner {
base::TimeDelta delay) override; base::TimeDelta delay) override;
private: private:
using TaskPair = base::Tuple< using TaskPair = std::tuple<
tracked_objects::Location, base::Closure, base::TimeDelta>; tracked_objects::Location, base::Closure, base::TimeDelta>;
std::vector<TaskPair> tasks_; std::vector<TaskPair> tasks_;
std::vector<TaskPair> non_nestable_tasks_; std::vector<TaskPair> non_nestable_tasks_;

View file

@ -252,11 +252,11 @@ content::ColorChooser* CommonWebContentsDelegate::OpenColorChooser(
} }
void CommonWebContentsDelegate::RunFileChooser( void CommonWebContentsDelegate::RunFileChooser(
content::WebContents* guest, content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params) { const content::FileChooserParams& params) {
if (!web_dialog_helper_) if (!web_dialog_helper_)
web_dialog_helper_.reset(new WebDialogHelper(owner_window())); web_dialog_helper_.reset(new WebDialogHelper(owner_window()));
web_dialog_helper_->RunFileChooser(guest, params); web_dialog_helper_->RunFileChooser(render_frame_host, params);
} }
void CommonWebContentsDelegate::EnumerateDirectory(content::WebContents* guest, void CommonWebContentsDelegate::EnumerateDirectory(content::WebContents* guest,

View file

@ -71,7 +71,7 @@ class CommonWebContentsDelegate
content::WebContents* web_contents, content::WebContents* web_contents,
SkColor color, SkColor color,
const std::vector<content::ColorSuggestion>& suggestions) override; const std::vector<content::ColorSuggestion>& suggestions) override;
void RunFileChooser(content::WebContents* web_contents, void RunFileChooser(content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params) override; const content::FileChooserParams& params) override;
void EnumerateDirectory(content::WebContents* web_contents, void EnumerateDirectory(content::WebContents* web_contents,
int request_id, int request_id,

View file

@ -33,6 +33,7 @@
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_macros.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"

View file

@ -22,6 +22,7 @@
#include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/render_widget_host_view.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "skia/ext/skia_utils_mac.h" #include "skia/ext/skia_utils_mac.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
namespace { namespace {
@ -1009,8 +1010,8 @@ bool NativeWindowMac::IsKiosk() {
void NativeWindowMac::SetBackgroundColor(const std::string& color_name) { void NativeWindowMac::SetBackgroundColor(const std::string& color_name) {
SkColor color = ParseHexColor(color_name); SkColor color = ParseHexColor(color_name);
base::ScopedCFTypeRef<CGColorRef> cgcolor = base::ScopedCFTypeRef<CGColorRef> cgcolor(
skia::CGColorCreateFromSkColor(color); skia::CGColorCreateFromSkColor(color));
[[[window_ contentView] layer] setBackgroundColor:cgcolor]; [[[window_ contentView] layer] setBackgroundColor:cgcolor];
const auto view = web_contents()->GetRenderWidgetHostView(); const auto view = web_contents()->GetRenderWidgetHostView();

View file

@ -40,10 +40,7 @@ void AtomCertVerifier::SetVerifyProc(const VerifyProc& proc) {
} }
int AtomCertVerifier::Verify( int AtomCertVerifier::Verify(
net::X509Certificate* cert, const RequestParams& params,
const std::string& hostname,
const std::string& ocsp_response,
int flags,
net::CRLSet* crl_set, net::CRLSet* crl_set,
net::CertVerifyResult* verify_result, net::CertVerifyResult* verify_result,
const net::CompletionCallback& callback, const net::CompletionCallback& callback,
@ -53,12 +50,11 @@ int AtomCertVerifier::Verify(
if (verify_proc_.is_null()) if (verify_proc_.is_null())
return default_cert_verifier_->Verify( return default_cert_verifier_->Verify(
cert, hostname, ocsp_response, flags, crl_set, verify_result, callback, params, crl_set, verify_result, callback, out_req, net_log);
out_req, net_log);
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
base::Bind(verify_proc_, hostname, make_scoped_refptr(cert), base::Bind(verify_proc_, params.hostname(), params.certificate(),
base::Bind(OnResult, verify_result, callback))); base::Bind(OnResult, verify_result, callback)));
return net::ERR_IO_PENDING; return net::ERR_IO_PENDING;
} }

View file

@ -26,10 +26,7 @@ class AtomCertVerifier : public net::CertVerifier {
protected: protected:
// net::CertVerifier: // net::CertVerifier:
int Verify(net::X509Certificate* cert, int Verify(const RequestParams& params,
const std::string& hostname,
const std::string& ocsp_response,
int flags,
net::CRLSet* crl_set, net::CRLSet* crl_set,
net::CertVerifyResult* verify_result, net::CertVerifyResult* verify_result,
const net::CompletionCallback& callback, const net::CompletionCallback& callback,

View file

@ -239,7 +239,7 @@ int AtomNetworkDelegate::OnBeforeURLRequest(
return HandleResponseEvent(kOnBeforeRequest, request, callback, new_url); return HandleResponseEvent(kOnBeforeRequest, request, callback, new_url);
} }
int AtomNetworkDelegate::OnBeforeSendHeaders( int AtomNetworkDelegate::OnBeforeStartTransaction(
net::URLRequest* request, net::URLRequest* request,
const net::CompletionCallback& callback, const net::CompletionCallback& callback,
net::HttpRequestHeaders* headers) { net::HttpRequestHeaders* headers) {
@ -254,18 +254,18 @@ int AtomNetworkDelegate::OnBeforeSendHeaders(
DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId, DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId,
client_id); client_id);
if (!ContainsKey(response_listeners_, kOnBeforeSendHeaders)) if (!ContainsKey(response_listeners_, kOnBeforeSendHeaders))
return brightray::NetworkDelegate::OnBeforeSendHeaders( return brightray::NetworkDelegate::OnBeforeStartTransaction(
request, callback, headers); request, callback, headers);
return HandleResponseEvent( return HandleResponseEvent(
kOnBeforeSendHeaders, request, callback, headers, *headers); kOnBeforeSendHeaders, request, callback, headers, *headers);
} }
void AtomNetworkDelegate::OnSendHeaders( void AtomNetworkDelegate::OnStartTransaction(
net::URLRequest* request, net::URLRequest* request,
const net::HttpRequestHeaders& headers) { const net::HttpRequestHeaders& headers) {
if (!ContainsKey(simple_listeners_, kOnSendHeaders)) { if (!ContainsKey(simple_listeners_, kOnSendHeaders)) {
brightray::NetworkDelegate::OnSendHeaders(request, headers); brightray::NetworkDelegate::OnStartTransaction(request, headers);
return; return;
} }

View file

@ -77,11 +77,11 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate {
int OnBeforeURLRequest(net::URLRequest* request, int OnBeforeURLRequest(net::URLRequest* request,
const net::CompletionCallback& callback, const net::CompletionCallback& callback,
GURL* new_url) override; GURL* new_url) override;
int OnBeforeSendHeaders(net::URLRequest* request, int OnBeforeStartTransaction(net::URLRequest* request,
const net::CompletionCallback& callback, const net::CompletionCallback& callback,
net::HttpRequestHeaders* headers) override; net::HttpRequestHeaders* headers) override;
void OnSendHeaders(net::URLRequest* request, void OnStartTransaction(net::URLRequest* request,
const net::HttpRequestHeaders& headers) override; const net::HttpRequestHeaders& headers) override;
int OnHeadersReceived( int OnHeadersReceived(
net::URLRequest* request, net::URLRequest* request,
const net::CompletionCallback& callback, const net::CompletionCallback& callback,

View file

@ -71,8 +71,9 @@ class AtomCopyFrameGenerator {
content::BrowserThread::PostDelayedTask(content::BrowserThread::UI, content::BrowserThread::PostDelayedTask(content::BrowserThread::UI,
FROM_HERE, FROM_HERE,
base::Bind(&AtomCopyFrameGenerator::InternalGenerateCopyFrame, base::Bind(&AtomCopyFrameGenerator::InternalGenerateCopyFrame,
weak_ptr_factory_.GetWeakPtr()), base::TimeDelta::FromMilliseconds( weak_ptr_factory_.GetWeakPtr()),
frame_rate_threshold_ms_ - frame_rate_delta)); base::TimeDelta::FromMilliseconds(
frame_rate_threshold_ms_ - frame_rate_delta));
return; return;
} }
@ -103,9 +104,7 @@ class AtomCopyFrameGenerator {
damage_rect)); damage_rect));
request->set_area(gfx::Rect(view_->GetPhysicalBackingSize())); request->set_area(gfx::Rect(view_->GetPhysicalBackingSize()));
view_->GetRootLayer()->RequestCopyOfOutput(std::move(request));
view_->DelegatedFrameHostGetLayer()->RequestCopyOfOutput(
std::move(request));
} }
void CopyFromCompositingSurfaceHasResult( void CopyFromCompositingSurfaceHasResult(
@ -302,10 +301,9 @@ class AtomBeginFrameTimer : public cc::DelayBasedTimeSourceClient {
AtomBeginFrameTimer(int frame_rate_threshold_ms, AtomBeginFrameTimer(int frame_rate_threshold_ms,
const base::Closure& callback) const base::Closure& callback)
: callback_(callback) { : callback_(callback) {
time_source_ = cc::DelayBasedTimeSource::Create( time_source_.reset(new cc::DelayBasedTimeSource(
base::TimeDelta::FromMilliseconds(frame_rate_threshold_ms),
content::BrowserThread::GetMessageLoopProxyForThread( content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::UI).get()); content::BrowserThread::UI).get()));
time_source_->SetClient(this); time_source_->SetClient(this);
} }
@ -351,12 +349,17 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
is_showing_(!render_widget_host_->is_hidden()), is_showing_(!render_widget_host_->is_hidden()),
size_(native_window->GetSize()), size_(native_window->GetSize()),
painting_(true), painting_(true),
root_layer_(new ui::Layer(ui::LAYER_SOLID_COLOR)), #if !defined(OS_MACOSX)
delegated_frame_host_(new content::DelegatedFrameHost(this)), delegated_frame_host_(new content::DelegatedFrameHost(this)),
#endif
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
DCHECK(render_widget_host_); DCHECK(render_widget_host_);
render_widget_host_->SetView(this); render_widget_host_->SetView(this);
#if !defined(OS_MACOSX)
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
#endif
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
CreatePlatformWidget(); CreatePlatformWidget();
#else #else
@ -364,17 +367,24 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
new ui::Compositor(content::GetContextFactory(), new ui::Compositor(content::GetContextFactory(),
base::ThreadTaskRunnerHandle::Get())); base::ThreadTaskRunnerHandle::Get()));
compositor_->SetAcceleratedWidget(native_window_->GetAcceleratedWidget()); compositor_->SetAcceleratedWidget(native_window_->GetAcceleratedWidget());
#endif
compositor_->SetDelegate(this); compositor_->SetDelegate(this);
compositor_->SetRootLayer(root_layer_.get()); compositor_->SetRootLayer(root_layer_.get());
#endif
ResizeRootLayer(); ResizeRootLayer();
} }
OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() { OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() {
#if defined(OS_MACOSX)
if (is_showing_)
browser_compositor_->SetRenderWidgetHostIsHidden(true);
#else
// Marking the DelegatedFrameHost as removed from the window hierarchy is
// necessary to remove all connections to its old ui::Compositor.
if (is_showing_) if (is_showing_)
delegated_frame_host_->WasHidden(); delegated_frame_host_->WasHidden();
delegated_frame_host_->ResetCompositor(); delegated_frame_host_->ResetCompositor();
#endif
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
DestroyPlatformWidget(); DestroyPlatformWidget();
@ -432,8 +442,8 @@ void OffScreenRenderWidgetHostView::SetSize(const gfx::Size& size) {
const gfx::Size& size_in_pixels = const gfx::Size& size_in_pixels =
gfx::ConvertSizeToPixel(scale_factor_, size); gfx::ConvertSizeToPixel(scale_factor_, size);
root_layer_->SetBounds(gfx::Rect(size)); GetRootLayer()->SetBounds(gfx::Rect(size));
compositor_->SetScaleAndSize(scale_factor_, size_in_pixels); GetCompositor()->SetScaleAndSize(scale_factor_, size_in_pixels);
} }
void OffScreenRenderWidgetHostView::SetBounds(const gfx::Rect& new_bounds) { void OffScreenRenderWidgetHostView::SetBounds(const gfx::Rect& new_bounds) {
@ -464,7 +474,7 @@ bool OffScreenRenderWidgetHostView::HasFocus() const {
} }
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() const { bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() const {
return delegated_frame_host_->CanCopyToBitmap(); return GetDelegatedFrameHost()->CanCopyToBitmap();
} }
void OffScreenRenderWidgetHostView::Show() { void OffScreenRenderWidgetHostView::Show() {
@ -472,10 +482,16 @@ void OffScreenRenderWidgetHostView::Show() {
return; return;
is_showing_ = true; is_showing_ = true;
if (render_widget_host_)
render_widget_host_->WasShown(ui::LatencyInfo()); #if defined(OS_MACOSX)
browser_compositor_->SetRenderWidgetHostIsHidden(false);
#else
delegated_frame_host_->SetCompositor(compositor_.get()); delegated_frame_host_->SetCompositor(compositor_.get());
delegated_frame_host_->WasShown(ui::LatencyInfo()); delegated_frame_host_->WasShown(ui::LatencyInfo());
#endif
if (render_widget_host_)
render_widget_host_->WasShown(ui::LatencyInfo());
} }
void OffScreenRenderWidgetHostView::Hide() { void OffScreenRenderWidgetHostView::Hide() {
@ -484,8 +500,14 @@ void OffScreenRenderWidgetHostView::Hide() {
if (render_widget_host_) if (render_widget_host_)
render_widget_host_->WasHidden(); render_widget_host_->WasHidden();
delegated_frame_host_->WasHidden();
delegated_frame_host_->ResetCompositor(); #if defined(OS_MACOSX)
browser_compositor_->SetRenderWidgetHostIsHidden(true);
#else
GetDelegatedFrameHost()->WasHidden();
GetDelegatedFrameHost()->ResetCompositor();
#endif
is_showing_ = false; is_showing_ = false;
} }
@ -522,52 +544,63 @@ bool OffScreenRenderWidgetHostView::LockMouse() {
void OffScreenRenderWidgetHostView::UnlockMouse() { void OffScreenRenderWidgetHostView::UnlockMouse() {
} }
bool OffScreenRenderWidgetHostView::GetScreenColorProfile(std::vector<char>*) {
return false;
}
void OffScreenRenderWidgetHostView::OnSwapCompositorFrame( void OffScreenRenderWidgetHostView::OnSwapCompositorFrame(
uint32_t output_surface_id, uint32_t output_surface_id,
std::unique_ptr<cc::CompositorFrame> frame) { cc::CompositorFrame frame) {
TRACE_EVENT0("electron", TRACE_EVENT0("electron",
"OffScreenRenderWidgetHostView::OnSwapCompositorFrame"); "OffScreenRenderWidgetHostView::OnSwapCompositorFrame");
if (frame->metadata.root_scroll_offset != last_scroll_offset_) { if (frame.metadata.root_scroll_offset != last_scroll_offset_) {
last_scroll_offset_ = frame->metadata.root_scroll_offset; last_scroll_offset_ = frame.metadata.root_scroll_offset;
} }
if (frame->delegated_frame_data) { if (frame.delegated_frame_data) {
if (software_output_device_) { if (software_output_device_) {
if (!begin_frame_timer_.get()) { if (!begin_frame_timer_.get()) {
software_output_device_->SetActive(painting_); software_output_device_->SetActive(painting_);
} }
// The compositor will draw directly to the SoftwareOutputDevice which
// then calls OnPaint.
#if defined(OS_MACOSX)
browser_compositor_->SwapCompositorFrame(output_surface_id,
std::move(frame));
#else
delegated_frame_host_->SwapDelegatedFrame(output_surface_id, delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
std::move(frame)); std::move(frame));
#endif
} else { } else {
if (!copy_frame_generator_.get()) { if (!copy_frame_generator_.get()) {
copy_frame_generator_.reset( copy_frame_generator_.reset(
new AtomCopyFrameGenerator(frame_rate_threshold_ms_, this)); new AtomCopyFrameGenerator(frame_rate_threshold_ms_, this));
} }
// Determine the damage rectangle for the current frame. This is the same
// calculation that SwapDelegatedFrame uses.
cc::RenderPass* root_pass = cc::RenderPass* root_pass =
frame->delegated_frame_data->render_pass_list.back().get(); frame.delegated_frame_data->render_pass_list.back().get();
gfx::Size frame_size = root_pass->output_rect.size(); gfx::Size frame_size = root_pass->output_rect.size();
gfx::Rect damage_rect = gfx::Rect damage_rect =
gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect)); gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect));
damage_rect.Intersect(gfx::Rect(frame_size)); damage_rect.Intersect(gfx::Rect(frame_size));
#if defined(OS_MACOSX)
browser_compositor_->SwapCompositorFrame(output_surface_id,
std::move(frame));
#else
delegated_frame_host_->SwapDelegatedFrame(output_surface_id, delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
std::move(frame)); std::move(frame));
#endif
if (painting_) // Request a copy of the last compositor frame which will eventually call
copy_frame_generator_->GenerateCopyFrame(true, damage_rect); // OnPaint asynchronously.
copy_frame_generator_->GenerateCopyFrame(true, damage_rect);
} }
} }
} }
void OffScreenRenderWidgetHostView::ClearCompositorFrame() { void OffScreenRenderWidgetHostView::ClearCompositorFrame() {
delegated_frame_host_->ClearDelegatedFrame(); GetDelegatedFrameHost()->ClearDelegatedFrame();
} }
void OffScreenRenderWidgetHostView::InitAsPopup( void OffScreenRenderWidgetHostView::InitAsPopup(
@ -612,7 +645,7 @@ void OffScreenRenderWidgetHostView::CopyFromCompositingSurface(
const gfx::Size& dst_size, const gfx::Size& dst_size,
const content::ReadbackRequestCallback& callback, const content::ReadbackRequestCallback& callback,
const SkColorType preferred_color_type) { const SkColorType preferred_color_type) {
delegated_frame_host_->CopyFromCompositingSurface( GetDelegatedFrameHost()->CopyFromCompositingSurface(
src_subrect, dst_size, callback, preferred_color_type); src_subrect, dst_size, callback, preferred_color_type);
} }
@ -620,21 +653,21 @@ void OffScreenRenderWidgetHostView::CopyFromCompositingSurfaceToVideoFrame(
const gfx::Rect& src_subrect, const gfx::Rect& src_subrect,
const scoped_refptr<media::VideoFrame>& target, const scoped_refptr<media::VideoFrame>& target,
const base::Callback<void(const gfx::Rect&, bool)>& callback) { const base::Callback<void(const gfx::Rect&, bool)>& callback) {
delegated_frame_host_->CopyFromCompositingSurfaceToVideoFrame( GetDelegatedFrameHost()->CopyFromCompositingSurfaceToVideoFrame(
src_subrect, target, callback); src_subrect, target, callback);
} }
bool OffScreenRenderWidgetHostView::CanCopyToVideoFrame() const { bool OffScreenRenderWidgetHostView::CanCopyToVideoFrame() const {
return delegated_frame_host_->CanCopyToVideoFrame(); return GetDelegatedFrameHost()->CanCopyToVideoFrame();
} }
void OffScreenRenderWidgetHostView::BeginFrameSubscription( void OffScreenRenderWidgetHostView::BeginFrameSubscription(
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber) { std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber) {
delegated_frame_host_->BeginFrameSubscription(std::move(subscriber)); GetDelegatedFrameHost()->BeginFrameSubscription(std::move(subscriber));
} }
void OffScreenRenderWidgetHostView::EndFrameSubscription() { void OffScreenRenderWidgetHostView::EndFrameSubscription() {
delegated_frame_host_->EndFrameSubscription(); GetDelegatedFrameHost()->EndFrameSubscription();
} }
bool OffScreenRenderWidgetHostView::HasAcceleratedSurface(const gfx::Size &) { bool OffScreenRenderWidgetHostView::HasAcceleratedSurface(const gfx::Size &) {
@ -749,7 +782,7 @@ void OffScreenRenderWidgetHostView::SetBeginFrameSource(
std::unique_ptr<cc::SoftwareOutputDevice> std::unique_ptr<cc::SoftwareOutputDevice>
OffScreenRenderWidgetHostView::CreateSoftwareOutputDevice( OffScreenRenderWidgetHostView::CreateSoftwareOutputDevice(
ui::Compositor* compositor) { ui::Compositor* compositor) {
DCHECK_EQ(compositor_.get(), compositor); DCHECK_EQ(GetCompositor(), compositor);
DCHECK(!copy_frame_generator_); DCHECK(!copy_frame_generator_);
DCHECK(!software_output_device_); DCHECK(!software_output_device_);
@ -763,7 +796,11 @@ std::unique_ptr<cc::SoftwareOutputDevice>
bool OffScreenRenderWidgetHostView::InstallTransparency() { bool OffScreenRenderWidgetHostView::InstallTransparency() {
if (transparent_) { if (transparent_) {
SetBackgroundColor(SkColor()); SetBackgroundColor(SkColor());
#if defined(OS_MACOSX)
browser_compositor_->SetHasTransparentBackground(true);
#else
compositor_->SetHostHasTransparentBackground(true); compositor_->SetHostHasTransparentBackground(true);
#endif
return true; return true;
} }
return false; return false;
@ -816,13 +853,28 @@ int OffScreenRenderWidgetHostView::GetFrameRate() const {
return frame_rate_; return frame_rate_;
} }
#if !defined(OS_MACOSX)
ui::Compositor* OffScreenRenderWidgetHostView::GetCompositor() const {
return compositor_.get();
}
ui::Layer* OffScreenRenderWidgetHostView::GetRootLayer() const {
return root_layer_.get();
}
content::DelegatedFrameHost*
OffScreenRenderWidgetHostView::GetDelegatedFrameHost() const {
return delegated_frame_host_.get();
}
#endif
void OffScreenRenderWidgetHostView::SetupFrameRate(bool force) { void OffScreenRenderWidgetHostView::SetupFrameRate(bool force) {
if (!force && frame_rate_threshold_ms_ != 0) if (!force && frame_rate_threshold_ms_ != 0)
return; return;
frame_rate_threshold_ms_ = 1000 / frame_rate_; frame_rate_threshold_ms_ = 1000 / frame_rate_;
compositor_->vsync_manager()->SetAuthoritativeVSyncInterval( GetCompositor()->vsync_manager()->SetAuthoritativeVSyncInterval(
base::TimeDelta::FromMilliseconds(frame_rate_threshold_ms_)); base::TimeDelta::FromMilliseconds(frame_rate_threshold_ms_));
if (copy_frame_generator_.get()) { if (copy_frame_generator_.get()) {
@ -848,14 +900,14 @@ void OffScreenRenderWidgetHostView::ResizeRootLayer() {
gfx::Size size = GetViewBounds().size(); gfx::Size size = GetViewBounds().size();
if (!scaleFactorDidChange && size == root_layer_->bounds().size()) if (!scaleFactorDidChange && size == GetRootLayer()->bounds().size())
return; return;
const gfx::Size& size_in_pixels = const gfx::Size& size_in_pixels =
gfx::ConvertSizeToPixel(scale_factor_, size); gfx::ConvertSizeToPixel(scale_factor_, size);
root_layer_->SetBounds(gfx::Rect(size)); GetRootLayer()->SetBounds(gfx::Rect(size));
compositor_->SetScaleAndSize(scale_factor_, size_in_pixels); GetCompositor()->SetScaleAndSize(scale_factor_, size_in_pixels);
} }
} // namespace atom } // namespace atom

View file

@ -36,7 +36,6 @@
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#include "content/browser/renderer_host/browser_compositor_view_mac.h" #include "content/browser/renderer_host/browser_compositor_view_mac.h"
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
#endif #endif
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
@ -54,11 +53,12 @@ namespace atom {
class AtomCopyFrameGenerator; class AtomCopyFrameGenerator;
class AtomBeginFrameTimer; class AtomBeginFrameTimer;
#if defined(OS_MACOSX)
class MacHelper;
#endif
class OffScreenRenderWidgetHostView class OffScreenRenderWidgetHostView
: public content::RenderWidgetHostViewBase, : public content::RenderWidgetHostViewBase,
#if defined(OS_MACOSX)
public ui::AcceleratedWidgetMacNSView,
#endif
public ui::CompositorDelegate, public ui::CompositorDelegate,
public content::DelegatedFrameHostClient { public content::DelegatedFrameHostClient {
public: public:
@ -90,7 +90,6 @@ class OffScreenRenderWidgetHostView
void SetBackgroundColor(SkColor color) override; void SetBackgroundColor(SkColor color) override;
bool LockMouse(void) override; bool LockMouse(void) override;
void UnlockMouse(void) override; void UnlockMouse(void) override;
bool GetScreenColorProfile(std::vector<char>*) override;
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override; ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override;
void SetActive(bool active) override; void SetActive(bool active) override;
@ -102,7 +101,7 @@ class OffScreenRenderWidgetHostView
#endif // defined(OS_MACOSX) #endif // defined(OS_MACOSX)
// content::RenderWidgetHostViewBase: // content::RenderWidgetHostViewBase:
void OnSwapCompositorFrame(uint32_t, std::unique_ptr<cc::CompositorFrame>) void OnSwapCompositorFrame(uint32_t, cc::CompositorFrame)
override; override;
void ClearCompositorFrame(void) override; void ClearCompositorFrame(void) override;
void InitAsPopup(content::RenderWidgetHostView *rwhv, const gfx::Rect& rect) void InitAsPopup(content::RenderWidgetHostView *rwhv, const gfx::Rect& rect)
@ -173,14 +172,6 @@ class OffScreenRenderWidgetHostView
bool IsAutoResizeEnabled() const; bool IsAutoResizeEnabled() const;
void OnSetNeedsBeginFrames(bool enabled); void OnSetNeedsBeginFrames(bool enabled);
#if defined(OS_MACOSX)
// ui::AcceleratedWidgetMacNSView:
NSView* AcceleratedWidgetGetNSView() const override;
void AcceleratedWidgetGetVSyncParameters(
base::TimeTicks* timebase, base::TimeDelta* interval) const override;
void AcceleratedWidgetSwapCompleted() override;
#endif // defined(OS_MACOSX)
void OnBeginFrameTimerTick(); void OnBeginFrameTimerTick();
void SendBeginFrame(base::TimeTicks frame_time, void SendBeginFrame(base::TimeTicks frame_time,
base::TimeDelta vsync_period); base::TimeDelta vsync_period);
@ -198,9 +189,13 @@ class OffScreenRenderWidgetHostView
void SetFrameRate(int frame_rate); void SetFrameRate(int frame_rate);
int GetFrameRate() const; int GetFrameRate() const;
ui::Compositor* compositor() const { return compositor_.get(); } ui::Compositor* GetCompositor() const;
ui::Layer* GetRootLayer() const;
content::DelegatedFrameHost* GetDelegatedFrameHost() const;
content::RenderWidgetHostImpl* render_widget_host() const content::RenderWidgetHostImpl* render_widget_host() const
{ return render_widget_host_; } { return render_widget_host_; }
NativeWindow* window() const { return native_window_; }
private: private:
void SetupFrameRate(bool force); void SetupFrameRate(bool force);
@ -233,10 +228,13 @@ class OffScreenRenderWidgetHostView
std::unique_ptr<AtomBeginFrameTimer> begin_frame_timer_; std::unique_ptr<AtomBeginFrameTimer> begin_frame_timer_;
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
NSWindow* window_;
CALayer* background_layer_; CALayer* background_layer_;
std::unique_ptr<content::BrowserCompositorMac> browser_compositor_; std::unique_ptr<content::BrowserCompositorMac> browser_compositor_;
// Can not be managed by smart pointer because its header can not be included
// in the file that has the destructor.
MacHelper* mac_helper_;
// Selected text on the renderer. // Selected text on the renderer.
std::string selected_text_; std::string selected_text_;
#endif #endif

View file

@ -7,48 +7,115 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "content/common/view_messages.h"
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
namespace atom {
class MacHelper :
public content::BrowserCompositorMacClient,
public ui::AcceleratedWidgetMacNSView {
public:
explicit MacHelper(OffScreenRenderWidgetHostView* view) : view_(view) {}
virtual ~MacHelper() {}
// content::BrowserCompositorMacClient:
NSView* BrowserCompositorMacGetNSView() const override {
// Intentionally return nil so that
// BrowserCompositorMac::DelegatedFrameHostDesiredSizeInDIP uses the layer
// size instead of the NSView size.
return nil;
}
SkColor BrowserCompositorMacGetGutterColor(SkColor color) const override {
// When making an element on the page fullscreen the element's background
// may not match the page's, so use black as the gutter color to avoid
// flashes of brighter colors during the transition.
if (view_->render_widget_host()->delegate() &&
view_->render_widget_host()->delegate()->IsFullscreenForCurrentTab()) {
return SK_ColorBLACK;
}
return color;
}
void BrowserCompositorMacSendCompositorSwapAck(
int output_surface_id,
const cc::CompositorFrameAck& ack) override {
view_->render_widget_host()->Send(new ViewMsg_SwapCompositorFrameAck(
view_->render_widget_host()->GetRoutingID(), output_surface_id, ack));
}
void BrowserCompositorMacSendReclaimCompositorResources(
int output_surface_id,
const cc::CompositorFrameAck& ack) override {
view_->render_widget_host()->Send(new ViewMsg_ReclaimCompositorResources(
view_->render_widget_host()->GetRoutingID(), output_surface_id, ack));
}
void BrowserCompositorMacOnLostCompositorResources() override {
view_->render_widget_host()->ScheduleComposite();
}
void BrowserCompositorMacUpdateVSyncParameters(
const base::TimeTicks& timebase,
const base::TimeDelta& interval) override {
view_->render_widget_host()->UpdateVSyncParameters(timebase, interval);
}
void BrowserCompositorMacSendBeginFrame(
const cc::BeginFrameArgs& args) override {
view_->render_widget_host()->Send(
new ViewMsg_BeginFrame(view_->render_widget_host()->GetRoutingID(),
args));
}
// ui::AcceleratedWidgetMacNSView:
NSView* AcceleratedWidgetGetNSView() const override {
return [view_->window()->GetNativeWindow() contentView];
}
void AcceleratedWidgetGetVSyncParameters(
base::TimeTicks* timebase, base::TimeDelta* interval) const override {
*timebase = base::TimeTicks();
*interval = base::TimeDelta();
}
void AcceleratedWidgetSwapCompleted() override {
}
private:
OffScreenRenderWidgetHostView* view_;
DISALLOW_COPY_AND_ASSIGN(MacHelper);
};
ui::AcceleratedWidgetMac* ui::AcceleratedWidgetMac*
atom::OffScreenRenderWidgetHostView::GetAcceleratedWidgetMac() const { OffScreenRenderWidgetHostView::GetAcceleratedWidgetMac() const {
if (browser_compositor_) if (browser_compositor_)
return browser_compositor_->accelerated_widget_mac(); return browser_compositor_->GetAcceleratedWidgetMac();
return nullptr; return nullptr;
} }
NSView* atom::OffScreenRenderWidgetHostView::AcceleratedWidgetGetNSView() const { void OffScreenRenderWidgetHostView::SetActive(bool active) {
return [native_window_->GetNativeWindow() contentView];
} }
void atom::OffScreenRenderWidgetHostView::AcceleratedWidgetGetVSyncParameters( void OffScreenRenderWidgetHostView::ShowDefinitionForSelection() {
base::TimeTicks* timebase, base::TimeDelta* interval) const {
*timebase = base::TimeTicks();
*interval = base::TimeDelta();
} }
void atom::OffScreenRenderWidgetHostView::AcceleratedWidgetSwapCompleted() { bool OffScreenRenderWidgetHostView::SupportsSpeech() const {
}
void atom::OffScreenRenderWidgetHostView::SetActive(bool active) {
}
void atom::OffScreenRenderWidgetHostView::ShowDefinitionForSelection() {
}
bool atom::OffScreenRenderWidgetHostView::SupportsSpeech() const {
return false; return false;
} }
void atom::OffScreenRenderWidgetHostView::SpeakSelection() { void OffScreenRenderWidgetHostView::SpeakSelection() {
} }
bool atom::OffScreenRenderWidgetHostView::IsSpeaking() const { bool OffScreenRenderWidgetHostView::IsSpeaking() const {
return false; return false;
} }
void atom::OffScreenRenderWidgetHostView::StopSpeaking() { void OffScreenRenderWidgetHostView::StopSpeaking() {
} }
void atom::OffScreenRenderWidgetHostView::SelectionChanged( void OffScreenRenderWidgetHostView::SelectionChanged(
const base::string16& text, const base::string16& text,
size_t offset, size_t offset,
const gfx::Range& range) { const gfx::Range& range) {
@ -69,24 +136,28 @@ void atom::OffScreenRenderWidgetHostView::SelectionChanged(
RenderWidgetHostViewBase::SelectionChanged(text, offset, range); RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
} }
void atom::OffScreenRenderWidgetHostView::CreatePlatformWidget() { void OffScreenRenderWidgetHostView::CreatePlatformWidget() {
browser_compositor_ = content::BrowserCompositorMac::Create(); mac_helper_ = new MacHelper(this);
browser_compositor_.reset(new content::BrowserCompositorMac(
compositor_.reset(browser_compositor_->compositor()); mac_helper_, mac_helper_, render_widget_host_->is_hidden(), true));
compositor_->SetRootLayer(root_layer_.get());
browser_compositor_->accelerated_widget_mac()->SetNSView(this);
browser_compositor_->compositor()->SetVisible(true);
compositor_->SetLocksWillTimeOut(true);
browser_compositor_->Unsuspend();
} }
void atom::OffScreenRenderWidgetHostView::DestroyPlatformWidget() { void OffScreenRenderWidgetHostView::DestroyPlatformWidget() {
ui::Compositor* compositor = compositor_.release(); browser_compositor_.reset();
ALLOW_UNUSED_LOCAL(compositor); delete mac_helper_;
browser_compositor_->accelerated_widget_mac()->ResetNSView();
browser_compositor_->compositor()->SetVisible(false);
browser_compositor_->compositor()->SetScaleAndSize(1.0, gfx::Size(0, 0));
browser_compositor_->compositor()->SetRootLayer(NULL);
} }
ui::Compositor* OffScreenRenderWidgetHostView::GetCompositor() const {
return browser_compositor_->GetCompositor();
}
ui::Layer* OffScreenRenderWidgetHostView::GetRootLayer() const {
return browser_compositor_->GetRootLayer();
}
content::DelegatedFrameHost*
OffScreenRenderWidgetHostView::GetDelegatedFrameHost() const {
return browser_compositor_->GetDelegatedFrameHost();
}
} // namespace

View file

@ -4,6 +4,8 @@
#include "atom/browser/osr/osr_web_contents_view.h" #include "atom/browser/osr/osr_web_contents_view.h"
#import <Cocoa/Cocoa.h>
@interface OffScreenView : NSView @interface OffScreenView : NSView
@end @end

View file

@ -16,9 +16,11 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/file_chooser_file_info.h" #include "content/public/common/file_chooser_file_info.h"
#include "content/public/common/file_chooser_params.h"
#include "net/base/mime_util.h" #include "net/base/mime_util.h"
#include "ui/shell_dialogs/selected_file_info.h" #include "ui/shell_dialogs/selected_file_info.h"
@ -75,8 +77,9 @@ WebDialogHelper::~WebDialogHelper() {
} }
void WebDialogHelper::RunFileChooser(content::WebContents* web_contents, void WebDialogHelper::RunFileChooser(
const content::FileChooserParams& params) { content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params) {
std::vector<content::FileChooserFileInfo> result; std::vector<content::FileChooserFileInfo> result;
file_dialog::Filters filters = GetFileTypesFromAcceptType( file_dialog::Filters filters = GetFileTypesFromAcceptType(
params.accept_types); params.accept_types);
@ -133,8 +136,7 @@ void WebDialogHelper::RunFileChooser(content::WebContents* web_contents,
} }
} }
web_contents->GetRenderViewHost()->FilesSelectedInChooser( render_frame_host->FilesSelectedInChooser(result, params.mode);
result, params.mode);
} }
void WebDialogHelper::EnumerateDirectory(content::WebContents* web_contents, void WebDialogHelper::EnumerateDirectory(content::WebContents* web_contents,

View file

@ -13,6 +13,7 @@ class FilePath;
namespace content { namespace content {
struct FileChooserParams; struct FileChooserParams;
class RenderFrameHost;
class WebContents; class WebContents;
} }
@ -25,7 +26,7 @@ class WebDialogHelper {
explicit WebDialogHelper(NativeWindow* window); explicit WebDialogHelper(NativeWindow* window);
~WebDialogHelper(); ~WebDialogHelper();
void RunFileChooser(content::WebContents* web_contents, void RunFileChooser(content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params); const content::FileChooserParams& params);
void EnumerateDirectory(content::WebContents* web_contents, void EnumerateDirectory(content::WebContents* web_contents,
int request_id, int request_id,

View file

@ -11,7 +11,6 @@
#include "atom/common/native_mate_converters/file_path_converter.h" #include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/gfx_converter.h" #include "atom/common/native_mate_converters/gfx_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/node_includes.h"
#include "base/base64.h" #include "base/base64.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/strings/pattern.h" #include "base/strings/pattern.h"
@ -33,6 +32,8 @@
#include "ui/gfx/icon_util.h" #include "ui/gfx/icon_util.h"
#endif #endif
#include "atom/common/node_includes.h"
namespace atom { namespace atom {
namespace api { namespace api {

View file

@ -12,8 +12,7 @@ namespace atom {
ObjectLifeMonitor::ObjectLifeMonitor(v8::Isolate* isolate, ObjectLifeMonitor::ObjectLifeMonitor(v8::Isolate* isolate,
v8::Local<v8::Object> target) v8::Local<v8::Object> target)
: isolate_(isolate), : context_(isolate, isolate->GetCurrentContext()),
context_(isolate, isolate->GetCurrentContext()),
target_(isolate, target), target_(isolate, target),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
target_.SetWeak(this, OnObjectGC, v8::WeakCallbackType::kParameter); target_.SetWeak(this, OnObjectGC, v8::WeakCallbackType::kParameter);

View file

@ -22,7 +22,6 @@ class ObjectLifeMonitor {
static void OnObjectGC(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data); static void OnObjectGC(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data);
static void Free(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data); static void Free(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data);
v8::Isolate* isolate_;
v8::Global<v8::Context> context_; v8::Global<v8::Context> context_;
v8::Global<v8::Object> target_; v8::Global<v8::Object> target_;

View file

@ -8,7 +8,7 @@
#ifndef ATOM_COMMON_CHROME_VERSION_H_ #ifndef ATOM_COMMON_CHROME_VERSION_H_
#define ATOM_COMMON_CHROME_VERSION_H_ #define ATOM_COMMON_CHROME_VERSION_H_
#define CHROME_VERSION_STRING "52.0.2743.82" #define CHROME_VERSION_STRING "53.0.2785.89"
#define CHROME_VERSION "v" CHROME_VERSION_STRING #define CHROME_VERSION "v" CHROME_VERSION_STRING
#endif // ATOM_COMMON_CHROME_VERSION_H_ #endif // ATOM_COMMON_CHROME_VERSION_H_

View file

@ -238,7 +238,15 @@ bool Converter<blink::WebMouseWheelEvent>::FromV8(
dict.Get("accelerationRatioX", &out->accelerationRatioX); dict.Get("accelerationRatioX", &out->accelerationRatioX);
dict.Get("accelerationRatioY", &out->accelerationRatioY); dict.Get("accelerationRatioY", &out->accelerationRatioY);
dict.Get("hasPreciseScrollingDeltas", &out->hasPreciseScrollingDeltas); dict.Get("hasPreciseScrollingDeltas", &out->hasPreciseScrollingDeltas);
dict.Get("canScroll", &out->canScroll);
#if defined(USE_AURA)
// Matches the behavior of ui/events/blink/web_input_event_traits.cc:
bool can_scroll = true;
if (dict.Get("canScroll", &can_scroll) && !can_scroll) {
out->hasPreciseScrollingDeltas = false;
out->modifiers &= ~blink::WebInputEvent::ControlKey;
}
#endif
return true; return true;
} }

View file

@ -9,7 +9,6 @@
#include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/values.h" #include "base/values.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
@ -21,6 +20,8 @@
#include "net/http/http_response_headers.h" #include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
#include "atom/common/node_includes.h"
namespace mate { namespace mate {
// static // static

View file

@ -375,7 +375,7 @@ base::Value* V8ValueConverter::FromNodeBuffer(
FromV8ValueState* state, FromV8ValueState* state,
v8::Isolate* isolate) const { v8::Isolate* isolate) const {
return base::BinaryValue::CreateWithCopiedBuffer( return base::BinaryValue::CreateWithCopiedBuffer(
node::Buffer::Data(value), node::Buffer::Length(value)); node::Buffer::Data(value), node::Buffer::Length(value)).release();
} }
base::Value* V8ValueConverter::FromV8Object( base::Value* V8ValueConverter::FromV8Object(

View file

@ -103,7 +103,6 @@ AtomRenderViewObserver::AtomRenderViewObserver(
content::RenderView* render_view, content::RenderView* render_view,
AtomRendererClient* renderer_client) AtomRendererClient* renderer_client)
: content::RenderViewObserver(render_view), : content::RenderViewObserver(render_view),
renderer_client_(renderer_client),
document_created_(false) { document_created_(false) {
// Initialise resource for directory listing. // Initialise resource for directory listing.
net::NetModule::SetResourceProvider(NetResourceProvider); net::NetModule::SetResourceProvider(NetResourceProvider);
@ -151,6 +150,10 @@ bool AtomRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
return handled; return handled;
} }
void AtomRenderViewObserver::OnDestruct() {
delete this;
}
void AtomRenderViewObserver::OnBrowserMessage(bool send_to_all, void AtomRenderViewObserver::OnBrowserMessage(bool send_to_all,
const base::string16& channel, const base::string16& channel,
const base::ListValue& args) { const base::ListValue& args) {

View file

@ -29,14 +29,12 @@ class AtomRenderViewObserver : public content::RenderViewObserver {
void DidCreateDocumentElement(blink::WebLocalFrame* frame) override; void DidCreateDocumentElement(blink::WebLocalFrame* frame) override;
void DraggableRegionsChanged(blink::WebFrame* frame) override; void DraggableRegionsChanged(blink::WebFrame* frame) override;
bool OnMessageReceived(const IPC::Message& message) override; bool OnMessageReceived(const IPC::Message& message) override;
void OnDestruct() override;
void OnBrowserMessage(bool send_to_all, void OnBrowserMessage(bool send_to_all,
const base::string16& channel, const base::string16& channel,
const base::ListValue& args); const base::ListValue& args);
// Weak reference to renderer client.
AtomRendererClient* renderer_client_;
// Whether the document object has been created. // Whether the document object has been created.
bool document_created_; bool document_created_;

View file

@ -13,7 +13,6 @@
#include "atom/common/color_util.h" #include "atom/common/color_util.h"
#include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_bindings.h" #include "atom/common/node_bindings.h"
#include "atom/common/node_includes.h"
#include "atom/common/options_switches.h" #include "atom/common/options_switches.h"
#include "atom/renderer/atom_render_view_observer.h" #include "atom/renderer/atom_render_view_observer.h"
#include "atom/renderer/guest_view_container.h" #include "atom/renderer/guest_view_container.h"
@ -51,6 +50,8 @@
#include <shlobj.h> #include <shlobj.h>
#endif #endif
#include "atom/common/node_includes.h"
namespace atom { namespace atom {
namespace { namespace {
@ -85,6 +86,10 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
renderer_client_->WillReleaseScriptContext(context, render_frame_); renderer_client_->WillReleaseScriptContext(context, render_frame_);
} }
void OnDestruct() override {
delete this;
}
private: private:
content::RenderFrame* render_frame_; content::RenderFrame* render_frame_;
int world_id_; int world_id_;

View file

@ -22,8 +22,7 @@ static base::LazyInstance<GuestViewContainerMap> g_guest_view_container_map =
} // namespace } // namespace
GuestViewContainer::GuestViewContainer(content::RenderFrame* render_frame) GuestViewContainer::GuestViewContainer(content::RenderFrame* render_frame)
: render_frame_(render_frame), : weak_ptr_factory_(this) {
weak_ptr_factory_(this) {
} }
GuestViewContainer::~GuestViewContainer() { GuestViewContainer::~GuestViewContainer() {

View file

@ -32,7 +32,6 @@ class GuestViewContainer : public content::BrowserPluginDelegate {
private: private:
int element_instance_id_; int element_instance_id_;
content::RenderFrame* render_frame_;
ResizeCallback element_resize_callback_; ResizeCallback element_resize_callback_;

View file

@ -97,7 +97,8 @@ class NativeDesktopMediaList::Worker
typedef std::map<DesktopMediaID, uint32> ImageHashesMap; typedef std::map<DesktopMediaID, uint32> ImageHashesMap;
// webrtc::DesktopCapturer::Callback interface. // webrtc::DesktopCapturer::Callback interface.
void OnCaptureCompleted(webrtc::DesktopFrame* frame) override; void OnCaptureResult(webrtc::DesktopCapturer::Result result,
std::unique_ptr<webrtc::DesktopFrame> frame) override;
base::WeakPtr<NativeDesktopMediaList> media_list_; base::WeakPtr<NativeDesktopMediaList> media_list_;
@ -217,9 +218,10 @@ void NativeDesktopMediaList::Worker::Refresh(
base::Bind(&NativeDesktopMediaList::OnRefreshFinished, media_list_)); base::Bind(&NativeDesktopMediaList::OnRefreshFinished, media_list_));
} }
void NativeDesktopMediaList::Worker::OnCaptureCompleted( void NativeDesktopMediaList::Worker::OnCaptureResult(
webrtc::DesktopFrame* frame) { webrtc::DesktopCapturer::Result result,
current_frame_.reset(frame); std::unique_ptr<webrtc::DesktopFrame> frame) {
current_frame_ = std::move(frame);
} }
NativeDesktopMediaList::NativeDesktopMediaList( NativeDesktopMediaList::NativeDesktopMediaList(

View file

@ -109,8 +109,6 @@ class PdfToEmfUtilityProcessHostClient
private: private:
class GetPageCallbackData { class GetPageCallbackData {
MOVE_ONLY_TYPE_FOR_CPP_03(GetPageCallbackData);
public: public:
GetPageCallbackData(int page_number, GetPageCallbackData(int page_number,
PdfToEmfConverter::GetPageCallback callback) PdfToEmfConverter::GetPageCallback callback)

View file

@ -7,9 +7,10 @@
#include <memory> #include <memory>
#include "base/bind.h" #include "base/bind.h"
#include "components/prefs/pref_service.h" #include "base/memory/ref_counted_memory.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "components/prefs/pref_service.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/printing/print_job.h" #include "chrome/browser/printing/print_job.h"
@ -133,7 +134,8 @@ void PrintViewManagerBase::OnDidPrintPage(
} }
} }
std::unique_ptr<PdfMetafileSkia> metafile(new PdfMetafileSkia); std::unique_ptr<PdfMetafileSkia> metafile(
new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
if (metafile_must_be_valid) { if (metafile_must_be_valid) {
if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) { if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) {
NOTREACHED() << "Invalid metafile header"; NOTREACHED() << "Invalid metafile header";

View file

@ -17,6 +17,7 @@
#include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/widevine_cdm_constants.h" #include "chrome/common/widevine_cdm_constants.h"
#include "third_party/widevine/cdm/stub/widevine_cdm_version.h" #include "third_party/widevine/cdm/stub/widevine_cdm_version.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h"
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "base/android/path_utils.h" #include "base/android/path_utils.h"
@ -364,7 +365,7 @@ bool PathProvider(int key, base::FilePath* result) {
case chrome::DIR_COMPONENT_WIDEVINE_CDM: case chrome::DIR_COMPONENT_WIDEVINE_CDM:
if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
return false; return false;
cur = cur.Append(kWidevineCdmBaseDirectory); cur = cur.AppendASCII(kWidevineCdmBaseDirectory);
break; break;
#endif // defined(WIDEVINE_CDM_IS_COMPONENT) #endif // defined(WIDEVINE_CDM_IS_COMPONENT)
// TODO(xhwang): FILE_WIDEVINE_CDM_ADAPTER has different meanings. // TODO(xhwang): FILE_WIDEVINE_CDM_ADAPTER has different meanings.

View file

@ -9,11 +9,11 @@
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
#include <string> #include <string>
#include <tuple>
#include <vector> #include <vector>
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/tuple.h"
#include "base/values.h" #include "base/values.h"
#include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h" #include "ipc/ipc_platform_file.h"
@ -25,9 +25,9 @@
#define CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_ #define CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
#if defined(OS_WIN) #if defined(OS_WIN)
// A vector of filters, each being a Tuple containing a display string (i.e. // A vector of filters, each being a tuple containing a display string (i.e.
// "Text Files") and a filter pattern (i.e. "*.txt"). // "Text Files") and a filter pattern (i.e. "*.txt").
typedef std::vector<base::Tuple<base::string16, base::string16>> typedef std::vector<std::tuple<base::string16, base::string16>>
GetOpenFileNameFilter; GetOpenFileNameFilter;
#endif // OS_WIN #endif // OS_WIN

View file

@ -7,9 +7,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "ppapi/shared_impl/ppapi_permissions.h" #include "ppapi/shared_impl/ppapi_permissions.h"
const base::FilePath::CharType kWidevineCdmBaseDirectory[] =
FILE_PATH_LITERAL("WidevineCDM");
const char kWidevineCdmPluginExtension[] = ""; const char kWidevineCdmPluginExtension[] = "";
const int32_t kWidevineCdmPluginPermissions = ppapi::PERMISSION_DEV | const int32_t kWidevineCdmPluginPermissions = ppapi::PERMISSION_DEV |

View file

@ -8,9 +8,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
// The Widevine CDM adapter and Widevine CDM are in this directory.
extern const base::FilePath::CharType kWidevineCdmBaseDirectory[];
extern const char kWidevineCdmPluginExtension[]; extern const char kWidevineCdmPluginExtension[];
// Permission bits for Widevine CDM plugin. // Permission bits for Widevine CDM plugin.

View file

@ -241,6 +241,7 @@ static void AddPepperBasedWidevine(
#endif // defined(USE_PROPRIETARY_CODECS) #endif // defined(USE_PROPRIETARY_CODECS)
} }
using Robustness = cdm::WidevineKeySystemProperties::Robustness;
concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties( concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties(
supported_codecs, supported_codecs,
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
@ -253,8 +254,8 @@ static void AddPepperBasedWidevine(
media::EmeFeatureSupport::REQUESTABLE, // Persistent state. media::EmeFeatureSupport::REQUESTABLE, // Persistent state.
media::EmeFeatureSupport::REQUESTABLE)); // Distinctive identifier. media::EmeFeatureSupport::REQUESTABLE)); // Distinctive identifier.
#else // (Desktop) #else // (Desktop)
media::EmeRobustness::SW_SECURE_CRYPTO, // Maximum audio robustness. Robustness::SW_SECURE_CRYPTO, // Maximum audio robustness.
media::EmeRobustness::SW_SECURE_DECODE, // Maximum video robustness. Robustness::SW_SECURE_DECODE, // Maximum video robustness.
media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license.
media::EmeSessionTypeSupport:: media::EmeSessionTypeSupport::
NOT_SUPPORTED, // persistent-release-message. NOT_SUPPORTED, // persistent-release-message.

View file

@ -205,8 +205,8 @@ int32_t PepperFlashRendererHost::OnDrawGlyphs(
style |= SkTypeface::kBold; style |= SkTypeface::kBold;
if (params.font_desc.italic) if (params.font_desc.italic)
style |= SkTypeface::kItalic; style |= SkTypeface::kItalic;
sk_sp<SkTypeface> typeface(SkTypeface::CreateFromName( sk_sp<SkTypeface> typeface(SkTypeface::MakeFromName(
params.font_desc.face.c_str(), static_cast<SkTypeface::Style>(style))); params.font_desc.face.c_str(), SkFontStyle::FromOldStyle(style)));
if (!typeface) if (!typeface)
return PP_ERROR_FAILED; return PP_ERROR_FAILED;

View file

@ -24,3 +24,7 @@ void PepperHelper::DidCreatePepperPlugin(content::RendererPpapiHost* host) {
std::unique_ptr<ppapi::host::InstanceMessageFilter>( std::unique_ptr<ppapi::host::InstanceMessageFilter>(
new PepperSharedMemoryMessageFilter(host))); new PepperSharedMemoryMessageFilter(host)));
} }
void PepperHelper::OnDestruct() {
delete this;
}

View file

@ -17,6 +17,7 @@ class PepperHelper : public content::RenderFrameObserver {
// RenderFrameObserver. // RenderFrameObserver.
void DidCreatePepperPlugin(content::RendererPpapiHost* host) override; void DidCreatePepperPlugin(content::RendererPpapiHost* host) override;
void OnDestruct() override;
private: private:
DISALLOW_COPY_AND_ASSIGN(PepperHelper); DISALLOW_COPY_AND_ASSIGN(PepperHelper);

View file

@ -545,7 +545,8 @@ void PrepareFrameAndViewForPrint::CopySelection(
WebPreferences prefs = preferences; WebPreferences prefs = preferences;
prefs.javascript_enabled = false; prefs.javascript_enabled = false;
blink::WebView* web_view = blink::WebView::create(this); blink::WebView* web_view =
blink::WebView::create(this, blink::WebPageVisibilityStateVisible);
owns_web_view_ = true; owns_web_view_ = true;
content::RenderView::ApplyWebPreferences(prefs, web_view); content::RenderView::ApplyWebPreferences(prefs, web_view);
web_view->setMainFrame( web_view->setMainFrame(
@ -662,6 +663,10 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
return handled; return handled;
} }
void PrintWebViewHelper::OnDestruct() {
delete this;
}
bool PrintWebViewHelper::GetPrintFrame(blink::WebLocalFrame** frame) { bool PrintWebViewHelper::GetPrintFrame(blink::WebLocalFrame** frame) {
DCHECK(frame); DCHECK(frame);
blink::WebView* webView = render_view()->GetWebView(); blink::WebView* webView = render_view()->GetWebView();
@ -1266,7 +1271,7 @@ bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument(
return false; return false;
} }
metafile_.reset(new PdfMetafileSkia); metafile_.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
CHECK(metafile_->Init()); CHECK(metafile_->Init());
current_page_index_ = 0; current_page_index_ = 0;

View file

@ -92,9 +92,9 @@ class PrintWebViewHelper
}; };
// RenderViewObserver implementation. // RenderViewObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) override; bool OnMessageReceived(const IPC::Message& message) override;
virtual void PrintPage(blink::WebLocalFrame* frame, void PrintPage(blink::WebLocalFrame* frame, bool user_initiated) override;
bool user_initiated) override; void OnDestruct() override;
// Message handlers --------------------------------------------------------- // Message handlers ---------------------------------------------------------
#if !defined(DISABLE_BASIC_PRINTING) #if !defined(DISABLE_BASIC_PRINTING)

View file

@ -33,7 +33,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
std::unique_ptr<PdfMetafileSkia> draft_metafile; std::unique_ptr<PdfMetafileSkia> draft_metafile;
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile(); PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) { if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) {
draft_metafile.reset(new PdfMetafileSkia); draft_metafile.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
initial_render_metafile = draft_metafile.get(); initial_render_metafile = draft_metafile.get();
} }
@ -49,14 +49,16 @@ bool PrintWebViewHelper::RenderPreviewPage(
print_preview_context_.generate_draft_pages()) { print_preview_context_.generate_draft_pages()) {
DCHECK(!draft_metafile.get()); DCHECK(!draft_metafile.get());
draft_metafile = draft_metafile =
print_preview_context_.metafile()->GetMetafileForCurrentPage(); print_preview_context_.metafile()->GetMetafileForCurrentPage(
PDF_SKIA_DOCUMENT_TYPE);
} }
return PreviewPageRendered(page_number, draft_metafile.get()); return PreviewPageRendered(page_number, draft_metafile.get());
} }
bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
int page_count) { int page_count) {
PdfMetafileSkia metafile; PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
if (!metafile.Init()) if (!metafile.Init())
return false; return false;

View file

@ -23,7 +23,7 @@ using blink::WebFrame;
void PrintWebViewHelper::PrintPageInternal( void PrintWebViewHelper::PrintPageInternal(
const PrintMsg_PrintPage_Params& params, const PrintMsg_PrintPage_Params& params,
WebFrame* frame) { WebFrame* frame) {
PdfMetafileSkia metafile; PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
CHECK(metafile.Init()); CHECK(metafile.Init());
int page_number = params.page_number; int page_number = params.page_number;
@ -61,7 +61,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
is_print_ready_metafile_sent_; is_print_ready_metafile_sent_;
if (render_to_draft) { if (render_to_draft) {
draft_metafile.reset(new PdfMetafileSkia()); draft_metafile.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
CHECK(draft_metafile->Init()); CHECK(draft_metafile->Init());
initial_render_metafile = draft_metafile.get(); initial_render_metafile = draft_metafile.get();
} }
@ -80,7 +80,8 @@ bool PrintWebViewHelper::RenderPreviewPage(
print_preview_context_.generate_draft_pages()) { print_preview_context_.generate_draft_pages()) {
DCHECK(!draft_metafile.get()); DCHECK(!draft_metafile.get());
draft_metafile = draft_metafile =
print_preview_context_.metafile()->GetMetafileForCurrentPage(); print_preview_context_.metafile()->GetMetafileForCurrentPage(
PDF_SKIA_DOCUMENT_TYPE);
} }
} }
return PreviewPageRendered(page_number, draft_metafile.get()); return PreviewPageRendered(page_number, draft_metafile.get());

View file

@ -31,7 +31,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
std::unique_ptr<PdfMetafileSkia> draft_metafile; std::unique_ptr<PdfMetafileSkia> draft_metafile;
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile(); PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) { if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) {
draft_metafile.reset(new PdfMetafileSkia); draft_metafile.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
initial_render_metafile = draft_metafile.get(); initial_render_metafile = draft_metafile.get();
} }
@ -49,14 +49,15 @@ bool PrintWebViewHelper::RenderPreviewPage(
print_preview_context_.generate_draft_pages()) { print_preview_context_.generate_draft_pages()) {
DCHECK(!draft_metafile.get()); DCHECK(!draft_metafile.get());
draft_metafile = draft_metafile =
print_preview_context_.metafile()->GetMetafileForCurrentPage(); print_preview_context_.metafile()->GetMetafileForCurrentPage(
PDF_SKIA_DOCUMENT_TYPE);
} }
return PreviewPageRendered(page_number, draft_metafile.get()); return PreviewPageRendered(page_number, draft_metafile.get());
} }
bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
int page_count) { int page_count) {
PdfMetafileSkia metafile; PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
if (!metafile.Init()) if (!metafile.Init())
return false; return false;

View file

@ -36,6 +36,7 @@
'node_use_perfctr': 'false', 'node_use_perfctr': 'false',
'node_use_v8_platform': 'false', 'node_use_v8_platform': 'false',
'node_use_bundled_v8': 'false', 'node_use_bundled_v8': 'false',
'node_enable_d8': 'false',
'uv_library': 'static_library', 'uv_library': 'static_library',
'uv_parent_path': 'vendor/node/deps/uv', 'uv_parent_path': 'vendor/node/deps/uv',
'uv_use_dtrace': 'false', 'uv_use_dtrace': 'false',
@ -228,6 +229,17 @@
}], # OS=="win" }], # OS=="win"
], ],
}], }],
['_target_name.startswith("crashpad")', {
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'WARNING_CFLAGS': [
'-Wno-unused-private-field',
],
},
}], # OS=="mac"
],
}],
['_target_name.startswith("breakpad") or _target_name in ["crash_report_sender", "dump_syms"]', { ['_target_name.startswith("breakpad") or _target_name in ["crash_report_sender", "dump_syms"]', {
'conditions': [ 'conditions': [
['OS=="mac"', { ['OS=="mac"', {

View file

@ -302,10 +302,9 @@ Returns:
* `event` Event * `event` Event
* `result` Object * `result` Object
* `requestId` Integer * `requestId` Integer
* `finalUpdate` Boolean - Indicates if more responses are to follow. * `activeMatchOrdinal` Integer - Position of the active match.
* `activeMatchOrdinal` Integer (optional) - Position of the active match. * `matches` Integer - Number of Matches.
* `matches` Integer (optional) - Number of Matches. * `selectionArea` Object - Coordinates of first match region.
* `selectionArea` Object (optional) - Coordinates of first match region.
Emitted when a result is available for Emitted when a result is available for
[`webContents.findInPage`](web-contents.md#webcontentsfindinpage) request. [`webContents.findInPage`](web-contents.md#webcontentsfindinpage) request.

View file

@ -646,10 +646,9 @@ Returns:
* `result` Object * `result` Object
* `requestId` Integer * `requestId` Integer
* `finalUpdate` Boolean - Indicates if more responses are to follow. * `activeMatchOrdinal` Integer - Position of the active match.
* `activeMatchOrdinal` Integer (optional) - Position of the active match. * `matches` Integer - Number of Matches.
* `matches` Integer (optional) - Number of Matches. * `selectionArea` Object - Coordinates of first match region.
* `selectionArea` Object (optional) - Coordinates of first match region.
Fired when a result is available for Fired when a result is available for
[`webview.findInPage`](web-view-tag.md#webviewtagfindinpage) request. [`webview.findInPage`](web-view-tag.md#webviewtagfindinpage) request.
@ -657,7 +656,7 @@ Fired when a result is available for
```javascript ```javascript
const webview = document.getElementById('foo') const webview = document.getElementById('foo')
webview.addEventListener('found-in-page', (e) => { webview.addEventListener('found-in-page', (e) => {
if (e.result.finalUpdate) webview.stopFindInPage('keepSelection') webview.stopFindInPage('keepSelection')
}) })
const requestId = webview.findInPage('test') const requestId = webview.findInPage('test')

View file

@ -9,7 +9,7 @@ import sys
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \ BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent' 'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = os.getenv('LIBCHROMIUMCONTENT_COMMIT') or \ LIBCHROMIUMCONTENT_COMMIT = os.getenv('LIBCHROMIUMCONTENT_COMMIT') or \
'c5cf295ef93d4ee88bff0c4b06b28ff0969a890e' '346dfe40a9658cc40924d29a1deb1d9669509076'
PLATFORM = { PLATFORM = {
'cygwin': 'win32', 'cygwin': 'win32',

View file

@ -152,6 +152,7 @@ describe('ipc module', function () {
assert.equal(property.getFunctionProperty(), 'foo-browser') assert.equal(property.getFunctionProperty(), 'foo-browser')
property.func.property = 'bar' property.func.property = 'bar'
assert.equal(property.getFunctionProperty(), 'bar-browser') assert.equal(property.getFunctionProperty(), 'bar-browser')
property.func.property = 'foo' // revert back
var property2 = remote.require(path.join(fixtures, 'module', 'property.js')) var property2 = remote.require(path.join(fixtures, 'module', 'property.js'))
assert.equal(property2.property, 1007) assert.equal(property2.property, 1007)

View file

@ -94,7 +94,8 @@ describe('Module._nodeModulePaths', function () {
it('includes paths outside of the resources path', function () { it('includes paths outside of the resources path', function () {
let modulePath = path.resolve('/foo') let modulePath = path.resolve('/foo')
assert.deepEqual(Module._nodeModulePaths(modulePath), [ assert.deepEqual(Module._nodeModulePaths(modulePath), [
path.join(modulePath, 'node_modules') path.join(modulePath, 'node_modules'),
path.resolve('/node_modules')
]) ])
}) })
}) })

View file

@ -780,25 +780,21 @@ describe('<webview> tag', function () {
describe('found-in-page event', function () { describe('found-in-page event', function () {
it('emits when a request is made', function (done) { it('emits when a request is made', function (done) {
var requestId = null let requestId = null
var totalMatches = null let activeMatchOrdinal = []
var activeMatchOrdinal = [] const listener = function (e) {
var listener = function (e) {
assert.equal(e.result.requestId, requestId) assert.equal(e.result.requestId, requestId)
if (e.result.finalUpdate) { assert.equal(e.result.matches, 3)
assert.equal(e.result.matches, 3) activeMatchOrdinal.push(e.result.activeMatchOrdinal)
totalMatches = e.result.matches if (e.result.activeMatchOrdinal === e.result.matches) {
listener2() assert.deepEqual(activeMatchOrdinal, [1, 2, 3])
webview.stopFindInPage('clearSelection')
done()
} else { } else {
activeMatchOrdinal.push(e.result.activeMatchOrdinal) listener2()
if (e.result.activeMatchOrdinal === totalMatches) {
assert.deepEqual(activeMatchOrdinal, [1, 2, 3])
webview.stopFindInPage('clearSelection')
done()
}
} }
} }
var listener2 = function () { const listener2 = function () {
requestId = webview.findInPage('virtual') requestId = webview.findInPage('virtual')
} }
webview.addEventListener('found-in-page', listener) webview.addEventListener('found-in-page', listener)

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit 554946c7873bbc6930779c871fe230856575049a Subproject commit 84f6d52b7893dbd44fa7d09ac19f2664669aaec6

2
vendor/node vendored

@ -1 +1 @@
Subproject commit ee8c429deaee0adeeef069c3ad34c0defe53a567 Subproject commit 219cca155dfd97312693c73e5b429bb2f8bc0063