Update all files to use Windows CRLF (\r\n) line endings (issue #45).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@33 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2009-07-24 19:11:01 +00:00
parent 6a7b6d5038
commit ea3a49abe1
72 changed files with 7757 additions and 7757 deletions

View File

@@ -1,7 +1,7 @@
// Copyright (c) 2008-2009 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
// Copyright (c) 2008-2009 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "stdafx.h"
#include "cefclient.h"
@@ -12,7 +12,7 @@
#define MAX_LOADSTRING 100
#define MAX_URL_LENGTH 255
#define BUTTON_WIDTH 72
#define BUTTON_WIDTH 72
#define URLBAR_HEIGHT 24
// Define this value to run CEF with messages processed using the current
@@ -135,24 +135,24 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
// Register a V8 extension with the below JavaScript code that calls native
// methods implemented in ClientV8ExtensionHandler.
std::wstring code = L"var cef;"
L"if (!cef)"
L" cef = {};"
L"if (!cef.test)"
L" cef.test = {};"
L"(function() {"
L" cef.test.__defineGetter__('test_param', function() {"
L" native function GetTestParam();"
L" return GetTestParam();"
L" });"
L" cef.test.__defineSetter__('test_param', function(b) {"
L" native function SetTestParam();"
L" if(b) SetTestParam(b);"
L" });"
L" cef.test.test_object = function() {"
L" native function GetTestObject();"
L" return GetTestObject();"
L" };"
std::wstring code = L"var cef;"
L"if (!cef)"
L" cef = {};"
L"if (!cef.test)"
L" cef.test = {};"
L"(function() {"
L" cef.test.__defineGetter__('test_param', function() {"
L" native function GetTestParam();"
L" return GetTestParam();"
L" });"
L" cef.test.__defineSetter__('test_param', function(b) {"
L" native function SetTestParam();"
L" if(b) SetTestParam(b);"
L" });"
L" cef.test.test_object = function() {"
L" native function GetTestObject();"
L" return GetTestObject();"
L" };"
L"})();";
CefRegisterExtension(L"v8/test", code, new ClientV8ExtensionHandler());
@@ -704,33 +704,33 @@ public:
// or RV_HANDLED if you displayed a custom alert.
virtual RetVal HandleJSAlert(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::wstring& message)
{
return RV_CONTINUE;
}
const std::wstring& message)
{
return RV_CONTINUE;
}
// Run a JS confirm request. Return RV_CONTINUE to display the default alert
// or RV_HANDLED if you displayed a custom alert. If you handled the alert
// set |retval| to true if the user accepted the confirmation.
virtual RetVal HandleJSConfirm(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::wstring& message, bool& retval)
{
return RV_CONTINUE;
}
const std::wstring& message, bool& retval)
{
return RV_CONTINUE;
}
// Run a JS prompt request. Return RV_CONTINUE to display the default prompt
// or RV_HANDLED if you displayed a custom prompt. If you handled the prompt
// set |retval| to true if the user accepted the prompt and request and
// |result| to the resulting value.
virtual RetVal HandleJSPrompt(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::wstring& message,
const std::wstring& defaultValue,
bool& retval,
const std::wstring& message,
const std::wstring& defaultValue,
bool& retval,
std::wstring& result)
{
return RV_CONTINUE;
return RV_CONTINUE;
}
// Called just before a window is closed. The return value is currently
@@ -863,25 +863,25 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if(hWnd == editWnd)
{
// Callback for the edit window
switch (message)
{
case WM_CHAR:
if (wParam == VK_RETURN && handler.get())
{
// When the user hits the enter key load the URL
CefRefPtr<CefBrowser> browser = handler->GetBrowser();
wchar_t strPtr[MAX_URL_LENGTH] = {0};
*((LPWORD)strPtr) = MAX_URL_LENGTH;
LRESULT strLen = SendMessage(hWnd, EM_GETLINE, 0, (LPARAM)strPtr);
if (strLen > 0) {
strPtr[strLen] = 0;
browser->GetMainFrame()->LoadURL(strPtr);
}
return 0;
}
}
switch (message)
{
case WM_CHAR:
if (wParam == VK_RETURN && handler.get())
{
// When the user hits the enter key load the URL
CefRefPtr<CefBrowser> browser = handler->GetBrowser();
wchar_t strPtr[MAX_URL_LENGTH] = {0};
*((LPWORD)strPtr) = MAX_URL_LENGTH;
LRESULT strLen = SendMessage(hWnd, EM_GETLINE, 0, (LPARAM)strPtr);
if (strLen > 0) {
strPtr[strLen] = 0;
browser->GetMainFrame()->LoadURL(strPtr);
}
return 0;
}
}
return (LRESULT)CallWindowProc(editWndOldProc, hWnd, message, wParam, lParam);
}
else
@@ -897,46 +897,46 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
// Create the child windows used for navigation
RECT rect;
int x = 0;
int x = 0;
GetClientRect(hWnd, &rect);
backWnd = CreateWindow(L"BUTTON", L"Back",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
| WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
hWnd, (HMENU) IDC_NAV_BACK, hInst, 0);
x += BUTTON_WIDTH;
forwardWnd = CreateWindow(L"BUTTON", L"Forward",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
| WS_DISABLED, x, 0, BUTTON_WIDTH,
URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_FORWARD,
hInst, 0);
x += BUTTON_WIDTH;
reloadWnd = CreateWindow(L"BUTTON", L"Reload",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
| WS_DISABLED, x, 0, BUTTON_WIDTH,
URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_RELOAD,
hInst, 0);
x += BUTTON_WIDTH;
stopWnd = CreateWindow(L"BUTTON", L"Stop",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
| WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
hWnd, (HMENU) IDC_NAV_STOP, hInst, 0);
x += BUTTON_WIDTH;
editWnd = CreateWindow(L"EDIT", 0,
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
ES_AUTOVSCROLL | ES_AUTOHSCROLL| WS_DISABLED,
x, 0, rect.right - BUTTON_WIDTH * 4,
URLBAR_HEIGHT, hWnd, 0, hInst, 0);
// Assign the edit window's WNDPROC to this function so that we can
// capture the enter key
editWndOldProc =
reinterpret_cast<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC));
backWnd = CreateWindow(L"BUTTON", L"Back",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
| WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
hWnd, (HMENU) IDC_NAV_BACK, hInst, 0);
x += BUTTON_WIDTH;
forwardWnd = CreateWindow(L"BUTTON", L"Forward",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
| WS_DISABLED, x, 0, BUTTON_WIDTH,
URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_FORWARD,
hInst, 0);
x += BUTTON_WIDTH;
reloadWnd = CreateWindow(L"BUTTON", L"Reload",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
| WS_DISABLED, x, 0, BUTTON_WIDTH,
URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_RELOAD,
hInst, 0);
x += BUTTON_WIDTH;
stopWnd = CreateWindow(L"BUTTON", L"Stop",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
| WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
hWnd, (HMENU) IDC_NAV_STOP, hInst, 0);
x += BUTTON_WIDTH;
editWnd = CreateWindow(L"EDIT", 0,
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
ES_AUTOVSCROLL | ES_AUTOHSCROLL| WS_DISABLED,
x, 0, rect.right - BUTTON_WIDTH * 4,
URLBAR_HEIGHT, hWnd, 0, hInst, 0);
// Assign the edit window's WNDPROC to this function so that we can
// capture the enter key
editWndOldProc =
reinterpret_cast<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC));
SetWindowLongPtr(editWnd, GWLP_WNDPROC,
reinterpret_cast<LONG_PTR>(WndProc));
handler->SetEditHwnd(editWnd);
@@ -1148,14 +1148,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
break;
case WM_ERASEBKGND:
if(handler.get() && handler->GetBrowserHwnd())
{
// Dont erase the background if the browser window has been loaded
// (this avoids flashing)
return 0;
}
break;
case WM_ERASEBKGND:
if(handler.get() && handler->GetBrowserHwnd())
{
// Dont erase the background if the browser window has been loaded
// (this avoids flashing)
return 0;
}
break;
case WM_DESTROY:
// The frame window has exited

View File

@@ -1,7 +1,7 @@
// Copyright (c) 2008 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
// Copyright (c) 2008 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#pragma once
#include "resource.h"

View File

@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioPropertySheet
ProjectType="Visual C++"
Version="8.00"
Name="cefclient"
InheritedPropertySheets="$(SolutionDir)libcef\libcef.vsprops;"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\include&quot;;&quot;$(OutDir)&quot;"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="comctl32.lib shlwapi.lib rpcrt4.lib winmm.lib"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
/>
<Tool
Name="VCResourceCompilerTool"
AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;$(IntDir)\..\&quot;"
/>
</VisualStudioPropertySheet>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioPropertySheet
ProjectType="Visual C++"
Version="8.00"
Name="cefclient"
InheritedPropertySheets="$(SolutionDir)libcef\libcef.vsprops;"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\include&quot;;&quot;$(OutDir)&quot;"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="comctl32.lib shlwapi.lib rpcrt4.lib winmm.lib"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
/>
<Tool
Name="VCResourceCompilerTool"
AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;$(IntDir)\..\&quot;"
/>
</VisualStudioPropertySheet>

View File

@@ -1,185 +1,185 @@
// Copyright (c) 2008 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Copyright (c) 2008 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "stdafx.h"
#include "clientplugin.h"
// Initialized in NP_Initialize.
NPNetscapeFuncs* g_browser = NULL;
// Initialized in NP_Initialize.
NPNetscapeFuncs* g_browser = NULL;
NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc,
char* argn[], char* argv[], NPSavedData* saved) {
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
ClientPlugin* plugin_impl = new ClientPlugin(mode);
plugin_impl->Initialize(GetModuleHandle(NULL), instance, plugin_type, argc,
argn, argv);
instance->pdata = reinterpret_cast<void*>(plugin_impl);
return NPERR_NO_ERROR;
}
NPError NPP_Destroy(NPP instance, NPSavedData** save) {
ClientPlugin* plugin_impl = reinterpret_cast<ClientPlugin*>(instance->pdata);
if (plugin_impl) {
plugin_impl->Shutdown();
delete plugin_impl;
}
return NPERR_NO_ERROR;
}
NPError NPP_SetWindow(NPP instance, NPWindow* window_info) {
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
if (window_info == NULL)
return NPERR_GENERIC_ERROR;
ClientPlugin* plugin_impl = reinterpret_cast<ClientPlugin*>(instance->pdata);
if (plugin_impl == NULL)
return NPERR_GENERIC_ERROR;
HWND window_handle = reinterpret_cast<HWND>(window_info->window);
if (!plugin_impl->SetWindow(window_handle)) {
delete plugin_impl;
return NPERR_GENERIC_ERROR;
}
return NPERR_NO_ERROR;
}
NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* pFuncs)
{
pFuncs->newp = NPP_New;
pFuncs->destroy = NPP_Destroy;
pFuncs->setwindow = NPP_SetWindow;
return NPERR_NO_ERROR;
}
NPError API_CALL NP_Initialize(NPNetscapeFuncs* pFuncs)
{
g_browser = pFuncs;
return NPERR_NO_ERROR;
}
NPError API_CALL NP_Shutdown(void)
{
g_browser = NULL;
return NPERR_NO_ERROR;
}
// ClientPlugin Implementation
ClientPlugin::ClientPlugin(int16 mode)
: mode_(mode)
{
}
ClientPlugin::~ClientPlugin()
{
}
bool ClientPlugin::Initialize(HINSTANCE module_handle, NPP instance,
NPMIMEType mime_type, int16 argc, char* argn[],
char* argv[])
{
RefreshDisplay();
return true;
}
bool ClientPlugin::SetWindow(HWND parent_window)
{
if (!::IsWindow(parent_window)) {
// No window created yet. Ignore this call.
if (!IsWindow())
return true;
// Parent window has been destroyed.
Shutdown();
return true;
}
RECT parent_rect;
if (IsWindow()) {
::GetClientRect(parent_window, &parent_rect);
SetWindowPos(NULL, &parent_rect, SWP_SHOWWINDOW);
return true;
}
// First time in -- no window created by plugin yet.
::GetClientRect(parent_window, &parent_rect);
Create(parent_window, parent_rect, NULL, WS_CHILD | WS_BORDER);
UpdateWindow();
ShowWindow(SW_SHOW);
return true;
}
void ClientPlugin::Shutdown()
{
if (IsWindow()) {
DestroyWindow();
}
}
LRESULT ClientPlugin::OnPaint(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled)
{
static LPCWSTR text = L"Left click in the green area for a message box!";
PAINTSTRUCT paint_struct;
BeginPaint(&paint_struct);
RECT client_rect;
GetClientRect(&client_rect);
int old_mode = SetBkMode(paint_struct.hdc, TRANSPARENT);
COLORREF old_color = SetTextColor(paint_struct.hdc, RGB(0, 0, 255));
RECT text_rect = client_rect;
DrawText(paint_struct.hdc, text, -1, &text_rect, DT_CENTER | DT_CALCRECT);
client_rect.top = ((client_rect.bottom - client_rect.top)
- (text_rect.bottom - text_rect.top)) / 2;
DrawText(paint_struct.hdc, text, -1, &client_rect, DT_CENTER);
SetBkMode(paint_struct.hdc, old_mode);
SetTextColor(paint_struct.hdc, old_color);
EndPaint(&paint_struct);
return 0;
}
LRESULT ClientPlugin::OnEraseBackGround(UINT message, WPARAM wparam,
LPARAM lparam, BOOL& handled)
{
HDC paint_device_context = reinterpret_cast<HDC>(wparam);
RECT erase_rect;
GetClipBox(paint_device_context, &erase_rect);
HBRUSH brush = CreateSolidBrush(RGB(0, 255, 0));
FillRect(paint_device_context, &erase_rect, brush);
DeleteObject(brush);
return 1;
}
LRESULT ClientPlugin::OnLButtonDown(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled)
{
MessageBox(L"You clicked on the client plugin!", L"Client Plugin", MB_OK);
return 0;
}
void ClientPlugin::RefreshDisplay() {
if (!IsWindow())
return;
InvalidateRect(NULL, TRUE);
UpdateWindow();
}
NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc,
char* argn[], char* argv[], NPSavedData* saved) {
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
ClientPlugin* plugin_impl = new ClientPlugin(mode);
plugin_impl->Initialize(GetModuleHandle(NULL), instance, plugin_type, argc,
argn, argv);
instance->pdata = reinterpret_cast<void*>(plugin_impl);
return NPERR_NO_ERROR;
}
NPError NPP_Destroy(NPP instance, NPSavedData** save) {
ClientPlugin* plugin_impl = reinterpret_cast<ClientPlugin*>(instance->pdata);
if (plugin_impl) {
plugin_impl->Shutdown();
delete plugin_impl;
}
return NPERR_NO_ERROR;
}
NPError NPP_SetWindow(NPP instance, NPWindow* window_info) {
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
if (window_info == NULL)
return NPERR_GENERIC_ERROR;
ClientPlugin* plugin_impl = reinterpret_cast<ClientPlugin*>(instance->pdata);
if (plugin_impl == NULL)
return NPERR_GENERIC_ERROR;
HWND window_handle = reinterpret_cast<HWND>(window_info->window);
if (!plugin_impl->SetWindow(window_handle)) {
delete plugin_impl;
return NPERR_GENERIC_ERROR;
}
return NPERR_NO_ERROR;
}
NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* pFuncs)
{
pFuncs->newp = NPP_New;
pFuncs->destroy = NPP_Destroy;
pFuncs->setwindow = NPP_SetWindow;
return NPERR_NO_ERROR;
}
NPError API_CALL NP_Initialize(NPNetscapeFuncs* pFuncs)
{
g_browser = pFuncs;
return NPERR_NO_ERROR;
}
NPError API_CALL NP_Shutdown(void)
{
g_browser = NULL;
return NPERR_NO_ERROR;
}
// ClientPlugin Implementation
ClientPlugin::ClientPlugin(int16 mode)
: mode_(mode)
{
}
ClientPlugin::~ClientPlugin()
{
}
bool ClientPlugin::Initialize(HINSTANCE module_handle, NPP instance,
NPMIMEType mime_type, int16 argc, char* argn[],
char* argv[])
{
RefreshDisplay();
return true;
}
bool ClientPlugin::SetWindow(HWND parent_window)
{
if (!::IsWindow(parent_window)) {
// No window created yet. Ignore this call.
if (!IsWindow())
return true;
// Parent window has been destroyed.
Shutdown();
return true;
}
RECT parent_rect;
if (IsWindow()) {
::GetClientRect(parent_window, &parent_rect);
SetWindowPos(NULL, &parent_rect, SWP_SHOWWINDOW);
return true;
}
// First time in -- no window created by plugin yet.
::GetClientRect(parent_window, &parent_rect);
Create(parent_window, parent_rect, NULL, WS_CHILD | WS_BORDER);
UpdateWindow();
ShowWindow(SW_SHOW);
return true;
}
void ClientPlugin::Shutdown()
{
if (IsWindow()) {
DestroyWindow();
}
}
LRESULT ClientPlugin::OnPaint(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled)
{
static LPCWSTR text = L"Left click in the green area for a message box!";
PAINTSTRUCT paint_struct;
BeginPaint(&paint_struct);
RECT client_rect;
GetClientRect(&client_rect);
int old_mode = SetBkMode(paint_struct.hdc, TRANSPARENT);
COLORREF old_color = SetTextColor(paint_struct.hdc, RGB(0, 0, 255));
RECT text_rect = client_rect;
DrawText(paint_struct.hdc, text, -1, &text_rect, DT_CENTER | DT_CALCRECT);
client_rect.top = ((client_rect.bottom - client_rect.top)
- (text_rect.bottom - text_rect.top)) / 2;
DrawText(paint_struct.hdc, text, -1, &client_rect, DT_CENTER);
SetBkMode(paint_struct.hdc, old_mode);
SetTextColor(paint_struct.hdc, old_color);
EndPaint(&paint_struct);
return 0;
}
LRESULT ClientPlugin::OnEraseBackGround(UINT message, WPARAM wparam,
LPARAM lparam, BOOL& handled)
{
HDC paint_device_context = reinterpret_cast<HDC>(wparam);
RECT erase_rect;
GetClipBox(paint_device_context, &erase_rect);
HBRUSH brush = CreateSolidBrush(RGB(0, 255, 0));
FillRect(paint_device_context, &erase_rect, brush);
DeleteObject(brush);
return 1;
}
LRESULT ClientPlugin::OnLButtonDown(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled)
{
MessageBox(L"You clicked on the client plugin!", L"Client Plugin", MB_OK);
return 0;
}
void ClientPlugin::RefreshDisplay() {
if (!IsWindow())
return;
InvalidateRect(NULL, TRUE);
UpdateWindow();
}

