commit
2832708618
34 changed files with 137 additions and 108 deletions
|
@ -13,7 +13,8 @@
|
|||
#include "content/public/common/url_constants.h"
|
||||
#include "net/url_request/data_protocol_handler.h"
|
||||
#include "net/url_request/file_protocol_handler.h"
|
||||
#include "net/url_request/protocol_intercept_job_factory.h"
|
||||
#include "net/url_request/url_request_intercepting_job_factory.h"
|
||||
#include "url/url_constants.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
|
@ -29,7 +30,7 @@ AtomBrowserContext::~AtomBrowserContext() {
|
|||
|
||||
net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory(
|
||||
content::ProtocolHandlerMap* handlers,
|
||||
content::ProtocolHandlerScopedVector* interceptors) {
|
||||
content::URLRequestInterceptorScopedVector* interceptors) {
|
||||
scoped_ptr<AtomURLRequestJobFactory> job_factory(job_factory_);
|
||||
|
||||
for (content::ProtocolHandlerMap::iterator it = handlers->begin();
|
||||
|
@ -38,18 +39,18 @@ net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory(
|
|||
handlers->clear();
|
||||
|
||||
job_factory->SetProtocolHandler(
|
||||
content::kDataScheme, new net::DataProtocolHandler);
|
||||
url::kDataScheme, new net::DataProtocolHandler);
|
||||
job_factory->SetProtocolHandler(
|
||||
content::kFileScheme, new net::FileProtocolHandler(
|
||||
url::kFileScheme, new net::FileProtocolHandler(
|
||||
BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
|
||||
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
|
||||
|
||||
// Set up interceptors in the reverse order.
|
||||
scoped_ptr<net::URLRequestJobFactory> top_job_factory =
|
||||
job_factory.PassAs<net::URLRequestJobFactory>();
|
||||
content::ProtocolHandlerScopedVector::reverse_iterator it;
|
||||
content::URLRequestInterceptorScopedVector::reverse_iterator it;
|
||||
for (it = interceptors->rbegin(); it != interceptors->rend(); ++it)
|
||||
top_job_factory.reset(new net::ProtocolInterceptJobFactory(
|
||||
top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
|
||||
top_job_factory.Pass(), make_scoped_ptr(*it)));
|
||||
interceptors->weak_clear();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class AtomBrowserContext : public brightray::BrowserContext {
|
|||
// brightray::URLRequestContextGetter::Delegate:
|
||||
virtual net::URLRequestJobFactory* CreateURLRequestJobFactory(
|
||||
content::ProtocolHandlerMap* handlers,
|
||||
content::ProtocolHandlerScopedVector* interceptors) OVERRIDE;
|
||||
content::URLRequestInterceptorScopedVector* interceptors) OVERRIDE;
|
||||
|
||||
private:
|
||||
// A fake BrowserProcess object that used to feed the source code from chrome.
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
namespace atom {
|
||||
|
||||
JavascriptEnvironment::JavascriptEnvironment()
|
||||
: isolate_(v8::Isolate::GetCurrent()),
|
||||
: isolate_holder_(gin::IsolateHolder::kNonStrictMode),
|
||||
isolate_(isolate_holder_.isolate()),
|
||||
isolate_scope_(isolate_),
|
||||
locker_(isolate_),
|
||||
handle_scope_(isolate_),
|
||||
context_(isolate_, v8::Context::New(isolate_)),
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#define ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "v8/include/v8.h"
|
||||
#include "gin/public/isolate_holder.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -20,7 +20,9 @@ class JavascriptEnvironment {
|
|||
}
|
||||
|
||||
private:
|
||||
gin::IsolateHolder isolate_holder_;
|
||||
v8::Isolate* isolate_;
|
||||
v8::Isolate::Scope isolate_scope_;
|
||||
v8::Locker locker_;
|
||||
v8::HandleScope handle_scope_;
|
||||
v8::UniquePersistent<v8::Context> context_;
|
||||
|
|
|
@ -145,7 +145,6 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents,
|
|||
params.bounds = bounds;
|
||||
params.delegate = this;
|
||||
params.type = views::Widget::InitParams::TYPE_WINDOW;
|
||||
params.top_level = true;
|
||||
params.remove_standard_frame = !has_frame_;
|
||||
|
||||
#if defined(USE_X11)
|
||||
|
|
|
@ -44,10 +44,12 @@ NodeDebugger::NodeDebugger() {
|
|||
if (use_debug_agent) {
|
||||
if (!port_str.empty())
|
||||
base::StringToInt(port_str, &port);
|
||||
#if 0
|
||||
v8::Debug::EnableAgent("atom-shell " ATOM_VERSION, port,
|
||||
wait_for_connection);
|
||||
v8::Debug::SetDebugMessageDispatchHandler(DispatchDebugMessagesInMsgThread,
|
||||
false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class MessageDialog : public views::WidgetDelegate,
|
|||
virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE;
|
||||
|
||||
// Overridden from views::View:
|
||||
virtual gfx::Size GetPreferredSize() OVERRIDE;
|
||||
virtual gfx::Size GetPreferredSize() const OVERRIDE;
|
||||
virtual void Layout() OVERRIDE;
|
||||
virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
|
||||
|
||||
|
@ -160,7 +160,6 @@ MessageDialog::MessageDialog(NativeWindow* parent_window,
|
|||
views::Widget::InitParams params;
|
||||
params.delegate = this;
|
||||
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
||||
params.top_level = true;
|
||||
if (parent_) {
|
||||
params.parent = parent_->GetNativeWindow();
|
||||
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
|
||||
|
@ -264,7 +263,7 @@ views::ClientView* MessageDialog::CreateClientView(views::Widget* widget) {
|
|||
return new MessageDialogClientView(this, widget);
|
||||
}
|
||||
|
||||
gfx::Size MessageDialog::GetPreferredSize() {
|
||||
gfx::Size MessageDialog::GetPreferredSize() const {
|
||||
gfx::Size size(0, buttons_[0]->GetPreferredSize().height());
|
||||
for (size_t i = 0; i < buttons_.size(); ++i)
|
||||
size.Enlarge(buttons_[i]->GetPreferredSize().width(), 0);
|
||||
|
|
|
@ -95,16 +95,16 @@ void FramelessView::UpdateWindowIcon() {
|
|||
void FramelessView::UpdateWindowTitle() {
|
||||
}
|
||||
|
||||
gfx::Size FramelessView::GetPreferredSize() {
|
||||
gfx::Size FramelessView::GetPreferredSize() const {
|
||||
return frame_->non_client_view()->GetWindowBoundsForClientBounds(
|
||||
gfx::Rect(frame_->client_view()->GetPreferredSize())).size();
|
||||
}
|
||||
|
||||
gfx::Size FramelessView::GetMinimumSize() {
|
||||
gfx::Size FramelessView::GetMinimumSize() const {
|
||||
return window_->GetMinimumSize();
|
||||
}
|
||||
|
||||
gfx::Size FramelessView::GetMaximumSize() {
|
||||
gfx::Size FramelessView::GetMaximumSize() const {
|
||||
return window_->GetMaximumSize();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ class FramelessView : public views::NonClientFrameView {
|
|||
virtual void UpdateWindowTitle() OVERRIDE;
|
||||
|
||||
// Overridden from View:
|
||||
virtual gfx::Size GetPreferredSize() OVERRIDE;
|
||||
virtual gfx::Size GetMinimumSize() OVERRIDE;
|
||||
virtual gfx::Size GetMaximumSize() OVERRIDE;
|
||||
virtual gfx::Size GetPreferredSize() const OVERRIDE;
|
||||
virtual gfx::Size GetMinimumSize() const OVERRIDE;
|
||||
virtual gfx::Size GetMaximumSize() const OVERRIDE;
|
||||
virtual const char* GetClassName() const OVERRIDE;
|
||||
|
||||
// Not owned.
|
||||
|
|
|
@ -74,10 +74,10 @@ void MenuBar::SetMenu(ui::MenuModel* model) {
|
|||
button->set_tag(i);
|
||||
|
||||
#if defined(USE_X11)
|
||||
button->SetEnabledColor(enabled_color_);
|
||||
button->SetDisabledColor(disabled_color_);
|
||||
button->SetHighlightColor(highlight_color_);
|
||||
button->SetHoverColor(hover_color_);
|
||||
button->SetTextColor(views::Button::STATE_NORMAL, enabled_color_);
|
||||
button->SetTextColor(views::Button::STATE_DISABLED, disabled_color_);
|
||||
button->SetTextColor(views::Button::STATE_PRESSED, highlight_color_);
|
||||
button->SetTextColor(views::Button::STATE_HOVERED, hover_color_);
|
||||
button->SetUnderlineColor(enabled_color_);
|
||||
#elif defined(OS_WIN)
|
||||
button->SetUnderlineColor(color_utils::GetSysSkColor(COLOR_GRAYTEXT));
|
||||
|
|
|
@ -73,7 +73,7 @@ bool MenuDelegate::IsTriggerableEvent(views::MenuItemView* source,
|
|||
return delegate()->IsTriggerableEvent(source, e);
|
||||
}
|
||||
|
||||
bool MenuDelegate::GetAccelerator(int id, ui::Accelerator* accelerator) {
|
||||
bool MenuDelegate::GetAccelerator(int id, ui::Accelerator* accelerator) const {
|
||||
return delegate()->GetAccelerator(id, accelerator);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class MenuDelegate : public views::MenuDelegate {
|
|||
virtual bool IsTriggerableEvent(views::MenuItemView* source,
|
||||
const ui::Event& e) OVERRIDE;
|
||||
virtual bool GetAccelerator(int id,
|
||||
ui::Accelerator* accelerator) OVERRIDE;
|
||||
ui::Accelerator* accelerator) const OVERRIDE;
|
||||
virtual base::string16 GetLabel(int id) const OVERRIDE;
|
||||
virtual const gfx::FontList* GetLabelFontList(int id) const OVERRIDE;
|
||||
virtual bool IsCommandEnabled(int id) const OVERRIDE;
|
||||
|
|
|
@ -30,7 +30,7 @@ void MenuLayout::Layout(views::View* host) {
|
|||
menu_bar->SetBoundsRect(menu_Bar_bounds);
|
||||
}
|
||||
|
||||
gfx::Size MenuLayout::GetPreferredSize(views::View* host) {
|
||||
gfx::Size MenuLayout::GetPreferredSize(const views::View* host) const {
|
||||
gfx::Size size = views::FillLayout::GetPreferredSize(host);
|
||||
if (!HasMenu(host))
|
||||
return size;
|
||||
|
@ -39,7 +39,8 @@ gfx::Size MenuLayout::GetPreferredSize(views::View* host) {
|
|||
return size;
|
||||
}
|
||||
|
||||
int MenuLayout::GetPreferredHeightForWidth(views::View* host, int width) {
|
||||
int MenuLayout::GetPreferredHeightForWidth(
|
||||
const views::View* host, int width) const {
|
||||
int height = views::FillLayout::GetPreferredHeightForWidth(host, width);
|
||||
if (!HasMenu(host))
|
||||
return height;
|
||||
|
|
|
@ -16,8 +16,9 @@ class MenuLayout : public views::FillLayout {
|
|||
|
||||
// views::LayoutManager:
|
||||
virtual void Layout(views::View* host) OVERRIDE;
|
||||
virtual gfx::Size GetPreferredSize(views::View* host) OVERRIDE;
|
||||
virtual int GetPreferredHeightForWidth(views::View* host, int width) OVERRIDE;
|
||||
virtual gfx::Size GetPreferredSize(const views::View* host) const OVERRIDE;
|
||||
virtual int GetPreferredHeightForWidth(
|
||||
const views::View* host, int width) const OVERRIDE;
|
||||
|
||||
private:
|
||||
bool HasMenu(const views::View* host) const;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "ui/gfx/canvas.h"
|
||||
#include "ui/gfx/text_utils.h"
|
||||
#include "ui/views/controls/button/label_button_border.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -34,9 +35,14 @@ SubmenuButton::SubmenuButton(views::ButtonListener* listener,
|
|||
text_width_(0),
|
||||
text_height_(0),
|
||||
underline_color_(SK_ColorBLACK) {
|
||||
#if defined(OS_LINUX)
|
||||
// Dont' use native style border.
|
||||
SetBorder(CreateDefaultBorder().PassAs<views::Border>());
|
||||
#endif
|
||||
|
||||
if (GetUnderlinePosition(title, &accelerator_, &underline_start_,
|
||||
&underline_end_))
|
||||
gfx::Canvas::SizeStringInt(text(), font_list(), &text_width_,
|
||||
gfx::Canvas::SizeStringInt(GetText(), GetFontList(), &text_width_,
|
||||
&text_height_, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -85,7 +91,7 @@ bool SubmenuButton::GetUnderlinePosition(const base::string16& text,
|
|||
void SubmenuButton::GetCharacterPosition(
|
||||
const base::string16& text, int index, int* pos) {
|
||||
int height;
|
||||
gfx::Canvas::SizeStringInt(text.substr(0, index), font_list(), pos, &height,
|
||||
gfx::Canvas::SizeStringInt(text.substr(0, index), GetFontList(), pos, &height,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@ class SubmenuButton : public views::MenuButton {
|
|||
void SetAcceleratorVisibility(bool visible);
|
||||
void SetUnderlineColor(SkColor color);
|
||||
|
||||
void SetEnabledColor(SkColor color);
|
||||
void SetBackgroundColor(SkColor color);
|
||||
|
||||
base::char16 accelerator() const { return accelerator_; }
|
||||
|
||||
// views::MenuButton:
|
||||
|
|
|
@ -61,7 +61,6 @@ AtomBindings::AtomBindings() {
|
|||
call_next_tick_async_.data = this;
|
||||
|
||||
uv_async_init(uv_default_loop(), &g_callback_uv_handle, UvOnCallback);
|
||||
v8::V8::SetFatalErrorHandler(FatalErrorCallback);
|
||||
}
|
||||
|
||||
AtomBindings::~AtomBindings() {
|
||||
|
@ -69,6 +68,8 @@ AtomBindings::~AtomBindings() {
|
|||
|
||||
void AtomBindings::BindTo(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Object> process) {
|
||||
v8::V8::SetFatalErrorHandler(FatalErrorCallback);
|
||||
|
||||
mate::Dictionary dict(isolate, process);
|
||||
dict.SetMethod("crash", &Crash);
|
||||
dict.SetMethod("log", &Log);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#ifndef ATOM_COMMON_CHROME_VERSION_H_
|
||||
#define ATOM_COMMON_CHROME_VERSION_H_
|
||||
|
||||
#define CHROME_VERSION_STRING "36.0.1985.125"
|
||||
#define CHROME_VERSION_STRING "37.0.2062.102"
|
||||
#define CHROME_VERSION "v" CHROME_VERSION_STRING
|
||||
|
||||
#endif // ATOM_COMMON_CHROME_VERSION_H_
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef ATOM_RENDERER_ATOM_RENDER_VIEW_OBSERVER_H_
|
||||
#define ATOM_RENDERER_ATOM_RENDER_VIEW_OBSERVER_H_
|
||||
|
||||
#include "base/strings/string16.h"
|
||||
#include "content/public/renderer/render_view_observer.h"
|
||||
|
||||
namespace base {
|
||||
|
|
|
@ -14,10 +14,12 @@
|
|||
#include "chrome/renderer/printing/print_web_view_helper.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "content/public/renderer/render_frame_observer.h"
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
#include "base/command_line.h"
|
||||
#include "native_mate/converter.h"
|
||||
#include "third_party/WebKit/public/web/WebDocument.h"
|
||||
#include "third_party/WebKit/public/web/WebFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebKit.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
||||
|
@ -83,7 +85,7 @@ AtomRendererClient::AtomRendererClient()
|
|||
AtomRendererClient::~AtomRendererClient() {
|
||||
}
|
||||
|
||||
void AtomRendererClient::RenderThreadStarted() {
|
||||
void AtomRendererClient::WebKitInitialized() {
|
||||
if (!IsNodeBindingEnabled())
|
||||
return;
|
||||
|
||||
|
@ -94,12 +96,16 @@ void AtomRendererClient::RenderThreadStarted() {
|
|||
|
||||
// Create a default empty environment which would be used when we need to
|
||||
// run V8 code out of a window context (like running a uv callback).
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
v8::Isolate* isolate = blink::mainThreadIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Local<v8::Context> context = v8::Context::New(isolate);
|
||||
global_env = node::Environment::New(context);
|
||||
}
|
||||
|
||||
void AtomRendererClient::RenderThreadStarted() {
|
||||
content::RenderThread::Get()->AddObserver(this);
|
||||
}
|
||||
|
||||
void AtomRendererClient::RenderFrameCreated(
|
||||
content::RenderFrame* render_frame) {
|
||||
new AtomRenderFrameObserver(render_frame, this);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "content/public/renderer/content_renderer_client.h"
|
||||
#include "content/public/renderer/render_process_observer.h"
|
||||
|
||||
namespace node {
|
||||
class Environment;
|
||||
|
@ -19,7 +20,8 @@ namespace atom {
|
|||
class AtomRendererBindings;
|
||||
class NodeBindings;
|
||||
|
||||
class AtomRendererClient : public content::ContentRendererClient {
|
||||
class AtomRendererClient : public content::ContentRendererClient,
|
||||
public content::RenderProcessObserver {
|
||||
public:
|
||||
AtomRendererClient();
|
||||
virtual ~AtomRendererClient();
|
||||
|
@ -41,6 +43,9 @@ class AtomRendererClient : public content::ContentRendererClient {
|
|||
DISABLE,
|
||||
};
|
||||
|
||||
// content::RenderProcessObserver:
|
||||
virtual void WebKitInitialized() OVERRIDE;
|
||||
|
||||
// content::ContentRendererClient:
|
||||
virtual void RenderThreadStarted() OVERRIDE;
|
||||
virtual void RenderFrameCreated(content::RenderFrame* render_frame) OVERRIDE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue