Add app.resolveProxy API, fixes #545.

This commit is contained in:
Cheng Zhao 2014-08-19 21:26:45 +08:00
commit cfae3cd3af
3 changed files with 75 additions and 6 deletions

View file

@ -7,12 +7,17 @@
#include <string>
#include "base/compiler_specific.h"
#include "atom/browser/api/event_emitter.h"
#include "atom/browser/browser_observer.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "base/callback.h"
#include "native_mate/handle.h"
class GURL;
namespace base {
class FilePath;
}
namespace atom {
namespace api {
@ -20,6 +25,8 @@ namespace api {
class App : public mate::EventEmitter,
public BrowserObserver {
public:
typedef base::Callback<void(std::string)> ResolveProxyCallback;
static mate::Handle<App> Create(v8::Isolate* isolate);
protected:
@ -35,13 +42,15 @@ class App : public mate::EventEmitter,
virtual void OnActivateWithNoOpenWindows() OVERRIDE;
virtual void OnWillFinishLaunching() OVERRIDE;
virtual void OnFinishLaunching() OVERRIDE;
virtual base::FilePath GetDataPath();
// mate::Wrappable implementations:
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate);
private:
base::FilePath GetDataPath();
void ResolveProxy(const GURL& url, ResolveProxyCallback callback);
DISALLOW_COPY_AND_ASSIGN(App);
};