View File

@@ -1,88 +1,88 @@
// Copyright (c) 2008 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Portions of this implementation are borrowed from webkit\default_plugin\
// plugin_impl.h
// Copyright (c) 2008 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Portions of this implementation are borrowed from webkit\default_plugin\
// plugin_impl.h
#pragma once
#include <atlbase.h>
#include <atlbase.h>
#include <atlwin.h>
#include "cef_nplugin.h"
extern NPNetscapeFuncs* g_browser;
extern NPNetscapeFuncs* g_browser;
NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
NPError API_CALL NP_Initialize(NPNetscapeFuncs* pFuncs);
NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
NPError API_CALL NP_Initialize(NPNetscapeFuncs* pFuncs);
NPError API_CALL NP_Shutdown(void);
// Provides the client plugin functionality.
class ClientPlugin : public CWindowImpl<ClientPlugin> {
public:
// mode is the plugin instantiation mode, i.e. whether it is a full
// page plugin (NP_FULL) or an embedded plugin (NP_EMBED)
explicit ClientPlugin(int16 mode);
virtual ~ClientPlugin();
BEGIN_MSG_MAP(ClientPlugin)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackGround)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
END_MSG_MAP()
// Initializes the plugin with the instance information, mime type
// and the list of parameters passed down to the plugin from the webpage.
//
// Parameters:
// module_handle
// The handle to the dll in which this object is instantiated.
// instance
// The plugins opaque instance handle.
// mime_type
// Identifies the third party plugin which would be eventually installed.
// argc
// Indicates the count of arguments passed in from the webpage.
// argv
// Pointer to the arguments.
// Returns true on success.
bool Initialize(HINSTANCE module_handle, NPP instance, NPMIMEType mime_type,
int16 argc, char* argn[], char* argv[]);
// Displays the default plugin UI.
//
// Parameters:
// parent_window
// Handle to the parent window.
bool SetWindow(HWND parent_window);
// Destroys the install dialog and the plugin window.
void Shutdown();
HWND window() const { return m_hWnd; }
// Getter for the NPP instance member.
const NPP instance() const {
return instance_;
}
protected:
// Window message handlers.
LRESULT OnPaint(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
LRESULT OnEraseBackGround(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled);
LRESULT OnLButtonDown(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled);
// Enables the plugin window if required and initiates an update of the
// the plugin window.
void RefreshDisplay();
private:
// The plugins opaque instance handle
NPP instance_;
// The plugin instantiation mode (NP_FULL or NP_EMBED)
int16 mode_;
// Provides the client plugin functionality.
class ClientPlugin : public CWindowImpl<ClientPlugin> {
public:
// mode is the plugin instantiation mode, i.e. whether it is a full
// page plugin (NP_FULL) or an embedded plugin (NP_EMBED)
explicit ClientPlugin(int16 mode);
virtual ~ClientPlugin();
BEGIN_MSG_MAP(ClientPlugin)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackGround)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
END_MSG_MAP()
// Initializes the plugin with the instance information, mime type
// and the list of parameters passed down to the plugin from the webpage.
//
// Parameters:
// module_handle
// The handle to the dll in which this object is instantiated.
// instance
// The plugins opaque instance handle.
// mime_type
// Identifies the third party plugin which would be eventually installed.
// argc
// Indicates the count of arguments passed in from the webpage.
// argv
// Pointer to the arguments.
// Returns true on success.
bool Initialize(HINSTANCE module_handle, NPP instance, NPMIMEType mime_type,
int16 argc, char* argn[], char* argv[]);
// Displays the default plugin UI.
//
// Parameters:
// parent_window
// Handle to the parent window.
bool SetWindow(HWND parent_window);
// Destroys the install dialog and the plugin window.
void Shutdown();
HWND window() const { return m_hWnd; }
// Getter for the NPP instance member.
const NPP instance() const {
return instance_;
}
protected:
// Window message handlers.
LRESULT OnPaint(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
LRESULT OnEraseBackGround(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled);
LRESULT OnLButtonDown(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled);
// Enables the plugin window if required and initiates an update of the
// the plugin window.
void RefreshDisplay();
private:
// The plugins opaque instance handle
NPP instance_;
// The plugin instantiation mode (NP_FULL or NP_EMBED)
int16 mode_;
};

View File

@@ -1,7 +1,7 @@
// Copyright (c) 2008 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
// Copyright (c) 2008 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by cefclient.rc

View File

@@ -1,7 +1,7 @@
// Copyright (c) 2008 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
// Copyright (c) 2008 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
// stdafx.cpp : source file that includes just the standard includes
// cefclient.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

View File

@@ -1,7 +1,7 @@
// Copyright (c) 2008 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
// Copyright (c) 2008 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently