2014-10-31 18:17:05 +00:00
|
|
|
// 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_
|
|
|
|
|
2014-03-16 01:13:06 +00:00
|
|
|
#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"
|
2015-10-19 21:43:04 +00:00
|
|
|
#include "atom/common/native_mate_converters/callback.h"
|
2015-10-20 21:36:01 +00:00
|
|
|
#include "chrome/browser/process_singleton.h"
|
2015-06-25 12:28:07 +00:00
|
|
|
#include "content/public/browser/gpu_data_manager_observer.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
|
|
|
namespace base {
|
|
|
|
class FilePath;
|
|
|
|
}
|
|
|
|
|
2015-01-19 04:24:58 +00:00
|
|
|
namespace mate {
|
|
|
|
class Arguments;
|
|
|
|
}
|
2015-10-20 20:27:34 +00:00
|
|
|
|
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,
|
2015-06-25 12:28:07 +00:00
|
|
|
public BrowserObserver,
|
|
|
|
public content::GpuDataManagerObserver {
|
2013-05-02 16:05:09 +00:00
|
|
|
public:
|
2014-04-17 09:13:46 +00:00
|
|
|
static mate::Handle<App> Create(v8::Isolate* isolate);
|
2013-05-02 16:05:09 +00:00
|
|
|
|
2013-05-03 02:53:54 +00:00
|
|
|
protected:
|
2014-04-17 09:13:46 +00:00
|
|
|
App();
|
|
|
|
virtual ~App();
|
2013-05-03 02:53:54 +00:00
|
|
|
|
2014-11-16 14:45:29 +00:00
|
|
|
// BrowserObserver:
|
2015-02-26 03:33:42 +00:00
|
|
|
void OnBeforeQuit(bool* prevent_default) override;
|
2014-11-16 14:45:29 +00:00
|
|
|
void OnWillQuit(bool* prevent_default) override;
|
|
|
|
void OnWindowAllClosed() override;
|
|
|
|
void OnQuit() override;
|
|
|
|
void OnOpenFile(bool* prevent_default, const std::string& file_path) override;
|
|
|
|
void OnOpenURL(const std::string& url) override;
|
2015-09-15 02:05:53 +00:00
|
|
|
void OnActivate(bool has_visible_windows) override;
|
2014-11-16 14:45:29 +00:00
|
|
|
void OnWillFinishLaunching() override;
|
|
|
|
void OnFinishLaunching() override;
|
2015-06-11 15:22:07 +00:00
|
|
|
void OnSelectCertificate(
|
|
|
|
content::WebContents* web_contents,
|
|
|
|
net::SSLCertRequestInfo* cert_request_info,
|
|
|
|
scoped_ptr<content::ClientCertificateDelegate> delegate) override;
|
2015-10-28 11:34:01 +00:00
|
|
|
void OnLogin(LoginHandler* login_handler) override;
|
2014-11-16 14:45:29 +00:00
|
|
|
|
2015-06-25 12:28:07 +00:00
|
|
|
// content::GpuDataManagerObserver:
|
|
|
|
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
|
|
|
|
|
2014-11-16 14:45:29 +00:00
|
|
|
// mate::Wrappable:
|
|
|
|
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
|
|
|
v8::Isolate* isolate) override;
|
2013-08-06 08:19:56 +00:00
|
|
|
|
2014-04-17 09:13:46 +00:00
|
|
|
private:
|
2015-01-19 01:52:15 +00:00
|
|
|
// Get/Set the pre-defined path in PathService.
|
2015-01-19 04:24:58 +00:00
|
|
|
base::FilePath GetPath(mate::Arguments* args, const std::string& name);
|
|
|
|
void SetPath(mate::Arguments* args,
|
|
|
|
const std::string& name,
|
|
|
|
const base::FilePath& path);
|
2015-01-19 01:52:15 +00:00
|
|
|
|
2014-09-18 11:12:24 +00:00
|
|
|
void SetDesktopName(const std::string& desktop_name);
|
2015-04-28 19:08:31 +00:00
|
|
|
void SetAppUserModelId(const std::string& app_id);
|
2015-10-16 23:45:54 +00:00
|
|
|
void AllowNTLMCredentialsForAllDomains(bool should_allow);
|
2015-10-22 08:24:35 +00:00
|
|
|
bool MakeSingleInstance(
|
|
|
|
const ProcessSingleton::NotificationCallback& callback);
|
2015-09-16 08:16:21 +00:00
|
|
|
std::string GetLocale();
|
2015-06-23 15:40:41 +00:00
|
|
|
v8::Local<v8::Value> DefaultSession(v8::Isolate* isolate);
|
|
|
|
|
|
|
|
v8::Global<v8::Value> default_session_;
|
2015-10-21 20:17:56 +00:00
|
|
|
|
2015-10-21 20:38:32 +00:00
|
|
|
scoped_ptr<ProcessSingleton> process_singleton_;
|
2014-08-19 13:26:45 +00:00
|
|
|
|
2013-05-03 02:53:54 +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_
|