electron/atom/browser/api/atom_api_app.h

64 lines
1.6 KiB
C
Raw Normal View History

// Copyright (c) 2013 GitHub, Inc.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
2013-05-02 16:05:09 +00:00
// found in the LICENSE file.
#ifndef ATOM_BROWSER_API_ATOM_API_APP_H_
#define ATOM_BROWSER_API_ATOM_API_APP_H_
#include <string>
2014-04-17 09:13:46 +00:00
#include "atom/browser/api/event_emitter.h"
2014-03-16 00:30:26 +00:00
#include "atom/browser/browser_observer.h"
2014-08-19 13:26:45 +00:00
#include "base/callback.h"
2014-04-17 09:13:46 +00:00
#include "native_mate/handle.h"
2013-05-02 16:05:09 +00:00
2014-08-19 13:26:45 +00:00
class GURL;
namespace base {
class FilePath;
}
2013-05-02 16:05:09 +00:00
namespace atom {
namespace api {
2014-04-17 09:13:46 +00:00
class App : public mate::EventEmitter,
public BrowserObserver {
2013-05-02 16:05:09 +00:00
public:
2014-08-19 13:26:45 +00:00
typedef base::Callback<void(std::string)> ResolveProxyCallback;
2014-04-17 09:13:46 +00:00
static mate::Handle<App> Create(v8::Isolate* isolate);
2013-05-02 16:05:09 +00:00
protected:
2014-04-17 09:13:46 +00:00
App();
virtual ~App();
// BrowserObserver implementations:
virtual void OnWillQuit(bool* prevent_default) OVERRIDE;
virtual void OnWindowAllClosed() OVERRIDE;
2014-09-25 13:47:54 +00:00
virtual void OnQuit() OVERRIDE;
virtual void OnOpenFile(bool* prevent_default,
const std::string& file_path) OVERRIDE;
virtual void OnOpenURL(const std::string& url) OVERRIDE;
virtual void OnActivateWithNoOpenWindows() OVERRIDE;
virtual void OnWillFinishLaunching() OVERRIDE;
virtual void OnFinishLaunching() OVERRIDE;
2014-04-17 09:13:46 +00:00
// mate::Wrappable implementations:
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate);
2013-08-06 08:19:56 +00:00
2014-04-17 09:13:46 +00:00
private:
2014-08-19 13:26:45 +00:00
base::FilePath GetDataPath();
void ResolveProxy(const GURL& url, ResolveProxyCallback callback);
2014-09-18 11:12:24 +00:00
void SetDesktopName(const std::string& desktop_name);
2014-08-19 13:26:45 +00:00
DISALLOW_COPY_AND_ASSIGN(App);
2013-05-02 16:05:09 +00:00
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_APP_H_