libcef: Update due to underlying chromium changes.

- Add WebKit-based printing support.
- Add re-sizable text area support.
- In release build, only log error messages and above.
- Modify cef.sln to point at new file locations for dynamically generated project files.
- More webkit_glue and webkit_init reorganization.
- Movement towards using Web* basic types.
- Include WebKit headers using the full path.
- Add app cache support in ResourceLoaderBridge.
- Method/member changes in WebViewDelegate.
- Simplify code in PrintSettings.
- Remove the WM_DESTROY and WM_NCDESTROY cases in WebWidgetHost::WndProc() to avoid a crash when closing a browser window via a DestroyWindow() call on a parent window.

libcef_dll:
- Add webkit_resources.rc and webkit_strings_en-US.rc to the project in order to support localized strings.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@23 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2009-04-28 00:29:14 +00:00
parent 3f5a01e969
commit 52196814b2
25 changed files with 538 additions and 501 deletions

View File

@ -29,3 +29,4 @@ Date | CEF Revision | Chromium Revision
2009-03-05 | /trunk@17 | /trunk@10987
2009-03-09 | /trunk@21 | /trunk@11252
2009-03-24 | /trunk@22 | /trunk@11768
2009-04-27 | /trunk@23 | /trunk@14651

162
cef.sln
View File

@ -4,25 +4,25 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebKit (readonly)", "WebKit
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebCore", "..\webkit\build\WebCore\WebCore.vcproj", "{1C16337B-ACF3-4D03-AA90-851C5B5EADA6}"
ProjectSection(ProjectDependencies) = postProject
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
{1444235E-0E97-4C80-A73E-EE73F3706C32} = {1444235E-0E97-4C80-A73E-EE73F3706C32}
{2F7EDFA2-EE27-4D83-8454-9EFBD5779203} = {2F7EDFA2-EE27-4D83-8454-9EFBD5779203}
{6EAD4A4B-2BBC-4974-8E45-BB5C16CC2AC9} = {6EAD4A4B-2BBC-4974-8E45-BB5C16CC2AC9}
{2F7EDFA2-EE27-4D83-8454-9EFBD5779203} = {2F7EDFA2-EE27-4D83-8454-9EFBD5779203}
{1444235E-0E97-4C80-A73E-EE73F3706C32} = {1444235E-0E97-4C80-A73E-EE73F3706C32}
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Port", "..\webkit\build\port\port.vcproj", "{5597AD47-3494-4750-A235-4F9C2F864700}"
ProjectSection(ProjectDependencies) = postProject
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
{2F7EDFA2-EE27-4D83-8454-9EFBD5779203} = {2F7EDFA2-EE27-4D83-8454-9EFBD5779203}
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Glue", "..\webkit\glue\glue.vcproj", "{C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09}"
ProjectSection(ProjectDependencies) = postProject
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
{0B469837-3D46-484A-AFB3-C5A6C68730B9} = {0B469837-3D46-484A-AFB3-C5A6C68730B9}
{2F7EDFA2-EE27-4D83-8454-9EFBD5779203} = {2F7EDFA2-EE27-4D83-8454-9EFBD5779203}
{60B43839-95E6-4526-A661-209F16335E0E} = {60B43839-95E6-4526-A661-209F16335E0E}
{1444235E-0E97-4C80-A73E-EE73F3706C32} = {1444235E-0E97-4C80-A73E-EE73F3706C32}
{60B43839-95E6-4526-A661-209F16335E0E} = {60B43839-95E6-4526-A661-209F16335E0E}
{2F7EDFA2-EE27-4D83-8454-9EFBD5779203} = {2F7EDFA2-EE27-4D83-8454-9EFBD5779203}
{0B469837-3D46-484A-AFB3-C5A6C68730B9} = {0B469837-3D46-484A-AFB3-C5A6C68730B9}
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "skia", "..\skia\skia.vcproj", "{CD9CA56E-4E94-444C-87D4-58CA1E6F300D}"
@ -55,52 +55,52 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Breakpad", "Breakpad", "{87
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "breakpad_handler", "..\breakpad\breakpad_handler.vcproj", "{B55CA863-B374-4BAF-95AC-539E4FA4C90C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml", "..\third_party\libxml\build\libxml.vcproj", "{F9810DE8-CBC3-4605-A7B1-ECA2D5292FD7}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml", "..\third_party\libxml\libxml.vcproj", "{F9810DE8-CBC3-4605-A7B1-ECA2D5292FD7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxslt", "..\third_party\libxslt\build\libxslt.vcproj", "{FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxslt", "..\third_party\libxslt\libxslt.vcproj", "{FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED}"
ProjectSection(ProjectDependencies) = postProject
{F9810DE8-CBC3-4605-A7B1-ECA2D5292FD7} = {F9810DE8-CBC3-4605-A7B1-ECA2D5292FD7}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "V8Bindings", "..\webkit\build\V8Bindings\V8Bindings.vcproj", "{625A8F11-2B4E-45B4-BD99-C6D629C606C0}"
ProjectSection(ProjectDependencies) = postProject
{2F7EDFA2-EE27-4D83-8454-9EFBD5779203} = {2F7EDFA2-EE27-4D83-8454-9EFBD5779203}
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
{2F7EDFA2-EE27-4D83-8454-9EFBD5779203} = {2F7EDFA2-EE27-4D83-8454-9EFBD5779203}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "..\third_party\bzip2\bzip2.vcproj", "{2A70CBF0-847E-4E3A-B926-542A656DC7FE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcef", "libcef\libcef.vcproj", "{FA39524D-3067-4141-888D-28A86C66F2B9}"
ProjectSection(ProjectDependencies) = postProject
{60B43839-95E6-4526-A661-209F16335E0E} = {60B43839-95E6-4526-A661-209F16335E0E}
{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65} = {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}
{2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE}
{49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {49909552-0B0C-4C14-8CF6-DB8A2ADE0934}
{5597AD47-3494-4750-A235-4F9C2F864700} = {5597AD47-3494-4750-A235-4F9C2F864700}
{5916D37D-8C97-424F-A904-74E52594C2D6} = {5916D37D-8C97-424F-A904-74E52594C2D6}
{625A8F11-2B4E-45B4-BD99-C6D629C606C0} = {625A8F11-2B4E-45B4-BD99-C6D629C606C0}
{7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D}
{8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} = {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C}
{8C27D792-2648-4F5E-9ED0-374276327308} = {8C27D792-2648-4F5E-9ED0-374276327308}
{A508ADD3-CECE-4E0F-8448-2F5E454DF551} = {A508ADD3-CECE-4E0F-8448-2F5E454DF551}
{AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
{B55CA863-B374-4BAF-95AC-539E4FA4C90C} = {B55CA863-B374-4BAF-95AC-539E4FA4C90C}
{C0334F9A-1168-4101-9DD8-C30FB252D435} = {C0334F9A-1168-4101-9DD8-C30FB252D435}
{C564F145-9172-42C3-BFCB-6014CA97DBCD} = {C564F145-9172-42C3-BFCB-6014CA97DBCD}
{C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09} = {C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09}
{CD9CA56E-4E94-444C-87D4-58CA1E6F300D} = {CD9CA56E-4E94-444C-87D4-58CA1E6F300D}
{EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C}
{F4F4BCAA-EA59-445C-A119-3E6C29647A51} = {F4F4BCAA-EA59-445C-A119-3E6C29647A51}
{F54ABC59-5C00-414A-A9BA-BAF26D1699F0} = {F54ABC59-5C00-414A-A9BA-BAF26D1699F0}
{FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED} = {FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED}
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} = {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
{326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243}
{1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
{238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601}
{1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165}
{21E22961-22BF-4493-BD3A-868F93DA5179} = {21E22961-22BF-4493-BD3A-868F93DA5179}
{EC8B7909-62AF-470D-A75D-E1D89C837142} = {EC8B7909-62AF-470D-A75D-E1D89C837142}
{0B469837-3D46-484A-AFB3-C5A6C68730B9} = {0B469837-3D46-484A-AFB3-C5A6C68730B9}
{EC8B7909-62AF-470D-A75D-E1D89C837142} = {EC8B7909-62AF-470D-A75D-E1D89C837142}
{21E22961-22BF-4493-BD3A-868F93DA5179} = {21E22961-22BF-4493-BD3A-868F93DA5179}
{1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165}
{238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601}
{1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
{326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243}
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} = {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
{FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED} = {FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED}
{F54ABC59-5C00-414A-A9BA-BAF26D1699F0} = {F54ABC59-5C00-414A-A9BA-BAF26D1699F0}
{F4F4BCAA-EA59-445C-A119-3E6C29647A51} = {F4F4BCAA-EA59-445C-A119-3E6C29647A51}
{EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C}
{CD9CA56E-4E94-444C-87D4-58CA1E6F300D} = {CD9CA56E-4E94-444C-87D4-58CA1E6F300D}
{C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09} = {C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09}
{C564F145-9172-42C3-BFCB-6014CA97DBCD} = {C564F145-9172-42C3-BFCB-6014CA97DBCD}
{C0334F9A-1168-4101-9DD8-C30FB252D435} = {C0334F9A-1168-4101-9DD8-C30FB252D435}
{B55CA863-B374-4BAF-95AC-539E4FA4C90C} = {B55CA863-B374-4BAF-95AC-539E4FA4C90C}
{AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
{A508ADD3-CECE-4E0F-8448-2F5E454DF551} = {A508ADD3-CECE-4E0F-8448-2F5E454DF551}
{8C27D792-2648-4F5E-9ED0-374276327308} = {8C27D792-2648-4F5E-9ED0-374276327308}
{8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} = {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C}
{7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D}
{625A8F11-2B4E-45B4-BD99-C6D629C606C0} = {625A8F11-2B4E-45B4-BD99-C6D629C606C0}
{5916D37D-8C97-424F-A904-74E52594C2D6} = {5916D37D-8C97-424F-A904-74E52594C2D6}
{5597AD47-3494-4750-A235-4F9C2F864700} = {5597AD47-3494-4750-A235-4F9C2F864700}
{49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {49909552-0B0C-4C14-8CF6-DB8A2ADE0934}
{2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE}
{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65} = {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}
{60B43839-95E6-4526-A661-209F16335E0E} = {60B43839-95E6-4526-A661-209F16335E0E}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "V8", "V8", "{B353A6A5-9551-4B76-908E-0F0A9B31E4CE}"
@ -111,22 +111,22 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modp_b64", "..\third_party\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "activex_shim", "..\webkit\activex_shim\activex_shim.vcproj", "{F4F4BCAA-EA59-445C-A119-3E6C29647A51}"
ProjectSection(ProjectDependencies) = postProject
{8C27D792-2648-4F5E-9ED0-374276327308} = {8C27D792-2648-4F5E-9ED0-374276327308}
{EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C}
{8C27D792-2648-4F5E-9ED0-374276327308} = {8C27D792-2648-4F5E-9ED0-374276327308}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "net", "..\net\build\net.vcproj", "{326E9795-E760-410A-B69A-3F79DB3F5243}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "net", "..\net\net.vcproj", "{326E9795-E760-410A-B69A-3F79DB3F5243}"
ProjectSection(ProjectDependencies) = postProject
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} = {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
{E13045CD-7E1F-4A41-9B18-8D288B2E7B41} = {E13045CD-7E1F-4A41-9B18-8D288B2E7B41}
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} = {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base", "..\base\build\base.vcproj", "{1832A374-8A74-4F9E-B536-69A699B3E165}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base", "..\base\base.vcproj", "{1832A374-8A74-4F9E-B536-69A699B3E165}"
ProjectSection(ProjectDependencies) = postProject
{8C27D792-2648-4F5E-9ED0-374276327308} = {8C27D792-2648-4F5E-9ED0-374276327308}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base_gfx", "..\base\build\base_gfx.vcproj", "{A508ADD3-CECE-4E0F-8448-2F5E454DF551}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base_gfx", "..\base\base_gfx.vcproj", "{A508ADD3-CECE-4E0F-8448-2F5E454DF551}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "default_plugin", "..\webkit\default_plugin\default_plugin.vcproj", "{5916D37D-8C97-424F-A904-74E52594C2D6}"
ProjectSection(ProjectDependencies) = postProject
@ -139,8 +139,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "V8Bindings_prebuild", "..\w
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v8_snapshot", "..\v8\tools\visual_studio\v8_snapshot.vcproj", "{C0334F9A-1168-4101-9DD8-C30FB252D435}"
ProjectSection(ProjectDependencies) = postProject
{865575D0-37E2-405E-8CBA-5F6C485B5A26} = {865575D0-37E2-405E-8CBA-5F6C485B5A26}
{0DDBDA8B-A49F-4CC7-A1D5-5BB8297C8A3F} = {0DDBDA8B-A49F-4CC7-A1D5-5BB8297C8A3F}
{865575D0-37E2-405E-8CBA-5F6C485B5A26} = {865575D0-37E2-405E-8CBA-5F6C485B5A26}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdch", "..\sdch\sdch.vcproj", "{F54ABC59-5C00-414A-A9BA-BAF26D1699F0}"
@ -149,11 +149,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cef", "Cef", "{08BAF606-555
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{A507014E-5F1D-4A60-963B-518FCED4B8AD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tld_cleanup", "..\net\build\tld_cleanup.vcproj", "{E13045CD-7E1F-4A41-9B18-8D288B2E7B41}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tld_cleanup", "..\net\tld_cleanup.vcproj", "{E13045CD-7E1F-4A41-9B18-8D288B2E7B41}"
ProjectSection(ProjectDependencies) = postProject
{EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C}
{8C27D792-2648-4F5E-9ED0-374276327308} = {8C27D792-2648-4F5E-9ED0-374276327308}
{1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165}
{8C27D792-2648-4F5E-9ED0-374276327308} = {8C27D792-2648-4F5E-9ED0-374276327308}
{EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v8_mksnapshot", "..\v8\tools\visual_studio\v8_mksnapshot.vcproj", "{865575D0-37E2-405E-8CBA-5F6C485B5A26}"
@ -174,13 +174,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "webkit_strings", "..\webkit
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cefclient", "tests\cefclient\cefclient.vcproj", "{6617FED9-C5D4-4907-BF55-A90062A6683F}"
ProjectSection(ProjectDependencies) = postProject
{A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9} = {A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9}
{C13650D5-CF1A-4259-BE45-B1EBA6280E47} = {C13650D5-CF1A-4259-BE45-B1EBA6280E47}
{A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9} = {A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icudt", "..\third_party\icu38\build\icudt.vcproj", "{A0D94973-D355-47A5-A1E2-3456F321F010}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "net_resources", "..\net\build\net_resources.vcproj", "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "net_resources", "..\net\net_resources.vcproj", "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "webkit_resources", "..\webkit\build\webkit_resources\webkit_resources.vcproj", "{0B469837-3D46-484A-AFB3-C5A6C68730B9}"
EndProject
@ -193,48 +193,48 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v8_snapshot_cc", "..\v8\too
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcef_dll", "libcef_dll\libcef_dll.vcproj", "{C13650D5-CF1A-4259-BE45-B1EBA6280E47}"
ProjectSection(ProjectDependencies) = postProject
{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65} = {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}
{EC8B7909-62AF-470D-A75D-E1D89C837142} = {EC8B7909-62AF-470D-A75D-E1D89C837142}
{8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} = {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C}
{625A8F11-2B4E-45B4-BD99-C6D629C606C0} = {625A8F11-2B4E-45B4-BD99-C6D629C606C0}
{7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D}
{0B469837-3D46-484A-AFB3-C5A6C68730B9} = {0B469837-3D46-484A-AFB3-C5A6C68730B9}
{60B43839-95E6-4526-A661-209F16335E0E} = {60B43839-95E6-4526-A661-209F16335E0E}
{C564F145-9172-42C3-BFCB-6014CA97DBCD} = {C564F145-9172-42C3-BFCB-6014CA97DBCD}
{5597AD47-3494-4750-A235-4F9C2F864700} = {5597AD47-3494-4750-A235-4F9C2F864700}
{FA39524D-3067-4141-888D-28A86C66F2B9} = {FA39524D-3067-4141-888D-28A86C66F2B9}
{F54ABC59-5C00-414A-A9BA-BAF26D1699F0} = {F54ABC59-5C00-414A-A9BA-BAF26D1699F0}
{21E22961-22BF-4493-BD3A-868F93DA5179} = {21E22961-22BF-4493-BD3A-868F93DA5179}
{B55CA863-B374-4BAF-95AC-539E4FA4C90C} = {B55CA863-B374-4BAF-95AC-539E4FA4C90C}
{C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09} = {C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09}
{CD9CA56E-4E94-444C-87D4-58CA1E6F300D} = {CD9CA56E-4E94-444C-87D4-58CA1E6F300D}
{1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165}
{238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601}
{1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
{5916D37D-8C97-424F-A904-74E52594C2D6} = {5916D37D-8C97-424F-A904-74E52594C2D6}
{AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
{8C27D792-2648-4F5E-9ED0-374276327308} = {8C27D792-2648-4F5E-9ED0-374276327308}
{326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243}
{C0334F9A-1168-4101-9DD8-C30FB252D435} = {C0334F9A-1168-4101-9DD8-C30FB252D435}
{F4F4BCAA-EA59-445C-A119-3E6C29647A51} = {F4F4BCAA-EA59-445C-A119-3E6C29647A51}
{EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C}
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} = {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
{FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED} = {FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED}
{A508ADD3-CECE-4E0F-8448-2F5E454DF551} = {A508ADD3-CECE-4E0F-8448-2F5E454DF551}
{2A70CBF0-847E-4E3A-B926-542A656DC7FE} = {2A70CBF0-847E-4E3A-B926-542A656DC7FE}
{A508ADD3-CECE-4E0F-8448-2F5E454DF551} = {A508ADD3-CECE-4E0F-8448-2F5E454DF551}
{FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED} = {FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED}
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} = {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
{EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C}
{F4F4BCAA-EA59-445C-A119-3E6C29647A51} = {F4F4BCAA-EA59-445C-A119-3E6C29647A51}
{C0334F9A-1168-4101-9DD8-C30FB252D435} = {C0334F9A-1168-4101-9DD8-C30FB252D435}
{326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243}
{8C27D792-2648-4F5E-9ED0-374276327308} = {8C27D792-2648-4F5E-9ED0-374276327308}
{AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
{5916D37D-8C97-424F-A904-74E52594C2D6} = {5916D37D-8C97-424F-A904-74E52594C2D6}
{1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
{238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601}
{1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165}
{CD9CA56E-4E94-444C-87D4-58CA1E6F300D} = {CD9CA56E-4E94-444C-87D4-58CA1E6F300D}
{C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09} = {C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09}
{B55CA863-B374-4BAF-95AC-539E4FA4C90C} = {B55CA863-B374-4BAF-95AC-539E4FA4C90C}
{21E22961-22BF-4493-BD3A-868F93DA5179} = {21E22961-22BF-4493-BD3A-868F93DA5179}
{F54ABC59-5C00-414A-A9BA-BAF26D1699F0} = {F54ABC59-5C00-414A-A9BA-BAF26D1699F0}
{FA39524D-3067-4141-888D-28A86C66F2B9} = {FA39524D-3067-4141-888D-28A86C66F2B9}
{5597AD47-3494-4750-A235-4F9C2F864700} = {5597AD47-3494-4750-A235-4F9C2F864700}
{C564F145-9172-42C3-BFCB-6014CA97DBCD} = {C564F145-9172-42C3-BFCB-6014CA97DBCD}
{60B43839-95E6-4526-A661-209F16335E0E} = {60B43839-95E6-4526-A661-209F16335E0E}
{0B469837-3D46-484A-AFB3-C5A6C68730B9} = {0B469837-3D46-484A-AFB3-C5A6C68730B9}
{7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D}
{625A8F11-2B4E-45B4-BD99-C6D629C606C0} = {625A8F11-2B4E-45B4-BD99-C6D629C606C0}
{8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} = {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C}
{EC8B7909-62AF-470D-A75D-E1D89C837142} = {EC8B7909-62AF-470D-A75D-E1D89C837142}
{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65} = {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcef_dll_wrapper", "libcef_dll\wrapper\libcef_dll_wrapper.vcproj", "{A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9}"
ProjectSection(ProjectDependencies) = postProject
{1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165}
{C13650D5-CF1A-4259-BE45-B1EBA6280E47} = {C13650D5-CF1A-4259-BE45-B1EBA6280E47}
{1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKit", "..\webkit\build\WebKit\WebKit.vcproj", "{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}"
ProjectSection(ProjectDependencies) = postProject
{2F7EDFA2-EE27-4D83-8454-9EFBD5779203} = {2F7EDFA2-EE27-4D83-8454-9EFBD5779203}
{1444235E-0E97-4C80-A73E-EE73F3706C32} = {1444235E-0E97-4C80-A73E-EE73F3706C32}
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
{1444235E-0E97-4C80-A73E-EE73F3706C32} = {1444235E-0E97-4C80-A73E-EE73F3706C32}
{2F7EDFA2-EE27-4D83-8454-9EFBD5779203} = {2F7EDFA2-EE27-4D83-8454-9EFBD5779203}
EndProjectSection
EndProject
Global

View File

@ -8,8 +8,12 @@
#include <atltypes.h>
#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
#include "webkit/glue/webview.h"
using WebKit::WebPoint;
namespace {
void GetCursorPositions(HWND hwnd, CPoint* client, CPoint* screen) {
@ -32,12 +36,14 @@ void BrowserDragDelegate::OnDragSourceDrop() {
CPoint client;
CPoint screen;
GetCursorPositions(source_hwnd_, &client, &screen);
webview_->DragSourceEndedAt(client.x, client.y, screen.x, screen.y);
webview_->DragSourceEndedAt(WebPoint(client.x, client.y),
WebPoint(screen.x, screen.y));
}
void BrowserDragDelegate::OnDragSourceMove() {
CPoint client;
CPoint screen;
GetCursorPositions(source_hwnd_, &client, &screen);
webview_->DragSourceMovedTo(client.x, client.y, screen.x, screen.y);
webview_->DragSourceMovedTo(WebPoint(client.x, client.y),
WebPoint(screen.x, screen.y));
}

View File

@ -6,10 +6,15 @@
#include "precompiled_libcef.h"
#include "browser_drop_delegate.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
#include "webkit/glue/webdropdata.h"
#include "webkit/glue/webview.h"
using WebKit::WebPoint;
// BaseDropTarget methods ----------------------------------------------------
DWORD BrowserDropDelegate::OnDragEnter(IDataObject* data_object,
DWORD key_state,
POINT cursor_position,
@ -19,8 +24,10 @@ DWORD BrowserDropDelegate::OnDragEnter(IDataObject* data_object,
POINT client_pt = cursor_position;
ScreenToClient(GetHWND(), &client_pt);
bool valid = webview_->DragTargetDragEnter(drop_data, client_pt.x,
client_pt.y, cursor_position.x, cursor_position.y);
bool valid = webview_->DragTargetDragEnter(
drop_data.ToDragData(), drop_data.identity,
WebPoint(client_pt.x, client_pt.y),
WebPoint(cursor_position.x, cursor_position.y));
return valid ? DROPEFFECT_COPY : DROPEFFECT_NONE;
}
@ -30,8 +37,9 @@ DWORD BrowserDropDelegate::OnDragOver(IDataObject* data_object,
DWORD effect) {
POINT client_pt = cursor_position;
ScreenToClient(GetHWND(), &client_pt);
bool valid = webview_->DragTargetDragOver(client_pt.x,
client_pt.y, cursor_position.x, cursor_position.y);
bool valid = webview_->DragTargetDragOver(
WebPoint(client_pt.x, client_pt.y),
WebPoint(cursor_position.x, cursor_position.y));
return valid ? DROPEFFECT_COPY : DROPEFFECT_NONE;
}
@ -45,8 +53,9 @@ DWORD BrowserDropDelegate::OnDrop(IDataObject* data_object,
DWORD effect) {
POINT client_pt = cursor_position;
ScreenToClient(GetHWND(), &client_pt);
webview_->DragTargetDrop(client_pt.x, client_pt.y,
cursor_position.x, cursor_position.y);
webview_->DragTargetDrop(
WebPoint(client_pt.x, client_pt.y),
WebPoint(cursor_position.x, cursor_position.y));
// webkit win port always returns DROPEFFECT_NONE
return DROPEFFECT_NONE;

View File

@ -9,8 +9,14 @@
#include "request_impl.h"
#include "base/string_util.h"
#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
#include "webkit/glue/webframe.h"
#include "webkit/glue/webscriptsource.h"
using WebKit::WebScriptSource;
using WebKit::WebString;
using WebKit::WebURL;
CefBrowserImpl::CefBrowserImpl(CefWindowInfo& windowInfo, bool popup,
@ -22,20 +28,12 @@ CefBrowserImpl::CefBrowserImpl(CefWindowInfo& windowInfo, bool popup,
{
delegate_ = new BrowserWebViewDelegate(this);
nav_controller_.reset(new BrowserNavigationController(this));
#if defined(OS_WIN)
webview_bitmap_size_.cx = webview_bitmap_size_.cy = 0;
webview_bitmap_ = NULL;
#endif
}
CefBrowserImpl::~CefBrowserImpl()
{
#if defined(OS_WIN)
if(webview_bitmap_ != NULL)
DeleteObject(webview_bitmap_);
#endif
RemoveAllJSHandlers();
UIT_GetWebView()->SetDelegate(NULL);
}
void CefBrowserImpl::GoBack()
@ -454,8 +452,8 @@ void CefBrowserImpl::UIT_ExecuteJavaScript(const std::wstring& js_code,
frame = UIT_GetWebView()->GetMainFrame();
frame->ExecuteScript(
webkit_glue::WebScriptSource(WideToUTF8(js_code), GURL(script_url),
start_line));
WebScriptSource(WebString(js_code), WebURL(GURL(script_url)),
start_line));
}
void CefBrowserImpl::UIT_GoBackOrForward(int offset)

View File

@ -187,28 +187,13 @@ public:
// Printing support
void UIT_PrintPages(WebFrame* frame);
void UIT_PrintPage(int page_number, WebFrame* frame, int total_pages);
void UIT_SwitchFrameToDisplayMediaType(WebFrame* frame);
int UIT_SwitchFrameToPrintMediaType(WebFrame* frame);
void UIT_PrintPage(int page_number, int total_pages,
const gfx::Size& canvas_size, WebFrame* frame);
int UIT_GetPagesCount(WebFrame* frame);
void UIT_SetUniqueID(int id) { unique_id_ = id; }
int UIT_GetUniqueID() { return unique_id_; }
#if defined(OS_WIN)
void UIT_DisableWebView(bool val);
bool UIT_IsWebViewDisabled() { return (webview_bitmap_ != NULL); }
void UIT_CaptureWebViewBitmap(HBITMAP &bitmap, SIZE &size);
void UIT_SetWebViewBitmap(HBITMAP bitmap, SIZE size);
void UIT_GetWebViewBitmap(HBITMAP &bitmap, SIZE &size)
{
bitmap = webview_bitmap_;
size.cx = webview_bitmap_size_.cx;
size.cy = webview_bitmap_size_.cy;
}
#endif
protected:
CefWindowInfo window_info_;
bool is_popup_;
@ -222,22 +207,14 @@ protected:
std::wstring title_;
// Backup the view size before printing since it needs to be overriden. This
// value is set to restore the view size when printing is done.
gfx::Size printing_view_size_;
// Context object used to manage printing.
printing::PrintingContext print_context_;
printing::PrintingContext print_context_;
typedef std::map<std::wstring, CefRefPtr<CefJSContainer> > JSContainerMap;
JSContainerMap jscontainers_;
// Unique browser ID assigned by the context.
int unique_id_;
#if defined(OS_WIN)
HBITMAP webview_bitmap_;
SIZE webview_bitmap_size_;
#endif
};
#endif // _BROWSER_IMPL_H

View File

@ -8,10 +8,13 @@
#include "browser_impl.h"
#include "browser_webkit_glue.h"
#include "stream_impl.h"
#include "printing/units.h"
#include "base/string_util.h"
#include "base/win_util.h"
#include "skia/ext/vector_canvas.h"
#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
#include "webkit/glue/webframe.h"
#include "webkit/glue/webkit_glue.h"
@ -20,6 +23,9 @@
#include <wininet.h>
#include <winspool.h>
using WebKit::WebRect;
using WebKit::WebSize;
LPCTSTR CefBrowserImpl::GetWndClass()
{
@ -61,39 +67,10 @@ LRESULT CALLBACK CefBrowserImpl::WndProc(HWND hwnd, UINT message,
GetClientRect(browser->UIT_GetMainWndHandle(), &rc);
MoveWindow(browser->UIT_GetWebViewWndHandle(), 0, 0, rc.right, rc.bottom,
TRUE);
if(browser->UIT_IsWebViewDisabled()) {
// recreate the capture bitmap at the correct size
HBITMAP bitmap;
SIZE size;
browser->UIT_CaptureWebViewBitmap(bitmap, size);
browser->UIT_SetWebViewBitmap(bitmap, size);
}
}
return 0;
case WM_PAINT:
if(browser->UIT_IsWebViewDisabled()) {
// when web view is disabled draw the capture bitmap
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
HBITMAP bitmap;
SIZE size;
browser->UIT_GetWebViewBitmap(bitmap, size);
HDC hMemDC = CreateCompatibleDC(hdc);
HBITMAP hOldBmp = (HBITMAP)SelectObject(hMemDC, bitmap);
BitBlt(hdc, 0, 0, size.cx, size.cy, hMemDC, 0, 0, SRCCOPY);
SelectObject(hMemDC, hOldBmp);
DeleteDC(hMemDC);
EndPaint(hwnd, &ps);
return 0;
}
break;
case WM_SETFOCUS:
case WM_SETFOCUS:
if (browser && browser->UIT_GetWebView())
browser->UIT_GetWebView()->SetFocus(true);
return 0;
@ -442,87 +419,22 @@ void CefBrowserImpl::UIT_CanGoForwardNotify(bool *retVal, HANDLE hEvent)
SetEvent(hEvent);
}
int CefBrowserImpl::UIT_SwitchFrameToPrintMediaType(WebFrame* frame) {
REQUIRE_UIT();
printing::PrintParams params;
print_context_.settings().RenderParams(&params);
float ratio = static_cast<float>(params.desired_dpi / params.dpi);
float paper_width = params.printable_size.width() * ratio;
float paper_height = params.printable_size.height() * ratio;
float minLayoutWidth = static_cast<float>(paper_width * params.min_shrink);
float maxLayoutWidth = static_cast<float>(paper_width * params.max_shrink);
// Safari uses: 765 & 1224. Margins aren't exactly the same either.
// Scale = 2.222 for MDI printer.
int pages;
int width;
if (!frame->SetPrintingMode(true,
minLayoutWidth,
maxLayoutWidth,
&width)) {
NOTREACHED();
pages = 0;
} else {
// Force to recalculate the height, otherwise it reuse the current window
// height as the default.
float effective_shrink = static_cast<float>(width) / paper_width;
gfx::Size page_size(width,
static_cast<int>(paper_height * effective_shrink) - 1);
WebView* view = frame->GetView();
if (view) {
// Hack around an issue where if the current view height is higher than
// the page height, empty pages will be printed even if the bottom of the
// web page is empty.
printing_view_size_ = view->GetSize();
view->Resize(page_size);
view->Layout();
}
pages = frame->ComputePageRects(params.printable_size);
DCHECK(pages);
}
return pages;
}
void CefBrowserImpl::UIT_SwitchFrameToDisplayMediaType(WebFrame* frame) {
REQUIRE_UIT();
// TODO(cef): Figure out how to make the frame redraw properly after printing
// to PDF file (currently leaves a white rectangle behind the save as dialog).
// Set the layout back to "normal" document; i.e. CSS media type = "screen".
frame->SetPrintingMode(false, 0, 0, NULL);
WebView* view = frame->GetView();
if (view) {
// Restore from the hack described at SwitchFrameToPrintMediaType().
view->Resize(printing_view_size_);
view->Layout();
printing_view_size_.SetSize(0, 0);
}
}
void CefBrowserImpl::UIT_PrintPage(int page_number, WebFrame* frame,
int total_pages) {
REQUIRE_UIT();
if (printing_view_size_.width() < 0) {
NOTREACHED();
return;
}
void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
const gfx::Size& canvas_size,
WebFrame* frame) {
REQUIRE_UIT();
printing::PrintParams params;
const printing::PrintSettings &settings = print_context_.settings();
settings.RenderParams(&params);
gfx::Size src_size = frame->GetView()->GetSize();
double src_size_x = src_size.width();
double src_size_y = src_size.height();
double src_margin = .1 * src_size_x;
int src_size_x = canvas_size.width();
int src_size_y = canvas_size.height();
float src_margin = .1f * src_size_x;
double dest_size_x = settings.page_setup_pixels().physical_size().width();
double dest_size_y = settings.page_setup_pixels().physical_size().height();
double dest_margin = .1 * dest_size_x;
int dest_size_x = settings.page_setup_pixels().physical_size().width();
int dest_size_y = settings.page_setup_pixels().physical_size().height();
float dest_margin = .1f * dest_size_x;
print_context_.NewPage();
@ -534,23 +446,29 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, WebFrame* frame,
int saved_state = SaveDC(hDC);
DCHECK_NE(saved_state, 0);
// 100% GDI based.
skia::VectorCanvas canvas(hDC, (int)ceil(dest_size_x), (int)ceil(dest_size_y));
canvas.translate(SkDoubleToScalar(dest_margin),
SkDoubleToScalar(dest_margin));
canvas.scale(SkDoubleToScalar((dest_size_x - dest_margin * 2) / src_size_x),
SkDoubleToScalar((dest_size_y - dest_margin * 2) / src_size_y));
skia::VectorCanvas canvas(hDC, dest_size_x, dest_size_y);
// Adjust for the margin offset.
canvas.translate(dest_margin, dest_margin);
// Apply the print scaling factor.
float print_scale = (dest_size_x - dest_margin * 2) / src_size_x;
canvas.scale(print_scale, print_scale);
// Set the clipping region to be sure to not overflow.
SkRect clip_rect;
clip_rect.set(0, 0, SkDoubleToScalar(src_size_x),
SkDoubleToScalar(src_size_y));
clip_rect.set(0, 0, static_cast<float>(src_size_x),
static_cast<float>(src_size_y));
canvas.clipRect(clip_rect);
if (!frame->SpoolPage(page_number-1, &canvas)) {
NOTREACHED() << "Printing page " << page_number << " failed.";
return;
// Apply the WebKit scaling factor.
float webkit_scale = frame->GetPrintPageShrink(page_number);
if (webkit_scale <= 0) {
NOTREACHED() << "Printing page " << page_number << " failed.";
}
canvas.scale(webkit_scale, webkit_scale);
frame->PrintPage(page_number, &canvas);
res = RestoreDC(hDC, saved_state);
DCHECK_NE(res, 0);
@ -582,7 +500,7 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, WebFrame* frame,
// allow the handler to format print header and/or footer
CefHandler::RetVal rv = handler_->HandlePrintHeaderFooter(this, printInfo,
url, title, page_number, total_pages, topLeft, topCenter, topRight,
url, title, page_number+1, total_pages, topLeft, topCenter, topRight,
bottomLeft, bottomCenter, bottomRight);
if(rv != RV_HANDLED) {
@ -666,88 +584,69 @@ void CefBrowserImpl::UIT_PrintPages(WebFrame* frame) {
settings.RenderParams(&params);
// disable the web view so we don't see printing related layout changes on
// the screen
UIT_DisableWebView(true);
int pages = UIT_SwitchFrameToPrintMediaType(frame);
if (pages) {
int page_count = 0;
gfx::Size canvas_size;
canvas_size.set_width(
printing::ConvertUnit(
settings.page_setup_pixels().physical_size().width(),
static_cast<int>(params.dpi),
params.desired_dpi));
canvas_size.set_height(
printing::ConvertUnit(
settings.page_setup_pixels().physical_size().height(),
static_cast<int>(params.dpi),
params.desired_dpi));
frame->BeginPrint(WebSize(canvas_size), &page_count);
if (page_count) {
bool old_state = MessageLoop::current()->NestableTasksAllowed();
MessageLoop::current()->SetNestableTasksAllowed(false);
// TODO(cef): Use the page title as the document name
print_context_.NewDocument(L"New Document");
if(settings.ranges.size() > 0) {
for (unsigned i = 0; i < settings.ranges.size(); ++i) {
const printing::PageRange& range = settings.ranges[i];
for (unsigned x = 0; x < settings.ranges.size(); ++x) {
const printing::PageRange& range = settings.ranges[x];
for(int i = range.from; i <= range.to; ++i)
UIT_PrintPage(i, frame, pages);
UIT_PrintPage(i, page_count, canvas_size, frame);
}
} else {
for(int i = 1; i <= pages; ++i)
UIT_PrintPage(i, frame, pages);
for(int i = 0; i < page_count; ++i)
UIT_PrintPage(i, page_count, canvas_size, frame);
}
print_context_.DocumentDone();
MessageLoop::current()->SetNestableTasksAllowed(old_state);
}
UIT_SwitchFrameToDisplayMediaType(frame);
// re-enable web view
UIT_DisableWebView(false);
frame->EndPrint();
}
int CefBrowserImpl::UIT_GetPagesCount(WebFrame* frame)
{
REQUIRE_UIT();
int pages = UIT_SwitchFrameToPrintMediaType(frame);
UIT_SwitchFrameToDisplayMediaType(frame);
return pages;
}
void CefBrowserImpl::UIT_CaptureWebViewBitmap(HBITMAP &bitmap, SIZE &size)
{
REQUIRE_UIT();
printing::PrintParams params;
const printing::PrintSettings &settings = print_context_.settings();
webkit_glue::CaptureWebViewBitmap(UIT_GetMainWndHandle(), UIT_GetWebView(),
bitmap, size);
}
settings.RenderParams(&params);
void CefBrowserImpl::UIT_SetWebViewBitmap(HBITMAP bitmap, SIZE size)
{
REQUIRE_UIT();
if(webview_bitmap_)
DeleteObject(webview_bitmap_);
webview_bitmap_ = bitmap;
webview_bitmap_size_ = size;
}
void CefBrowserImpl::UIT_DisableWebView(bool val)
{
REQUIRE_UIT();
if(val) {
// disable the web view window
if(webview_bitmap_ != NULL)
return;
int page_count = 0;
gfx::Size canvas_size;
canvas_size.set_width(
printing::ConvertUnit(
settings.page_setup_pixels().physical_size().width(),
static_cast<int>(params.dpi),
params.desired_dpi));
canvas_size.set_height(
printing::ConvertUnit(
settings.page_setup_pixels().physical_size().height(),
static_cast<int>(params.dpi),
params.desired_dpi));
frame->BeginPrint(WebSize(canvas_size), &page_count);
frame->EndPrint();
HBITMAP bitmap;
SIZE size;
UIT_CaptureWebViewBitmap(bitmap, size);
UIT_SetWebViewBitmap(bitmap, size);
DWORD dwStyle = GetWindowLong(UIT_GetWebViewWndHandle(), GWL_STYLE);
SetWindowLong(UIT_GetWebViewWndHandle(), GWL_STYLE, dwStyle & ~WS_VISIBLE);
RedrawWindow(UIT_GetMainWndHandle(), NULL, NULL, RDW_INVALIDATE);
} else if(webview_bitmap_) {
// enable the web view window
SIZE size = {0,0};
UIT_SetWebViewBitmap(NULL, size);
DWORD dwStyle = GetWindowLong(UIT_GetWebViewWndHandle(), GWL_STYLE);
SetWindowLong(UIT_GetWebViewWndHandle(), GWL_STYLE, dwStyle | WS_VISIBLE);
RedrawWindow(UIT_GetMainWndHandle(), NULL, NULL, RDW_INVALIDATE);
}
return page_count;
}

View File

@ -52,6 +52,7 @@
#include "net/proxy/proxy_service.h"
#include "net/url_request/url_request.h"
#include "webkit/glue/resource_loader_bridge.h"
#include "webkit/glue/webappcachecontext.h"
#include "webkit/glue/webframe.h"
#include "webkit/glue/webview.h"
@ -106,6 +107,7 @@ struct RequestParams {
GURL referrer;
std::string headers;
int load_flags;
int app_cache_context_id;
scoped_refptr<net::UploadData> upload;
};
@ -376,6 +378,7 @@ class RequestProxy : public URLRequest::Delegate,
info.request_time = request->request_time();
info.response_time = request->response_time();
info.headers = request->response_headers();
info.app_cache_id = WebAppCacheContext::kNoAppCacheId;
request->GetMimeType(&info.mime_type);
request->GetCharset(&info.charset);
OnReceivedResponse(info, false);
@ -416,6 +419,14 @@ class RequestProxy : public URLRequest::Delegate,
// Called on the IO thread.
void MaybeUpdateUploadProgress() {
// If a redirect is received upload is cancelled in URLRequest, we should
// try to stop the |upload_progress_timer_| timer and return.
if (!request_->has_upload()) {
if (upload_progress_timer_.IsRunning())
upload_progress_timer_.Stop();
return;
}
uint64 size = request_->get_upload()->GetContentLength();
uint64 position = request_->GetUploadProgress();
if (position == last_upload_position_)
@ -520,7 +531,8 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge {
const GURL& policy_url,
const GURL& referrer,
const std::string& headers,
int load_flags)
int load_flags,
int app_cache_context_id)
: browser_(browser),
params_(new RequestParams),
proxy_(NULL) {
@ -530,6 +542,7 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge {
params_->referrer = referrer;
params_->headers = headers;
params_->load_flags = load_flags;
params_->app_cache_context_id = app_cache_context_id;
}
virtual ~ResourceLoaderBridgeImpl() {
@ -550,7 +563,7 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge {
params_->upload->AppendBytes(data, data_len);
}
virtual void AppendFileRangeToUpload(const std::wstring& file_path,
virtual void AppendFileRangeToUpload(const FilePath& file_path,
uint64 offset, uint64 length) {
DCHECK(params_.get());
if (!params_->upload)
@ -558,6 +571,13 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge {
params_->upload->AppendFileRange(file_path, offset, length);
}
virtual void SetUploadIdentifier(int64 identifier) {
DCHECK(params_.get());
if (!params_->upload)
params_->upload = new net::UploadData();
params_->upload->set_identifier(identifier);
}
virtual bool Start(Peer* peer) {
DCHECK(!proxy_);
@ -652,15 +672,18 @@ ResourceLoaderBridge* ResourceLoaderBridge::Create(
const GURL& url,
const GURL& policy_url,
const GURL& referrer,
const std::string& frame_origin,
const std::string& main_frame_origin,
const std::string& headers,
int load_flags,
int requestor_pid,
ResourceType::Type request_type,
bool mixed_contents,
int app_cache_context_id,
int routing_id) {
CefRefPtr<CefBrowser> browser = _Context->GetBrowserByID(routing_id);
return new ResourceLoaderBridgeImpl(browser, method, url, policy_url,
referrer, headers, load_flags);
referrer, headers, load_flags,
app_cache_context_id);
}
// Issue the proxy resolve request on the io thread, and wait

View File

@ -4,7 +4,6 @@
// found in the LICENSE file.
#include "precompiled_libcef.h"
#include "browser_webkit_glue.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
@ -17,14 +16,16 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "webkit/glue/webframe_impl.h"
MSVC_POP_WARNING();
#include "browser_webkit_glue.h"
#undef LOG
#include "base/path_service.h"
#include "base/resource_util.h"
#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "base/win_util.h"
#include "net/base/mime_util.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/screen_info.h"
#include "webkit/glue/webframe.h"
#include "webkit/glue/webkit_glue.h"
@ -43,8 +44,21 @@ void AppendToLog(const char* file, int line, const char* msg) {
logging::LogMessage(file, line).stream() << msg;
}
std::string GetDataResource(int resource_id) {
if (resource_id == IDR_BROKENIMAGE) {
StringPiece GetRawDataResource(HMODULE module, int resource_id) {
void* data_ptr;
size_t data_size;
return base::GetDataResourceFromModule(module, resource_id, &data_ptr,
&data_size) ?
StringPiece(static_cast<char*>(data_ptr), data_size) : StringPiece();
}
StringPiece NetResourceProvider(int key) {
return GetRawDataResource(::GetModuleHandle(NULL), key);
}
StringPiece GetDataResource(int resource_id) {
switch (resource_id) {
case IDR_BROKENIMAGE: {
// Use webkit's broken image icon (16x16)
static unsigned char broken_image_data[] = {
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x10, 0x00, 0x10, 0x00, 0xD5, 0x00,
@ -79,16 +93,51 @@ std::string GetDataResource(int resource_id) {
0x07, 0x0E, 0xC7, 0x4C, 0xCF, 0x49, 0xCD, 0xD2, 0xD3, 0xD4, 0xD2, 0x41,
0x00, 0x3B
};
return reinterpret_cast<char*>(broken_image_data);
} else if (resource_id == IDR_FEED_PREVIEW) {
return StringPiece(reinterpret_cast<char*>(broken_image_data),
static_cast<StringPiece::size_type>(
sizeof(broken_image_data) / sizeof(unsigned char)));
}
case IDR_FEED_PREVIEW:
// It is necessary to return a feed preview template that contains
// a {{URL}} substring where the feed URL should go; see the code
// that computes feed previews in feed_preview.cc:MakeFeedPreview.
// This fixes issue #932714.
return std::string("Feed preview for {{URL}}");
} else {
return std::string();
return "Feed preview for {{URL}}";
case IDR_TEXTAREA_RESIZER: {
// Use webkit's text area resizer image.
static unsigned char area_resizer_data[] = {
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08,
0x08, 0x06, 0x00, 0x00, 0x00, 0xC4, 0x0F, 0xBE, 0x8B, 0x00, 0x00, 0x00,
0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0B, 0x13, 0x00, 0x00, 0x0B,
0x13, 0x01, 0x00, 0x9A, 0x9C, 0x18, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41,
0x4D, 0x41, 0x00, 0x00, 0xB1, 0x8E, 0x7C, 0xFB, 0x51, 0x93, 0x00, 0x00,
0x00, 0x20, 0x63, 0x48, 0x52, 0x4D, 0x00, 0x00, 0x7A, 0x25, 0x00, 0x00,
0x80, 0x83, 0x00, 0x00, 0xF9, 0xFF, 0x00, 0x00, 0x80, 0xE9, 0x00, 0x00,
0x75, 0x30, 0x00, 0x00, 0xEA, 0x60, 0x00, 0x00, 0x3A, 0x98, 0x00, 0x00,
0x17, 0x6F, 0x92, 0x5F, 0xC5, 0x46, 0x00, 0x00, 0x00, 0x39, 0x49, 0x44,
0x41, 0x54, 0x78, 0xDA, 0x7C, 0x8E, 0xB1, 0x0D, 0x00, 0x20, 0x0C, 0xC3,
0x1C, 0x9E, 0xE5, 0xA6, 0x5E, 0x1B, 0xB6, 0x4A, 0xA0, 0xD0, 0xAC, 0x8E,
0x25, 0xC3, 0x7F, 0x65, 0x9B, 0x35, 0xC1, 0xC9, 0x2C, 0x80, 0x74, 0x6A,
0x98, 0x0E, 0x17, 0x7C, 0x1B, 0xCA, 0x36, 0x92, 0x76, 0x6A, 0x48, 0x66,
0x37, 0x68, 0xAA, 0x05, 0x38, 0x03, 0x00, 0x40, 0x17, 0x33, 0x3D, 0x58,
0x57, 0x6B, 0xB3, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE,
0x42, 0x60, 0x82
};
return StringPiece(reinterpret_cast<char*>(area_resizer_data),
static_cast<StringPiece::size_type>(
sizeof(area_resizer_data) / sizeof(unsigned char)));
}
case IDR_SEARCH_CANCEL:
case IDR_SEARCH_CANCEL_PRESSED:
case IDR_SEARCH_MAGNIFIER:
case IDR_SEARCH_MAGNIFIER_RESULTS:
return NetResourceProvider(resource_id);
default:
break;
}
return StringPiece();
}
bool GetApplicationDirectory(std::wstring *path) {
@ -115,10 +164,6 @@ bool SpellCheckWord(const wchar_t* word, int word_len,
return true;
}
ScreenInfo GetScreenInfo(gfx::NativeView window) {
return GetScreenInfoHelper(window);
}
bool IsPluginRunningInRendererProcess() {
return true;
}
@ -142,10 +187,6 @@ std::string GetDocumentString(WebFrame* frame) {
return StringToStdString(WebCore::createMarkup(core_frame->document()));
}
ScreenInfo GetScreenInfo(gfx::NativeViewId window) {
return GetScreenInfoHelper(gfx::NativeViewFromId(window));
}
void InitializeTextEncoding() {
WebCore::UTF8Encoding();
}

View File

@ -2,8 +2,13 @@
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#if defined(OS_WIN)
#include <windows.h>
#endif
#include <string>
#include "base/string_piece.h"
class WebFrame;
class WebView;
@ -24,4 +29,7 @@ BOOL SaveBitmapToFile(HBITMAP hBmp, HDC hDC, LPCTSTR file, LPBYTE lpBits);
// Text encoding objects must be initialized on the main thread.
void InitializeTextEncoding();
// This is called indirectly by the network layer to access resources.
StringPiece NetResourceProvider(int key);
} // namespace webkit_glue

View File

@ -4,7 +4,6 @@
// found in the LICENSE file.
#include "precompiled_libcef.h"
#include "browser_webkit_glue.h"
#include <atlcore.h>
#include <atlbase.h>
@ -18,21 +17,28 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "PlatformContextSkia.h"
MSVC_POP_WARNING();
#include "browser_webkit_glue.h"
#undef LOG
#include "base/gfx/gdi_util.h"
#include "base/logging.h"
#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webview.h"
#include "webkit/glue/plugins/plugin_list.h"
using WebKit::WebRect;
using WebKit::WebSize;
namespace webkit_glue {
string16 GetLocalizedString(int message_id) {
// Localized resources are provided via webkit_resources.rc and
// webkit_strings_en-US.rc.
const ATLSTRINGRESOURCEIMAGE* image =
AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(),
message_id);
// TODO(cef): Need to provide strings for common resources.
if (!image) {
NOTREACHED();
return L"No string for this identifier!";
@ -57,16 +63,17 @@ bool DownloadUrl(const std::string& url, HWND caller_window) {
return false;
}
void CaptureWebViewBitmap(HWND mainWnd, WebView* webview, HBITMAP& bitmap, SIZE& size)
void CaptureWebViewBitmap(HWND mainWnd, WebView* webview, HBITMAP& bitmap,
SIZE& size)
{
gfx::Size webSize = webview->GetSize();
size.cx = webSize.width();
size.cy = webSize.height();
WebKit::WebSize webSize = webview->GetSize();
size.cx = webSize.width;
size.cy = webSize.height;
skia::PlatformCanvasWin canvas(size.cx, size.cy, true);
canvas.drawARGB(255, 255, 255, 255, SkPorterDuff::kSrc_Mode);
PlatformContextSkia context(&canvas);
gfx::Rect rect(size.cx, size.cy);
WebKit::WebRect rect(0, 0, size.cx, size.cy);
webview->Layout();
webview->Paint(&canvas, rect);

View File

@ -6,18 +6,21 @@
#ifndef _BROWSER_WEBKIT_INIT_H
#define _BROWSER_WEBKIT_INIT_H
#include "base/stats_counters.h"
#include "base/string_util.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
#include "webkit/glue/simple_webmimeregistry_impl.h"
#include "webkit/glue/webclipboard_impl.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webkitclient_impl.h"
#include "webkit/extensions/v8/gears_extension.h"
#include "webkit/extensions/v8/interval_extension.h"
#include "browser_resource_loader_bridge.h"
#include "WebCString.h"
#include "WebKit.h"
#include "WebString.h"
#include "WebURL.h"
class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
public:
@ -42,15 +45,22 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
return &mime_registry_;
}
WebKit::WebClipboard* clipboard() {
if (!clipboard_.get()) {
clipboard_.reset(new webkit_glue::WebClipboardImpl());
}
return clipboard_.get();
}
virtual WebKit::WebSandboxSupport* sandboxSupport() {
return NULL;
}
virtual uint64_t visitedLinkHash(const char* canonicalURL, size_t length) {
virtual unsigned long long visitedLinkHash(const char* canonicalURL, size_t length) {
return 0;
}
virtual bool isLinkVisited(uint64_t linkHash) {
virtual bool isLinkVisited(unsigned long long linkHash) {
return false;
}
@ -68,7 +78,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
virtual void prefetchHostName(const WebKit::WebString&) {
}
virtual WebKit::WebCString loadResource(const char* name) {
virtual WebKit::WebData loadResource(const char* name) {
if (!strcmp(name, "deleteButton")) {
// Create a red 30x30 square.
const char red_square[] =
@ -83,7 +93,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
"\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d"
"\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60"
"\x82";
return WebKit::WebCString(red_square, arraysize(red_square));
return WebKit::WebData(red_square, arraysize(red_square));
}
return webkit_glue::WebKitClientImpl::loadResource(name);
}
@ -94,6 +104,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
private:
webkit_glue::SimpleWebMimeRegistryImpl mime_registry_;
scoped_ptr<WebKit::WebClipboard> clipboard_;
};
#endif // _BROWSER_WEBKIT_INIT_H

View File

@ -8,6 +8,7 @@
// have initialized a MessageLoop before these methods are called.
#include "precompiled_libcef.h"
#include "config.h"
#include "browser_webview_delegate.h"
#include "browser_impl.h"
#include "browser_navigation_controller.h"
@ -22,6 +23,10 @@
#include "base/string_util.h"
#include "base/trace_event.h"
#include "net/base/net_errors.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "webkit/glue/webdatasource.h"
#include "webkit/glue/webdropdata.h"
#include "webkit/glue/weberror.h"
@ -40,6 +45,14 @@
#include "browser_drop_delegate.h"
#endif
using WebKit::WebDragData;
using WebKit::WebRect;
using WebKit::WebScreenInfo;
using WebKit::WebSize;
using WebKit::WebString;
using WebKit::WebWorker;
using WebKit::WebWorkerClient;
namespace {
int next_page_id_ = 1;
@ -60,6 +73,10 @@ WebWidget* BrowserWebViewDelegate::CreatePopupWidget(WebView* webview,
return browser_->UIT_CreatePopupWidget(webview);
}
WebWorker* BrowserWebViewDelegate::CreateWebWorker(WebWorkerClient* client) {
return NULL;
}
void BrowserWebViewDelegate::OpenURL(WebView* webview, const GURL& url,
const GURL& referrer,
WindowOpenDisposition disposition) {
@ -143,19 +160,21 @@ WindowOpenDisposition BrowserWebViewDelegate::DispositionForNavigationAction(
return IGNORE_ACTION;
}
if (is_custom_policy_delegate_) {
WindowOpenDisposition result;
if (policy_delegate_enabled_) {
std::wstring frame_name = frame->GetName();
printf("Policy delegate: attempt to load %s\n",
request->GetURL().spec().c_str());
return IGNORE_ACTION;
std::string url_description;
if (request->GetURL().SchemeIs("file")) {
url_description = request->GetURL().ExtractFileName();
} else {
url_description = request->GetURL().spec();
}
result = policy_delegate_is_permissive_ ? CURRENT_TAB : IGNORE_ACTION;
} else {
return WebViewDelegate::DispositionForNavigationAction(
webview, frame, request, type, disposition, is_redirect);
result = WebViewDelegate::DispositionForNavigationAction(
webview, frame, request, type, disposition, is_redirect);
}
}
void BrowserWebViewDelegate::SetCustomPolicyDelegate(bool isCustom) {
is_custom_policy_delegate_ = isCustom;
return result;
}
void BrowserWebViewDelegate::AssignIdentifierToRequest(WebView* webview,
@ -202,7 +221,7 @@ void BrowserWebViewDelegate::DidFailProvisionalLoadWithError(
WebView* webview,
const WebError& error,
WebFrame* frame) {
LocationChangeDone(frame->GetProvisionalDataSource());
LocationChangeDone(frame);
// error codes are defined in net\base\net_error_list.h
@ -259,13 +278,13 @@ void BrowserWebViewDelegate::DidReceiveTitle(WebView* webview,
void BrowserWebViewDelegate::DidFinishLoadForFrame(WebView* webview,
WebFrame* frame) {
UpdateAddressBar(webview);
LocationChangeDone(frame->GetDataSource());
LocationChangeDone(frame);
}
void BrowserWebViewDelegate::DidFailLoadWithError(WebView* webview,
const WebError& error,
WebFrame* frame) {
LocationChangeDone(frame->GetDataSource());
LocationChangeDone(frame);
}
void BrowserWebViewDelegate::DidFinishDocumentLoadForFrame(WebView* webview,
@ -357,7 +376,7 @@ void BrowserWebViewDelegate::SetStatusbarText(WebView* webview,
}
void BrowserWebViewDelegate::StartDragging(WebView* webview,
const WebDropData& drop_data) {
const WebDragData& drag_data) {
#if defined(OS_WIN)
// TODO(port): make this work on all platforms.
if (!drag_delegate_) {
@ -369,7 +388,7 @@ void BrowserWebViewDelegate::StartDragging(WebView* webview,
// to be able to convert from WebDragData to an IDataObject.
//const DWORD ok_effect = DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE;
//DWORD effect;
//HRESULT res = DoDragDrop(drop_data.data_object, drag_delegate_.get(),
//HRESULT res = DoDragDrop(drag_data.data_object, drag_delegate_.get(),
// ok_effect, &effect);
//DCHECK(DRAGDROP_S_DROP == res || DRAGDROP_S_CANCEL == res);
webview->DragSourceSystemDragEnded();
@ -486,13 +505,13 @@ gfx::NativeViewId BrowserWebViewDelegate::GetContainingView(WebWidget* webwidget
}
void BrowserWebViewDelegate::DidInvalidateRect(WebWidget* webwidget,
const gfx::Rect& rect) {
const WebRect& rect) {
if (WebWidgetHost* host = GetHostForWidget(webwidget))
host->DidInvalidateRect(rect);
}
void BrowserWebViewDelegate::DidScrollRect(WebWidget* webwidget, int dx, int dy,
const gfx::Rect& clip_rect) {
const WebRect& clip_rect) {
if (WebWidgetHost* host = GetHostForWidget(webwidget))
host->DidScrollRect(dx, dy, clip_rect);
}
@ -507,10 +526,31 @@ void BrowserWebViewDelegate::Blur(WebWidget* webwidget) {
browser_->UIT_SetFocus(host, false);
}
bool BrowserWebViewDelegate::IsHidden() {
bool BrowserWebViewDelegate::IsHidden(WebWidget* webwidget) {
return false;
}
WebScreenInfo BrowserWebViewDelegate::GetScreenInfo(WebWidget* webwidget) {
if (WebWidgetHost* host = GetHostForWidget(webwidget))
return host->GetScreenInfo();
return WebScreenInfo();
}
void BrowserWebViewDelegate::SetSmartInsertDeleteEnabled(bool enabled) {
smart_insert_delete_enabled_ = enabled;
// In upstream WebKit, smart insert/delete is mutually exclusive with select
// trailing whitespace, however, we allow both because Chromium on Windows
// allows both.
}
void BrowserWebViewDelegate::SetSelectTrailingWhitespaceEnabled(bool enabled) {
select_trailing_whitespace_enabled_ = enabled;
// In upstream WebKit, smart insert/delete is mutually exclusive with select
// trailing whitespace, however, we allow both because Chromium on Windows
// allows both.
}
void BrowserWebViewDelegate::RegisterDragDrop() {
#if defined(OS_WIN)
// TODO(port): add me once drag and drop works.
@ -520,6 +560,16 @@ void BrowserWebViewDelegate::RegisterDragDrop() {
#endif
}
void BrowserWebViewDelegate::SetCustomPolicyDelegate(bool is_custom,
bool is_permissive) {
policy_delegate_enabled_ = is_custom;
policy_delegate_is_permissive_ = is_permissive;
}
void BrowserWebViewDelegate::WaitForPolicyDelegate() {
policy_delegate_enabled_ = true;
}
// Private methods -----------------------------------------------------------
void BrowserWebViewDelegate::UpdateAddressBar(WebView* webView) {
@ -535,8 +585,8 @@ void BrowserWebViewDelegate::UpdateAddressBar(WebView* webView) {
*/
}
void BrowserWebViewDelegate::LocationChangeDone(WebDataSource* data_source) {
if (data_source->GetWebFrame() == top_loading_frame_)
void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
if (frame == top_loading_frame_)
top_loading_frame_ = NULL;
}

View File

@ -38,11 +38,18 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
public WebViewDelegate {
public:
BrowserWebViewDelegate(CefBrowserImpl* shell)
: is_custom_policy_delegate_(false),
: policy_delegate_enabled_(false),
policy_delegate_is_permissive_(false),
browser_(shell),
top_loading_frame_(NULL),
page_id_(-1),
last_page_id_updated_(-1)
last_page_id_updated_(-1),
smart_insert_delete_enabled_(true)
#if defined(OS_WIN)
, select_trailing_whitespace_enabled_(true)
#else
, select_trailing_whitespace_enabled_(false)
#endif
#if defined(OS_LINUX)
, cursor_type_(GDK_X_CURSOR)
#endif
@ -59,6 +66,7 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
const std::string& mime_type,
const std::string& clsid,
std::string* actual_mime_type);
virtual WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client);
virtual void OpenURL(WebView* webview,
const GURL& url,
const GURL& referrer,
@ -78,7 +86,7 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
unsigned int line_no,
const std::wstring& source_id);
virtual void StartDragging(WebView* webview,
const WebDropData& drop_data);
const WebKit::WebDragData& drop_data);
virtual void ShowContextMenu(WebView* webview,
ContextNode in_node,
int x,
@ -174,29 +182,36 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
WebNavigationType type,
WindowOpenDisposition disposition,
bool is_redirect);
void SetCustomPolicyDelegate(bool isCustom);
virtual WebHistoryItem* GetHistoryEntryAtOffset(int offset);
virtual int GetHistoryBackListCount();
virtual int GetHistoryForwardListCount();
// WebWidgetDelegate
virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget);
virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect);
virtual void DidInvalidateRect(WebWidget* webwidget,
const WebKit::WebRect& rect);
virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy,
const gfx::Rect& clip_rect);
const WebKit::WebRect& clip_rect);
virtual void Show(WebWidget* webview, WindowOpenDisposition disposition);
virtual void ShowAsPopupWithItems(WebWidget* webwidget,
const WebKit::WebRect& bounds,
int item_height,
int selected_index,
const std::vector<WebMenuItem>& items);
virtual void CloseWidgetSoon(WebWidget* webwidget);
virtual void Focus(WebWidget* webwidget);
virtual void Blur(WebWidget* webwidget);
virtual void SetCursor(WebWidget* webwidget,
const WebCursor& cursor);
virtual void GetWindowRect(WebWidget* webwidget, gfx::Rect* rect);
virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect);
virtual void GetRootWindowRect(WebWidget *,gfx::Rect *);
virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* rect);
virtual void GetWindowRect(WebWidget* webwidget, WebKit::WebRect* rect);
virtual void SetWindowRect(WebWidget* webwidget, const WebKit::WebRect& rect);
virtual void GetRootWindowRect(WebWidget *,WebKit::WebRect *);
virtual void GetRootWindowResizerRect(WebWidget* webwidget,
WebKit::WebRect* rect);
virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move);
virtual void RunModal(WebWidget* webwidget);
virtual bool IsHidden();
virtual bool IsHidden(WebWidget* webwidget);
virtual WebKit::WebScreenInfo GetScreenInfo(WebWidget* webwidget);
virtual void AddRef() {
base::RefCounted<BrowserWebViewDelegate>::AddRef();
}
@ -205,6 +220,9 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
}
virtual void TakeFocus(WebView* webview, bool reverse);
void SetSmartInsertDeleteEnabled(bool enabled);
void SetSelectTrailingWhitespaceEnabled(bool enabled);
// Additional accessors
WebFrame* top_loading_frame() { return top_loading_frame_; }
#if defined(OS_WIN)
@ -219,6 +237,9 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
// Sets the webview as a drop target.
void RegisterDragDrop();
void SetCustomPolicyDelegate(bool is_custom, bool is_permissive);
void WaitForPolicyDelegate();
CefBrowserImpl* GetBrowser() { return browser_; }
protected:
@ -234,7 +255,7 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
// In the Mac code, this is called to trigger the end of a test after the
// page has finished loading. From here, we can generate the dump for the
// test.
void LocationChangeDone(WebDataSource* data_source);
void LocationChangeDone(WebFrame*);
WebWidgetHost* GetHostForWidget(WebWidget* webwidget);
@ -249,7 +270,11 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
// Causes navigation actions just printout the intended navigation instead
// of taking you to the page. This is used for cases like mailto, where you
// don't actually want to open the mail program.
bool is_custom_policy_delegate_;
bool policy_delegate_enabled_;
// Toggles the behavior of the policy delegate. If true, then navigations
// will be allowed. Otherwise, they will be ignored (dropped).
bool policy_delegate_is_permissive_;
// Non-owning pointer. The delegate is owned by the host.
CefBrowserImpl* browser_;
@ -261,6 +286,12 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
int page_id_;
int last_page_id_updated_;
// true if we want to enable smart insert/delete.
bool smart_insert_delete_enabled_;
// true if we want to enable selection of trailing whitespaces
bool select_trailing_whitespace_enabled_;
WebCursor current_cursor_;
#if defined(OS_WIN)
// Classes needed by drag and drop.

View File

@ -26,11 +26,13 @@
#include "base/string_util.h"
#include "base/trace_event.h"
#include "net/base/net_errors.h"
#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "webkit/glue/webdatasource.h"
#include "webkit/glue/webdropdata.h"
#include "webkit/glue/weberror.h"
#include "webkit/glue/webframe.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webplugin.h"
#include "webkit/glue/weburlrequest.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webview.h"
@ -38,6 +40,8 @@
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
#include "webkit/glue/window_open_disposition.h"
using WebKit::WebRect;
// WebViewDelegate -----------------------------------------------------------
BrowserWebViewDelegate::~BrowserWebViewDelegate() {
@ -80,6 +84,15 @@ void BrowserWebViewDelegate::Show(WebWidget* webwidget, WindowOpenDisposition) {
}
}
void BrowserWebViewDelegate::ShowAsPopupWithItems(
WebWidget* webwidget,
const WebRect& bounds,
int item_height,
int selected_index,
const std::vector<WebMenuItem>& items) {
NOTREACHED();
}
void BrowserWebViewDelegate::CloseWidgetSoon(WebWidget* webwidget) {
if (webwidget == browser_->UIT_GetWebView()) {
PostMessage(browser_->UIT_GetMainWndHandle(), WM_CLOSE, 0, 0);
@ -98,7 +111,7 @@ void BrowserWebViewDelegate::SetCursor(WebWidget* webwidget,
}
void BrowserWebViewDelegate::GetWindowRect(WebWidget* webwidget,
gfx::Rect* out_rect) {
WebRect* out_rect) {
if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
RECT rect;
::GetWindowRect(host->window_handle(), &rect);
@ -107,17 +120,17 @@ void BrowserWebViewDelegate::GetWindowRect(WebWidget* webwidget,
}
void BrowserWebViewDelegate::SetWindowRect(WebWidget* webwidget,
const gfx::Rect& rect) {
const WebRect& rect) {
if (webwidget == browser_->UIT_GetWebView()) {
// ignored
} else if (webwidget == browser_->UIT_GetPopup()) {
MoveWindow(browser_->UIT_GetPopupWndHandle(),
rect.x(), rect.y(), rect.width(), rect.height(), FALSE);
rect.x, rect.y, rect.width, rect.height, FALSE);
}
}
void BrowserWebViewDelegate::GetRootWindowRect(WebWidget* webwidget,
gfx::Rect* out_rect) {
WebRect* out_rect) {
if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
RECT rect;
HWND root_window = ::GetAncestor(host->window_handle(), GA_ROOT);
@ -127,7 +140,7 @@ void BrowserWebViewDelegate::GetRootWindowRect(WebWidget* webwidget,
}
void BrowserWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
gfx::Rect* out_rect) {
WebRect* out_rect) {
// Not necessary on Windows.
*out_rect = gfx::Rect();
}

View File

@ -142,19 +142,6 @@ void CefContext::UIT_RegisterPlugin(struct CefPluginInfo* plugin_info)
delete plugin_info;
}
StringPiece GetRawDataResource(HMODULE module, int resource_id) {
void* data_ptr;
size_t data_size;
return base::GetDataResourceFromModule(module, resource_id, &data_ptr,
&data_size) ?
StringPiece(static_cast<char*>(data_ptr), data_size) : StringPiece();
}
// This is called indirectly by the network layer to access resources.
StringPiece NetResourceProvider(int key) {
return GetRawDataResource(::GetModuleHandle(NULL), key);
}
bool CefContext::DoInitialize()
{
HRESULT res;
@ -189,7 +176,7 @@ bool CefContext::DoInitialize()
}
// Config the network module so it has access to a limited set of resources.
net::NetModule::SetResourceProvider(NetResourceProvider);
net::NetModule::SetResourceProvider(webkit_glue::NetResourceProvider);
// Load and initialize the stats table. Attempt to construct a somewhat
// unique name to isolate separate instances from each other.
@ -304,6 +291,11 @@ bool CefContext::Initialize(bool multi_threaded_message_loop,
// Initialize WebKit encodings
webkit_glue::InitializeTextEncoding();
#ifndef _DEBUG
// Only log error messages and above in release build.
logging::SetMinLogLevel(logging::LOG_ERROR);
#endif
// Initialize web preferences
webprefs_ = new WebPreferences;
*webprefs_ = WebPreferences();
@ -338,7 +330,7 @@ bool CefContext::Initialize(bool multi_threaded_message_loop,
webprefs_->developer_extras_enabled = true;
webprefs_->shrinks_standalone_images_to_fit = false;
webprefs_->uses_universal_detector = false;
webprefs_->text_areas_are_resizable = false;
webprefs_->text_areas_are_resizable = true;
webprefs_->java_enabled = true;
webprefs_->allow_scripts_to_close_windows = false;

View File

@ -3,6 +3,6 @@
ProjectType="Visual C++"
Version="8.00"
Name="webkit_common"
InheritedPropertySheets=".\libcef_webkit_includes.vsprops;$(SolutionDir)..\webkit\build\webkit_common_defines.vsprops;$(SolutionDir)..\webkit\build\js_engine$(JS_ENGINE_TYPE).vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;$(SolutionDir)..\build\external_code.vsprops;$(SolutionDir)..\third_party\icu38\build\using_icu.vsprops;$(SolutionDir)..\webkit\build\webkit\using_WebKit.vsprops"
InheritedPropertySheets=".\libcef_webkit_includes.vsprops;$(SolutionDir)..\webkit\build\webkit_common_defines.vsprops;$(SolutionDir)..\webkit\build\js_engine$(JS_ENGINE_TYPE).vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;$(SolutionDir)..\build\external_code.vsprops;$(SolutionDir)..\third_party\icu38\build\using_icu.vsprops"
>
</VisualStudioPropertySheet>

View File

@ -29,7 +29,6 @@ void PrintSettings::Clear() {
desired_dpi = 72;
printer_name_.clear();
device_name_.clear();
page_setup_cmm_.Clear();
page_setup_pixels_.Clear();
dpi_ = 0;
landscape_ = false;
@ -46,7 +45,6 @@ void PrintSettings::Init(HDC hdc,
ranges = new_ranges;
landscape_ = dev_mode.dmOrientation == DMORIENT_LANDSCAPE;
int old_dpi = dpi_;
dpi_ = GetDeviceCaps(hdc, LOGPIXELSX);
// No printer device is known to advertise different dpi in X and Y axis; even
// the fax device using the 200x100 dpi setting. It's ought to break so many
@ -64,74 +62,30 @@ void PrintSettings::Init(HDC hdc,
GetDeviceCaps(hdc, PHYSICALOFFSETY),
GetDeviceCaps(hdc, HORZRES),
GetDeviceCaps(hdc, VERTRES));
// Hard-code text_height = 0.5cm = ~1/5 of inch
page_setup_pixels_.Init(physical_size_pixels, printable_area_pixels,
ConvertUnit(500, kHundrethsMMPerInch, dpi_));
// Initialize page_setup_cmm_.
// In theory, we should be using HORZSIZE and VERTSIZE but their value is
// so wrong it's useless. So read the values in dpi unit and convert them back
// in 0.01 mm.
gfx::Size physical_size_cmm(
ConvertUnit(physical_size_pixels.width(), dpi_, kHundrethsMMPerInch),
ConvertUnit(physical_size_pixels.height(), dpi_, kHundrethsMMPerInch));
gfx::Rect printable_area_cmm(
ConvertUnit(printable_area_pixels.x(), dpi_, kHundrethsMMPerInch),
ConvertUnit(printable_area_pixels.y(), dpi_, kHundrethsMMPerInch),
ConvertUnit(printable_area_pixels.width(), dpi_, kHundrethsMMPerInch),
ConvertUnit(printable_area_pixels.bottom(), dpi_, kHundrethsMMPerInch));
static const int kRoundingTolerance = 5;
// Some printers may advertise a slightly larger printable area than the
// physical area. This is mostly due to integer calculation and rounding.
if (physical_size_cmm.height() > printable_area_cmm.bottom() &&
physical_size_cmm.height() <= (printable_area_cmm.bottom() +
kRoundingTolerance)) {
physical_size_cmm.set_height(printable_area_cmm.bottom());
}
if (physical_size_cmm.width() > printable_area_cmm.right() &&
physical_size_cmm.width() <= (printable_area_cmm.right() +
kRoundingTolerance)) {
physical_size_cmm.set_width(printable_area_cmm.right());
}
page_setup_cmm_.Init(physical_size_cmm, printable_area_cmm, 500);
SetPrinterPrintableArea(physical_size_pixels, printable_area_pixels);
}
#endif
void PrintSettings::UpdateMarginsMetric(const PageMargins& new_margins) {
// Apply the new margins in 0.01 mm unit.
page_setup_cmm_.SetRequestedMargins(new_margins);
void PrintSettings::SetPrinterPrintableArea(
gfx::Size const& physical_size_pixels,
gfx::Rect const& printable_area_pixels) {
// Converts the margins in dpi unit and apply those too.
PageMargins pixels_margins;
pixels_margins.header = ConvertUnit(new_margins.header, kHundrethsMMPerInch,
dpi_);
pixels_margins.footer = ConvertUnit(new_margins.footer, kHundrethsMMPerInch,
dpi_);
pixels_margins.left = ConvertUnit(new_margins.left, kHundrethsMMPerInch,
dpi_);
pixels_margins.top = ConvertUnit(new_margins.top, kHundrethsMMPerInch, dpi_);
pixels_margins.right = ConvertUnit(new_margins.right, kHundrethsMMPerInch,
dpi_);
pixels_margins.bottom = ConvertUnit(new_margins.bottom, kHundrethsMMPerInch,
dpi_);
page_setup_pixels_.SetRequestedMargins(pixels_margins);
}
// Start by setting the user configuration
// Hard-code text_height = 0.5cm = ~1/5 of inch
page_setup_pixels_.Init(physical_size_pixels,
printable_area_pixels,
ConvertUnit(500, kHundrethsMMPerInch, dpi_));
void PrintSettings::UpdateMarginsMilliInch(const PageMargins& new_margins) {
// Convert margins from thousandth inches to cmm (0.01mm).
PageMargins cmm_margins;
cmm_margins.header =
ConvertMilliInchToHundredThousanthMeter(new_margins.header);
cmm_margins.footer =
ConvertMilliInchToHundredThousanthMeter(new_margins.footer);
cmm_margins.left = ConvertMilliInchToHundredThousanthMeter(new_margins.left);
cmm_margins.top = ConvertMilliInchToHundredThousanthMeter(new_margins.top);
cmm_margins.right =
ConvertMilliInchToHundredThousanthMeter(new_margins.right);
cmm_margins.bottom =
ConvertMilliInchToHundredThousanthMeter(new_margins.bottom);
UpdateMarginsMetric(cmm_margins);
// Now apply user configured settings.
PageMargins margins;
margins.header = 500;
margins.footer = 500;
margins.left = 500;
margins.top = 500;
margins.right = 500;
margins.bottom = 500;
page_setup_pixels_.SetRequestedMargins(margins);
}
void PrintSettings::RenderParams(PrintParams* params) const {
@ -159,7 +113,6 @@ bool PrintSettings::Equals(const PrintSettings& rhs) const {
desired_dpi == rhs.desired_dpi &&
device_name_ == rhs.device_name_ &&
page_setup_pixels_.Equals(rhs.page_setup_pixels_) &&
page_setup_cmm_.Equals(rhs.page_setup_cmm_) &&
dpi_ == rhs.dpi_ &&
landscape_ == rhs.landscape_;
}

View File

@ -62,11 +62,9 @@ class PrintSettings {
const std::wstring& new_device_name);
#endif
// Sets margins in 0.01 millimeter unit.
void UpdateMarginsMetric(const PageMargins& new_margins);
// Sets margins in thousandth of inch.
void UpdateMarginsMilliInch(const PageMargins& new_margins);
// Set printer printable area in pixels.
void SetPrinterPrintableArea(gfx::Size const& physical_size_pixels,
gfx::Rect const& printable_area_pixels);
// Initializes the print parameters that needs to be sent to the renderer
// process.
@ -83,11 +81,10 @@ class PrintSettings {
}
const std::wstring& device_name() const { return device_name_; }
int dpi() const { return dpi_; }
const PageSetup& page_setup_cmm() const { return page_setup_cmm_; }
const PageSetup& page_setup_pixels() const { return page_setup_pixels_; }
// Multipage printing. Each PageRange describes a from-to page combinaison.
// This permits printing some selected pages only.
// Multi-page printing. Each PageRange describes a from-to page combination.
// This permits printing selected pages only.
PageRanges ranges;
// By imaging to a width a little wider than the available pixels, thin pages
@ -122,9 +119,6 @@ class PrintSettings {
// Printer device name as opened by the OS.
std::wstring device_name_;
// Page setup in centimillimeter (0.01 mm) units.
PageSetup page_setup_cmm_;
// Page setup in pixel units, dpi adjusted.
PageSetup page_setup_pixels_;

View File

@ -282,14 +282,6 @@ bool PrintingContext::InitializeSettings(const DEVMODE& dev_mode,
ranges_vector.push_back(range);
}
settings_.Init(hdc_, dev_mode, ranges_vector, new_device_name);
PageMargins margins;
margins.header = 500;
margins.footer = 500;
margins.left = 500;
margins.top = 500;
margins.right = 500;
margins.bottom = 500;
settings_.UpdateMarginsMilliInch(margins);
return true;
}

View File

@ -373,7 +373,7 @@ void CefPostDataElementImpl::Set(const net::UploadData::Element& element)
std::string(element.bytes().begin(),
element.bytes().end()).c_str()));
} else if (element.type() == net::UploadData::TYPE_FILE) {
SetToFile(element.file_path());
SetToFile(element.file_path().value());
} else {
NOTREACHED();
}
@ -388,7 +388,7 @@ void CefPostDataElementImpl::Get(net::UploadData::Element& element)
if(type_ == PDE_TYPE_BYTES) {
element.SetToBytes(static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
} else if(type_ == PDE_TYPE_FILE) {
element.SetToFilePath(data_.filename);
element.SetToFilePath(FilePath(data_.filename));
} else {
NOTREACHED();
}

View File

@ -9,7 +9,6 @@
#include "base/gfx/rect.h"
#include "base/gfx/size.h"
#include "base/win_util.h"
#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webview.h"
static const wchar_t kWindowClassName[] = L"WebViewHost";

View File

@ -9,9 +9,22 @@
#include "base/gfx/rect.h"
#include "base/logging.h"
#include "base/win_util.h"
#include "webkit/glue/webinputevent.h"
#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
#include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
#include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h"
#include "third_party/WebKit/WebKit/chromium/public/win/WebScreenInfoFactory.h"
#include "webkit/glue/webwidget.h"
using WebKit::WebInputEvent;
using WebKit::WebInputEventFactory;
using WebKit::WebKeyboardEvent;
using WebKit::WebMouseEvent;
using WebKit::WebMouseWheelEvent;
using WebKit::WebScreenInfo;
using WebKit::WebScreenInfoFactory;
using WebKit::WebSize;
static const wchar_t kWindowClassName[] = L"WebWidgetHost";
/*static*/
@ -56,13 +69,6 @@ LRESULT CALLBACK WebWidgetHost::WndProc(HWND hwnd, UINT message, WPARAM wparam,
WebWidgetHost* host = FromWindow(hwnd);
if (host && !host->WndProc(message, wparam, lparam)) {
switch (message) {
case WM_DESTROY:
delete host;
break;
case WM_NCDESTROY:
TRACK_HWND_DESTRUCTION(hwnd);
break;
case WM_PAINT: {
RECT rect;
if (GetUpdateRect(hwnd, &rect, FALSE)) {
@ -267,23 +273,28 @@ void WebWidgetHost::Paint() {
UpdateWindow(view_);
}
WebScreenInfo WebWidgetHost::GetScreenInfo() {
return WebScreenInfoFactory::screenInfo(view_);
}
void WebWidgetHost::Resize(LPARAM lparam) {
// Force an entire re-paint. TODO(darin): Maybe reuse this memory buffer.
DiscardBackingStore();
webwidget_->Resize(gfx::Size(LOWORD(lparam), HIWORD(lparam)));
webwidget_->Resize(WebSize(LOWORD(lparam), HIWORD(lparam)));
}
void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
WebMouseEvent event(view_, message, wparam, lparam);
const WebMouseEvent& event = WebInputEventFactory::mouseEvent(
view_, message, wparam, lparam);
switch (event.type) {
case WebInputEvent::MOUSE_MOVE:
case WebInputEvent::MouseMove:
TrackMouseLeave(true);
break;
case WebInputEvent::MOUSE_LEAVE:
case WebInputEvent::MouseLeave:
TrackMouseLeave(false);
break;
case WebInputEvent::MOUSE_DOWN:
case WebInputEvent::MouseDown:
SetCapture(view_);
// This mimics a temporary workaround in RenderWidgetHostViewWin
// for bug 765011 to get focus when the mouse is clicked. This
@ -291,7 +302,7 @@ void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
// because normally Windows does a WM_SETFOCUS after WM_LBUTTONDOWN.
::SetFocus(view_);
break;
case WebInputEvent::MOUSE_UP:
case WebInputEvent::MouseUp:
if (GetCapture() == view_)
ReleaseCapture();
break;
@ -300,12 +311,14 @@ void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
}
void WebWidgetHost::WheelEvent(WPARAM wparam, LPARAM lparam) {
WebMouseWheelEvent event(view_, WM_MOUSEWHEEL, wparam, lparam);
const WebMouseWheelEvent& event = WebInputEventFactory::mouseWheelEvent(
view_, WM_MOUSEWHEEL, wparam, lparam);
webwidget_->HandleInputEvent(&event);
}
void WebWidgetHost::KeyEvent(UINT message, WPARAM wparam, LPARAM lparam) {
WebKeyboardEvent event(view_, message, wparam, lparam);
const WebKeyboardEvent& event = WebInputEventFactory::keyboardEvent(
view_, message, wparam, lparam);
webwidget_->HandleInputEvent(&event);
}

View File

@ -18,6 +18,10 @@ namespace gfx {
class Size;
}
namespace WebKit {
struct WebScreenInfo;
}
// This class is a simple ViewHandle-based host for a WebWidget
class WebWidgetHost {
public:
@ -46,6 +50,10 @@ class WebWidgetHost {
void UpdatePaintRect(const gfx::Rect& rect);
void Paint();
skia::PlatformCanvas* canvas() const { return canvas_.get(); }
WebKit::WebScreenInfo GetScreenInfo();
protected:
WebWidgetHost();
~WebWidgetHost();

View File

@ -355,6 +355,22 @@
>
</File>
</Filter>
<Filter
Name="resources"
>
<File
RelativePath=".\libcef_dll.rc"
>
</File>
<File
RelativePath="$(OutDir)\grit_derived_sources\webkit_resources.rc"
>
</File>
<File
RelativePath="$(OutDir)\grit_derived_sources\webkit_strings_en-US.rc"
>
</File>
</Filter>
<File
RelativePath=".\cef_string.c"
>
@ -383,10 +399,6 @@
RelativePath=".\libcef_dll.cc"
>
</File>
<File
RelativePath=".\libcef_dll.rc"
>
</File>
<File
RelativePath=".\precompiled_libcef.cc"
>