Skip to content
This repository
Browse code

AppSettings and WindowSettings, change Window to NativeWindow in js, …

…change NativeWindow constructor to just take an options object, cleanup
  • Loading branch information...
commit 46adf695bcf015eec2e8d2d16c8b5808e4ab0ae9 1 parent 6b71646
Brandon Benvie Benvie authored
42 lib/index.js
... ... @@ -1,19 +1,17 @@
1 1 var bindings = require('./bindings'),
2   - config = require('./settings')(bindings.initConfig),
  2 + settings = require('./settings'),
3 3 router = require('./router'),
4 4 decorate = require('./utils').decorate,
5 5 isObject = require('./utils').isObject;
6 6
7 7 var App = bindings.App,
8   - NativeWindow = bindings.Window,
9   - Window = require('./window'),
10   - Icons = require('./utils').Icons;
  8 + NativeWindow = bindings.NativeWindow,
  9 + Window = require('./window');
11 10
12 11 var concat = Array.prototype.concat,
13 12 _createWindow = App.prototype.createWindow;
14 13
15   -var names = require('./utils').names,
16   - events = ['minimize', 'maximize', 'fullscreen', 'restore', 'move', 'resize'];
  14 +var events = ['minimize', 'maximize', 'fullscreen', 'restore', 'move', 'resize'];
17 15
18 16
19 17
@@ -39,31 +37,29 @@ decorate(App.prototype, [
39 37 }, this);
40 38 mod.call(this);
41 39 },
42   - function createWindow(url, settings){
  40 + function createWindow(options){
43 41 var self = this;
44   - if (url && typeof url === 'object') {
45   - settings = url;
46   - url = settings.url;
47   - }
48   - settings = decorate({}, settings);
49   - settings.icons = new Icons(settings.icons);
50   - if (!settings.name) {
51   - settings.name = names[names.index++] + names.suffix;
52   - if (names.index === names.length) {
53   - names.index = 0;
54   - names.suffix = (names.suffix || 0) + 1;
  42 + if (typeof options === 'string') {
  43 + if (isObject(arguments[1])) {
  44 + arguments[1].url = options;
  45 + options = arguments[1];
  46 + } else {
  47 + options = { url: options };
55 48 }
56 49 }
  50 + if (!(options instanceof settings.WindowSettings)) {
  51 + options = new settings.WindowSettings(options);
  52 + }
57 53
58   - var nativeWindow = _createWindow.call(this, url || 'http://appjs/', settings),
  54 + var nativeWindow = _createWindow.call(this, options),
59 55 window = new Window(nativeWindow);
60 56
61   - nativeWindow.name = settings.name;
62   - this.windows[settings.name] = window;
  57 + nativeWindow.name = options.name;
  58 + this.windows[options.name] = window;
63 59
64 60 nativeWindow.on('close', function(){
65 61 window.emit('close');
66   - delete self.windows[settings.name];
  62 + delete self.windows[options.name];
67 63 });
68 64
69 65 events.forEach(function(event){
@@ -84,7 +80,7 @@ decorate(App.prototype, [
84 80
85 81
86 82
87   -var app = module.exports = bindings.init(config);
  83 +var app = module.exports = bindings.init(new settings.AppSettings(bindings.initConfig));
88 84 app.screenWidth = App.screenWidth;
89 85 app.screenHeight = App.screenHeight;
90 86 app.windows = {};
185 lib/settings.js
... ... @@ -1,41 +1,46 @@
1   -module.exports = function createSettings(o){
2   - return new Settings(o);
3   -};
  1 +var decorate = require('./utils').decorate,
  2 + constants = require('./utils').constants;
4 3
5   -module.exports.Settings = Settings;
  4 +module.exports = {
  5 + AppSettings: AppSettings,
  6 + WindowSettings: WindowSettings,
  7 + IconSettings: IconSettings
  8 +};
6 9
7 10
8   -function Settings(o){
9   - for (var k in o) {
  11 +function AppSettings(o){
  12 + for (var k in Object(o)) {
10 13 this[k] = o[k];
11 14 }
12 15 }
13 16
14   -var LOGSEVERITY = Settings.LOGSEVERITY = {
15   - VERBOSE : -1,
16   - INFO : 0,
17   - WARNING : 1,
18   - ERROR : 2,
19   - ERROR_REPORT : 3,
20   - DISABLE : 99
  17 +AppSettings.create = function createAppSettings(o){
  18 + return new AppSettings(o);
21 19 };
22 20
23   -var DEFAULT = '';
  21 +constants(AppSettings, {
  22 + LOGLEVEL_VERBOSE : -1,
  23 + LOGLEVEL_INFO : 0,
  24 + LOGLEVEL_WARNING : 1,
  25 + LOGLEVEL_ERROR : 2,
  26 + LOGLEVEL_ERROR_REPORT: 3,
  27 + LOGLEVEL_DISABLED : 99
  28 +});
24 29
25   -Settings.prototype = {
  30 +decorate(AppSettings.prototype, {
26 31 JSFlags : ' --harmony_proxies --harmony_collections --harmony_scoping',
27   - LogLevel : LOGSEVERITY.DISABLE,
  32 + LogLevel : AppSettings.LOGLEVEL_DISABLED,
28 33 PakLoading : true,
29 34
30   - LocalesPakPath : DEFAULT,
31   - ChromePakPath : DEFAULT,
32   - LogFilePath : DEFAULT,
33   - CachePath : DEFAULT,
34   - UserStylesheetPath : DEFAULT,
  35 + LocalesPakPath : '',
  36 + ChromePakPath : '',
  37 + LogFilePath : '',
  38 + CachePath : '',
  39 + UserStylesheetPath : '',
35 40
36   - UserAgent : DEFAULT,
37   - ProductVersion : DEFAULT,
38   - Locale : DEFAULT,
  41 + UserAgent : '',
  42 + ProductVersion : '',
  43 + Locale : '',
39 44
40 45 StandardFont : 'Times New Roman',
41 46 FixedFont : 'Courier New',
@@ -57,7 +62,6 @@ Settings.prototype = {
57 62
58 63 XSSAuditer : true,
59 64 HyperlinkAuditing : true,
60   - WebSecurity : true,
61 65 Plugins : true,
62 66 Java : true,
63 67 PageCache : true,
@@ -93,4 +97,135 @@ Settings.prototype = {
93 97 FullscreenAPI : true,
94 98 LocalStorageAPI : true,
95 99 WebGLAPI : true,
  100 +});
  101 +
  102 +
  103 +var names = module.exports.names = [
  104 + 'alpha', 'bravo', 'charlie', 'delta', 'echo', 'foxtrot', 'golf',
  105 + 'hotel', 'india', 'juliet', 'kilo', 'lima', 'mike', 'november',
  106 + 'oscar', 'papa', 'quebec', 'romeo', 'sierra', 'tango', 'uniform',
  107 + 'victor', 'whiskey', 'x-ray', 'yankee', 'zulu'
  108 +];
  109 +
  110 +names.index = 0;
  111 +names.suffix = '';
  112 +
  113 +
  114 +function WindowSettings(o){
  115 + for (var k in Object(o)) {
  116 + this[k] = o[k];
  117 + }
  118 + this.icons = new IconSettings(this.icons);
  119 + if (!this.name || typeof this.name !== 'string') {
  120 + this.name = names[names.index++] + names.suffix;
  121 + if (names.index === names.length) {
  122 + names.index = 0;
  123 + names.suffix = (names.suffix || 0) + 1;
  124 + }
  125 + }
  126 +}
  127 +
  128 +WindowSettings.create = function createWindowSettings(o){
  129 + return new WindowSettings(o);
  130 +};
  131 +
  132 +decorate(WindowSettings.prototype, {
  133 + url :'http://appjs/',
  134 + name : null,
  135 + icons : null,
  136 + width : 800,
  137 + height : 600,
  138 + left : -1,
  139 + top : -1,
  140 + opacity : 1,
  141 + alpha : false,
  142 + showChrome : true,
  143 + autoResize : false,
  144 + resizable : true,
  145 + showResizeGrip: false,
  146 + fullscreen : false,
  147 + topmost : false,
  148 +});
  149 +
  150 +
  151 +
  152 +
  153 +function IconSettings(o){
  154 + if (o instanceof IconSettings) {
  155 + Object.keys(o).forEach(function(key){
  156 + this[key] = o[key];
  157 + }, this);
  158 + } else if (typeof o === 'string') {
  159 + this.setRoot(o);
  160 + } else if (isObject(o)) {
  161 + this.setObject(o);
  162 + } else if (Array.isArray(o)) {
  163 + this.setArray(o);
  164 + }
  165 +}
  166 +
  167 +IconSettings.create = function createIconSettings(o){
  168 + return new IconSettings(o);
96 169 };
  170 +
  171 +
  172 +var namedSizes = ['smaller', 'small', 'largel', 'larger'],
  173 + numberSizes = [16, 32, 64, 128];
  174 +
  175 +var sizeMap = {
  176 + 16: 'smaller',
  177 + 32: 'small',
  178 + 64: 'large',
  179 + 128: 'larger',
  180 + smaller: 'smaller',
  181 + small: 'small',
  182 + large: 'large',
  183 + larger: 'larger'
  184 + };
  185 +
  186 +decorate(IconSettings.prototype, [
  187 + function setRoot(root){
  188 + if (fs.existsSync(root + '/small.png')) {
  189 + var sizes = namedSizes;
  190 + } else if (fs.existsSync(root + '/16.png')) {
  191 + var sizes = numberSizes;
  192 + } else {
  193 + return this;
  194 + }
  195 + sizes.forEach(function(size){
  196 + this[sizeMap[size]] = path.resolve(root, size+'.png');
  197 + }, this);
  198 + this.resolve();
  199 + return this;
  200 + },
  201 + function setObject(obj){
  202 + for (var k in obj) {
  203 + if (sizeMap.hasOwnProperty(k)) {
  204 + this[sizeMap[k]] = obj[k];
  205 + }
  206 + }
  207 + this.resolve();
  208 + return this;
  209 + },
  210 + function setArray(array){
  211 + array.forEach(function(item){
  212 + if (typeof item === 'string' && /\.png$/.test(item)) {
  213 + var name = path.basename(item).slice(0, -4);
  214 + if (sizeMap.hasOwnProperty(name)) {
  215 + this[sizeMap[name]] = item;
  216 + }
  217 + }
  218 + }, this);
  219 + this.resolve();
  220 + return this;
  221 + },
  222 + function resolve(){
  223 + Object.keys(this).forEach(function(key){
  224 + this[key] = path.resolve(this[key]);
  225 + if (!fs.existsSync(this[key])) {
  226 + delete this[key];
  227 + }
  228 + }, this);
  229 + return this;
  230 + }
  231 +]);
96 lib/utils.js
@@ -6,6 +6,7 @@ module.exports = {
6 6 decorate: decorate,
7 7 isObject: isObject,
8 8 inherit: inherit,
  9 + constants: constants,
9 10 log: log
10 11 };
11 12
@@ -95,6 +96,15 @@ function decorate(o){
95 96 return o;
96 97 }
97 98
  99 +function constants(o, p){
  100 + Object.keys(p).forEach(function(key){
  101 + Object.defineProperty(o, key, {
  102 + enumerable: true,
  103 + value: p[key]
  104 + });
  105 + });
  106 +}
  107 +
98 108
99 109 function inherit(Ctor, Super, props){
100 110 Ctor.prototype = Object.create(Super.prototype);
@@ -107,81 +117,6 @@ function inherit(Ctor, Super, props){
107 117
108 118
109 119
110   -var Icons = module.exports.Icons = function(){
111   - function Icons(o){
112   - if (typeof o === 'string') {
113   - this.setRoot(o);
114   - } else if (isObject(o)) {
115   - this.setObject(o);
116   - } else if (Array.isArray(o)) {
117   - this.setArray(o);
118   - }
119   - }
120   -
121   - var namedSizes = ['smaller', 'small', 'largel', 'larger'],
122   - numberSizes = [16, 32, 64, 128],
123   - sizeMap = {
124   - 16: 'smaller',
125   - 32: 'small',
126   - 64: 'large',
127   - 128: 'larger',
128   - smaller: 'smaller',
129   - small: 'small',
130   - large: 'large',
131   - larger: 'larger'
132   - };
133   -
134   - decorate(Icons.prototype, [
135   - function setRoot(root){
136   - if (fs.existsSync(root + '/small.png')) {
137   - var sizes = namedSizes;
138   - } else if (fs.existsSync(root + '/16.png')) {
139   - var sizes = numberSizes;
140   - } else {
141   - return this;
142   - }
143   - sizes.forEach(function(size){
144   - this[sizeMap[size]] = path.resolve(root, size+'.png');
145   - }, this);
146   - this.resolve();
147   - return this;
148   - },
149   - function setObject(obj){
150   - for (var k in obj) {
151   - if (sizeMap.hasOwnProperty(k)) {
152   - this[sizeMap[k]] = obj[k];
153   - }
154   - }
155   - this.resolve();
156   - return this;
157   - },
158   - function setArray(array){
159   - array.forEach(function(item){
160   - if (typeof item === 'string' && /\.png$/.test(item)) {
161   - var name = path.basename(item).slice(0, -4);
162   - if (sizeMap.hasOwnProperty(name)) {
163   - this[sizeMap[name]] = item;
164   - }
165   - }
166   - }, this);
167   - this.resolve();
168   - return this;
169   - },
170   - function resolve(){
171   - Object.keys(this).forEach(function(key){
172   - this[key] = path.resolve(this[key]);
173   - if (!fs.existsSync(this[key])) {
174   - delete this[key];
175   - }
176   - }, this);
177   - return this;
178   - }
179   - ]);
180   -
181   - return Icons;
182   -}();
183   -
184   -
185 120
186 121
187 122 var logPath = path.resolve(module.parent && module.parent.parent && path.dirname(module.parent.parent.filename) || __dirname);
@@ -224,14 +159,3 @@ function log(path, type, context, msg){
224 159 catch (e) { console.log(e, out) }
225 160 }
226 161 }
227   -
228   -
229   -var names = module.exports.names = [
230   - 'alpha', 'bravo', 'charlie', 'delta', 'echo', 'foxtrot', 'golf',
231   - 'hotel', 'india', 'juliet', 'kilo', 'lima', 'mike', 'november',
232   - 'oscar', 'papa', 'quebec', 'romeo', 'sierra', 'tango', 'uniform',
233   - 'victor', 'whiskey', 'x-ray', 'yankee', 'zulu'
234   -];
235   -
236   -names.index = 0;
237   -names.suffix = '';
2  lib/window.js
... ... @@ -1,4 +1,4 @@
1   -var NativeWindow = require('./bindings').Window,
  1 +var NativeWindow = require('./bindings').NativeWindow,
2 2 App = require('./bindings').App,
3 3 Ephemeral = require('./handlers').Ephemeral,
4 4 ReferenceType = require('./handlers').ReferenceType,
2  src/appjs.cpp
@@ -17,7 +17,7 @@ void Init(Handle<v8::Object> target) {
17 17
18 18 target->Set(String::NewSymbol("init"), FunctionTemplate::New(InitApp)->GetFunction());
19 19 target->Set(String::NewSymbol("App"), App::constructor);
20   - target->Set(String::NewSymbol("Window"), Window::constructor);
  20 + target->Set(String::NewSymbol("NativeWindow"), Window::constructor);
21 21 }
22 22
23 23 } /* appjs */
38 src/appjs_app.cpp
@@ -15,69 +15,57 @@ App::~App() {};
15 15 bool App::initialized_ = false;
16 16 Persistent<Function> App::constructor;
17 17
18   -void App::Init () {
  18 +void App::Init() {
19 19 DECLARE_CONSTRUCTOR("App");
20 20 DECLARE_PROTOTYPE_METHOD("on",On);
21 21 DECLARE_PROTOTYPE_METHOD("createWindow",CreateWindow2);
22   - DECLARE_CLASS_FUNCTION(screenWidth,ScreenWidth);
23   - DECLARE_CLASS_FUNCTION(screenHeight,ScreenHeight);
  22 + DECLARE_CLASS_FUNCTION(screenWidth, ScreenWidth);
  23 + DECLARE_CLASS_FUNCTION(screenHeight, ScreenHeight);
24 24 END_CONSTRUCTOR();
25 25 }
26 26
27 27 Handle<Value> App::New(const Arguments& args) {
28 28 HandleScope scope;
29   -
30 29 App* obj = new App();
31   -
32 30 obj->Wrap(args.This());
33   -
34 31 return scope.Close(args.This());
35 32 }
36 33
37 34 Handle<Value> App::NewInstance(const Arguments& args) {
38 35 HandleScope scope;
39 36
40   - Persistent<Object> initSettings = Persistent<Object>::New((args[0]->IsObject()) ? args[0]->ToObject() : Object::New());
41   - Cef::Init(new Settings(initSettings));
  37 + Persistent<Object> options = Persistent<Object>::New(args[0]->ToObject());
  38 + Cef::Init(new Settings(options));
42 39
43   - const unsigned argc = 1;
44   - Handle<Value> argv[argc] = {args[0]};
45   - Local<Object> instance = constructor->NewInstance(argc,argv);
  40 + Handle<Value> argv[1] = { args[0] };
  41 + Local<Object> instance = constructor->NewInstance(1, argv);
46 42
47 43 // get the events.EventEmitter constructor
48 44 Local<Object> global = Context::GetCurrent()->Global();
49 45 Handle<Object> process = global->Get(String::NewSymbol("process"))->ToObject();
50   - Local<Function> emitterConstructor = Local<Function>::Cast(process->Get(String::NewSymbol("EventEmitter")));
  46 + Local<Function> EventEmitter = Local<Function>::Cast(process->Get(String::NewSymbol("EventEmitter")));
51 47
52 48 // create process.AppjsEmitter object
53   - Handle<Object> AppjsEmitter = emitterConstructor->NewInstance();
54   - process->Set(String::NewSymbol("AppjsEmitter"),AppjsEmitter);
  49 + Handle<Object> AppjsEmitter = EventEmitter->NewInstance();
  50 + process->Set(String::NewSymbol("AppjsEmitter"), AppjsEmitter);
55 51
56 52 return scope.Close(instance);
57 53 }
58 54
59 55 Handle<Value> App::CreateWindow2(const Arguments& args) {
60   -
61 56 HandleScope scope;
62   -
63 57 return scope.Close(Window::NewInstance(args));
64 58 }
65 59
66 60 Handle<Value> App::ScreenWidth(const Arguments& args) {
67   -
68 61 HandleScope scope;
69   -
70 62 Handle<Value> width = Integer::New(NativeWindow::ScreenWidth());
71   -
72 63 return scope.Close(width);
73 64 }
74 65
75 66 Handle<Value> App::ScreenHeight(const Arguments& args) {
76   -
77 67 HandleScope scope;
78   -
79 68 Handle<Value> height = Integer::New(NativeWindow::ScreenHeight());
80   -
81 69 return scope.Close(height);
82 70 }
83 71
@@ -89,10 +77,8 @@ Handle<Value> App::On(const Arguments& args) {
89 77 Local<Object> Emitter = Local<Object>::Cast(process->Get(String::NewSymbol("AppjsEmitter")));
90 78 Local<Function> On = Local<Function>::Cast(Emitter->Get(String::NewSymbol("on")));
91 79
92   - const unsigned argc = 2;
93   - Handle<Value> argv[argc] = { args[0] , args[1] };
94   -
95   - On->Call(Emitter,argc,argv);
  80 + Handle<Value> argv[2] = { args[0] , args[1] };
  81 + On->Call(Emitter, 2, argv);
96 82
97 83 return scope.Close(args.This());
98 84 }
25 src/appjs_window.cpp
@@ -15,8 +15,8 @@ Window::~Window() {};
15 15
16 16 Persistent<Function> Window::constructor;
17 17
18   -void Window::Init () {
19   - DECLARE_CONSTRUCTOR("Window");
  18 +void Window::Init() {
  19 + DECLARE_CONSTRUCTOR("NativeWindow");
20 20 DECLARE_PROTOTYPE_METHOD("openDevTools", OpenDevTools);
21 21 DECLARE_PROTOTYPE_METHOD("closeDevTools", CloseDevTools);
22 22 DECLARE_PROTOTYPE_METHOD("restore", Restore);
@@ -52,28 +52,21 @@ void Window::Init () {
52 52 Handle<Value> Window::New(const Arguments& args) {
53 53 HandleScope scope;
54 54
55   - Handle<Object> self = Persistent<Object>::New(args.This());
  55 + Persistent<Object> options = Persistent<Object>::New(args[0]->ToObject());
  56 + Settings* settings = new Settings(options);
  57 + NativeWindow* window = new NativeWindow(settings);
56 58
57   - char* url = (args[0]->IsString()) ? V8StringToChar(args[0]->ToString()) : (char*) "/";
58   - Persistent<Object> windowSettings = Persistent<Object>::New((args[1]->IsObject()) ? args[1]->ToObject() : Object::New());
59   -
60   - Settings* settings = new Settings(windowSettings);
61   - NativeWindow* window = new NativeWindow(url, settings);
  59 + Persistent<Object> self = Persistent<Object>::New(args.This());
62 60 window->SetV8Handle(self);
63   -
64   - self->SetPointerInInternalField (0, window);
  61 + self->SetPointerInInternalField(0, window);
65 62
66 63 return scope.Close(args.This());
67 64 }
68 65
69 66 Handle<Value> Window::NewInstance(const Arguments& args) {
70 67 HandleScope scope;
71   -
72   - const unsigned argc = 2;
73   - Handle<Value> argv[argc] = { args[0],args[1] };
74   - Local<Object> instance = constructor->NewInstance(argc, argv);
75   -
76   - return scope.Close(instance);
  68 + Handle<Value> argv[1] = { args[0] };
  69 + return scope.Close(constructor->NewInstance(1, argv));
77 70 }
78 71
79 72 CREATE_INSTANCE_ACCESSOR(Window, Left, Integer, MAKE_INT32)
34 src/base/native_window.cpp
@@ -11,27 +11,27 @@ namespace appjs {
11 11
12 12 using namespace v8;
13 13
14   -NativeWindow::NativeWindow(char* url, Settings* settings){
15   - rect_.width = settings->getNumber("width",800);
16   - rect_.height = settings->getNumber("height",600);
17   - rect_.left = settings->getNumber("left",-1);
18   - rect_.top = settings->getNumber("top",-1);
19   - opacity_ = settings->getNumber("opacity",1);
20   - alpha_ = settings->getBoolean("alpha",false);
21   - show_chrome_ = settings->getBoolean("showChrome",true);
22   - auto_resize_ = settings->getBoolean("autoResize",false);
23   - resizable_ = settings->getBoolean("resizable",true);
24   - show_resize_grip = settings->getBoolean("showResizeGrip",false);
25   - fullscreen_ = settings->getBoolean("fullscreen",false);
26   - icons = new Settings(settings->getObject("icons", Object::New()));
27   -
  14 +NativeWindow::NativeWindow(Settings* settings){
28 15 is_main_window_ = !initialized;
29 16 initialized = true;
30 17 closed_ = false;
31 18
32   - Init(url, settings);
33   -
34   - if (settings->getBoolean("topmost",false)) {
  19 + rect_.width = settings->getInteger("width", 800);
  20 + rect_.height = settings->getInteger("height", 600);
  21 + rect_.left = settings->getInteger("left", -1);
  22 + rect_.top = settings->getInteger("top", -1);
  23 + opacity_ = settings->getInteger("opacity", 1);
  24 + alpha_ = settings->getBoolean("alpha", false);
  25 + show_chrome_ = settings->getBoolean("showChrome", true);
  26 + auto_resize_ = settings->getBoolean("autoResize", false);
  27 + resizable_ = settings->getBoolean("resizable", true);
  28 + show_resize_grip = settings->getBoolean("showResizeGrip", false);
  29 + fullscreen_ = settings->getBoolean("fullscreen", false);
  30 + icons = new Settings(settings->getObject("icons"));
  31 +
  32 + Init(settings->getString("url", ""), settings);
  33 +
  34 + if (settings->getBoolean("topmost", false)) {
35 35 SetTopmost(true);
36 36 }
37 37
2  src/base/native_window.h
@@ -26,7 +26,7 @@ enum NW_STATE {
26 26 class NativeWindow {
27 27
28 28 public:
29   - NativeWindow(char* url, Settings* settings);
  29 + NativeWindow(Settings* settings);
30 30 ~NativeWindow();
31 31 void Init(char* url, Settings* settings);
32 32
5 src/includes/util.cpp
@@ -98,6 +98,11 @@ Local<Object> Settings::getObject(const char* property, Local<Object> defaultVal
98 98 return (tmp->IsObject())? tmp->ToObject() : defaultValue;
99 99 }
100 100
  101 +Local<Object> Settings::getObject(const char* property) {
  102 + Local<Value> tmp = get(property);
  103 + return tmp->IsObject() ? tmp->ToObject() : Object::New();
  104 +}
  105 +
101 106 Local<Value> Settings::get(const char* property) {
102 107 return settings_->Get(String::New(property));
103 108 }
1  src/includes/util.h
@@ -39,6 +39,7 @@ class Settings {
39 39 #endif
40 40
41 41 v8::Local<v8::Object> getObject(const char*,v8::Local<v8::Object>);
  42 + v8::Local<v8::Object> getObject(const char*);
42 43
43 44 private:
44 45 v8::Persistent<v8::Object> settings_;
10 src/windows/native_window_win.cpp
@@ -134,11 +134,6 @@ NativeWindow* NativeWindow::GetWindow(CefRefPtr<CefBrowser> browser){
134 134 return GetWindow(GetParent(browser->GetWindowHandle()));
135 135 }
136 136
137   -
138   -void NativeWindow::SetTitle(const char* title) {
139   - SetWindowText(handle_, title);
140   -}
141   -
142 137 // ############################
143 138 // ### NativeWindow methods ###
144 139 // ############################
@@ -277,6 +272,9 @@ const char* NativeWindow::GetTitle() {
277 272 return title;
278 273 }
279 274
  275 +void NativeWindow::SetTitle(const char* title) {
  276 + SetWindowText(handle_, title);
  277 +}
280 278
281 279 void NativeWindow::Move(int left, int top, int width, int height) {
282 280 UpdatePosition(left, top, width, height);
@@ -336,7 +334,7 @@ void NativeWindow::SetResizable(bool resizable) {
336 334 }
337 335
338 336 bool NativeWindow::GetResizable() {
339   - return GetWindowLongPtr(handle_, GWL_STYLE) & WS_SIZEBOX;
  337 + return GetWindowLongPtr(handle_, GWL_STYLE) & WS_SIZEBOX > 0;
340 338 }
341 339
342 340 void NativeWindow::SetShowChrome(bool showChrome) {

0 comments on commit 46adf69

Please sign in to comment.
Something went wrong with that request. Please try again.