commit
c497eef3b3
55 changed files with 369 additions and 159 deletions
15
atom.gyp
15
atom.gyp
|
@ -65,6 +65,8 @@
|
||||||
'atom/app/atom_main_delegate.cc',
|
'atom/app/atom_main_delegate.cc',
|
||||||
'atom/app/atom_main_delegate.h',
|
'atom/app/atom_main_delegate.h',
|
||||||
'atom/app/atom_main_delegate_mac.mm',
|
'atom/app/atom_main_delegate_mac.mm',
|
||||||
|
'atom/app/node_main.cc',
|
||||||
|
'atom/app/node_main.h',
|
||||||
'atom/browser/api/atom_api_app.cc',
|
'atom/browser/api/atom_api_app.cc',
|
||||||
'atom/browser/api/atom_api_app.h',
|
'atom/browser/api/atom_api_app.h',
|
||||||
'atom/browser/api/atom_api_auto_updater.cc',
|
'atom/browser/api/atom_api_auto_updater.cc',
|
||||||
|
@ -114,6 +116,8 @@
|
||||||
'atom/browser/atom_browser_main_parts_mac.mm',
|
'atom/browser/atom_browser_main_parts_mac.mm',
|
||||||
'atom/browser/atom_javascript_dialog_manager.cc',
|
'atom/browser/atom_javascript_dialog_manager.cc',
|
||||||
'atom/browser/atom_javascript_dialog_manager.h',
|
'atom/browser/atom_javascript_dialog_manager.h',
|
||||||
|
'atom/browser/atom_resource_dispatcher_host_delegate.cc',
|
||||||
|
'atom/browser/atom_resource_dispatcher_host_delegate.h',
|
||||||
'atom/browser/atom_speech_recognition_manager_delegate.cc',
|
'atom/browser/atom_speech_recognition_manager_delegate.cc',
|
||||||
'atom/browser/atom_speech_recognition_manager_delegate.h',
|
'atom/browser/atom_speech_recognition_manager_delegate.h',
|
||||||
'atom/browser/browser.cc',
|
'atom/browser/browser.cc',
|
||||||
|
@ -277,6 +281,8 @@
|
||||||
'atom/renderer/atom_render_view_observer.h',
|
'atom/renderer/atom_render_view_observer.h',
|
||||||
'atom/renderer/atom_renderer_client.cc',
|
'atom/renderer/atom_renderer_client.cc',
|
||||||
'atom/renderer/atom_renderer_client.h',
|
'atom/renderer/atom_renderer_client.h',
|
||||||
|
'atom/renderer/guest_view_container.cc',
|
||||||
|
'atom/renderer/guest_view_container.h',
|
||||||
'chromium_src/chrome/browser/browser_process.cc',
|
'chromium_src/chrome/browser/browser_process.cc',
|
||||||
'chromium_src/chrome/browser/browser_process.h',
|
'chromium_src/chrome/browser/browser_process.h',
|
||||||
'chromium_src/chrome/browser/chrome_notification_types.h',
|
'chromium_src/chrome/browser/chrome_notification_types.h',
|
||||||
|
@ -492,6 +498,8 @@
|
||||||
'<(libchromiumcontent_resources_dir)/content_resources_200_percent.pak',
|
'<(libchromiumcontent_resources_dir)/content_resources_200_percent.pak',
|
||||||
'<(libchromiumcontent_resources_dir)/content_shell.pak',
|
'<(libchromiumcontent_resources_dir)/content_shell.pak',
|
||||||
'<(libchromiumcontent_resources_dir)/ui_resources_200_percent.pak',
|
'<(libchromiumcontent_resources_dir)/ui_resources_200_percent.pak',
|
||||||
|
'<(libchromiumcontent_resources_dir)/natives_blob.bin',
|
||||||
|
'<(libchromiumcontent_resources_dir)/snapshot_blob.bin',
|
||||||
'external_binaries/d3dcompiler_46.dll',
|
'external_binaries/d3dcompiler_46.dll',
|
||||||
'external_binaries/msvcp120.dll',
|
'external_binaries/msvcp120.dll',
|
||||||
'external_binaries/msvcr120.dll',
|
'external_binaries/msvcr120.dll',
|
||||||
|
@ -516,6 +524,8 @@
|
||||||
'<(libchromiumcontent_library_dir)/libffmpegsumo.so',
|
'<(libchromiumcontent_library_dir)/libffmpegsumo.so',
|
||||||
'<(libchromiumcontent_resources_dir)/icudtl.dat',
|
'<(libchromiumcontent_resources_dir)/icudtl.dat',
|
||||||
'<(libchromiumcontent_resources_dir)/content_shell.pak',
|
'<(libchromiumcontent_resources_dir)/content_shell.pak',
|
||||||
|
'<(libchromiumcontent_resources_dir)/natives_blob.bin',
|
||||||
|
'<(libchromiumcontent_resources_dir)/snapshot_blob.bin',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -542,6 +552,9 @@
|
||||||
'SK_SUPPORT_LEGACY_GETTOPDEVICE',
|
'SK_SUPPORT_LEGACY_GETTOPDEVICE',
|
||||||
# Disable warnings for g_settings_list_schemas.
|
# Disable warnings for g_settings_list_schemas.
|
||||||
'GLIB_DISABLE_DEPRECATION_WARNINGS',
|
'GLIB_DISABLE_DEPRECATION_WARNINGS',
|
||||||
|
# Defined in Chromium but not exposed in its gyp file.
|
||||||
|
'V8_USE_EXTERNAL_STARTUP_DATA',
|
||||||
|
'ENABLE_PLUGINS',
|
||||||
],
|
],
|
||||||
'sources': [
|
'sources': [
|
||||||
'<@(lib_sources)',
|
'<@(lib_sources)',
|
||||||
|
@ -844,6 +857,8 @@
|
||||||
'atom/common/resources/mac/MainMenu.xib',
|
'atom/common/resources/mac/MainMenu.xib',
|
||||||
'<(libchromiumcontent_resources_dir)/content_shell.pak',
|
'<(libchromiumcontent_resources_dir)/content_shell.pak',
|
||||||
'<(libchromiumcontent_resources_dir)/icudtl.dat',
|
'<(libchromiumcontent_resources_dir)/icudtl.dat',
|
||||||
|
'<(libchromiumcontent_resources_dir)/natives_blob.bin',
|
||||||
|
'<(libchromiumcontent_resources_dir)/snapshot_blob.bin',
|
||||||
],
|
],
|
||||||
'xcode_settings': {
|
'xcode_settings': {
|
||||||
'INFOPLIST_FILE': 'atom/common/resources/mac/Info.plist',
|
'INFOPLIST_FILE': 'atom/common/resources/mac/Info.plist',
|
||||||
|
|
|
@ -13,7 +13,7 @@ __attribute__((visibility("default")))
|
||||||
int AtomMain(int argc, const char* argv[]);
|
int AtomMain(int argc, const char* argv[]);
|
||||||
|
|
||||||
__attribute__((visibility("default")))
|
__attribute__((visibility("default")))
|
||||||
void AtomInitializeICU();
|
int AtomInitializeICUandStartNode(int argc, char *argv[]);
|
||||||
}
|
}
|
||||||
#endif // OS_MACOSX
|
#endif // OS_MACOSX
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "atom/app/atom_library_main.h"
|
#include "atom/app/atom_library_main.h"
|
||||||
|
|
||||||
#include "atom/app/atom_main_delegate.h"
|
#include "atom/app/atom_main_delegate.h"
|
||||||
|
#include "atom/app/node_main.h"
|
||||||
|
#include "base/at_exit.h"
|
||||||
#include "base/i18n/icu_util.h"
|
#include "base/i18n/icu_util.h"
|
||||||
#include "base/mac/bundle_locations.h"
|
#include "base/mac/bundle_locations.h"
|
||||||
#include "brightray/common/mac/main_application_bundle.h"
|
#include "brightray/common/mac/main_application_bundle.h"
|
||||||
|
@ -19,12 +21,14 @@ int AtomMain(int argc, const char* argv[]) {
|
||||||
return content::ContentMain(params);
|
return content::ContentMain(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomInitializeICU() {
|
int AtomInitializeICUandStartNode(int argc, char *argv[]) {
|
||||||
|
base::AtExitManager atexit_manager;
|
||||||
base::mac::SetOverrideFrameworkBundlePath(
|
base::mac::SetOverrideFrameworkBundlePath(
|
||||||
brightray::MainApplicationBundlePath()
|
brightray::MainApplicationBundlePath()
|
||||||
.Append("Contents")
|
.Append("Contents")
|
||||||
.Append("Frameworks")
|
.Append("Frameworks")
|
||||||
.Append(PRODUCT_NAME " Framework.framework"));
|
.Append(PRODUCT_NAME " Framework.framework"));
|
||||||
base::i18n::InitializeICU();
|
base::i18n::InitializeICU();
|
||||||
|
return atom::NodeMain(argc, argv);
|
||||||
}
|
}
|
||||||
#endif // OS_MACOSX
|
#endif // OS_MACOSX
|
||||||
|
|
|
@ -31,13 +31,9 @@
|
||||||
#include "atom/app/atom_library_main.h"
|
#include "atom/app/atom_library_main.h"
|
||||||
#endif // defined(OS_MACOSX)
|
#endif // defined(OS_MACOSX)
|
||||||
|
|
||||||
|
#include "atom/app/node_main.h"
|
||||||
#include "base/i18n/icu_util.h"
|
#include "base/i18n/icu_util.h"
|
||||||
|
|
||||||
// Declaration of node::Start.
|
|
||||||
namespace node {
|
|
||||||
int Start(int argc, char *argv[]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -137,7 +133,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
|
||||||
}
|
}
|
||||||
// Now that conversion is done, we can finally start.
|
// Now that conversion is done, we can finally start.
|
||||||
base::i18n::InitializeICU();
|
base::i18n::InitializeICU();
|
||||||
return node::Start(argc, argv);
|
return atom::NodeMain(argc, argv);
|
||||||
} else if (env->GetVar("ATOM_SHELL_INTERNAL_CRASH_SERVICE",
|
} else if (env->GetVar("ATOM_SHELL_INTERNAL_CRASH_SERVICE",
|
||||||
&crash_service_indicator) &&
|
&crash_service_indicator) &&
|
||||||
crash_service_indicator == "1") {
|
crash_service_indicator == "1") {
|
||||||
|
@ -166,7 +162,7 @@ int main(int argc, const char* argv[]) {
|
||||||
char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE");
|
char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE");
|
||||||
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0) {
|
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0) {
|
||||||
base::i18n::InitializeICU();
|
base::i18n::InitializeICU();
|
||||||
return node::Start(argc, const_cast<char**>(argv));
|
return atom::NodeMain(argc, const_cast<char**>(argv));
|
||||||
}
|
}
|
||||||
|
|
||||||
atom::AtomMainDelegate delegate;
|
atom::AtomMainDelegate delegate;
|
||||||
|
@ -181,8 +177,7 @@ int main(int argc, const char* argv[]) {
|
||||||
int main(int argc, const char* argv[]) {
|
int main(int argc, const char* argv[]) {
|
||||||
char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE");
|
char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE");
|
||||||
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0) {
|
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0) {
|
||||||
AtomInitializeICU();
|
return AtomInitializeICUandStartNode(argc, const_cast<char**>(argv));
|
||||||
return node::Start(argc, const_cast<char**>(argv));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return AtomMain(argc, argv);
|
return AtomMain(argc, argv);
|
||||||
|
|
|
@ -59,7 +59,7 @@ void AtomMainDelegate::PreSandboxStartup() {
|
||||||
if (!env->HasVar("GOOGLE_API_KEY"))
|
if (!env->HasVar("GOOGLE_API_KEY"))
|
||||||
env->SetVar("GOOGLE_API_KEY", GOOGLEAPIS_API_KEY);
|
env->SetVar("GOOGLE_API_KEY", GOOGLEAPIS_API_KEY);
|
||||||
|
|
||||||
CommandLine* command_line = CommandLine::ForCurrentProcess();
|
auto command_line = base::CommandLine::ForCurrentProcess();
|
||||||
std::string process_type = command_line->GetSwitchValueASCII(
|
std::string process_type = command_line->GetSwitchValueASCII(
|
||||||
switches::kProcessType);
|
switches::kProcessType);
|
||||||
|
|
||||||
|
|
56
atom/app/node_main.cc
Normal file
56
atom/app/node_main.cc
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
// Copyright (c) 2015 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "atom/app/node_main.h"
|
||||||
|
|
||||||
|
#include "atom/browser/javascript_environment.h"
|
||||||
|
#include "atom/common/node_includes.h"
|
||||||
|
#include "gin/array_buffer.h"
|
||||||
|
#include "gin/public/isolate_holder.h"
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
int NodeMain(int argc, char *argv[]) {
|
||||||
|
argv = uv_setup_args(argc, argv);
|
||||||
|
int exec_argc;
|
||||||
|
const char** exec_argv;
|
||||||
|
node::Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
|
||||||
|
|
||||||
|
int exit_code = 1;
|
||||||
|
{
|
||||||
|
gin::IsolateHolder::LoadV8Snapshot();
|
||||||
|
gin::IsolateHolder::Initialize(
|
||||||
|
gin::IsolateHolder::kNonStrictMode,
|
||||||
|
gin::ArrayBufferAllocator::SharedInstance());
|
||||||
|
|
||||||
|
JavascriptEnvironment gin_env;
|
||||||
|
node::Environment* env = node::CreateEnvironment(
|
||||||
|
gin_env.isolate(), gin_env.context(), argc, argv, exec_argc, exec_argv);
|
||||||
|
|
||||||
|
bool more;
|
||||||
|
do {
|
||||||
|
more = uv_run(env->event_loop(), UV_RUN_ONCE);
|
||||||
|
if (more == false) {
|
||||||
|
node::EmitBeforeExit(env);
|
||||||
|
|
||||||
|
// Emit `beforeExit` if the loop became alive either after emitting
|
||||||
|
// event, or after running some callbacks.
|
||||||
|
more = uv_loop_alive(env->event_loop());
|
||||||
|
if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
|
||||||
|
more = true;
|
||||||
|
}
|
||||||
|
} while (more == true);
|
||||||
|
|
||||||
|
exit_code = node::EmitExit(env);
|
||||||
|
node::RunAtExit(env);
|
||||||
|
|
||||||
|
env->Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
v8::V8::Dispose();
|
||||||
|
|
||||||
|
return exit_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace atom
|
14
atom/app/node_main.h
Normal file
14
atom/app/node_main.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright (c) 2015 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef ATOM_APP_NODE_MAIN_H_
|
||||||
|
#define ATOM_APP_NODE_MAIN_H_
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
int NodeMain(int argc, char *argv[]);
|
||||||
|
|
||||||
|
} // namespace atom
|
||||||
|
|
||||||
|
#endif // ATOM_APP_NODE_MAIN_H_
|
|
@ -238,11 +238,12 @@ mate::Handle<App> App::Create(v8::Isolate* isolate) {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void AppendSwitch(const std::string& switch_string, mate::Arguments* args) {
|
void AppendSwitch(const std::string& switch_string, mate::Arguments* args) {
|
||||||
|
auto command_line = base::CommandLine::ForCurrentProcess();
|
||||||
std::string value;
|
std::string value;
|
||||||
if (args->GetNext(&value))
|
if (args->GetNext(&value))
|
||||||
CommandLine::ForCurrentProcess()->AppendSwitchASCII(switch_string, value);
|
command_line->AppendSwitchASCII(switch_string, value);
|
||||||
else
|
else
|
||||||
CommandLine::ForCurrentProcess()->AppendSwitch(switch_string);
|
command_line->AppendSwitch(switch_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
|
@ -263,13 +264,13 @@ void DockSetMenu(atom::api::Menu* menu) {
|
||||||
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
|
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
|
||||||
v8::Handle<v8::Context> context, void* priv) {
|
v8::Handle<v8::Context> context, void* priv) {
|
||||||
v8::Isolate* isolate = context->GetIsolate();
|
v8::Isolate* isolate = context->GetIsolate();
|
||||||
CommandLine* command_line = CommandLine::ForCurrentProcess();
|
auto command_line = base::CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
mate::Dictionary dict(isolate, exports);
|
mate::Dictionary dict(isolate, exports);
|
||||||
dict.Set("app", atom::api::App::Create(isolate));
|
dict.Set("app", atom::api::App::Create(isolate));
|
||||||
dict.SetMethod("appendSwitch", &AppendSwitch);
|
dict.SetMethod("appendSwitch", &AppendSwitch);
|
||||||
dict.SetMethod("appendArgument",
|
dict.SetMethod("appendArgument",
|
||||||
base::Bind(&CommandLine::AppendArg,
|
base::Bind(&base::CommandLine::AppendArg,
|
||||||
base::Unretained(command_line)));
|
base::Unretained(command_line)));
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
auto browser = base::Unretained(Browser::Get());
|
auto browser = base::Unretained(Browser::Get());
|
||||||
|
|
|
@ -62,31 +62,26 @@ namespace {
|
||||||
|
|
||||||
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
|
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
|
||||||
v8::Handle<v8::Context> context, void* priv) {
|
v8::Handle<v8::Context> context, void* priv) {
|
||||||
TracingController* controller = TracingController::GetInstance();
|
auto controller = base::Unretained(TracingController::GetInstance());
|
||||||
mate::Dictionary dict(context->GetIsolate(), exports);
|
mate::Dictionary dict(context->GetIsolate(), exports);
|
||||||
dict.SetMethod("getCategories", base::Bind(
|
dict.SetMethod("getCategories", base::Bind(
|
||||||
&TracingController::GetCategories, base::Unretained(controller)));
|
&TracingController::GetCategories, controller));
|
||||||
dict.SetMethod("startRecording", base::Bind(
|
dict.SetMethod("startRecording", base::Bind(
|
||||||
&TracingController::EnableRecording, base::Unretained(controller)));
|
&TracingController::EnableRecording, controller));
|
||||||
dict.SetMethod("stopRecording", base::Bind(
|
dict.SetMethod("stopRecording", base::Bind(
|
||||||
&TracingController::DisableRecording,
|
&TracingController::DisableRecording, controller, nullptr));
|
||||||
base::Unretained(controller),
|
|
||||||
nullptr));
|
|
||||||
dict.SetMethod("startMonitoring", base::Bind(
|
dict.SetMethod("startMonitoring", base::Bind(
|
||||||
&TracingController::EnableMonitoring, base::Unretained(controller)));
|
&TracingController::EnableMonitoring, controller));
|
||||||
dict.SetMethod("stopMonitoring", base::Bind(
|
dict.SetMethod("stopMonitoring", base::Bind(
|
||||||
&TracingController::DisableMonitoring, base::Unretained(controller)));
|
&TracingController::DisableMonitoring, controller));
|
||||||
dict.SetMethod("captureMonitoringSnapshot", base::Bind(
|
dict.SetMethod("captureMonitoringSnapshot", base::Bind(
|
||||||
&TracingController::CaptureMonitoringSnapshot,
|
&TracingController::CaptureMonitoringSnapshot, controller, nullptr));
|
||||||
base::Unretained(controller),
|
dict.SetMethod("getTraceBufferUsage", base::Bind(
|
||||||
nullptr));
|
&TracingController::GetTraceBufferUsage, controller));
|
||||||
dict.SetMethod("getTraceBufferPercentFull", base::Bind(
|
|
||||||
&TracingController::GetTraceBufferPercentFull,
|
|
||||||
base::Unretained(controller)));
|
|
||||||
dict.SetMethod("setWatchEvent", base::Bind(
|
dict.SetMethod("setWatchEvent", base::Bind(
|
||||||
&TracingController::SetWatchEvent, base::Unretained(controller)));
|
&TracingController::SetWatchEvent, controller));
|
||||||
dict.SetMethod("cancelWatchEvent", base::Bind(
|
dict.SetMethod("cancelWatchEvent", base::Bind(
|
||||||
&TracingController::CancelWatchEvent, base::Unretained(controller)));
|
&TracingController::CancelWatchEvent, controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -56,6 +56,7 @@ WebContents::WebContents(content::WebContents* web_contents)
|
||||||
guest_instance_id_(-1),
|
guest_instance_id_(-1),
|
||||||
element_instance_id_(-1),
|
element_instance_id_(-1),
|
||||||
guest_opaque_(true),
|
guest_opaque_(true),
|
||||||
|
guest_sizer_(nullptr),
|
||||||
auto_size_enabled_(false) {
|
auto_size_enabled_(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +64,7 @@ WebContents::WebContents(const mate::Dictionary& options)
|
||||||
: guest_instance_id_(-1),
|
: guest_instance_id_(-1),
|
||||||
element_instance_id_(-1),
|
element_instance_id_(-1),
|
||||||
guest_opaque_(true),
|
guest_opaque_(true),
|
||||||
|
guest_sizer_(nullptr),
|
||||||
auto_size_enabled_(false) {
|
auto_size_enabled_(false) {
|
||||||
options.Get("guestInstanceId", &guest_instance_id_);
|
options.Get("guestInstanceId", &guest_instance_id_);
|
||||||
|
|
||||||
|
@ -96,6 +98,7 @@ bool WebContents::AddMessageToConsole(content::WebContents* source,
|
||||||
bool WebContents::ShouldCreateWebContents(
|
bool WebContents::ShouldCreateWebContents(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
int route_id,
|
int route_id,
|
||||||
|
int main_frame_route_id,
|
||||||
WindowContainerType window_container_type,
|
WindowContainerType window_container_type,
|
||||||
const base::string16& frame_name,
|
const base::string16& frame_name,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
|
@ -222,7 +225,7 @@ void WebContents::DidStopLoading(content::RenderViewHost* render_view_host) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::DidGetRedirectForResourceRequest(
|
void WebContents::DidGetRedirectForResourceRequest(
|
||||||
content::RenderViewHost* render_view_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const content::ResourceRedirectDetails& details) {
|
const content::ResourceRedirectDetails& details) {
|
||||||
Emit("did-get-redirect-request",
|
Emit("did-get-redirect-request",
|
||||||
details.url,
|
details.url,
|
||||||
|
@ -284,9 +287,16 @@ void WebContents::DidAttach(int guest_proxy_routing_id) {
|
||||||
Emit("did-attach");
|
Emit("did-attach");
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::ElementSizeChanged(const gfx::Size& old_size,
|
void WebContents::ElementSizeChanged(const gfx::Size& size) {
|
||||||
const gfx::Size& new_size) {
|
element_size_ = size;
|
||||||
element_size_ = new_size;
|
|
||||||
|
// Only resize if needed.
|
||||||
|
if (!size.IsEmpty())
|
||||||
|
guest_sizer_->SizeContents(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
content::WebContents* WebContents::GetOwnerWebContents() const {
|
||||||
|
return embedder_web_contents_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::GuestSizeChanged(const gfx::Size& old_size,
|
void WebContents::GuestSizeChanged(const gfx::Size& old_size,
|
||||||
|
@ -302,10 +312,15 @@ void WebContents::RegisterDestructionCallback(
|
||||||
destruction_callback_ = callback;
|
destruction_callback_ = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebContents::SetGuestSizer(content::GuestSizer* guest_sizer) {
|
||||||
|
guest_sizer_ = guest_sizer;
|
||||||
|
}
|
||||||
|
|
||||||
void WebContents::WillAttach(content::WebContents* embedder_web_contents,
|
void WebContents::WillAttach(content::WebContents* embedder_web_contents,
|
||||||
int browser_plugin_instance_id) {
|
int element_instance_id,
|
||||||
|
bool is_full_page_plugin) {
|
||||||
embedder_web_contents_ = embedder_web_contents;
|
embedder_web_contents_ = embedder_web_contents;
|
||||||
element_instance_id_ = browser_plugin_instance_id;
|
element_instance_id_ = element_instance_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::Destroy() {
|
void WebContents::Destroy() {
|
||||||
|
|
|
@ -120,6 +120,7 @@ class WebContents : public mate::EventEmitter,
|
||||||
bool ShouldCreateWebContents(
|
bool ShouldCreateWebContents(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
int route_id,
|
int route_id,
|
||||||
|
int main_frame_route_id,
|
||||||
WindowContainerType window_container_type,
|
WindowContainerType window_container_type,
|
||||||
const base::string16& frame_name,
|
const base::string16& frame_name,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
|
@ -161,7 +162,7 @@ class WebContents : public mate::EventEmitter,
|
||||||
void DidStartLoading(content::RenderViewHost* render_view_host) override;
|
void DidStartLoading(content::RenderViewHost* render_view_host) override;
|
||||||
void DidStopLoading(content::RenderViewHost* render_view_host) override;
|
void DidStopLoading(content::RenderViewHost* render_view_host) override;
|
||||||
void DidGetRedirectForResourceRequest(
|
void DidGetRedirectForResourceRequest(
|
||||||
content::RenderViewHost* render_view_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const content::ResourceRedirectDetails& details) override;
|
const content::ResourceRedirectDetails& details) override;
|
||||||
void DidNavigateMainFrame(
|
void DidNavigateMainFrame(
|
||||||
const content::LoadCommittedDetails& details,
|
const content::LoadCommittedDetails& details,
|
||||||
|
@ -174,13 +175,15 @@ class WebContents : public mate::EventEmitter,
|
||||||
|
|
||||||
// content::BrowserPluginGuestDelegate:
|
// content::BrowserPluginGuestDelegate:
|
||||||
void DidAttach(int guest_proxy_routing_id) final;
|
void DidAttach(int guest_proxy_routing_id) final;
|
||||||
void ElementSizeChanged(const gfx::Size& old_size,
|
void ElementSizeChanged(const gfx::Size& size) final;
|
||||||
const gfx::Size& new_size) final;
|
content::WebContents* GetOwnerWebContents() const final;
|
||||||
void GuestSizeChanged(const gfx::Size& old_size,
|
void GuestSizeChanged(const gfx::Size& old_size,
|
||||||
const gfx::Size& new_size) final;
|
const gfx::Size& new_size) final;
|
||||||
void RegisterDestructionCallback(const DestructionCallback& callback) final;
|
void RegisterDestructionCallback(const DestructionCallback& callback) final;
|
||||||
|
void SetGuestSizer(content::GuestSizer* guest_sizer) final;
|
||||||
void WillAttach(content::WebContents* embedder_web_contents,
|
void WillAttach(content::WebContents* embedder_web_contents,
|
||||||
int browser_plugin_instance_id) final;
|
int element_instance_id,
|
||||||
|
bool is_full_page_plugin) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Called when received a message from renderer.
|
// Called when received a message from renderer.
|
||||||
|
@ -222,6 +225,9 @@ class WebContents : public mate::EventEmitter,
|
||||||
// element may not match the size of the guest.
|
// element may not match the size of the guest.
|
||||||
gfx::Size guest_size_;
|
gfx::Size guest_size_;
|
||||||
|
|
||||||
|
// A pointer to the guest_sizer.
|
||||||
|
content::GuestSizer* guest_sizer_;
|
||||||
|
|
||||||
// Indicates whether autosize mode is enabled or not.
|
// Indicates whether autosize mode is enabled or not.
|
||||||
bool auto_size_enabled_;
|
bool auto_size_enabled_;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "atom/browser/atom_access_token_store.h"
|
#include "atom/browser/atom_access_token_store.h"
|
||||||
#include "atom/browser/atom_browser_context.h"
|
#include "atom/browser/atom_browser_context.h"
|
||||||
#include "atom/browser/atom_browser_main_parts.h"
|
#include "atom/browser/atom_browser_main_parts.h"
|
||||||
|
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
|
||||||
#include "atom/browser/atom_speech_recognition_manager_delegate.h"
|
#include "atom/browser/atom_speech_recognition_manager_delegate.h"
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
#include "atom/browser/web_view_manager.h"
|
#include "atom/browser/web_view_manager.h"
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
#include "chrome/browser/speech/tts_message_filter.h"
|
#include "chrome/browser/speech/tts_message_filter.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/site_instance.h"
|
#include "content/public/browser/site_instance.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/common/web_preferences.h"
|
#include "content/public/common/web_preferences.h"
|
||||||
|
@ -61,7 +63,7 @@ void AtomBrowserClient::RenderProcessWillLaunch(
|
||||||
}
|
}
|
||||||
|
|
||||||
content::SpeechRecognitionManagerDelegate*
|
content::SpeechRecognitionManagerDelegate*
|
||||||
AtomBrowserClient::GetSpeechRecognitionManagerDelegate() {
|
AtomBrowserClient::CreateSpeechRecognitionManagerDelegate() {
|
||||||
return new AtomSpeechRecognitionManagerDelegate;
|
return new AtomSpeechRecognitionManagerDelegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +71,12 @@ content::AccessTokenStore* AtomBrowserClient::CreateAccessTokenStore() {
|
||||||
return new AtomAccessTokenStore;
|
return new AtomAccessTokenStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtomBrowserClient::ResourceDispatcherHostCreated() {
|
||||||
|
resource_dispatcher_delegate_.reset(new AtomResourceDispatcherHostDelegate);
|
||||||
|
content::ResourceDispatcherHost::Get()->SetDelegate(
|
||||||
|
resource_dispatcher_delegate_.get());
|
||||||
|
}
|
||||||
|
|
||||||
void AtomBrowserClient::OverrideWebkitPrefs(
|
void AtomBrowserClient::OverrideWebkitPrefs(
|
||||||
content::RenderViewHost* render_view_host,
|
content::RenderViewHost* render_view_host,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
class AtomResourceDispatcherHostDelegate;
|
||||||
|
|
||||||
class AtomBrowserClient : public brightray::BrowserClient {
|
class AtomBrowserClient : public brightray::BrowserClient {
|
||||||
public:
|
public:
|
||||||
AtomBrowserClient();
|
AtomBrowserClient();
|
||||||
|
@ -20,8 +22,9 @@ class AtomBrowserClient : public brightray::BrowserClient {
|
||||||
// content::ContentBrowserClient:
|
// content::ContentBrowserClient:
|
||||||
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
|
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
|
||||||
content::SpeechRecognitionManagerDelegate*
|
content::SpeechRecognitionManagerDelegate*
|
||||||
GetSpeechRecognitionManagerDelegate() override;
|
CreateSpeechRecognitionManagerDelegate() override;
|
||||||
content::AccessTokenStore* CreateAccessTokenStore() override;
|
content::AccessTokenStore* CreateAccessTokenStore() override;
|
||||||
|
void ResourceDispatcherHostCreated() override;
|
||||||
void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
|
void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::WebPreferences* prefs) override;
|
content::WebPreferences* prefs) override;
|
||||||
|
@ -37,6 +40,8 @@ class AtomBrowserClient : public brightray::BrowserClient {
|
||||||
brightray::BrowserMainParts* OverrideCreateBrowserMainParts(
|
brightray::BrowserMainParts* OverrideCreateBrowserMainParts(
|
||||||
const content::MainFunctionParams&) override;
|
const content::MainFunctionParams&) override;
|
||||||
|
|
||||||
|
scoped_ptr<AtomResourceDispatcherHostDelegate> resource_dispatcher_delegate_;
|
||||||
|
|
||||||
// The render process which would be swapped out soon.
|
// The render process which would be swapped out soon.
|
||||||
content::RenderProcessHost* dying_render_process_;
|
content::RenderProcessHost* dying_render_process_;
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
|
||||||
brightray::BrowserMainParts::PreMainMessageLoopRun();
|
brightray::BrowserMainParts::PreMainMessageLoopRun();
|
||||||
|
|
||||||
#if defined(USE_X11)
|
#if defined(USE_X11)
|
||||||
libgtk2ui::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess());
|
libgtk2ui::GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OS_MACOSX)
|
#if !defined(OS_MACOSX)
|
||||||
|
|
33
atom/browser/atom_resource_dispatcher_host_delegate.cc
Normal file
33
atom/browser/atom_resource_dispatcher_host_delegate.cc
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "base/logging.h"
|
||||||
|
#include "content/public/browser/render_frame_host.h"
|
||||||
|
#include "content/public/browser/resource_request_info.h"
|
||||||
|
#include "net/http/http_response_headers.h"
|
||||||
|
#include "net/url_request/url_request.h"
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
AtomResourceDispatcherHostDelegate::AtomResourceDispatcherHostDelegate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void AtomResourceDispatcherHostDelegate::OnResponseStarted(
|
||||||
|
net::URLRequest* request,
|
||||||
|
content::ResourceContext* resource_context,
|
||||||
|
content::ResourceResponse* response,
|
||||||
|
IPC::Sender* sender) {
|
||||||
|
// Remove the "X-Frame-Options" from response headers for devtools.
|
||||||
|
if (request->url().SchemeIs("chrome-devtools")) {
|
||||||
|
net::HttpResponseHeaders* response_headers = request->response_headers();
|
||||||
|
if (response_headers && response_headers->HasHeader("x-frame-options"))
|
||||||
|
response_headers->RemoveHeader("x-frame-options");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace atom
|
30
atom/browser/atom_resource_dispatcher_host_delegate.h
Normal file
30
atom/browser/atom_resource_dispatcher_host_delegate.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|
||||||
|
#define ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|
||||||
|
|
||||||
|
#include "base/compiler_specific.h"
|
||||||
|
#include "content/public/browser/resource_dispatcher_host_delegate.h"
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
class AtomResourceDispatcherHostDelegate
|
||||||
|
: public content::ResourceDispatcherHostDelegate {
|
||||||
|
public:
|
||||||
|
AtomResourceDispatcherHostDelegate();
|
||||||
|
|
||||||
|
// content::ResourceDispatcherHostDelegate:
|
||||||
|
void OnResponseStarted(net::URLRequest* request,
|
||||||
|
content::ResourceContext* resource_context,
|
||||||
|
content::ResourceResponse* response,
|
||||||
|
IPC::Sender* sender) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(AtomResourceDispatcherHostDelegate);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace atom
|
||||||
|
|
||||||
|
#endif // ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|
|
@ -74,7 +74,7 @@ app.once 'ready', ->
|
||||||
return new protocol.RequestFileJob(path.join(directory, parsed.path))
|
return new protocol.RequestFileJob(path.join(directory, parsed.path))
|
||||||
|
|
||||||
BrowserWindow::_loadDevToolsExtensions = (extensionInfoArray) ->
|
BrowserWindow::_loadDevToolsExtensions = (extensionInfoArray) ->
|
||||||
@devToolsWebContents?.executeJavaScript "WebInspector.addExtensions(#{JSON.stringify(extensionInfoArray)});"
|
@devToolsWebContents?.executeJavaScript "DevToolsAPI.addExtensions(#{JSON.stringify(extensionInfoArray)});"
|
||||||
|
|
||||||
BrowserWindow.addDevToolsExtension = (srcDirectory) ->
|
BrowserWindow.addDevToolsExtension = (srcDirectory) ->
|
||||||
extensionInfo = getExtensionInfoFromPath srcDirectory
|
extensionInfo = getExtensionInfoFromPath srcDirectory
|
||||||
|
|
|
@ -52,10 +52,10 @@
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "ui/gfx/codec/png_codec.h"
|
#include "ui/gfx/codec/png_codec.h"
|
||||||
#include "ui/gfx/geometry/size_conversions.h"
|
#include "ui/gfx/geometry/size_conversions.h"
|
||||||
#include "ui/gfx/point.h"
|
#include "ui/gfx/geometry/point.h"
|
||||||
#include "ui/gfx/rect.h"
|
#include "ui/gfx/geometry/rect.h"
|
||||||
#include "ui/gfx/screen.h"
|
#include "ui/gfx/screen.h"
|
||||||
#include "ui/gfx/size.h"
|
#include "ui/gfx/geometry/size.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "ui/gfx/switches.h"
|
#include "ui/gfx/switches.h"
|
||||||
|
@ -77,7 +77,6 @@ namespace {
|
||||||
const char* kWebRuntimeFeatures[] = {
|
const char* kWebRuntimeFeatures[] = {
|
||||||
switches::kExperimentalFeatures,
|
switches::kExperimentalFeatures,
|
||||||
switches::kExperimentalCanvasFeatures,
|
switches::kExperimentalCanvasFeatures,
|
||||||
switches::kSubpixelFontScaling,
|
|
||||||
switches::kOverlayScrollbars,
|
switches::kOverlayScrollbars,
|
||||||
switches::kOverlayFullscreenVideo,
|
switches::kOverlayFullscreenVideo,
|
||||||
switches::kSharedWorker,
|
switches::kSharedWorker,
|
||||||
|
@ -515,6 +514,7 @@ void NativeWindow::NotifyWindowLeaveFullScreen() {
|
||||||
bool NativeWindow::ShouldCreateWebContents(
|
bool NativeWindow::ShouldCreateWebContents(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
int route_id,
|
int route_id,
|
||||||
|
int main_frame_route_id,
|
||||||
WindowContainerType window_container_type,
|
WindowContainerType window_container_type,
|
||||||
const base::string16& frame_name,
|
const base::string16& frame_name,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
|
@ -568,7 +568,8 @@ content::WebContents* NativeWindow::OpenURLFromTab(
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
content::JavaScriptDialogManager* NativeWindow::GetJavaScriptDialogManager() {
|
content::JavaScriptDialogManager* NativeWindow::GetJavaScriptDialogManager(
|
||||||
|
content::WebContents* source) {
|
||||||
if (!dialog_manager_)
|
if (!dialog_manager_)
|
||||||
dialog_manager_.reset(new AtomJavaScriptDialogManager);
|
dialog_manager_.reset(new AtomJavaScriptDialogManager);
|
||||||
|
|
||||||
|
@ -730,7 +731,7 @@ void NativeWindow::DevToolsSaveToFile(const std::string& url,
|
||||||
base::FilePath default_path(base::FilePath::FromUTF8Unsafe(url));
|
base::FilePath default_path(base::FilePath::FromUTF8Unsafe(url));
|
||||||
if (!file_dialog::ShowSaveDialog(this, url, default_path, filters, &path)) {
|
if (!file_dialog::ShowSaveDialog(this, url, default_path, filters, &path)) {
|
||||||
base::StringValue url_value(url);
|
base::StringValue url_value(url);
|
||||||
CallDevToolsFunction("InspectorFrontendAPI.canceledSaveURL", &url_value);
|
CallDevToolsFunction("DevToolsAPI.canceledSaveURL", &url_value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -740,7 +741,7 @@ void NativeWindow::DevToolsSaveToFile(const std::string& url,
|
||||||
|
|
||||||
// Notify devtools.
|
// Notify devtools.
|
||||||
base::StringValue url_value(url);
|
base::StringValue url_value(url);
|
||||||
CallDevToolsFunction("InspectorFrontendAPI.savedURL", &url_value);
|
CallDevToolsFunction("DevToolsAPI.savedURL", &url_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::DevToolsAppendToFile(const std::string& url,
|
void NativeWindow::DevToolsAppendToFile(const std::string& url,
|
||||||
|
@ -752,7 +753,7 @@ void NativeWindow::DevToolsAppendToFile(const std::string& url,
|
||||||
|
|
||||||
// Notify devtools.
|
// Notify devtools.
|
||||||
base::StringValue url_value(url);
|
base::StringValue url_value(url);
|
||||||
CallDevToolsFunction("InspectorFrontendAPI.appendedToURL", &url_value);
|
CallDevToolsFunction("DevToolsAPI.appendedToURL", &url_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::ScheduleUnresponsiveEvent(int ms) {
|
void NativeWindow::ScheduleUnresponsiveEvent(int ms) {
|
||||||
|
@ -778,11 +779,11 @@ void NativeWindow::NotifyWindowUnresponsive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback,
|
void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback,
|
||||||
bool succeed,
|
const SkBitmap& bitmap,
|
||||||
const SkBitmap& bitmap) {
|
content::ReadbackResponse response) {
|
||||||
SkAutoLockPixels screen_capture_lock(bitmap);
|
SkAutoLockPixels screen_capture_lock(bitmap);
|
||||||
std::vector<unsigned char> data;
|
std::vector<unsigned char> data;
|
||||||
if (succeed)
|
if (response == content::READBACK_SUCCESS)
|
||||||
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &data);
|
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &data);
|
||||||
callback.Run(data);
|
callback.Run(data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "brightray/browser/inspectable_web_contents_impl.h"
|
#include "brightray/browser/inspectable_web_contents_impl.h"
|
||||||
#include "content/public/browser/notification_registrar.h"
|
#include "content/public/browser/notification_registrar.h"
|
||||||
#include "content/public/browser/notification_observer.h"
|
#include "content/public/browser/notification_observer.h"
|
||||||
|
#include "content/public/browser/readback_types.h"
|
||||||
#include "native_mate/persistent_dictionary.h"
|
#include "native_mate/persistent_dictionary.h"
|
||||||
#include "ui/gfx/image/image.h"
|
#include "ui/gfx/image/image.h"
|
||||||
|
|
||||||
|
@ -235,6 +236,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||||
bool ShouldCreateWebContents(
|
bool ShouldCreateWebContents(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
int route_id,
|
int route_id,
|
||||||
|
int main_frame_route_id,
|
||||||
WindowContainerType window_container_type,
|
WindowContainerType window_container_type,
|
||||||
const base::string16& frame_name,
|
const base::string16& frame_name,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
|
@ -243,7 +245,8 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||||
content::WebContents* OpenURLFromTab(
|
content::WebContents* OpenURLFromTab(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
const content::OpenURLParams& params) override;
|
const content::OpenURLParams& params) override;
|
||||||
content::JavaScriptDialogManager* GetJavaScriptDialogManager() override;
|
content::JavaScriptDialogManager* GetJavaScriptDialogManager(
|
||||||
|
content::WebContents* source) override;
|
||||||
void BeforeUnloadFired(content::WebContents* tab,
|
void BeforeUnloadFired(content::WebContents* tab,
|
||||||
bool proceed,
|
bool proceed,
|
||||||
bool* proceed_to_fire_unload) override;
|
bool* proceed_to_fire_unload) override;
|
||||||
|
@ -314,8 +317,8 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||||
|
|
||||||
// Called when CapturePage has done.
|
// Called when CapturePage has done.
|
||||||
void OnCapturePageDone(const CapturePageCallback& callback,
|
void OnCapturePageDone(const CapturePageCallback& callback,
|
||||||
bool succeed,
|
const SkBitmap& bitmap,
|
||||||
const SkBitmap& bitmap);
|
content::ReadbackResponse response);
|
||||||
|
|
||||||
// Notification manager.
|
// Notification manager.
|
||||||
content::NotificationRegistrar registrar_;
|
content::NotificationRegistrar registrar_;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
|
#include "base/mac/foundation_util.h"
|
||||||
#include "base/mac/mac_util.h"
|
#include "base/mac/mac_util.h"
|
||||||
#include "base/mac/scoped_cftyperef.h"
|
#include "base/mac/scoped_cftyperef.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#include "third_party/skia/include/core/SkBitmap.h"
|
#include "third_party/skia/include/core/SkBitmap.h"
|
||||||
#include "ui/gfx/icon_util.h"
|
#include "ui/gfx/icon_util.h"
|
||||||
#include "ui/gfx/image/image.h"
|
#include "ui/gfx/image/image.h"
|
||||||
#include "ui/gfx/point.h"
|
#include "ui/gfx/geometry/point.h"
|
||||||
#include "ui/gfx/rect.h"
|
#include "ui/gfx/geometry/rect.h"
|
||||||
#include "ui/views/controls/menu/menu_runner.h"
|
#include "ui/views/controls/menu/menu_runner.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
|
@ -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 "40.0.2214.91"
|
#define CHROME_VERSION_STRING "41.0.2272.76"
|
||||||
#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_
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
namespace crash_reporter {
|
namespace crash_reporter {
|
||||||
|
|
||||||
CrashReporter::CrashReporter() {
|
CrashReporter::CrashReporter() {
|
||||||
const CommandLine& command = *CommandLine::ForCurrentProcess();
|
auto cmd = base::CommandLine::ForCurrentProcess();
|
||||||
is_browser_ = command.GetSwitchValueASCII(switches::kProcessType).empty();
|
is_browser_ = cmd->GetSwitchValueASCII(switches::kProcessType).empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
CrashReporter::~CrashReporter() {
|
CrashReporter::~CrashReporter() {
|
||||||
|
|
|
@ -205,7 +205,7 @@ bool CrashService::Initialize(const base::FilePath& operating_dir,
|
||||||
// reports per day quota. Does not seem to serve any other purpose.
|
// reports per day quota. Does not seem to serve any other purpose.
|
||||||
base::FilePath checkpoint_path = operating_dir.Append(kCheckPointFile);
|
base::FilePath checkpoint_path = operating_dir.Append(kCheckPointFile);
|
||||||
|
|
||||||
CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
|
base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
base::FilePath dumps_path_to_use = dumps_path;
|
base::FilePath dumps_path_to_use = dumps_path;
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ bool GetCrashServiceDirectory(const std::wstring& application_name,
|
||||||
int Main(const wchar_t* cmd) {
|
int Main(const wchar_t* cmd) {
|
||||||
// Initialize all Chromium things.
|
// Initialize all Chromium things.
|
||||||
base::AtExitManager exit_manager;
|
base::AtExitManager exit_manager;
|
||||||
CommandLine::Init(0, NULL);
|
base::CommandLine::Init(0, NULL);
|
||||||
CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
|
base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
// Use the application's name as pipe name and output directory.
|
// Use the application's name as pipe name and output directory.
|
||||||
if (!cmd_line.HasSwitch(kApplicationName)) {
|
if (!cmd_line.HasSwitch(kApplicationName)) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#ifndef ATOM_COMMON_DRAGGABLE_REGION_H_
|
#ifndef ATOM_COMMON_DRAGGABLE_REGION_H_
|
||||||
#define ATOM_COMMON_DRAGGABLE_REGION_H_
|
#define ATOM_COMMON_DRAGGABLE_REGION_H_
|
||||||
|
|
||||||
#include "ui/gfx/rect.h"
|
#include "ui/gfx/geometry/rect.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
#include "atom/common/native_mate_converters/gfx_converter.h"
|
#include "atom/common/native_mate_converters/gfx_converter.h"
|
||||||
|
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "ui/gfx/point.h"
|
#include "ui/gfx/geometry/point.h"
|
||||||
#include "ui/gfx/rect.h"
|
#include "ui/gfx/geometry/rect.h"
|
||||||
#include "ui/gfx/screen.h"
|
#include "ui/gfx/screen.h"
|
||||||
#include "ui/gfx/size.h"
|
#include "ui/gfx/geometry/size.h"
|
||||||
|
|
||||||
namespace mate {
|
namespace mate {
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ REFERENCE_MODULE(tls_wrap);
|
||||||
REFERENCE_MODULE(tty_wrap);
|
REFERENCE_MODULE(tty_wrap);
|
||||||
REFERENCE_MODULE(udp_wrap);
|
REFERENCE_MODULE(udp_wrap);
|
||||||
REFERENCE_MODULE(uv);
|
REFERENCE_MODULE(uv);
|
||||||
|
REFERENCE_MODULE(js_stream);
|
||||||
// Atom Shell's builtin modules.
|
// Atom Shell's builtin modules.
|
||||||
REFERENCE_MODULE(atom_browser_app);
|
REFERENCE_MODULE(atom_browser_app);
|
||||||
REFERENCE_MODULE(atom_browser_auto_updater);
|
REFERENCE_MODULE(atom_browser_auto_updater);
|
||||||
|
@ -112,7 +113,8 @@ std::vector<std::string> String16VectorToStringVector(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
base::FilePath GetResourcesPath(CommandLine* command_line, bool is_browser) {
|
base::FilePath GetResourcesPath(base::CommandLine* command_line,
|
||||||
|
bool is_browser) {
|
||||||
base::FilePath exec_path(command_line->argv()[0]);
|
base::FilePath exec_path(command_line->argv()[0]);
|
||||||
PathService::Get(base::FILE_EXE, &exec_path);
|
PathService::Get(base::FILE_EXE, &exec_path);
|
||||||
base::FilePath resources_path =
|
base::FilePath resources_path =
|
||||||
|
@ -165,7 +167,7 @@ void NodeBindings::Initialize() {
|
||||||
|
|
||||||
node::Environment* NodeBindings::CreateEnvironment(
|
node::Environment* NodeBindings::CreateEnvironment(
|
||||||
v8::Handle<v8::Context> context) {
|
v8::Handle<v8::Context> context) {
|
||||||
CommandLine* command_line = CommandLine::ForCurrentProcess();
|
auto command_line = base::CommandLine::ForCurrentProcess();
|
||||||
std::vector<std::string> args =
|
std::vector<std::string> args =
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
String16VectorToStringVector(command_line->argv());
|
String16VectorToStringVector(command_line->argv());
|
||||||
|
|
|
@ -78,7 +78,6 @@ const char kType[] = "type";
|
||||||
// Web runtime features.
|
// Web runtime features.
|
||||||
const char kExperimentalFeatures[] = "experimental-features";
|
const char kExperimentalFeatures[] = "experimental-features";
|
||||||
const char kExperimentalCanvasFeatures[] = "experimental-canvas-features";
|
const char kExperimentalCanvasFeatures[] = "experimental-canvas-features";
|
||||||
const char kSubpixelFontScaling[] = "subpixel-font-scaling";
|
|
||||||
const char kOverlayScrollbars[] = "overlay-scrollbars";
|
const char kOverlayScrollbars[] = "overlay-scrollbars";
|
||||||
const char kOverlayFullscreenVideo[] = "overlay-fullscreen-video";
|
const char kOverlayFullscreenVideo[] = "overlay-fullscreen-video";
|
||||||
const char kSharedWorker[] = "shared-worker";
|
const char kSharedWorker[] = "shared-worker";
|
||||||
|
|
|
@ -44,7 +44,6 @@ extern const char kType[];
|
||||||
|
|
||||||
extern const char kExperimentalFeatures[];
|
extern const char kExperimentalFeatures[];
|
||||||
extern const char kExperimentalCanvasFeatures[];
|
extern const char kExperimentalCanvasFeatures[];
|
||||||
extern const char kSubpixelFontScaling[];
|
|
||||||
extern const char kOverlayScrollbars[];
|
extern const char kOverlayScrollbars[];
|
||||||
extern const char kOverlayFullscreenVideo[];
|
extern const char kOverlayFullscreenVideo[];
|
||||||
extern const char kSharedWorker[];
|
extern const char kSharedWorker[];
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace {
|
||||||
// is empty. This function tells if it is.
|
// is empty. This function tells if it is.
|
||||||
bool ValidateShellCommandForScheme(const std::string& scheme) {
|
bool ValidateShellCommandForScheme(const std::string& scheme) {
|
||||||
base::win::RegKey key;
|
base::win::RegKey key;
|
||||||
std::wstring registry_path = base::ASCIIToWide(scheme) +
|
base::string16 registry_path = base::ASCIIToUTF16(scheme) +
|
||||||
L"\\shell\\open\\command";
|
L"\\shell\\open\\command";
|
||||||
key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ);
|
key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ);
|
||||||
if (!key.Valid())
|
if (!key.Valid())
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -67,7 +67,7 @@ void AtomRenderViewObserver::DidCreateDocumentElement(
|
||||||
document_created_ = true;
|
document_created_ = true;
|
||||||
|
|
||||||
// Read --zoom-factor from command line.
|
// Read --zoom-factor from command line.
|
||||||
std::string zoom_factor_str = CommandLine::ForCurrentProcess()->
|
std::string zoom_factor_str = base::CommandLine::ForCurrentProcess()->
|
||||||
GetSwitchValueASCII(switches::kZoomFactor);;
|
GetSwitchValueASCII(switches::kZoomFactor);;
|
||||||
if (zoom_factor_str.empty())
|
if (zoom_factor_str.empty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "atom/common/node_bindings.h"
|
#include "atom/common/node_bindings.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 "chrome/renderer/printing/print_web_view_helper.h"
|
#include "chrome/renderer/printing/print_web_view_helper.h"
|
||||||
#include "chrome/renderer/tts_dispatcher.h"
|
#include "chrome/renderer/tts_dispatcher.h"
|
||||||
#include "content/public/common/content_constants.h"
|
#include "content/public/common/content_constants.h"
|
||||||
|
@ -149,6 +150,17 @@ bool AtomRendererClient::ShouldFork(blink::WebFrame* frame,
|
||||||
return http_method == "GET";
|
return http_method == "GET";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content::BrowserPluginDelegate* AtomRendererClient::CreateBrowserPluginDelegate(
|
||||||
|
content::RenderFrame* render_frame,
|
||||||
|
const std::string& mime_type,
|
||||||
|
const GURL& original_url) {
|
||||||
|
if (mime_type == content::kBrowserPluginMimeType) {
|
||||||
|
return new GuestViewContainer(render_frame);
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AtomRendererClient::EnableWebRuntimeFeatures() {
|
void AtomRendererClient::EnableWebRuntimeFeatures() {
|
||||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
bool b;
|
bool b;
|
||||||
|
@ -156,8 +168,6 @@ void AtomRendererClient::EnableWebRuntimeFeatures() {
|
||||||
blink::WebRuntimeFeatures::enableExperimentalFeatures(b);
|
blink::WebRuntimeFeatures::enableExperimentalFeatures(b);
|
||||||
if (IsSwitchEnabled(command_line, switches::kExperimentalCanvasFeatures, &b))
|
if (IsSwitchEnabled(command_line, switches::kExperimentalCanvasFeatures, &b))
|
||||||
blink::WebRuntimeFeatures::enableExperimentalCanvasFeatures(b);
|
blink::WebRuntimeFeatures::enableExperimentalCanvasFeatures(b);
|
||||||
if (IsSwitchEnabled(command_line, switches::kSubpixelFontScaling, &b))
|
|
||||||
blink::WebRuntimeFeatures::enableSubpixelFontScaling(b);
|
|
||||||
if (IsSwitchEnabled(command_line, switches::kOverlayScrollbars, &b))
|
if (IsSwitchEnabled(command_line, switches::kOverlayScrollbars, &b))
|
||||||
blink::WebRuntimeFeatures::enableOverlayScrollbars(b);
|
blink::WebRuntimeFeatures::enableOverlayScrollbars(b);
|
||||||
if (IsSwitchEnabled(command_line, switches::kOverlayFullscreenVideo, &b))
|
if (IsSwitchEnabled(command_line, switches::kOverlayFullscreenVideo, &b))
|
||||||
|
|
|
@ -51,6 +51,10 @@ class AtomRendererClient : public content::ContentRendererClient,
|
||||||
bool is_initial_navigation,
|
bool is_initial_navigation,
|
||||||
bool is_server_redirect,
|
bool is_server_redirect,
|
||||||
bool* send_referrer) override;
|
bool* send_referrer) override;
|
||||||
|
content::BrowserPluginDelegate* CreateBrowserPluginDelegate(
|
||||||
|
content::RenderFrame* render_frame,
|
||||||
|
const std::string& mime_type,
|
||||||
|
const GURL& original_url) override;
|
||||||
|
|
||||||
void EnableWebRuntimeFeatures();
|
void EnableWebRuntimeFeatures();
|
||||||
|
|
||||||
|
|
15
atom/renderer/guest_view_container.cc
Normal file
15
atom/renderer/guest_view_container.cc
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright (c) 2015 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "atom/renderer/guest_view_container.h"
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
GuestViewContainer::GuestViewContainer(content::RenderFrame* render_frame) {
|
||||||
|
}
|
||||||
|
|
||||||
|
GuestViewContainer::~GuestViewContainer() {
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace atom
|
24
atom/renderer/guest_view_container.h
Normal file
24
atom/renderer/guest_view_container.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (c) 2015 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
|
||||||
|
#define ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
|
||||||
|
|
||||||
|
#include "content/public/renderer/browser_plugin_delegate.h"
|
||||||
|
#include "v8/include/v8.h"
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
class GuestViewContainer : public content::BrowserPluginDelegate {
|
||||||
|
public:
|
||||||
|
explicit GuestViewContainer(content::RenderFrame* render_frame);
|
||||||
|
~GuestViewContainer() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(GuestViewContainer);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace atom
|
||||||
|
|
||||||
|
#endif // ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
|
|
@ -1,14 +1,11 @@
|
||||||
window.onload = ->
|
window.onload = ->
|
||||||
|
inspectorFrame = document.getElementById('inspector-app-iframe').contentWindow
|
||||||
|
|
||||||
# Use menu API to show context menu.
|
# Use menu API to show context menu.
|
||||||
InspectorFrontendHost.showContextMenuAtPoint = (x, y, items, document) ->
|
inspectorFrame.eval 'InspectorFrontendHost.showContextMenuAtPoint = parent.createMenu'
|
||||||
createMenu items
|
|
||||||
|
|
||||||
# Use dialog API to override file chooser dialog.
|
# Use dialog API to override file chooser dialog.
|
||||||
WebInspector.createFileSelectorElement = (callback) ->
|
inspectorFrame.eval 'WebInspector.createFileSelectorElement = parent.createFileSelectorElement'
|
||||||
fileSelectorElement = document.createElement 'span'
|
|
||||||
fileSelectorElement.style.display = 'none'
|
|
||||||
fileSelectorElement.click = showFileChooserDialog.bind this, callback
|
|
||||||
return fileSelectorElement
|
|
||||||
|
|
||||||
convertToMenuTemplate = (items) ->
|
convertToMenuTemplate = (items) ->
|
||||||
template = []
|
template = []
|
||||||
|
@ -32,11 +29,11 @@ convertToMenuTemplate = (items) ->
|
||||||
label: item.label
|
label: item.label
|
||||||
enabled: item.enabled
|
enabled: item.enabled
|
||||||
if item.id?
|
if item.id?
|
||||||
transformed.click = -> InspectorFrontendAPI.contextMenuItemSelected item.id
|
transformed.click = -> DevToolsAPI.contextMenuItemSelected item.id
|
||||||
template.push transformed
|
template.push transformed
|
||||||
template
|
template
|
||||||
|
|
||||||
createMenu = (items) ->
|
createMenu = (x, y, items, document) ->
|
||||||
remote = require 'remote'
|
remote = require 'remote'
|
||||||
Menu = remote.require 'menu'
|
Menu = remote.require 'menu'
|
||||||
|
|
||||||
|
@ -44,7 +41,7 @@ createMenu = (items) ->
|
||||||
# The menu is expected to show asynchronously.
|
# The menu is expected to show asynchronously.
|
||||||
setImmediate ->
|
setImmediate ->
|
||||||
menu.popup remote.getCurrentWindow()
|
menu.popup remote.getCurrentWindow()
|
||||||
InspectorFrontendAPI.contextMenuCleared()
|
DevToolsAPI.contextMenuCleared()
|
||||||
|
|
||||||
showFileChooserDialog = (callback) ->
|
showFileChooserDialog = (callback) ->
|
||||||
remote = require 'remote'
|
remote = require 'remote'
|
||||||
|
@ -57,3 +54,13 @@ pathToHtml5FileObject = (path) ->
|
||||||
blob = new Blob([fs.readFileSync(path)])
|
blob = new Blob([fs.readFileSync(path)])
|
||||||
blob.name = path
|
blob.name = path
|
||||||
blob
|
blob
|
||||||
|
|
||||||
|
createFileSelectorElement = (callback) ->
|
||||||
|
fileSelectorElement = document.createElement 'span'
|
||||||
|
fileSelectorElement.style.display = 'none'
|
||||||
|
fileSelectorElement.click = showFileChooserDialog.bind this, callback
|
||||||
|
return fileSelectorElement
|
||||||
|
|
||||||
|
# Exposed for iframe.
|
||||||
|
window.createMenu = createMenu
|
||||||
|
window.createFileSelectorElement = createFileSelectorElement
|
||||||
|
|
|
@ -192,6 +192,7 @@ void PrintJobWorker::GetSettingsWithUI(
|
||||||
printing_context_->AskUserForSettings(
|
printing_context_->AskUserForSettings(
|
||||||
document_page_count,
|
document_page_count,
|
||||||
has_selection,
|
has_selection,
|
||||||
|
false,
|
||||||
base::Bind(&PrintJobWorker::GetSettingsWithUIDone,
|
base::Bind(&PrintJobWorker::GetSettingsWithUIDone,
|
||||||
base::Unretained(this)));
|
base::Unretained(this)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ void PrintViewManagerBase::OnDidPrintPage(
|
||||||
reinterpret_cast<const unsigned char*>(shared_buf.memory()),
|
reinterpret_cast<const unsigned char*>(shared_buf.memory()),
|
||||||
params.data_size);
|
params.data_size);
|
||||||
|
|
||||||
document->DebugDumpData(bytes, FILE_PATH_LITERAL(".pdf"));
|
document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
|
||||||
}
|
}
|
||||||
#endif // !OS_WIN
|
#endif // !OS_WIN
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
#include "ui/gfx/size.h"
|
#include "ui/gfx/geometry/size.h"
|
||||||
|
|
||||||
PrintMsg_Print_Params::PrintMsg_Print_Params()
|
PrintMsg_Print_Params::PrintMsg_Print_Params()
|
||||||
: page_size(),
|
: page_size(),
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "printing/print_job_constants.h"
|
#include "printing/print_job_constants.h"
|
||||||
#include "third_party/WebKit/public/web/WebPrintScalingOption.h"
|
#include "third_party/WebKit/public/web/WebPrintScalingOption.h"
|
||||||
#include "ui/gfx/native_widget_types.h"
|
#include "ui/gfx/native_widget_types.h"
|
||||||
#include "ui/gfx/rect.h"
|
#include "ui/gfx/geometry/rect.h"
|
||||||
|
|
||||||
#ifndef CHROME_COMMON_PRINT_MESSAGES_H_
|
#ifndef CHROME_COMMON_PRINT_MESSAGES_H_
|
||||||
#define CHROME_COMMON_PRINT_MESSAGES_H_
|
#define CHROME_COMMON_PRINT_MESSAGES_H_
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include "net/base/escape.h"
|
#include "net/base/escape.h"
|
||||||
#include "printing/pdf_metafile_skia.h"
|
#include "printing/pdf_metafile_skia.h"
|
||||||
#include "printing/units.h"
|
#include "printing/units.h"
|
||||||
#include "skia/ext/vector_platform_device_skia.h"
|
|
||||||
#include "third_party/WebKit/public/platform/WebSize.h"
|
#include "third_party/WebKit/public/platform/WebSize.h"
|
||||||
#include "third_party/WebKit/public/platform/WebURLRequest.h"
|
#include "third_party/WebKit/public/platform/WebURLRequest.h"
|
||||||
#include "third_party/WebKit/public/web/WebConsoleMessage.h"
|
#include "third_party/WebKit/public/web/WebConsoleMessage.h"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "third_party/WebKit/public/platform/WebCanvas.h"
|
#include "third_party/WebKit/public/platform/WebCanvas.h"
|
||||||
#include "third_party/WebKit/public/web/WebNode.h"
|
#include "third_party/WebKit/public/web/WebNode.h"
|
||||||
#include "third_party/WebKit/public/web/WebPrintParams.h"
|
#include "third_party/WebKit/public/web/WebPrintParams.h"
|
||||||
#include "ui/gfx/size.h"
|
#include "ui/gfx/geometry/size.h"
|
||||||
|
|
||||||
struct PrintMsg_Print_Params;
|
struct PrintMsg_Print_Params;
|
||||||
struct PrintMsg_PrintPage_Params;
|
struct PrintMsg_PrintPage_Params;
|
||||||
|
|
|
@ -130,21 +130,16 @@ void PrintWebViewHelper::PrintPageInternal(
|
||||||
&content_area);
|
&content_area);
|
||||||
gfx::Rect canvas_area = content_area;
|
gfx::Rect canvas_area = content_area;
|
||||||
|
|
||||||
SkBaseDevice* device = metafile->StartPageForVectorCanvas(page_size,
|
skia::PlatformCanvas* canvas = metafile->GetVectorCanvasForNewPage(
|
||||||
canvas_area,
|
page_size, canvas_area, scale_factor);
|
||||||
scale_factor);
|
if (!canvas)
|
||||||
if (!device)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// The printPage method take a reference to the canvas we pass down, so it
|
|
||||||
// can't be a stack object.
|
|
||||||
skia::RefPtr<skia::VectorCanvas> canvas =
|
|
||||||
skia::AdoptRef(new skia::VectorCanvas(device));
|
|
||||||
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
|
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
|
||||||
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
|
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
|
||||||
|
|
||||||
RenderPageContent(frame, params.page_number, canvas_area, content_area,
|
RenderPageContent(frame, params.page_number, canvas_area, content_area,
|
||||||
scale_factor, canvas.get());
|
scale_factor, canvas);
|
||||||
|
|
||||||
// Done printing. Close the device context to retrieve the compiled metafile.
|
// Done printing. Close the device context to retrieve the compiled metafile.
|
||||||
if (!metafile->FinishPage())
|
if (!metafile->FinishPage())
|
||||||
|
|
|
@ -76,20 +76,17 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
|
||||||
gfx::Rect canvas_area = content_area;
|
gfx::Rect canvas_area = content_area;
|
||||||
|
|
||||||
{
|
{
|
||||||
SkBaseDevice* device = metafile->StartPageForVectorCanvas(
|
skia::PlatformCanvas* canvas = metafile->GetVectorCanvasForNewPage(
|
||||||
*page_size, canvas_area, scale_factor);
|
*page_size, canvas_area, scale_factor);
|
||||||
if (!device)
|
if (!canvas)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
skia::RefPtr<skia::VectorCanvas> canvas =
|
|
||||||
skia::AdoptRef(new skia::VectorCanvas(device));
|
|
||||||
blink::WebCanvas* canvas_ptr = canvas.get();
|
|
||||||
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
|
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
|
||||||
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
|
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
|
||||||
skia::SetIsPreviewMetafile(*canvas, is_preview);
|
skia::SetIsPreviewMetafile(*canvas, is_preview);
|
||||||
|
|
||||||
RenderPageContent(frame, page_number, canvas_area, content_area,
|
RenderPageContent(frame, page_number, canvas_area, content_area,
|
||||||
scale_factor, canvas_ptr);
|
scale_factor, static_cast<blink::WebCanvas*>(canvas));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done printing. Close the device context to retrieve the compiled metafile.
|
// Done printing. Close the device context to retrieve the compiled metafile.
|
||||||
|
|
|
@ -184,16 +184,11 @@ void PrintWebViewHelper::PrintPageInternal(
|
||||||
frame->getPrintPageShrink(params.page_number);
|
frame->getPrintPageShrink(params.page_number);
|
||||||
float scale_factor = css_scale_factor * webkit_page_shrink_factor;
|
float scale_factor = css_scale_factor * webkit_page_shrink_factor;
|
||||||
|
|
||||||
SkBaseDevice* device = metafile->StartPageForVectorCanvas(page_size,
|
skia::PlatformCanvas* canvas = metafile->GetVectorCanvasForNewPage(
|
||||||
canvas_area,
|
page_size, canvas_area, scale_factor);
|
||||||
scale_factor);
|
if (!canvas)
|
||||||
if (!device)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// The printPage method take a reference to the canvas we pass down, so it
|
|
||||||
// can't be a stack object.
|
|
||||||
skia::RefPtr<skia::VectorCanvas> canvas =
|
|
||||||
skia::AdoptRef(new skia::VectorCanvas(device));
|
|
||||||
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
|
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
|
||||||
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
|
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
|
||||||
|
|
||||||
|
@ -215,7 +210,7 @@ void PrintWebViewHelper::PrintPageInternal(
|
||||||
canvas_area,
|
canvas_area,
|
||||||
content_area,
|
content_area,
|
||||||
scale_factor,
|
scale_factor,
|
||||||
canvas.get());
|
canvas);
|
||||||
DCHECK_GT(webkit_scale_factor, 0.0f);
|
DCHECK_GT(webkit_scale_factor, 0.0f);
|
||||||
// Done printing. Close the device context to retrieve the compiled metafile.
|
// Done printing. Close the device context to retrieve the compiled metafile.
|
||||||
if (!metafile->FinishPage())
|
if (!metafile->FinishPage())
|
||||||
|
|
|
@ -88,7 +88,6 @@ You can also create a window without chrome by using
|
||||||
under current working directory.
|
under current working directory.
|
||||||
* `experimental-features` Boolean
|
* `experimental-features` Boolean
|
||||||
* `experimental-canvas-features` Boolean
|
* `experimental-canvas-features` Boolean
|
||||||
* `subpixel-font-scaling` Boolean
|
|
||||||
* `overlay-scrollbars` Boolean
|
* `overlay-scrollbars` Boolean
|
||||||
* `overlay-fullscreen-video` Boolean
|
* `overlay-fullscreen-video` Boolean
|
||||||
* `shared-worker` Boolean
|
* `shared-worker` Boolean
|
||||||
|
|
|
@ -86,8 +86,8 @@ Start monitoring on all processes.
|
||||||
Monitoring begins immediately locally, and asynchronously on child processes as
|
Monitoring begins immediately locally, and asynchronously on child processes as
|
||||||
soon as they receive the `startMonitoring` request.
|
soon as they receive the `startMonitoring` request.
|
||||||
|
|
||||||
Once all child processes have acked to the `startMonitoring` request, `callback`
|
Once all child processes have acked to the `startMonitoring` request,
|
||||||
will be called back.
|
`callback` will be called back.
|
||||||
|
|
||||||
## tracing.stopMonitoring(callback);
|
## tracing.stopMonitoring(callback);
|
||||||
|
|
||||||
|
@ -115,12 +115,12 @@ Once all child processes have acked to the `captureMonitoringSnapshot` request,
|
||||||
`callback` will be called back with a file that contains the traced data.
|
`callback` will be called back with a file that contains the traced data.
|
||||||
|
|
||||||
|
|
||||||
## tracing.getTraceBufferPercentFull(callback)
|
## tracing.getTraceBufferUsage(callback)
|
||||||
|
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
|
|
||||||
Get the maximum across processes of trace buffer percent full state. When the
|
Get the maximum across processes of trace buffer percent full state. When the
|
||||||
TraceBufferPercentFull value is determined, the `callback` is called.
|
TraceBufferUsage value is determined, the `callback` is called.
|
||||||
|
|
||||||
## tracing.setWatchEvent(categoryName, eventName, callback)
|
## tracing.setWatchEvent(categoryName, eventName, callback)
|
||||||
|
|
||||||
|
@ -128,7 +128,8 @@ TraceBufferPercentFull value is determined, the `callback` is called.
|
||||||
* `eventName` String
|
* `eventName` String
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
|
|
||||||
`callback` will will be called every time the given event occurs on any process.
|
`callback` will will be called every time the given event occurs on any
|
||||||
|
process.
|
||||||
|
|
||||||
## tracing.cancelWatchEvent()
|
## tracing.cancelWatchEvent()
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
],
|
],
|
||||||
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"atom-package-manager": "0.126.0",
|
"atom-package-manager": "0.144.0",
|
||||||
"asar": "0.2.2",
|
"asar": "0.2.2",
|
||||||
"coffee-script": "~1.7.1",
|
"coffee-script": "~1.7.1",
|
||||||
"coffeelint": "~1.3.0",
|
"coffeelint": "~1.3.0",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import platform
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
|
BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
|
||||||
LIBCHROMIUMCONTENT_COMMIT = '103778aa0ec3772f88e915ca9efdb941afdc85cf'
|
LIBCHROMIUMCONTENT_COMMIT = '78ddaee2158886da53d0801db572be38230fd814'
|
||||||
|
|
||||||
ARCH = {
|
ARCH = {
|
||||||
'cygwin': '32bit',
|
'cygwin': '32bit',
|
||||||
|
|
|
@ -2,7 +2,6 @@ assert = require 'assert'
|
||||||
http = require 'http'
|
http = require 'http'
|
||||||
https = require 'https'
|
https = require 'https'
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
pem = require 'pem'
|
|
||||||
|
|
||||||
describe 'chromium feature', ->
|
describe 'chromium feature', ->
|
||||||
fixtures = path.resolve __dirname, 'fixtures'
|
fixtures = path.resolve __dirname, 'fixtures'
|
||||||
|
@ -11,33 +10,16 @@ describe 'chromium feature', ->
|
||||||
it 'does not crash', ->
|
it 'does not crash', ->
|
||||||
process.atomBinding('v8_util').takeHeapSnapshot()
|
process.atomBinding('v8_util').takeHeapSnapshot()
|
||||||
|
|
||||||
describe 'sending request of https protocol urls', ->
|
describe 'sending request of http protocol urls', ->
|
||||||
it 'does not crash', (done) ->
|
it 'does not crash', (done) ->
|
||||||
@timeout 5000
|
@timeout 5000
|
||||||
options = {
|
server = http.createServer (req, res) ->
|
||||||
days: 1,
|
res.end()
|
||||||
selfSigned: true
|
server.close()
|
||||||
}
|
done()
|
||||||
pem.createCertificate options, (err, keys) ->
|
server.listen 0, '127.0.0.1', ->
|
||||||
server = https.createServer {key: keys.serviceKey, cert: keys.certificate}, (req, res) ->
|
{port} = server.address()
|
||||||
res.end('hello!')
|
$.get "http://127.0.0.1:#{port}"
|
||||||
server.close()
|
|
||||||
done()
|
|
||||||
server.listen 4300, '127.0.0.1', ->
|
|
||||||
{port} = server.address()
|
|
||||||
$.get "https://127.0.0.1:#{port}", (res) ->
|
|
||||||
assert.equal res, "hello!"
|
|
||||||
|
|
||||||
describe 'sending request of http protocol urls', ->
|
|
||||||
it 'does not crash', (done) ->
|
|
||||||
@timeout 5000
|
|
||||||
server = http.createServer (req, res) ->
|
|
||||||
res.end()
|
|
||||||
server.close()
|
|
||||||
done()
|
|
||||||
server.listen 0, '127.0.0.1', ->
|
|
||||||
{port} = server.address()
|
|
||||||
$.get "http://127.0.0.1:#{port}"
|
|
||||||
|
|
||||||
describe 'navigator.webkitGetUserMedia', ->
|
describe 'navigator.webkitGetUserMedia', ->
|
||||||
it 'calls its callbacks', (done) ->
|
it 'calls its callbacks', (done) ->
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
"formidable": "1.0.16",
|
"formidable": "1.0.16",
|
||||||
"graceful-fs": "3.0.5",
|
"graceful-fs": "3.0.5",
|
||||||
"mocha": "2.1.0",
|
"mocha": "2.1.0",
|
||||||
"pem": "^1.7.1",
|
|
||||||
"q": "0.9.7",
|
"q": "0.9.7",
|
||||||
"runas": "2.x",
|
"runas": "2.x",
|
||||||
"temp": "0.8.1",
|
"temp": "0.8.1",
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit d3500e5d9451e248dd8f4ae805f19b371e795cc3
|
Subproject commit eb3564c4f7a7867bfa151bdfd1b5c83efe55d75d
|
2
vendor/native_mate
vendored
2
vendor/native_mate
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit d0db7bfb586afe9f491bd4cb368353d2660ecfe1
|
Subproject commit 38aba072908357b4eebc68462714b01a9c2d0138
|
2
vendor/node
vendored
2
vendor/node
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 9cd0fad904c3ebf0af0aeec2097cad3e039a7c6d
|
Subproject commit 9140160f9d3792dfd0f1de13a9781e28a9dc4d3c
|
Loading…
Add table
Reference in a new issue