From 32eb277ae3eeaa42d647f0e2c61b1850ebfa640c Mon Sep 17 00:00:00 2001 From: chillitom Date: Tue, 7 Dec 2010 15:14:57 +0000 Subject: [PATCH] move CEF class definition into CefSharp.h header and move IBeforeResourceLoad into own header file --- CefSharp/BrowserControl.h | 23 ++++------------ CefSharp/CefSharp.cpp | 39 -------------------------- CefSharp/CefSharp.h | 50 ++++++++++++++++++++++------------ CefSharp/CefSharp.vcproj | 4 +++ CefSharp/HandlerAdapter.h | 1 - CefSharp/IBeforeResourceLoad.h | 34 +++++++++++++++++++++++ 6 files changed, 76 insertions(+), 75 deletions(-) create mode 100644 CefSharp/IBeforeResourceLoad.h diff --git a/CefSharp/BrowserControl.h b/CefSharp/BrowserControl.h index e6f3105f2..5e46e1d6f 100644 --- a/CefSharp/BrowserControl.h +++ b/CefSharp/BrowserControl.h @@ -2,7 +2,7 @@ #pragma once #include "HandlerAdapter.h" -#include "CefSharp.h" +#include "IBeforeResourceLoad.h" using namespace System; using namespace System::ComponentModel; @@ -61,31 +61,18 @@ namespace CefSharp property String^ Title { - String^ get() - { - return _title; - } + String^ get() { return _title; } } property String^ Address { - String^ get() - { - return _address; - } + String^ get() { return _address; } } property IBeforeResourceLoad^ BeforeResourceLoadHandler { - IBeforeResourceLoad^ get() - { - return _beforeResourceLoadHandler; - } - - void set(IBeforeResourceLoad^ handler) - { - _beforeResourceLoadHandler = handler; - } + IBeforeResourceLoad^ get() { return _beforeResourceLoadHandler; } + void set(IBeforeResourceLoad^ handler) { _beforeResourceLoadHandler = handler; } } property bool CanGoForward diff --git a/CefSharp/CefSharp.cpp b/CefSharp/CefSharp.cpp index 734001fef..87d0e36d1 100644 --- a/CefSharp/CefSharp.cpp +++ b/CefSharp/CefSharp.cpp @@ -30,45 +30,6 @@ public: } };*/ -public ref class CEF sealed -{ -public: - static property String^ CefSharpVersion - { - String^ get() - { - return "0.1"; - } - } - - static property String^ CefVersion - { - String^ get() - { - return "trunk r149"; - } - } - - static property String^ ChromiumVersion - { - String^ get() - { - return "trunk r66269"; - } - } - - static bool Initialize(Settings^ settings, BrowserSettings^ browserSettings) - { - return CefInitialize(*settings->_cefSettings, *browserSettings->_browserSettings); - } - - static void Shutdown() - { - CefShutdown(); - } -}; - - ///////////////////////////////// END OF NAMESPACE } diff --git a/CefSharp/CefSharp.h b/CefSharp/CefSharp.h index b408425a5..08e47a4be 100644 --- a/CefSharp/CefSharp.h +++ b/CefSharp/CefSharp.h @@ -12,25 +12,41 @@ using namespace System::IO; namespace CefSharp { - public interface class IBeforeResourceLoad + public ref class CEF sealed { public: - - /* Event called before a resource is loaded. - - To allow the resource to load normally return ReturnValue.Continue. - - To redirect the resource to a new url populate the redirectUrl value - and return ReturnValue.Continue. - - To specify data for the resource return a Stream object in resourceStream, - set mimeType to the resource stream's mime type, and return ReturnValue.Continue. + static property String^ CefSharpVersion + { + String^ get() + { + return "0.1"; + } + } - To cancel loading of the resource return ReturnValue.Handled. - - Any modifications to request will be observed. If the URL in request is changed and - redirectUrl is also set, the URL in request will be used. */ - ReturnValue HandleBeforeResourceLoad(BrowserControl^ browserControl, IRequest^ request, - String^% redirectUrl, Stream^% resourceStream, String^% mimeType, int loadFlags); + static property String^ CefVersion + { + String^ get() + { + return "trunk r149"; + } + } + + static property String^ ChromiumVersion + { + String^ get() + { + return "trunk r66269"; + } + } + + static bool Initialize(Settings^ settings, BrowserSettings^ browserSettings) + { + return CefInitialize(*settings->_cefSettings, *browserSettings->_browserSettings); + } + + static void Shutdown() + { + CefShutdown(); + } }; } diff --git a/CefSharp/CefSharp.vcproj b/CefSharp/CefSharp.vcproj index 2bb5a6235..06b61c825 100644 --- a/CefSharp/CefSharp.vcproj +++ b/CefSharp/CefSharp.vcproj @@ -282,6 +282,10 @@ RelativePath=".\HandlerAdapter.h" > + + diff --git a/CefSharp/HandlerAdapter.h b/CefSharp/HandlerAdapter.h index 45c64ecf5..a06ca3579 100644 --- a/CefSharp/HandlerAdapter.h +++ b/CefSharp/HandlerAdapter.h @@ -1,5 +1,4 @@ #include "stdafx.h" - #pragma once namespace CefSharp diff --git a/CefSharp/IBeforeResourceLoad.h b/CefSharp/IBeforeResourceLoad.h new file mode 100644 index 000000000..3135151f9 --- /dev/null +++ b/CefSharp/IBeforeResourceLoad.h @@ -0,0 +1,34 @@ +#include "stdafx.h" +#pragma once + +#include "BrowserControl.h" +#include "Request.h" +#include "ReturnValue.h" + +using namespace System; +using namespace System::IO; + +namespace CefSharp +{ + public interface class IBeforeResourceLoad + { + public: + + /// Event called before a resource is loaded. + /// + /// To allow the resource to load normally return ReturnValue.Continue. + /// + /// To redirect the resource to a new url populate the redirectUrl value + /// and return ReturnValue.Continue. + /// + /// To specify data for the resource return a Stream object in resourceStream, + /// set mimeType to the resource stream's mime type, and return ReturnValue.Continue. + /// + /// To cancel loading of the resource return ReturnValue.Handled. + /// + /// Any modifications to request will be observed. If the URL in request is changed and + /// redirectUrl is also set, the URL in request will be used. */ + ReturnValue HandleBeforeResourceLoad(BrowserControl^ browserControl, IRequest^ request, + String^% redirectUrl, Stream^% resourceStream, String^% mimeType, int loadFlags); + }; +} \ No newline at end of file