electron/atom/browser/atom_browser_main_parts.h

59 lines
1.6 KiB
C
Raw Normal View History

2013-04-12 01:46:58 +00:00
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
2013-04-12 01:46:58 +00:00
// found in the LICENSE file.
2014-03-16 00:58:59 +00:00
#ifndef ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_H_
#define ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_H_
2013-04-12 01:46:58 +00:00
#include "brightray/browser/browser_main_parts.h"
#include "v8/include/v8.h"
2013-04-12 01:46:58 +00:00
namespace atom {
class AtomBindings;
class Browser;
2013-04-13 10:39:09 +00:00
class NodeBindings;
2013-04-12 01:46:58 +00:00
class AtomBrowserMainParts : public brightray::BrowserMainParts {
2013-04-12 15:16:16 +00:00
public:
2013-04-12 01:46:58 +00:00
AtomBrowserMainParts();
2013-04-12 15:16:16 +00:00
virtual ~AtomBrowserMainParts();
2013-04-12 01:46:58 +00:00
static AtomBrowserMainParts* Get();
Browser* browser() { return browser_.get(); }
2013-04-12 15:16:16 +00:00
protected:
// Implementations of brightray::BrowserMainParts.
virtual brightray::BrowserContext* CreateBrowserContext() OVERRIDE;
virtual void InitProxyResolverV8() OVERRIDE;
// Implementations of content::BrowserMainParts.
2013-04-13 10:39:09 +00:00
virtual void PostEarlyInitialization() OVERRIDE;
2013-04-12 01:46:58 +00:00
virtual void PreMainMessageLoopRun() OVERRIDE;
#if defined(OS_MACOSX)
virtual void PreMainMessageLoopStart() OVERRIDE;
virtual void PostDestroyThreads() OVERRIDE;
#endif
2013-04-12 01:46:58 +00:00
2013-04-13 10:39:09 +00:00
private:
scoped_ptr<AtomBindings> atom_bindings_;
scoped_ptr<Browser> browser_;
2013-04-13 10:39:09 +00:00
scoped_ptr<NodeBindings> node_bindings_;
// The V8 environment of browser process.
v8::Isolate* isolate_;
v8::Locker locker_;
v8::HandleScope handle_scope_;
v8::UniquePersistent<v8::Context> context_;
v8::Context::Scope context_scope_;
static AtomBrowserMainParts* self_;
2013-04-12 01:46:58 +00:00
DISALLOW_COPY_AND_ASSIGN(AtomBrowserMainParts);
};
} // namespace atom
2014-03-16 00:58:59 +00:00
#endif // ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_H_