libcef: Update due to underlying chromium changes.
- Add the printing project and delete duplicated files from the CEF printing directory. - Add media-related projects and support for <video> and <image> tags. - Use WebKit::WebHTTPBody instead of net::UploadData for web requests. - Numerous changes due to continued cleanup of webkit/glue and webkit/api/public. - Use a separate BrowserWebViewDelegate instance for popup windows. libcef: - Add support for printing to file. - Use WebFrame::GetFullPageHtml() instead of webkit_glue::GetDocumentString(). - Parse extra header values in RequestProxy for passing to CefHandler::HandleBeforeResourceLoad(). - Add urlmon.lib dependency in libcef.vsprops. tools: - Add the patch application tool (patcher.py). patch: - New project for applying required patches to the Chromium source tree (issue #47). - Add webkit_glue.patch for http://codereview.chromium.org/160004 cefclient: - Add new test for submitting and handling requests. - Don't change navigation button state for popup windows. - Fix problem on Vista where the string returned by EM_GETLINE is not NULL-terminated. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@32 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
0a92d27cc1
commit
6a7b6d5038
|
@ -32,3 +32,4 @@ Date | CEF Revision | Chromium Revision
|
|||
2009-04-27 | /trunk@23 | /trunk@14651
|
||||
2009-05-15 | /trunk@24 | /trunk@16080
|
||||
2009-06-02 | /trunk@28 | /trunk@17397
|
||||
2009-07-24 | /trunk@32 | /trunk@21529
|
||||
|
|
227
cef.sln
227
cef.sln
|
@ -4,26 +4,26 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebKit (readonly)", "WebKit
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "webcore", "..\webkit\WebCore.vcproj", "{1C16337B-ACF3-4D03-AA90-851C5B5EADA6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{F9810DE8-CBC3-4605-A7B1-ECA2D5292FD7} = {F9810DE8-CBC3-4605-A7B1-ECA2D5292FD7}
|
||||
{FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED} = {FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED}
|
||||
{EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C}
|
||||
{21E22961-22BF-4493-BD3A-868F93DA5179} = {21E22961-22BF-4493-BD3A-868F93DA5179}
|
||||
{AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
|
||||
{238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601}
|
||||
{CD9CA56E-4E94-444C-87D4-58CA1E6F300D} = {CD9CA56E-4E94-444C-87D4-58CA1E6F300D}
|
||||
{6EAD4A4B-2BBC-4974-8E45-BB5C16CC2AC9} = {6EAD4A4B-2BBC-4974-8E45-BB5C16CC2AC9}
|
||||
{C564F145-9172-42C3-BFCB-6014CA97DBCD} = {C564F145-9172-42C3-BFCB-6014CA97DBCD}
|
||||
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
|
||||
{C564F145-9172-42C3-BFCB-6014CA97DBCD} = {C564F145-9172-42C3-BFCB-6014CA97DBCD}
|
||||
{6EAD4A4B-2BBC-4974-8E45-BB5C16CC2AC9} = {6EAD4A4B-2BBC-4974-8E45-BB5C16CC2AC9}
|
||||
{CD9CA56E-4E94-444C-87D4-58CA1E6F300D} = {CD9CA56E-4E94-444C-87D4-58CA1E6F300D}
|
||||
{238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601}
|
||||
{AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
|
||||
{21E22961-22BF-4493-BD3A-868F93DA5179} = {21E22961-22BF-4493-BD3A-868F93DA5179}
|
||||
{EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C}
|
||||
{FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED} = {FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED}
|
||||
{F9810DE8-CBC3-4605-A7B1-ECA2D5292FD7} = {F9810DE8-CBC3-4605-A7B1-ECA2D5292FD7}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glue", "..\webkit\glue.vcproj", "{C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
|
||||
{1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
|
||||
{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65} = {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}
|
||||
{326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243}
|
||||
{0B469837-3D46-484A-AFB3-C5A6C68730B9} = {0B469837-3D46-484A-AFB3-C5A6C68730B9}
|
||||
{60B43839-95E6-4526-A661-209F16335E0E} = {60B43839-95E6-4526-A661-209F16335E0E}
|
||||
{0B469837-3D46-484A-AFB3-C5A6C68730B9} = {0B469837-3D46-484A-AFB3-C5A6C68730B9}
|
||||
{326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243}
|
||||
{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65} = {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}
|
||||
{1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
|
||||
{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}"
|
||||
|
@ -70,32 +70,32 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "..\third_party\bzi
|
|||
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}
|
||||
{5916D37D-8C97-424F-A904-74E52594C2D6} = {5916D37D-8C97-424F-A904-74E52594C2D6}
|
||||
{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}
|
||||
{5916D37D-8C97-424F-A904-74E52594C2D6} = {5916D37D-8C97-424F-A904-74E52594C2D6}
|
||||
{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}"
|
||||
|
@ -106,14 +106,14 @@ 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\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\base.vcproj", "{1832A374-8A74-4F9E-B536-69A699B3E165}"
|
||||
|
@ -130,8 +130,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "default_plugin", "..\webkit
|
|||
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}"
|
||||
|
@ -142,9 +142,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{A507014E
|
|||
EndProject
|
||||
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}"
|
||||
|
@ -163,8 +163,8 @@ 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}"
|
||||
|
@ -180,34 +180,37 @@ 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
|
||||
{EC8B7909-62AF-470D-A75D-E1D89C837142} = {EC8B7909-62AF-470D-A75D-E1D89C837142}
|
||||
{8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} = {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C}
|
||||
{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}
|
||||
{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}
|
||||
{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65} = {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}
|
||||
{6AE76406-B03B-11DD-94B1-80B556D89593} = {6AE76406-B03B-11DD-94B1-80B556D89593}
|
||||
{9E5416B9-B91B-4029-93F4-102C1AD5CAF4} = {9E5416B9-B91B-4029-93F4-102C1AD5CAF4}
|
||||
{49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {49909552-0B0C-4C14-8CF6-DB8A2ADE0934}
|
||||
{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65} = {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}
|
||||
{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}
|
||||
{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}
|
||||
{8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} = {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C}
|
||||
{D7A94F58-576A-45D9-A45F-EB87C63ABBB0} = {D7A94F58-576A-45D9-A45F-EB87C63ABBB0}
|
||||
{EC8B7909-62AF-470D-A75D-E1D89C837142} = {EC8B7909-62AF-470D-A75D-E1D89C837142}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcef_dll_wrapper", "libcef_dll\wrapper\libcef_dll_wrapper.vcproj", "{A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9}"
|
||||
|
@ -217,14 +220,37 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcef_dll_wrapper", "libce
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "webkit", "..\webkit\WebKit.vcproj", "{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
|
||||
{1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
|
||||
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "config", "..\webkit\config.vcproj", "{2E2D3301-2EC4-4C0F-B889-87073B30F673}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6} = {A6D0953E-899E-4C60-AB6B-CAE75A44B8E6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcre", "..\webkit\pcre.vcproj", "{49909552-0B0C-4C14-8CF6-DB8A2ADE0934}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "printing", "..\printing\printing.vcproj", "{9E5416B9-B91B-4029-93F4-102C1AD5CAF4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "media", "..\media\media.vcproj", "{6AE76406-B03B-11DD-94B1-80B556D89593}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cygwin", "..\build\win\cygwin.vcproj", "{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ffmpeg", "ffmpeg", "{963C8C1D-059E-49C6-881E-5BE6919113FC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ffmpeg", "..\third_party\ffmpeg\ffmpeg.vcproj", "{D7A94F58-576A-45D9-A45F-EB87C63ABBB0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{4E4070E1-EFD9-4EF1-8634-3960956F6F10} = {4E4070E1-EFD9-4EF1-8634-3960956F6F10}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ffmpeg_binaries", "..\third_party\ffmpeg\ffmpeg_binaries.vcproj", "{4E4070E1-EFD9-4EF1-8634-3960956F6F10}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} = {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "patch", "patch\patch.vcproj", "{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
|
@ -536,6 +562,54 @@ Global
|
|||
{49909552-0B0C-4C14-8CF6-DB8A2ADE0934}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{49909552-0B0C-4C14-8CF6-DB8A2ADE0934}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{49909552-0B0C-4C14-8CF6-DB8A2ADE0934}.Release|Win32.Build.0 = Release|Win32
|
||||
{9E5416B9-B91B-4029-93F4-102C1AD5CAF4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{9E5416B9-B91B-4029-93F4-102C1AD5CAF4}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{9E5416B9-B91B-4029-93F4-102C1AD5CAF4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9E5416B9-B91B-4029-93F4-102C1AD5CAF4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9E5416B9-B91B-4029-93F4-102C1AD5CAF4}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{9E5416B9-B91B-4029-93F4-102C1AD5CAF4}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{9E5416B9-B91B-4029-93F4-102C1AD5CAF4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9E5416B9-B91B-4029-93F4-102C1AD5CAF4}.Release|Win32.Build.0 = Release|Win32
|
||||
{6AE76406-B03B-11DD-94B1-80B556D89593}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{6AE76406-B03B-11DD-94B1-80B556D89593}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{6AE76406-B03B-11DD-94B1-80B556D89593}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6AE76406-B03B-11DD-94B1-80B556D89593}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6AE76406-B03B-11DD-94B1-80B556D89593}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{6AE76406-B03B-11DD-94B1-80B556D89593}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{6AE76406-B03B-11DD-94B1-80B556D89593}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6AE76406-B03B-11DD-94B1-80B556D89593}.Release|Win32.Build.0 = Release|Win32
|
||||
{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Release|Win32.Build.0 = Release|Win32
|
||||
{D7A94F58-576A-45D9-A45F-EB87C63ABBB0}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{D7A94F58-576A-45D9-A45F-EB87C63ABBB0}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{D7A94F58-576A-45D9-A45F-EB87C63ABBB0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D7A94F58-576A-45D9-A45F-EB87C63ABBB0}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D7A94F58-576A-45D9-A45F-EB87C63ABBB0}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{D7A94F58-576A-45D9-A45F-EB87C63ABBB0}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{D7A94F58-576A-45D9-A45F-EB87C63ABBB0}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D7A94F58-576A-45D9-A45F-EB87C63ABBB0}.Release|Win32.Build.0 = Release|Win32
|
||||
{4E4070E1-EFD9-4EF1-8634-3960956F6F10}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{4E4070E1-EFD9-4EF1-8634-3960956F6F10}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{4E4070E1-EFD9-4EF1-8634-3960956F6F10}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4E4070E1-EFD9-4EF1-8634-3960956F6F10}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4E4070E1-EFD9-4EF1-8634-3960956F6F10}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{4E4070E1-EFD9-4EF1-8634-3960956F6F10}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{4E4070E1-EFD9-4EF1-8634-3960956F6F10}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4E4070E1-EFD9-4EF1-8634-3960956F6F10}.Release|Win32.Build.0 = Release|Win32
|
||||
{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -568,6 +642,8 @@ Global
|
|||
{A508ADD3-CECE-4E0F-8448-2F5E454DF551} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA}
|
||||
{F54ABC59-5C00-414A-A9BA-BAF26D1699F0} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA}
|
||||
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA}
|
||||
{9E5416B9-B91B-4029-93F4-102C1AD5CAF4} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA}
|
||||
{963C8C1D-059E-49C6-881E-5BE6919113FC} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA}
|
||||
{8C27D792-2648-4F5E-9ED0-374276327308} = {1AFC1EC3-24FA-4260-B099-76319EC9977A}
|
||||
{A0D94973-D355-47A5-A1E2-3456F321F010} = {1AFC1EC3-24FA-4260-B099-76319EC9977A}
|
||||
{B55CA863-B374-4BAF-95AC-539E4FA4C90C} = {873D095E-150E-4262-8C41-2D8ED02F0F57}
|
||||
|
@ -575,11 +651,16 @@ Global
|
|||
{6617FED9-C5D4-4907-BF55-A90062A6683F} = {08BAF606-555E-4048-A47E-22CFA89A21B4}
|
||||
{C13650D5-CF1A-4259-BE45-B1EBA6280E47} = {08BAF606-555E-4048-A47E-22CFA89A21B4}
|
||||
{A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9} = {08BAF606-555E-4048-A47E-22CFA89A21B4}
|
||||
{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6} = {08BAF606-555E-4048-A47E-22CFA89A21B4}
|
||||
{C0334F9A-1168-4101-9DD8-C30FB252D435} = {B353A6A5-9551-4B76-908E-0F0A9B31E4CE}
|
||||
{865575D0-37E2-405E-8CBA-5F6C485B5A26} = {B353A6A5-9551-4B76-908E-0F0A9B31E4CE}
|
||||
{21E22961-22BF-4493-BD3A-868F93DA5179} = {B353A6A5-9551-4B76-908E-0F0A9B31E4CE}
|
||||
{EC8B7909-62AF-470D-A75D-E1D89C837142} = {B353A6A5-9551-4B76-908E-0F0A9B31E4CE}
|
||||
{0DDBDA8B-A49F-4CC7-A1D5-5BB8297C8A3F} = {B353A6A5-9551-4B76-908E-0F0A9B31E4CE}
|
||||
{E13045CD-7E1F-4A41-9B18-8D288B2E7B41} = {A507014E-5F1D-4A60-963B-518FCED4B8AD}
|
||||
{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} = {A507014E-5F1D-4A60-963B-518FCED4B8AD}
|
||||
{6AE76406-B03B-11DD-94B1-80B556D89593} = {963C8C1D-059E-49C6-881E-5BE6919113FC}
|
||||
{D7A94F58-576A-45D9-A45F-EB87C63ABBB0} = {963C8C1D-059E-49C6-881E-5BE6919113FC}
|
||||
{4E4070E1-EFD9-4EF1-8634-3960956F6F10} = {963C8C1D-059E-49C6-881E-5BE6919113FC}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -154,6 +154,10 @@ enum cef_handler_menutypebits_t
|
|||
MENUTYPE_EDITABLE = 0x20,
|
||||
// A misspelled word is selected
|
||||
MENUTYPE_MISSPELLED_WORD = 0x40,
|
||||
// A video node is selected
|
||||
MENUTYPE_VIDEO = 0x80,
|
||||
// A video node is selected
|
||||
MENUTYPE_AUDIO = 0x100,
|
||||
};
|
||||
|
||||
// The cef_handler_menuinfo_t editFlags value will be a combination of the
|
||||
|
|
|
@ -9,15 +9,22 @@
|
|||
#include "request_impl.h"
|
||||
|
||||
#include "base/string_util.h"
|
||||
#include "webkit/api/public/WebHTTPBody.h"
|
||||
#include "webkit/api/public/WebScriptSource.h"
|
||||
#include "webkit/api/public/WebString.h"
|
||||
#include "webkit/api/public/WebURL.h"
|
||||
#include "webkit/api/public/WebURLRequest.h"
|
||||
#include "webkit/glue/glue_serialize.h"
|
||||
#include "webkit/glue/glue_util.h"
|
||||
#include "webkit/glue/webframe.h"
|
||||
|
||||
|
||||
using WebKit::WebHTTPBody;
|
||||
using WebKit::WebScriptSource;
|
||||
using WebKit::WebString;
|
||||
using WebKit::WebURL;
|
||||
using WebKit::WebURLRequest;
|
||||
using webkit_glue::StdStringToWebString;
|
||||
using webkit_glue::WebStringToStdString;
|
||||
|
||||
|
||||
CefBrowserImpl::CefBrowserImpl(CefWindowInfo& windowInfo, bool popup,
|
||||
|
@ -27,6 +34,7 @@ CefBrowserImpl::CefBrowserImpl(CefWindowInfo& windowInfo, bool popup,
|
|||
frame_main_(NULL)
|
||||
{
|
||||
delegate_ = new BrowserWebViewDelegate(this);
|
||||
popup_delegate_ = new BrowserWebViewDelegate(this);
|
||||
nav_controller_.reset(new BrowserNavigationController(this));
|
||||
}
|
||||
|
||||
|
@ -342,8 +350,8 @@ CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
|
|||
void CefBrowserImpl::UIT_LoadURL(CefFrame* frame,
|
||||
const std::wstring& url)
|
||||
{
|
||||
UIT_LoadURLForRequest(frame, url, std::wstring(), NULL,
|
||||
WebRequest::HeaderMap());
|
||||
UIT_LoadURLForRequest(frame, url, std::wstring(), WebHTTPBody(),
|
||||
CefRequest::HeaderMap());
|
||||
}
|
||||
|
||||
void CefBrowserImpl::UIT_LoadURLForRequestRef(CefFrame* frame,
|
||||
|
@ -354,27 +362,26 @@ void CefBrowserImpl::UIT_LoadURLForRequestRef(CefFrame* frame,
|
|||
|
||||
CefRequestImpl *impl = static_cast<CefRequestImpl*>(request);
|
||||
|
||||
scoped_refptr<net::UploadData> upload_data;
|
||||
WebHTTPBody upload_data;
|
||||
CefRefPtr<CefPostData> postdata = impl->GetPostData();
|
||||
if(postdata.get())
|
||||
{
|
||||
upload_data = new net::UploadData();
|
||||
static_cast<CefPostDataImpl*>(postdata.get())->Get(*upload_data.get());
|
||||
if(postdata.get()) {
|
||||
upload_data.initialize();
|
||||
static_cast<CefPostDataImpl*>(postdata.get())->Get(upload_data);
|
||||
}
|
||||
|
||||
WebRequest::HeaderMap headers;
|
||||
CefRequest::HeaderMap headers;
|
||||
impl->GetHeaderMap(headers);
|
||||
|
||||
UIT_LoadURLForRequest(frame, url, method, upload_data.get(), headers);
|
||||
UIT_LoadURLForRequest(frame, url, method, upload_data, headers);
|
||||
|
||||
request->Release();
|
||||
}
|
||||
|
||||
void CefBrowserImpl::UIT_LoadURLForRequest(CefFrame* frame,
|
||||
const std::wstring& url,
|
||||
const std::wstring& method,
|
||||
net::UploadData *upload_data,
|
||||
const WebRequest::HeaderMap& headers)
|
||||
const std::wstring& url,
|
||||
const std::wstring& method,
|
||||
const WebKit::WebHTTPBody& upload_data,
|
||||
const CefRequest::HeaderMap& headers)
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
|
@ -508,41 +515,40 @@ bool CefBrowserImpl::UIT_Navigate(const BrowserNavigationEntry& entry,
|
|||
|
||||
// If we are reloading, then WebKit will use the state of the current page.
|
||||
// Otherwise, we give it the state to navigate to.
|
||||
if (!reload && !entry.GetContentState().empty()) {
|
||||
if (reload) {
|
||||
frame->Reload();
|
||||
} else if (!entry.GetContentState().empty()) {
|
||||
DCHECK(entry.GetPageID() != -1);
|
||||
frame->LoadHistoryState(entry.GetContentState());
|
||||
frame->LoadHistoryItem(
|
||||
webkit_glue::HistoryItemFromString(entry.GetContentState()));
|
||||
} else {
|
||||
WebRequestCachePolicy cache_policy;
|
||||
if (reload) {
|
||||
cache_policy = WebRequestReloadIgnoringCacheData;
|
||||
} else {
|
||||
DCHECK(entry.GetPageID() == -1);
|
||||
cache_policy = WebRequestUseProtocolCachePolicy;
|
||||
DCHECK(entry.GetPageID() == -1);
|
||||
WebURLRequest request(entry.GetURL());
|
||||
|
||||
if(entry.GetMethod().size() > 0) {
|
||||
request.setHTTPMethod(
|
||||
StdStringToWebString(WideToUTF8(entry.GetMethod())));
|
||||
}
|
||||
|
||||
scoped_ptr<WebRequest> request(WebRequest::Create(entry.GetURL()));
|
||||
request->SetCachePolicy(cache_policy);
|
||||
|
||||
if(entry.GetMethod().size() > 0)
|
||||
request->SetHttpMethod(WideToUTF8(entry.GetMethod()));
|
||||
|
||||
if(entry.GetHeaders().size() > 0)
|
||||
request->SetHttpHeaders(entry.GetHeaders());
|
||||
CefRequestImpl::SetHeaderMap(entry.GetHeaders(), request);
|
||||
|
||||
if(entry.GetUploadData())
|
||||
if(!entry.GetUploadData().isNull())
|
||||
{
|
||||
if(request->GetHttpMethod() == "GET"
|
||||
|| request->GetHttpMethod() == "HEAD") {
|
||||
request->SetHttpMethod("POST");
|
||||
std::string method = WebStringToStdString(request.httpMethod());
|
||||
if(method == "GET" || method == "HEAD") {
|
||||
request.setHTTPMethod(StdStringToWebString("POST"));
|
||||
}
|
||||
if(request->GetHttpHeaderValue("Content-Type").size() == 0) {
|
||||
request->SetHttpHeaderValue(
|
||||
"Content-Type", "application/x-www-form-urlencoded");
|
||||
if(request.httpHeaderField(StdStringToWebString("Content-Type")).length()
|
||||
== 0) {
|
||||
request.setHTTPHeaderField(
|
||||
StdStringToWebString("Content-Type"),
|
||||
StdStringToWebString("application/x-www-form-urlencoded"));
|
||||
}
|
||||
request->SetUploadData(*entry.GetUploadData());
|
||||
request.setHTTPBody(entry.GetUploadData());
|
||||
}
|
||||
|
||||
frame->LoadRequest(request.get());
|
||||
frame->LoadRequest(request);
|
||||
}
|
||||
|
||||
// In case LoadRequest failed before DidCreateDataSource was called.
|
||||
|
@ -590,11 +596,10 @@ CefRefPtr<CefBrowserImpl> CefBrowserImpl::UIT_CreatePopupWindow(const std::wstri
|
|||
return browser;
|
||||
}
|
||||
|
||||
void CefBrowserImpl::UIT_Show(WebView* webview,
|
||||
WindowOpenDisposition disposition)
|
||||
void CefBrowserImpl::UIT_Show(WebKit::WebNavigationPolicy policy)
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
delegate_->Show(webview, disposition);
|
||||
delegate_->show(policy);
|
||||
}
|
||||
|
||||
void CefBrowserImpl::UIT_HandleActionView(CefHandler::MenuId menuId)
|
||||
|
|
|
@ -97,22 +97,29 @@ public:
|
|||
WebViewHost* GetWebViewHost() const {
|
||||
return webviewhost_.get();
|
||||
}
|
||||
BrowserWebViewDelegate* GetWebViewDelegate() const {
|
||||
return delegate_.get();
|
||||
}
|
||||
HWND GetWebViewWndHandle() const {
|
||||
return webviewhost_->window_handle();
|
||||
return webviewhost_->view_handle();
|
||||
}
|
||||
WebWidget* GetPopup() const {
|
||||
WebKit::WebWidget* GetPopup() const {
|
||||
return popuphost_ ? popuphost_->webwidget() : NULL;
|
||||
}
|
||||
WebWidgetHost* GetPopupHost() const {
|
||||
return popuphost_;
|
||||
}
|
||||
BrowserWebViewDelegate* GetPopupDelegate() const {
|
||||
return popup_delegate_.get();
|
||||
}
|
||||
HWND GetPopupWndHandle() const {
|
||||
return popuphost_->window_handle();
|
||||
return popuphost_->view_handle();
|
||||
}
|
||||
HWND GetMainWndHandle() const {
|
||||
return window_info_.m_hWnd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// ALL UIT_* METHODS MUST ONLY BE CALLED ON THE UI THREAD //
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -121,7 +128,7 @@ public:
|
|||
REQUIRE_UIT();
|
||||
return nav_controller_.get();
|
||||
}
|
||||
|
||||
|
||||
// Return true to allow user editing such as entering text in form elements
|
||||
bool UIT_AllowEditing() { return true; }
|
||||
|
||||
|
@ -150,8 +157,8 @@ public:
|
|||
void UIT_LoadURLForRequest(CefFrame* frame,
|
||||
const std::wstring& url,
|
||||
const std::wstring& method,
|
||||
net::UploadData *upload_data,
|
||||
const WebRequest::HeaderMap& headers);
|
||||
const WebKit::WebHTTPBody& upload_data,
|
||||
const CefRequest::HeaderMap& headers);
|
||||
void UIT_LoadURLForRequestRef(CefFrame* frame,
|
||||
CefRequest* request);
|
||||
void UIT_LoadHTML(CefFrame* frame,
|
||||
|
@ -170,10 +177,10 @@ public:
|
|||
void UIT_SetFocus(WebWidgetHost* host, bool enable);
|
||||
|
||||
CefRefPtr<CefBrowserImpl> UIT_CreatePopupWindow(const std::wstring& url);
|
||||
WebWidget* UIT_CreatePopupWidget(WebView* webview);
|
||||
WebKit::WebWidget* UIT_CreatePopupWidget(WebView* webview);
|
||||
void UIT_ClosePopupWidget();
|
||||
|
||||
void UIT_Show(WebView* webview, WindowOpenDisposition disposition);
|
||||
void UIT_Show(WebKit::WebNavigationPolicy policy);
|
||||
|
||||
// Handles most simple browser actions
|
||||
void UIT_HandleActionView(CefHandler::MenuId menuId);
|
||||
|
@ -211,6 +218,7 @@ protected:
|
|||
scoped_ptr<WebViewHost> webviewhost_;
|
||||
WebWidgetHost* popuphost_;
|
||||
scoped_refptr<BrowserWebViewDelegate> delegate_;
|
||||
scoped_refptr<BrowserWebViewDelegate> popup_delegate_;
|
||||
scoped_ptr<BrowserNavigationController> nav_controller_;
|
||||
|
||||
std::wstring title_;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "browser_webkit_glue.h"
|
||||
#include "stream_impl.h"
|
||||
#include "printing/units.h"
|
||||
#include "../patch/patch_state.h"
|
||||
|
||||
#include "base/string_util.h"
|
||||
#include "base/win_util.h"
|
||||
|
@ -62,7 +63,7 @@ LRESULT CALLBACK CefBrowserImpl::WndProc(HWND hwnd, UINT message,
|
|||
browser->GetWebView()->GetMainFrame()->CallJSGC();
|
||||
|
||||
// Clean up anything associated with the WebViewHost widget.
|
||||
browser->GetWebViewHost()->webwidget()->Close();
|
||||
browser->GetWebViewHost()->webwidget()->close();
|
||||
|
||||
// Remove the browser from the list maintained by the context
|
||||
_Context->RemoveBrowser(browser);
|
||||
|
@ -81,12 +82,12 @@ LRESULT CALLBACK CefBrowserImpl::WndProc(HWND hwnd, UINT message,
|
|||
|
||||
case WM_SETFOCUS:
|
||||
if (browser && browser->GetWebView())
|
||||
browser->GetWebView()->SetFocus(true);
|
||||
browser->GetWebView()->setFocus(true);
|
||||
return 0;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
if (browser && browser->GetWebView())
|
||||
browser->GetWebView()->SetFocus(false);
|
||||
browser->GetWebView()->setFocus(false);
|
||||
return 0;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
|
@ -136,7 +137,7 @@ std::wstring CefBrowserImpl::GetSource(CefRefPtr<CefFrame> frame)
|
|||
// Retrieve the document string directly
|
||||
WebFrame* web_frame = GetWebFrame(frame);
|
||||
if(web_frame)
|
||||
return UTF8ToWide(webkit_glue::GetDocumentString(web_frame));
|
||||
return UTF8ToWide(web_frame->GetFullPageHtml());
|
||||
return std::wstring();
|
||||
}
|
||||
}
|
||||
|
@ -287,17 +288,17 @@ void CefBrowserImpl::UIT_SetFocus(WebWidgetHost* host, bool enable)
|
|||
REQUIRE_UIT();
|
||||
|
||||
if (enable)
|
||||
::SetFocus(host->window_handle());
|
||||
else if (::GetFocus() == host->window_handle())
|
||||
::SetFocus(host->view_handle());
|
||||
else if (::GetFocus() == host->view_handle())
|
||||
::SetFocus(NULL);
|
||||
}
|
||||
|
||||
WebWidget* CefBrowserImpl::UIT_CreatePopupWidget(WebView* webview)
|
||||
WebKit::WebWidget* CefBrowserImpl::UIT_CreatePopupWidget(WebView* webview)
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
DCHECK(!popuphost_);
|
||||
popuphost_ = WebWidgetHost::Create(NULL, delegate_.get());
|
||||
popuphost_ = WebWidgetHost::Create(NULL, popup_delegate_.get());
|
||||
ShowWindow(GetPopupWndHandle(), SW_SHOW);
|
||||
|
||||
return popuphost_->webwidget();
|
||||
|
@ -348,7 +349,7 @@ bool CefBrowserImpl::UIT_ViewDocumentString(WebFrame *frame)
|
|||
|
||||
size_t len = wcslen(szTempName);
|
||||
wcscpy(szTempName + len - 3, L"txt");
|
||||
WriteTextToFile(webkit_glue::GetDocumentString(frame), szTempName);
|
||||
WriteTextToFile(frame->GetFullPageHtml(), szTempName);
|
||||
|
||||
int errorCode = (int)ShellExecute(GetMainWndHandle(), L"open", szTempName,
|
||||
NULL, NULL, SW_SHOWNORMAL);
|
||||
|
@ -367,7 +368,7 @@ void CefBrowserImpl::UIT_GetDocumentStringNotify(CefFrame* frame,
|
|||
WebFrame* web_frame = GetWebFrame(frame);
|
||||
if(web_frame) {
|
||||
// Retrieve the document string
|
||||
std::string str = webkit_glue::GetDocumentString(web_frame);
|
||||
std::string str = web_frame->GetFullPageHtml();
|
||||
// Write the document string to the stream
|
||||
writer->Write(str.c_str(), str.size(), 1);
|
||||
}
|
||||
|
@ -424,6 +425,11 @@ void CefBrowserImpl::UIT_CanGoForwardNotify(bool *retVal, HANDLE hEvent)
|
|||
void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
|
||||
const gfx::Size& canvas_size,
|
||||
WebFrame* frame) {
|
||||
#if !CEF_PATCHES_APPLIED
|
||||
NOTREACHED() << "CEF patches must be applied to support printing.";
|
||||
return;
|
||||
#endif // !CEF_PATCHES_APPLIED
|
||||
|
||||
REQUIRE_UIT();
|
||||
|
||||
printing::PrintParams params;
|
||||
|
@ -464,7 +470,10 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
|
|||
canvas.clipRect(clip_rect);
|
||||
|
||||
// Apply the WebKit scaling factor.
|
||||
float webkit_scale = frame->GetPrintPageShrink(page_number);
|
||||
float webkit_scale = 0;
|
||||
#if CEF_PATCHES_APPLIED
|
||||
webkit_scale = frame->GetPrintPageShrink(page_number);
|
||||
#endif // CEF_PATCHES_APPLIED
|
||||
if (webkit_scale <= 0) {
|
||||
NOTREACHED() << "Printing page " << page_number << " failed.";
|
||||
}
|
||||
|
@ -564,6 +573,10 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
|
|||
}
|
||||
|
||||
void CefBrowserImpl::UIT_PrintPages(WebFrame* frame) {
|
||||
#if !CEF_PATCHES_APPLIED
|
||||
NOTREACHED() << "CEF patches must be applied to support printing.";
|
||||
return;
|
||||
#endif // !CEF_PATCHES_APPLIED
|
||||
|
||||
REQUIRE_UIT();
|
||||
|
||||
|
@ -577,7 +590,7 @@ void CefBrowserImpl::UIT_PrintPages(WebFrame* frame) {
|
|||
}
|
||||
|
||||
if(print_context_.AskUserForSettings(
|
||||
GetMainWndHandle(), UIT_GetPagesCount(frame))
|
||||
GetMainWndHandle(), UIT_GetPagesCount(frame), false)
|
||||
!= printing::PrintingContext::OK)
|
||||
return;
|
||||
|
||||
|
@ -599,7 +612,7 @@ void CefBrowserImpl::UIT_PrintPages(WebFrame* frame) {
|
|||
settings.page_setup_pixels().physical_size().height(),
|
||||
static_cast<int>(params.dpi),
|
||||
params.desired_dpi));
|
||||
frame->BeginPrint(WebSize(canvas_size), &page_count);
|
||||
page_count = frame->PrintBegin(WebSize(canvas_size));
|
||||
|
||||
if (page_count) {
|
||||
bool old_state = MessageLoop::current()->NestableTasksAllowed();
|
||||
|
@ -622,7 +635,7 @@ void CefBrowserImpl::UIT_PrintPages(WebFrame* frame) {
|
|||
MessageLoop::current()->SetNestableTasksAllowed(old_state);
|
||||
}
|
||||
|
||||
frame->EndPrint();
|
||||
frame->PrintEnd();
|
||||
}
|
||||
|
||||
int CefBrowserImpl::UIT_GetPagesCount(WebFrame* frame)
|
||||
|
@ -651,8 +664,8 @@ int CefBrowserImpl::UIT_GetPagesCount(WebFrame* frame)
|
|||
settings.page_setup_pixels().physical_size().height(),
|
||||
static_cast<int>(params.dpi),
|
||||
params.desired_dpi));
|
||||
frame->BeginPrint(WebSize(canvas_size), &page_count);
|
||||
frame->EndPrint();
|
||||
page_count = frame->PrintBegin(WebSize(canvas_size));
|
||||
frame->PrintEnd();
|
||||
|
||||
return page_count;
|
||||
}
|
||||
|
|
|
@ -22,15 +22,16 @@ BrowserNavigationEntry::BrowserNavigationEntry(int page_id,
|
|||
const std::wstring& title,
|
||||
const std::wstring& target_frame,
|
||||
const std::wstring& method,
|
||||
net::UploadData *upload,
|
||||
const WebRequest::HeaderMap& headers)
|
||||
const WebKit::WebHTTPBody& upload,
|
||||
const CefRequest::HeaderMap& headers)
|
||||
: page_id_(page_id),
|
||||
url_(url),
|
||||
title_(title),
|
||||
target_frame_(target_frame),
|
||||
method_(method),
|
||||
upload_(upload),
|
||||
headers_(headers) {
|
||||
if(!upload.isNull())
|
||||
upload_ = upload;
|
||||
}
|
||||
|
||||
BrowserNavigationEntry::~BrowserNavigationEntry() {
|
||||
|
|
|
@ -13,18 +13,16 @@
|
|||
#include "base/linked_ptr.h"
|
||||
#include "base/ref_counted.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "webkit/glue/webdatasource.h"
|
||||
#include "webkit/glue/weburlrequest.h"
|
||||
#include "webkit/api/public/WebDataSource.h"
|
||||
#include "webkit/api/public/WebHTTPBody.h"
|
||||
|
||||
namespace net {
|
||||
class UploadData;
|
||||
}
|
||||
#include "include/cef.h"
|
||||
|
||||
class GURL;
|
||||
class CefBrowserImpl;
|
||||
|
||||
// Associated with browser-initated navigations to hold tracking data.
|
||||
class BrowserExtraData : public WebDataSource::ExtraData {
|
||||
class BrowserExtraData : public WebKit::WebDataSource::ExtraData {
|
||||
public:
|
||||
BrowserExtraData(int32 pending_page_id)
|
||||
: pending_page_id(pending_page_id),
|
||||
|
@ -48,8 +46,8 @@ class BrowserNavigationEntry {
|
|||
const std::wstring& title,
|
||||
const std::wstring& target_frame,
|
||||
const std::wstring& method,
|
||||
net::UploadData *upload,
|
||||
const WebRequest::HeaderMap& headers);
|
||||
const WebKit::WebHTTPBody& upload,
|
||||
const CefRequest::HeaderMap& headers);
|
||||
~BrowserNavigationEntry();
|
||||
|
||||
// Set / Get the URI
|
||||
|
@ -75,8 +73,8 @@ class BrowserNavigationEntry {
|
|||
const std::wstring& GetTargetFrame() const { return target_frame_; }
|
||||
|
||||
const std::wstring& GetMethod() const { return method_; }
|
||||
net::UploadData* GetUploadData() const { return upload_.get(); }
|
||||
const WebRequest::HeaderMap& GetHeaders() const { return headers_; }
|
||||
const WebKit::WebHTTPBody& GetUploadData() const { return upload_; }
|
||||
const CefRequest::HeaderMap& GetHeaders() const { return headers_; }
|
||||
|
||||
private:
|
||||
// Describes the current page that the tab represents. This is not relevant
|
||||
|
@ -87,8 +85,8 @@ private:
|
|||
std::wstring title_;
|
||||
std::string state_;
|
||||
std::wstring method_;
|
||||
scoped_refptr<net::UploadData> upload_;
|
||||
WebRequest::HeaderMap headers_;
|
||||
WebKit::WebHTTPBody upload_;
|
||||
CefRequest::HeaderMap headers_;
|
||||
|
||||
std::wstring target_frame_;
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "browser_request_context.h"
|
||||
|
||||
#include "net/base/cookie_monster.h"
|
||||
#include "net/base/host_resolver.h"
|
||||
#include "net/ftp/ftp_network_layer.h"
|
||||
#include "net/proxy/proxy_service.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
|
||||
|
@ -32,21 +34,25 @@ void BrowserRequestContext::Init(
|
|||
accept_charset_ = "iso-8859-1,*,utf-8";
|
||||
|
||||
net::ProxyConfig proxy_config;
|
||||
host_resolver_ = net::CreateSystemHostResolver();
|
||||
proxy_service_ = net::ProxyService::Create(no_proxy ? &proxy_config : NULL,
|
||||
false, NULL, NULL);
|
||||
|
||||
net::HttpCache *cache;
|
||||
if (cache_path.empty()) {
|
||||
cache = new net::HttpCache(proxy_service_, 0);
|
||||
cache = new net::HttpCache(host_resolver_, proxy_service_, 0);
|
||||
} else {
|
||||
cache = new net::HttpCache(proxy_service_, cache_path, 0);
|
||||
cache = new net::HttpCache(host_resolver_, proxy_service_, cache_path, 0);
|
||||
}
|
||||
cache->set_mode(cache_mode);
|
||||
http_transaction_factory_ = cache;
|
||||
|
||||
ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_);
|
||||
}
|
||||
|
||||
BrowserRequestContext::~BrowserRequestContext() {
|
||||
delete cookie_store_;
|
||||
delete ftp_transaction_factory_;
|
||||
delete http_transaction_factory_;
|
||||
delete proxy_service_;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "base/ref_counted.h"
|
||||
#include "base/string_util.h"
|
||||
#include "base/time.h"
|
||||
#include "base/timer.h"
|
||||
#include "base/thread.h"
|
||||
#include "base/waitable_event.h"
|
||||
#include "net/base/cookie_monster.h"
|
||||
|
@ -50,6 +51,7 @@
|
|||
#include "net/base/net_util.h"
|
||||
#include "net/base/upload_data.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/http/http_util.h"
|
||||
#include "net/proxy/proxy_service.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
#include "webkit/glue/resource_loader_bridge.h"
|
||||
|
@ -223,9 +225,19 @@ class RequestProxy : public URLRequest::Delegate,
|
|||
requestimpl->SetURL(UTF8ToWide(params->url.spec()));
|
||||
requestimpl->SetMethod(UTF8ToWide(params->method));
|
||||
|
||||
// TODO(cef): Parse the extra header values from params->headers and
|
||||
// add to the header map.
|
||||
CefRequest::HeaderMap headerMap;
|
||||
|
||||
// Parse the request header values
|
||||
std::string headerStr = "HTTP/1.1 200 OK\n";
|
||||
headerStr += params->headers;
|
||||
scoped_refptr<net::HttpResponseHeaders> headers =
|
||||
new HttpResponseHeaders(net::HttpUtil::AssembleRawHeaders(
|
||||
headerStr.c_str(), headerStr.length()));
|
||||
void* iter = NULL;
|
||||
std::string name, value;
|
||||
while(headers->EnumerateHeaderLines(&iter, &name, &value))
|
||||
headerMap.insert(std::make_pair(UTF8ToWide(name), UTF8ToWide(value)));
|
||||
|
||||
headerMap.insert(
|
||||
std::make_pair(L"Referrer", UTF8ToWide(params->referrer.spec())));
|
||||
|
||||
|
@ -368,7 +380,8 @@ class RequestProxy : public URLRequest::Delegate,
|
|||
// URLRequest::Delegate implementation:
|
||||
|
||||
virtual void OnReceivedRedirect(URLRequest* request,
|
||||
const GURL& new_url) {
|
||||
const GURL& new_url,
|
||||
bool* defer_redirect) {
|
||||
DCHECK(request->status().is_success());
|
||||
OnReceivedRedirect(new_url);
|
||||
}
|
||||
|
|
|
@ -10,11 +10,8 @@
|
|||
|
||||
#include "config.h"
|
||||
MSVC_PUSH_WARNING_LEVEL(0);
|
||||
#include "Frame.h"
|
||||
#include "Markup.h"
|
||||
#include "TextEncoding.h"
|
||||
#include "webkit/glue/webframe_impl.h"
|
||||
#include "webkit/port/bindings/v8/v8_proxy.h"
|
||||
MSVC_POP_WARNING();
|
||||
|
||||
#include "browser_webkit_glue.h"
|
||||
|
@ -133,6 +130,10 @@ StringPiece GetDataResource(int resource_id) {
|
|||
case IDR_SEARCH_CANCEL_PRESSED:
|
||||
case IDR_SEARCH_MAGNIFIER:
|
||||
case IDR_SEARCH_MAGNIFIER_RESULTS:
|
||||
case IDR_MEDIA_PAUSE_BUTTON:
|
||||
case IDR_MEDIA_PLAY_BUTTON:
|
||||
case IDR_MEDIA_SOUND_FULL_BUTTON:
|
||||
case IDR_MEDIA_SOUND_NONE_BUTTON:
|
||||
return NetResourceProvider(resource_id);
|
||||
default:
|
||||
break;
|
||||
|
@ -181,13 +182,6 @@ std::wstring GetWebKitLocale() {
|
|||
return L"en-US";
|
||||
}
|
||||
|
||||
std::string GetDocumentString(WebFrame* frame) {
|
||||
WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(frame);
|
||||
WebCore::Frame* core_frame = webFrameImpl->frame();
|
||||
|
||||
return StringToStdString(WebCore::createMarkup(core_frame->document()));
|
||||
}
|
||||
|
||||
void InitializeTextEncoding() {
|
||||
WebCore::UTF8Encoding();
|
||||
}
|
||||
|
@ -196,7 +190,15 @@ v8::Handle<v8::Context> GetV8Context(WebFrame* frame)
|
|||
{
|
||||
WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(frame);
|
||||
WebCore::Frame* core_frame = webFrameImpl->frame();
|
||||
return WebCore::V8Proxy::GetContext(core_frame);
|
||||
return WebCore::V8Proxy::context(core_frame);
|
||||
}
|
||||
|
||||
void CloseIdleConnections() {
|
||||
// Used in benchmarking, Ignored for CEF.
|
||||
}
|
||||
|
||||
void SetCacheMode(bool enabled) {
|
||||
// Used in benchmarking, Ignored for CEF.
|
||||
}
|
||||
|
||||
} // namespace webkit_glue
|
||||
|
|
|
@ -15,9 +15,6 @@ class WebView;
|
|||
|
||||
namespace webkit_glue {
|
||||
|
||||
// Return the HTML contents of a web frame as a string
|
||||
std::string GetDocumentString(WebFrame* frame);
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Capture a bitmap of the web view.
|
||||
void CaptureWebViewBitmap(HWND mainWnd, WebView* webview, HBITMAP& bitmap,
|
||||
|
|
|
@ -21,6 +21,7 @@ MSVC_POP_WARNING();
|
|||
#undef LOG
|
||||
#include "base/gfx/gdi_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "skia/ext/platform_canvas.h"
|
||||
#include "webkit/api/public/WebRect.h"
|
||||
#include "webkit/api/public/WebSize.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
|
@ -65,16 +66,16 @@ bool DownloadUrl(const std::string& url, HWND caller_window) {
|
|||
void CaptureWebViewBitmap(HWND mainWnd, WebView* webview, HBITMAP& bitmap,
|
||||
SIZE& size)
|
||||
{
|
||||
WebKit::WebSize webSize = webview->GetSize();
|
||||
WebKit::WebSize webSize = webview->size();
|
||||
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);
|
||||
skia::PlatformCanvas canvas(size.cx, size.cy, true);
|
||||
canvas.drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode);
|
||||
PlatformContextSkia context(&canvas);
|
||||
WebKit::WebRect rect(0, 0, size.cx, size.cy);
|
||||
webview->Layout();
|
||||
webview->Paint(&canvas, rect);
|
||||
webview->layout();
|
||||
webview->paint(&canvas, rect);
|
||||
|
||||
HDC hRefDC = GetDC(mainWnd);
|
||||
HDC hDC = CreateCompatibleDC(hRefDC);
|
||||
|
|
|
@ -6,11 +6,16 @@
|
|||
#ifndef _BROWSER_WEBKIT_INIT_H
|
||||
#define _BROWSER_WEBKIT_INIT_H
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/stats_counters.h"
|
||||
#include "base/string_util.h"
|
||||
#include "media/base/media.h"
|
||||
#include "webkit/api/public/WebCString.h"
|
||||
#include "webkit/api/public/WebData.h"
|
||||
#include "webkit/api/public/WebKit.h"
|
||||
#include "webkit/api/public/WebStorageArea.h"
|
||||
#include "webkit/api/public/WebStorageNamespace.h"
|
||||
#include "webkit/api/public/WebString.h"
|
||||
#include "webkit/api/public/WebURL.h"
|
||||
#include "webkit/glue/simple_webmimeregistry_impl.h"
|
||||
|
@ -35,6 +40,13 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
ASCIIToUTF16(webkit_glue::GetUIResourceProtocol()));
|
||||
WebKit::registerExtension(extensions_v8::GearsExtension::Get());
|
||||
WebKit::registerExtension(extensions_v8::IntervalExtension::Get());
|
||||
|
||||
// Load libraries for media and enable the media player.
|
||||
FilePath module_path;
|
||||
if (PathService::Get(base::DIR_MODULE, &module_path) &&
|
||||
media::InitializeMediaLibrary(module_path)) {
|
||||
WebKit::enableMediaPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
~BrowserWebKitInit() {
|
||||
|
@ -56,6 +68,11 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
virtual bool getFileSize(const WebKit::WebString& path, long long& result) {
|
||||
return file_util::GetFileSize(
|
||||
FilePath(webkit_glue::WebStringToFilePathString(path)), &result);
|
||||
}
|
||||
|
||||
virtual unsigned long long visitedLinkHash(const char* canonicalURL, size_t length) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -105,6 +122,16 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
return ASCIIToUTF16("en-US");
|
||||
}
|
||||
|
||||
virtual WebKit::WebStorageNamespace* createLocalStorageNamespace(
|
||||
const WebKit::WebString& path) {
|
||||
return WebKit::WebStorageNamespace::createLocalStorageNamespace(path);
|
||||
}
|
||||
|
||||
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace() {
|
||||
return WebKit::WebStorageNamespace::createSessionStorageNamespace();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
webkit_glue::SimpleWebMimeRegistryImpl mime_registry_;
|
||||
scoped_ptr<WebKit::WebClipboard> clipboard_;
|
||||
|
|
|
@ -21,23 +21,34 @@
|
|||
#include "base/gfx/point.h"
|
||||
#include "base/gfx/native_widget_types.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/process_util.h"
|
||||
#include "base/string_util.h"
|
||||
#include "base/trace_event.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "webkit/api/public/WebData.h"
|
||||
#include "webkit/api/public/WebDataSource.h"
|
||||
#include "webkit/api/public/WebDragData.h"
|
||||
#include "webkit/api/public/WebHistoryItem.h"
|
||||
#include "webkit/api/public/WebKit.h"
|
||||
#include "webkit/api/public/WebScreenInfo.h"
|
||||
#include "webkit/api/public/WebString.h"
|
||||
#include "webkit/glue/webdatasource.h"
|
||||
#include "webkit/api/public/WebURL.h"
|
||||
#include "webkit/api/public/WebURLError.h"
|
||||
#include "webkit/api/public/WebURLRequest.h"
|
||||
#include "webkit/glue/glue_serialize.h"
|
||||
#include "webkit/glue/glue_util.h"
|
||||
#include "webkit/glue/media/buffered_data_source.h"
|
||||
#include "webkit/glue/media/media_resource_loader_bridge_factory.h"
|
||||
#include "webkit/glue/media/simple_data_source.h"
|
||||
#include "webkit/glue/webappcachecontext.h"
|
||||
#include "webkit/glue/webdropdata.h"
|
||||
#include "webkit/glue/weberror.h"
|
||||
#include "webkit/glue/webframe.h"
|
||||
#include "webkit/glue/webpreferences.h"
|
||||
#include "webkit/glue/weburlrequest.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
#include "webkit/glue/webview.h"
|
||||
#include "webkit/glue/plugins/plugin_list.h"
|
||||
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
|
||||
#include "webkit/glue/webmediaplayer_impl.h"
|
||||
#include "webkit/glue/window_open_disposition.h"
|
||||
#include "browser_webkit_glue.h"
|
||||
|
||||
|
@ -47,11 +58,19 @@
|
|||
#include "browser_drop_delegate.h"
|
||||
#endif
|
||||
|
||||
using WebKit::WebData;
|
||||
using WebKit::WebDataSource;
|
||||
using WebKit::WebDragData;
|
||||
using WebKit::WebHistoryItem;
|
||||
using WebKit::WebNavigationPolicy;
|
||||
using WebKit::WebRect;
|
||||
using WebKit::WebScreenInfo;
|
||||
using WebKit::WebSize;
|
||||
using WebKit::WebString;
|
||||
using WebKit::WebURL;
|
||||
using WebKit::WebURLError;
|
||||
using WebKit::WebURLRequest;
|
||||
using WebKit::WebWidget;
|
||||
using WebKit::WebWorker;
|
||||
using WebKit::WebWorkerClient;
|
||||
|
||||
|
@ -71,27 +90,45 @@ WebView* BrowserWebViewDelegate::CreateWebView(WebView* webview,
|
|||
return browser.get() ? browser->GetWebView() : NULL;
|
||||
}
|
||||
|
||||
WebWidget* BrowserWebViewDelegate::CreatePopupWidget(WebView* webview,
|
||||
bool activatable) {
|
||||
WebKit::WebWidget* BrowserWebViewDelegate::CreatePopupWidget(
|
||||
WebView* webview,
|
||||
bool activatable) {
|
||||
return browser_->UIT_CreatePopupWidget(webview);
|
||||
}
|
||||
|
||||
WebKit::WebMediaPlayer* BrowserWebViewDelegate::CreateWebMediaPlayer(
|
||||
WebKit::WebMediaPlayerClient* client) {
|
||||
scoped_refptr<media::FilterFactoryCollection> factory =
|
||||
new media::FilterFactoryCollection();
|
||||
|
||||
// TODO(hclam): this is the same piece of code as in RenderView, maybe they
|
||||
// should be grouped together.
|
||||
webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory =
|
||||
new webkit_glue::MediaResourceLoaderBridgeFactory(
|
||||
GURL::EmptyGURL(), // referrer
|
||||
"null", // frame origin
|
||||
"null", // main_frame_origin
|
||||
base::GetCurrentProcId(),
|
||||
WebAppCacheContext::kNoAppCacheContextId,
|
||||
0);
|
||||
factory->AddFactory(webkit_glue::BufferedDataSource::CreateFactory(
|
||||
MessageLoop::current(), bridge_factory));
|
||||
return new webkit_glue::WebMediaPlayerImpl(client, factory);
|
||||
}
|
||||
|
||||
WebWorker* BrowserWebViewDelegate::CreateWebWorker(WebWorkerClient* client) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::OpenURL(WebView* webview, const GURL& url,
|
||||
const GURL& referrer,
|
||||
WindowOpenDisposition disposition) {
|
||||
DCHECK_NE(disposition, CURRENT_TAB); // No code for this
|
||||
if (disposition == SUPPRESS_OPEN)
|
||||
return;
|
||||
|
||||
WebNavigationPolicy policy) {
|
||||
DCHECK_NE(policy, WebKit::WebNavigationPolicyCurrentTab);
|
||||
CefRefPtr<CefBrowserImpl> browser =
|
||||
browser_->UIT_CreatePopupWindow(UTF8ToWide(url.spec()));
|
||||
|
||||
if(browser.get())
|
||||
browser->UIT_Show(browser->GetWebView(), disposition);
|
||||
browser->UIT_Show(policy);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidStartLoading(WebView* webview) {
|
||||
|
@ -138,12 +175,12 @@ void BrowserWebViewDelegate::WindowObjectCleared(WebFrame* webframe) {
|
|||
}
|
||||
}
|
||||
|
||||
WindowOpenDisposition BrowserWebViewDelegate::DispositionForNavigationAction(
|
||||
WebNavigationPolicy BrowserWebViewDelegate::PolicyForNavigationAction(
|
||||
WebView* webview,
|
||||
WebFrame* frame,
|
||||
const WebRequest* request,
|
||||
WebNavigationType type,
|
||||
WindowOpenDisposition disposition,
|
||||
const WebKit::WebURLRequest& request,
|
||||
WebKit::WebNavigationType type,
|
||||
WebNavigationPolicy default_policy,
|
||||
bool is_redirect) {
|
||||
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
|
@ -151,20 +188,20 @@ WindowOpenDisposition BrowserWebViewDelegate::DispositionForNavigationAction(
|
|||
// Gather browse request information
|
||||
CefRefPtr<CefRequest> req(CefRequest::CreateRequest());
|
||||
|
||||
req->SetURL(UTF8ToWide(request->GetURL().spec()));
|
||||
req->SetMethod(UTF8ToWide(request->GetHttpMethod()));
|
||||
|
||||
if(request->HasUploadData()) {
|
||||
scoped_refptr<net::UploadData> data(new net::UploadData());
|
||||
request->GetUploadData(data.get());
|
||||
GURL request_url = request.url();
|
||||
req->SetURL(UTF8ToWide(request_url.spec()));
|
||||
req->SetMethod(
|
||||
UTF8ToWide(webkit_glue::WebStringToStdString(request.httpMethod())));
|
||||
|
||||
const WebKit::WebHTTPBody& httpBody = request.httpBody();
|
||||
if(!httpBody.isNull()) {
|
||||
CefRefPtr<CefPostData> postdata(CefPostData::CreatePostData());
|
||||
static_cast<CefPostDataImpl*>(postdata.get())->Set(*data.get());
|
||||
static_cast<CefPostDataImpl*>(postdata.get())->Set(httpBody);
|
||||
req->SetPostData(postdata);
|
||||
}
|
||||
}
|
||||
|
||||
WebRequest::HeaderMap map;
|
||||
request->GetHttpHeaders(&map);
|
||||
CefRequest::HeaderMap map;
|
||||
CefRequestImpl::GetHeaderMap(request, map);
|
||||
if(map.size() > 0)
|
||||
static_cast<CefRequestImpl*>(req.get())->SetHeaderMap(map);
|
||||
|
||||
|
@ -173,37 +210,41 @@ WindowOpenDisposition BrowserWebViewDelegate::DispositionForNavigationAction(
|
|||
browser_->GetCefFrame(frame), req, (CefHandler::NavType)type,
|
||||
is_redirect);
|
||||
if(rv == RV_HANDLED)
|
||||
return IGNORE_ACTION;
|
||||
}
|
||||
|
||||
WindowOpenDisposition result;
|
||||
return WebKit::WebNavigationPolicyIgnore;
|
||||
}
|
||||
|
||||
WebNavigationPolicy result;
|
||||
if (policy_delegate_enabled_) {
|
||||
std::wstring frame_name = frame->GetName();
|
||||
std::string url_description;
|
||||
if (request->GetURL().SchemeIs("file")) {
|
||||
url_description = request->GetURL().ExtractFileName();
|
||||
GURL request_url = request.url();
|
||||
if (request_url.SchemeIs("file")) {
|
||||
url_description = request_url.ExtractFileName();
|
||||
} else {
|
||||
url_description = request->GetURL().spec();
|
||||
url_description = request_url.spec();
|
||||
}
|
||||
if (policy_delegate_is_permissive_) {
|
||||
result = WebKit::WebNavigationPolicyCurrentTab;
|
||||
} else {
|
||||
result = WebKit::WebNavigationPolicyIgnore;
|
||||
}
|
||||
result = policy_delegate_is_permissive_ ? CURRENT_TAB : IGNORE_ACTION;
|
||||
} else {
|
||||
result = WebViewDelegate::DispositionForNavigationAction(
|
||||
webview, frame, request, type, disposition, is_redirect);
|
||||
result = default_policy;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::AssignIdentifierToRequest(WebView* webview,
|
||||
uint32 identifier,
|
||||
const WebRequest& request) {
|
||||
uint32 identifier,
|
||||
const WebURLRequest& request) {
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::WillSendRequest(WebView* webview,
|
||||
uint32 identifier,
|
||||
WebRequest* request) {
|
||||
uint32 identifier,
|
||||
WebURLRequest* request) {
|
||||
// The requestor ID is used by the resource loader bridge to locate the
|
||||
// browser that originated the request.
|
||||
request->SetRequestorID(browser_->UIT_GetUniqueID());
|
||||
request->setRequestorID(browser_->UIT_GetUniqueID());
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidFinishLoading(WebView* webview,
|
||||
|
@ -213,13 +254,13 @@ void BrowserWebViewDelegate::DidFinishLoading(WebView* webview,
|
|||
|
||||
void BrowserWebViewDelegate::DidFailLoadingWithError(WebView* webview,
|
||||
uint32 identifier,
|
||||
const WebError& error) {
|
||||
const WebURLError& error) {
|
||||
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidCreateDataSource(WebFrame* frame,
|
||||
WebDataSource* ds) {
|
||||
ds->SetExtraData(pending_extra_data_.release());
|
||||
ds->setExtraData(pending_extra_data_.release());
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidStartProvisionalLoadForFrame(
|
||||
|
@ -240,7 +281,7 @@ void BrowserWebViewDelegate::DidReceiveServerRedirectForProvisionalLoadForFrame(
|
|||
|
||||
void BrowserWebViewDelegate::DidFailProvisionalLoadWithError(
|
||||
WebView* webview,
|
||||
const WebError& error,
|
||||
const WebURLError& error,
|
||||
WebFrame* frame) {
|
||||
LocationChangeDone(frame);
|
||||
|
||||
|
@ -248,17 +289,14 @@ void BrowserWebViewDelegate::DidFailProvisionalLoadWithError(
|
|||
|
||||
// Don't display an error page if this is simply a cancelled load. Aside
|
||||
// from being dumb, WebCore doesn't expect it and it will cause a crash.
|
||||
if (error.GetErrorCode() == net::ERR_ABORTED)
|
||||
if (error.reason == net::ERR_ABORTED)
|
||||
return;
|
||||
|
||||
const WebDataSource* failed_ds = frame->GetProvisionalDataSource();
|
||||
BrowserExtraData* extra_data =
|
||||
static_cast<BrowserExtraData*>(failed_ds->GetExtraData());
|
||||
static_cast<BrowserExtraData*>(failed_ds->extraData());
|
||||
bool replace = extra_data && extra_data->pending_page_id != -1;
|
||||
|
||||
scoped_ptr<WebRequest> request(failed_ds->GetRequest().Clone());
|
||||
request->SetURL(GURL("cef-error:"));
|
||||
|
||||
std::string error_text;
|
||||
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
|
@ -267,16 +305,20 @@ void BrowserWebViewDelegate::DidFailProvisionalLoadWithError(
|
|||
std::wstring error_str;
|
||||
CefHandler::RetVal rv = handler->HandleLoadError(browser_,
|
||||
browser_->GetCefFrame(frame),
|
||||
static_cast<CefHandler::ErrorCode>(error.GetErrorCode()),
|
||||
UTF8ToWide(error.GetFailedURL().spec()), error_str);
|
||||
static_cast<CefHandler::ErrorCode>(error.reason),
|
||||
UTF8ToWide(failed_ds->request().url().spec().data()), error_str);
|
||||
if(rv == RV_HANDLED && !error_str.empty())
|
||||
error_text = WideToUTF8(error_str);
|
||||
} else {
|
||||
error_text = StringPrintf("Error loading url: %d", error.GetErrorCode());
|
||||
error_text = StringPrintf("Error %d when loading url %s", error.reason,
|
||||
failed_ds->request().url().spec().data());
|
||||
}
|
||||
|
||||
frame->LoadAlternateHTMLString(request.get(), error_text,
|
||||
error.GetFailedURL(), replace);
|
||||
// Make sure we never show errors in view source mode.
|
||||
frame->SetInViewSourceMode(false);
|
||||
|
||||
frame->LoadHTMLString(
|
||||
error_text, GURL("testshell-error:"), error.unreachableURL, replace);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidCommitLoadForFrame(WebView* webview,
|
||||
|
@ -313,8 +355,8 @@ void BrowserWebViewDelegate::DidFinishLoadForFrame(WebView* webview,
|
|||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidFailLoadWithError(WebView* webview,
|
||||
const WebError& error,
|
||||
WebFrame* frame) {
|
||||
const WebURLError& error,
|
||||
WebFrame* frame) {
|
||||
LocationChangeDone(frame);
|
||||
}
|
||||
|
||||
|
@ -330,7 +372,7 @@ void BrowserWebViewDelegate::DidHandleOnloadEventsForFrame(WebView* webview,
|
|||
|
||||
void BrowserWebViewDelegate::DidChangeLocationWithinPageForFrame(
|
||||
WebView* webview, WebFrame* frame, bool is_new_navigation) {
|
||||
frame->GetDataSource()->SetExtraData(pending_extra_data_.release());
|
||||
frame->GetDataSource()->setExtraData(pending_extra_data_.release());
|
||||
UpdateForCommittedLoad(frame, is_new_navigation);
|
||||
}
|
||||
|
||||
|
@ -513,6 +555,14 @@ int BrowserWebViewDelegate::GetHistoryForwardListCount() {
|
|||
- current_index - 1;
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::TakeFocus(WebView* webview, bool reverse) {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler that it should take a focus
|
||||
handler->HandleTakeFocus(browser_, reverse);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::SetUserStyleSheetEnabled(bool is_enabled) {
|
||||
WebPreferences* prefs = _Context->GetWebPreferences();
|
||||
prefs->user_style_sheet_enabled = is_enabled;
|
||||
|
@ -526,51 +576,6 @@ void BrowserWebViewDelegate::SetUserStyleSheetLocation(const GURL& location) {
|
|||
browser_->GetWebView()->SetPreferences(*prefs);
|
||||
}
|
||||
|
||||
// WebWidgetDelegate ---------------------------------------------------------
|
||||
|
||||
gfx::NativeViewId BrowserWebViewDelegate::GetContainingView(WebWidget* webwidget) {
|
||||
if (WebWidgetHost* host = GetHostForWidget(webwidget))
|
||||
return gfx::IdFromNativeView(host->window_handle());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidInvalidateRect(WebWidget* webwidget,
|
||||
const WebRect& rect) {
|
||||
if (WebWidgetHost* host = GetHostForWidget(webwidget))
|
||||
host->DidInvalidateRect(rect);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidScrollRect(WebWidget* webwidget, int dx, int dy,
|
||||
const WebRect& clip_rect) {
|
||||
if (WebWidgetHost* host = GetHostForWidget(webwidget))
|
||||
host->DidScrollRect(dx, dy, clip_rect);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::Focus(WebWidget* webwidget) {
|
||||
if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if (handler.get() && handler->HandleSetFocus(browser_, true) == RV_CONTINUE)
|
||||
browser_->UIT_SetFocus(host, true);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::Blur(WebWidget* webwidget) {
|
||||
if (WebWidgetHost* host = GetHostForWidget(webwidget))
|
||||
browser_->UIT_SetFocus(host, false);
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -604,6 +609,39 @@ void BrowserWebViewDelegate::WaitForPolicyDelegate() {
|
|||
policy_delegate_enabled_ = true;
|
||||
}
|
||||
|
||||
// WebWidgetClient ---------------------------------------------------------
|
||||
|
||||
void BrowserWebViewDelegate::didInvalidateRect(const WebRect& rect) {
|
||||
if (WebWidgetHost* host = GetWidgetHost())
|
||||
host->DidInvalidateRect(rect);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didScrollRect(int dx, int dy,
|
||||
const WebRect& clip_rect) {
|
||||
if (WebWidgetHost* host = GetWidgetHost())
|
||||
host->DidScrollRect(dx, dy, clip_rect);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didFocus() {
|
||||
if (WebWidgetHost* host = GetWidgetHost()) {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if (handler.get() && handler->HandleSetFocus(browser_, true) == RV_CONTINUE)
|
||||
browser_->UIT_SetFocus(host, true);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didBlur() {
|
||||
if (WebWidgetHost* host = GetWidgetHost())
|
||||
browser_->UIT_SetFocus(host, false);
|
||||
}
|
||||
|
||||
WebScreenInfo BrowserWebViewDelegate::screenInfo() {
|
||||
if (WebWidgetHost* host = GetWidgetHost())
|
||||
return host->GetScreenInfo();
|
||||
|
||||
return WebScreenInfo();
|
||||
}
|
||||
|
||||
// Private methods -----------------------------------------------------------
|
||||
|
||||
void BrowserWebViewDelegate::UpdateAddressBar(WebView* webView) {
|
||||
|
@ -615,7 +653,7 @@ void BrowserWebViewDelegate::UpdateAddressBar(WebView* webView) {
|
|||
if (!dataSource)
|
||||
return;
|
||||
|
||||
GURL gUrl = dataSource->GetRequest().GetFirstPartyForCookies();
|
||||
GURL gUrl = dataSource->request().firstPartyForCookies();
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -624,10 +662,10 @@ void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
|
|||
top_loading_frame_ = NULL;
|
||||
}
|
||||
|
||||
WebWidgetHost* BrowserWebViewDelegate::GetHostForWidget(WebWidget* webwidget) {
|
||||
if (webwidget == browser_->GetWebView())
|
||||
WebWidgetHost* BrowserWebViewDelegate::GetWidgetHost() {
|
||||
if (this == browser_->GetWebViewDelegate())
|
||||
return browser_->GetWebViewHost();
|
||||
if (webwidget == browser_->GetPopup())
|
||||
if (this == browser_->GetPopupDelegate())
|
||||
return browser_->GetPopupHost();
|
||||
return NULL;
|
||||
}
|
||||
|
@ -638,7 +676,7 @@ void BrowserWebViewDelegate::UpdateForCommittedLoad(WebFrame* frame,
|
|||
|
||||
// Code duplicated from RenderView::DidCommitLoadForFrame.
|
||||
BrowserExtraData* extra_data = static_cast<BrowserExtraData*>(
|
||||
frame->GetDataSource()->GetExtraData());
|
||||
frame->GetDataSource()->extraData());
|
||||
|
||||
if (is_new_navigation) {
|
||||
// New navigation.
|
||||
|
@ -662,7 +700,7 @@ void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
|||
WebDataSource* ds = frame->GetDataSource();
|
||||
DCHECK(ds);
|
||||
|
||||
const WebRequest& request = ds->GetRequest();
|
||||
const WebURLRequest& request = ds->request();
|
||||
|
||||
// Type is unused.
|
||||
scoped_ptr<BrowserNavigationEntry> entry(new BrowserNavigationEntry);
|
||||
|
@ -670,10 +708,10 @@ void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
|||
// Bug 654101: the referrer will be empty on https->http transitions. It
|
||||
// would be nice if we could get the real referrer from somewhere.
|
||||
entry->SetPageID(page_id_);
|
||||
if (ds->HasUnreachableURL()) {
|
||||
entry->SetURL(GURL(ds->GetUnreachableURL()));
|
||||
if (ds->hasUnreachableURL()) {
|
||||
entry->SetURL(ds->unreachableURL());
|
||||
} else {
|
||||
entry->SetURL(GURL(request.GetURL()));
|
||||
entry->SetURL(request.url());
|
||||
}
|
||||
|
||||
std::wstring url = UTF8ToWide(entry->GetURL().spec().c_str());
|
||||
|
@ -684,9 +722,9 @@ void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
|||
handler->HandleAddressChange(browser_, browser_->GetCefFrame(frame), url);
|
||||
}
|
||||
|
||||
std::string state;
|
||||
if (frame->GetCurrentHistoryState(&state))
|
||||
entry->SetContentState(state);
|
||||
const WebHistoryItem& history_item = frame->GetCurrentHistoryItem();
|
||||
if (!history_item.isNull())
|
||||
entry->SetContentState(webkit_glue::HistoryItemToString(history_item));
|
||||
|
||||
browser_->UIT_GetNavigationController()->DidNavigateToEntry(entry.release());
|
||||
|
||||
|
@ -705,12 +743,12 @@ void BrowserWebViewDelegate::UpdateSessionHistory(WebFrame* frame) {
|
|||
if (!entry)
|
||||
return;
|
||||
|
||||
std::string state;
|
||||
if (!browser_->GetWebView()->GetMainFrame()->
|
||||
GetPreviousHistoryState(&state))
|
||||
const WebHistoryItem& history_item =
|
||||
browser_->GetWebView()->GetMainFrame()->GetPreviousHistoryItem();
|
||||
if (history_item.isNull())
|
||||
return;
|
||||
|
||||
entry->SetContentState(state);
|
||||
entry->SetContentState(webkit_glue::HistoryItemToString(history_item));
|
||||
}
|
||||
|
||||
std::wstring BrowserWebViewDelegate::GetFrameDescription(WebFrame* webframe) {
|
||||
|
@ -728,11 +766,3 @@ std::wstring BrowserWebViewDelegate::GetFrameDescription(WebFrame* webframe) {
|
|||
return L"frame (anonymous)";
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::TakeFocus(WebView* webview, bool reverse) {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler that it should take a focus
|
||||
handler->HandleTakeFocus(browser_, reverse);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "base/scoped_ptr.h"
|
||||
#include "webkit/glue/webcursor.h"
|
||||
#include "webkit/glue/webview_delegate.h"
|
||||
#include "webkit/glue/webwidget_delegate.h"
|
||||
#if defined(OS_WIN)
|
||||
#include "browser_drag_delegate.h"
|
||||
#include "browser_drop_delegate.h"
|
||||
|
@ -31,9 +30,9 @@
|
|||
#include "browser_navigation_controller.h"
|
||||
|
||||
class CefBrowserImpl;
|
||||
struct ContextMenuMediaParams;
|
||||
struct WebPreferences;
|
||||
class GURL;
|
||||
class WebDataSource;
|
||||
class WebWidgetHost;
|
||||
|
||||
class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
||||
|
@ -63,18 +62,23 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
|||
virtual WebView* CreateWebView(WebView* webview,
|
||||
bool user_gesture,
|
||||
const GURL& creator_url);
|
||||
virtual WebWidget* CreatePopupWidget(WebView* webview, bool activatable);
|
||||
virtual WebKit::WebWidget* CreatePopupWidget(
|
||||
WebView* webview,
|
||||
bool activatable);
|
||||
virtual WebPluginDelegate* CreatePluginDelegate(
|
||||
WebView* webview,
|
||||
const GURL& url,
|
||||
const std::string& mime_type,
|
||||
const std::string& clsid,
|
||||
std::string* actual_mime_type);
|
||||
virtual WebKit::WebMediaPlayer* CreateWebMediaPlayer(
|
||||
WebKit::WebMediaPlayerClient* client);
|
||||
virtual WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client);
|
||||
virtual void OpenURL(WebView* webview,
|
||||
const GURL& url,
|
||||
const GURL& referrer,
|
||||
WindowOpenDisposition disposition);
|
||||
WebKit::WebNavigationPolicy policy);
|
||||
virtual void DidMovePlugin(const WebPluginGeometry& move);
|
||||
virtual void RunJavaScriptAlert(WebFrame* webframe,
|
||||
const std::wstring& message);
|
||||
virtual bool RunJavaScriptConfirm(WebFrame* webframe,
|
||||
|
@ -92,29 +96,31 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
|||
virtual void StartDragging(WebView* webview,
|
||||
const WebKit::WebDragData& drop_data);
|
||||
virtual void ShowContextMenu(WebView* webview,
|
||||
ContextNode in_node,
|
||||
ContextNodeType node_type,
|
||||
int x,
|
||||
int y,
|
||||
const GURL& link_url,
|
||||
const GURL& image_url,
|
||||
const GURL& page_url,
|
||||
const GURL& frame_url,
|
||||
const ContextMenuMediaParams& media_params,
|
||||
const std::wstring& selection_text,
|
||||
const std::wstring& misspelled_word,
|
||||
int edit_flags,
|
||||
const std::string& security_info,
|
||||
const std::string& frame_charset);
|
||||
virtual void DidCreateDataSource(WebFrame* frame,
|
||||
WebDataSource* ds);
|
||||
WebKit::WebDataSource* ds);
|
||||
virtual void DidStartProvisionalLoadForFrame(
|
||||
WebView* webview,
|
||||
WebFrame* frame,
|
||||
NavigationGesture gesture);
|
||||
virtual void DidReceiveServerRedirectForProvisionalLoadForFrame(
|
||||
WebView* webview, WebFrame* frame);
|
||||
virtual void DidFailProvisionalLoadWithError(WebView* webview,
|
||||
const WebError& error,
|
||||
WebFrame* frame);
|
||||
virtual void DidFailProvisionalLoadWithError(
|
||||
WebView* webview,
|
||||
const WebKit::WebURLError& error,
|
||||
WebFrame* frame);
|
||||
virtual void DidCommitLoadForFrame(WebView* webview, WebFrame* frame,
|
||||
bool is_new_navigation);
|
||||
virtual void DidReceiveTitle(WebView* webview,
|
||||
|
@ -139,19 +145,19 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
|||
|
||||
virtual void DidFinishLoadForFrame(WebView* webview, WebFrame* frame);
|
||||
virtual void DidFailLoadWithError(WebView* webview,
|
||||
const WebError& error,
|
||||
WebFrame* forFrame);
|
||||
const WebKit::WebURLError& error,
|
||||
WebFrame* for_frame);
|
||||
|
||||
virtual void AssignIdentifierToRequest(WebView* webview,
|
||||
uint32 identifier,
|
||||
const WebRequest& request);
|
||||
const WebKit::WebURLRequest& request);
|
||||
virtual void WillSendRequest(WebView* webview,
|
||||
uint32 identifier,
|
||||
WebRequest* request);
|
||||
WebKit::WebURLRequest* request);
|
||||
virtual void DidFinishLoading(WebView* webview, uint32 identifier);
|
||||
virtual void DidFailLoadingWithError(WebView* webview,
|
||||
uint32 identifier,
|
||||
const WebError& error);
|
||||
const WebKit::WebURLError& error);
|
||||
|
||||
virtual bool ShouldBeginEditing(WebView* webview, std::wstring range);
|
||||
virtual bool ShouldEndEditing(WebView* webview, std::wstring range);
|
||||
|
@ -182,51 +188,34 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
|||
virtual void DidStopLoading(WebView* webview);
|
||||
|
||||
virtual void WindowObjectCleared(WebFrame* webframe);
|
||||
virtual WindowOpenDisposition DispositionForNavigationAction(
|
||||
virtual WebKit::WebNavigationPolicy PolicyForNavigationAction(
|
||||
WebView* webview,
|
||||
WebFrame* frame,
|
||||
const WebRequest* request,
|
||||
WebNavigationType type,
|
||||
WindowOpenDisposition disposition,
|
||||
const WebKit::WebURLRequest& request,
|
||||
WebKit::WebNavigationType type,
|
||||
WebKit::WebNavigationPolicy default_policy,
|
||||
bool is_redirect);
|
||||
virtual void NavigateBackForwardSoon(int offset);
|
||||
virtual int GetHistoryBackListCount();
|
||||
virtual int GetHistoryForwardListCount();
|
||||
|
||||
// WebWidgetDelegate
|
||||
virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget);
|
||||
virtual void DidInvalidateRect(WebWidget* webwidget,
|
||||
const WebKit::WebRect& rect);
|
||||
virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy,
|
||||
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, 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(WebWidget* webwidget);
|
||||
virtual WebKit::WebScreenInfo GetScreenInfo(WebWidget* webwidget);
|
||||
virtual void AddRef() {
|
||||
base::RefCounted<BrowserWebViewDelegate>::AddRef();
|
||||
}
|
||||
virtual void Release() {
|
||||
base::RefCounted<BrowserWebViewDelegate>::Release();
|
||||
}
|
||||
virtual void TakeFocus(WebView* webview, bool reverse);
|
||||
|
||||
// WebWidgetClient
|
||||
virtual void didInvalidateRect(const WebKit::WebRect& rect);
|
||||
virtual void didScrollRect(int dx, int dy,
|
||||
const WebKit::WebRect& clip_rect);
|
||||
virtual void didFocus();
|
||||
virtual void didBlur();
|
||||
virtual void didChangeCursor(const WebKit::WebCursorInfo& cursor);
|
||||
virtual void closeWidgetSoon();
|
||||
virtual void show(WebKit::WebNavigationPolicy policy);
|
||||
virtual void runModal();
|
||||
virtual WebKit::WebRect windowRect();
|
||||
virtual void setWindowRect(const WebKit::WebRect& rect);
|
||||
virtual WebKit::WebRect rootWindowRect();
|
||||
virtual WebKit::WebRect windowResizerRect();
|
||||
virtual WebKit::WebScreenInfo screenInfo();
|
||||
|
||||
void SetSmartInsertDeleteEnabled(bool enabled);
|
||||
void SetSelectTrailingWhitespaceEnabled(bool enabled);
|
||||
|
||||
|
@ -268,7 +257,7 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
|||
// test.
|
||||
void LocationChangeDone(WebFrame*);
|
||||
|
||||
WebWidgetHost* GetHostForWidget(WebWidget* webwidget);
|
||||
WebWidgetHost* GetWidgetHost();
|
||||
|
||||
void UpdateForCommittedLoad(WebFrame* webframe, bool is_new_navigation);
|
||||
void UpdateURL(WebFrame* frame);
|
||||
|
|
|
@ -26,20 +26,20 @@
|
|||
#include "base/string_util.h"
|
||||
#include "base/trace_event.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "webkit/api/public/WebCursorInfo.h"
|
||||
#include "webkit/api/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"
|
||||
#include "webkit/glue/plugins/plugin_list.h"
|
||||
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
|
||||
#include "webkit/glue/window_open_disposition.h"
|
||||
|
||||
using WebKit::WebCursorInfo;
|
||||
using WebKit::WebNavigationPolicy;
|
||||
using WebKit::WebRect;
|
||||
|
||||
// WebViewDelegate -----------------------------------------------------------
|
||||
|
@ -50,7 +50,7 @@ WebPluginDelegate* BrowserWebViewDelegate::CreatePluginDelegate(
|
|||
const std::string& mime_type,
|
||||
const std::string& clsid,
|
||||
std::string* actual_mime_type) {
|
||||
HWND hwnd = gfx::NativeViewFromId(GetContainingView(webview));
|
||||
HWND hwnd = browser_->GetWebViewHost()->view_handle();
|
||||
if (!hwnd)
|
||||
return NULL;
|
||||
|
||||
|
@ -70,79 +70,7 @@ WebPluginDelegate* BrowserWebViewDelegate::CreatePluginDelegate(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::Show(WebWidget* webwidget, WindowOpenDisposition) {
|
||||
if (webwidget == browser_->GetWebView()) {
|
||||
ShowWindow(browser_->GetMainWndHandle(), SW_SHOW);
|
||||
UpdateWindow(browser_->GetMainWndHandle());
|
||||
} else if (webwidget == browser_->GetPopup()) {
|
||||
ShowWindow(browser_->GetPopupWndHandle(), SW_SHOW);
|
||||
UpdateWindow(browser_->GetPopupWndHandle());
|
||||
}
|
||||
}
|
||||
|
||||
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_->GetWebView()) {
|
||||
PostMessage(browser_->GetMainWndHandle(), WM_CLOSE, 0, 0);
|
||||
} else if (webwidget == browser_->GetPopup()) {
|
||||
browser_->UIT_ClosePopupWidget();
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::SetCursor(WebWidget* webwidget,
|
||||
const WebCursor& cursor) {
|
||||
if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
|
||||
current_cursor_ = cursor;
|
||||
HINSTANCE mod_handle = GetModuleHandle(NULL);
|
||||
host->SetCursor(current_cursor_.GetCursor(mod_handle));
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::GetWindowRect(WebWidget* webwidget,
|
||||
WebRect* out_rect) {
|
||||
if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
|
||||
RECT rect;
|
||||
::GetWindowRect(host->window_handle(), &rect);
|
||||
*out_rect = gfx::Rect(rect);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::SetWindowRect(WebWidget* webwidget,
|
||||
const WebRect& rect) {
|
||||
if (webwidget == browser_->GetWebView()) {
|
||||
// ignored
|
||||
} else if (webwidget == browser_->GetPopup()) {
|
||||
MoveWindow(browser_->GetPopupWndHandle(),
|
||||
rect.x, rect.y, rect.width, rect.height, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::GetRootWindowRect(WebWidget* webwidget,
|
||||
WebRect* out_rect) {
|
||||
if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
|
||||
RECT rect;
|
||||
HWND root_window = ::GetAncestor(host->window_handle(), GA_ROOT);
|
||||
::GetWindowRect(root_window, &rect);
|
||||
*out_rect = gfx::Rect(rect);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
|
||||
WebRect* out_rect) {
|
||||
// Not necessary on Windows.
|
||||
*out_rect = gfx::Rect();
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidMove(WebWidget* webwidget,
|
||||
const WebPluginGeometry& move) {
|
||||
void BrowserWebViewDelegate::DidMovePlugin(const WebPluginGeometry& move) {
|
||||
HRGN hrgn = ::CreateRectRgn(move.clip_rect.x(),
|
||||
move.clip_rect.y(),
|
||||
move.clip_rect.right(),
|
||||
|
@ -152,7 +80,6 @@ void BrowserWebViewDelegate::DidMove(WebWidget* webwidget,
|
|||
// Note: System will own the hrgn after we call SetWindowRgn,
|
||||
// so we don't need to call DeleteObject(hrgn)
|
||||
::SetWindowRgn(move.window, hrgn, FALSE);
|
||||
|
||||
unsigned long flags = 0;
|
||||
if (move.visible)
|
||||
flags |= SWP_SHOWWINDOW;
|
||||
|
@ -166,33 +93,6 @@ void BrowserWebViewDelegate::DidMove(WebWidget* webwidget,
|
|||
move.window_rect.width(),
|
||||
move.window_rect.height(),
|
||||
flags);
|
||||
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::RunModal(WebWidget* webwidget) {
|
||||
Show(webwidget, NEW_WINDOW);
|
||||
|
||||
CefContext::BrowserList *list;
|
||||
CefContext::BrowserList::const_iterator i;
|
||||
|
||||
_Context->Lock();
|
||||
list = _Context->GetBrowserList();
|
||||
i = list->begin();
|
||||
for (; i != list->end(); ++i) {
|
||||
if (i->get()->IsPopup())
|
||||
EnableWindow(i->get()->GetMainWndHandle(), FALSE);
|
||||
}
|
||||
_Context->Unlock();
|
||||
|
||||
browser_->UIT_SetIsModal(true);
|
||||
MessageLoop::current()->Run();
|
||||
|
||||
_Context->Lock();
|
||||
list = _Context->GetBrowserList();
|
||||
i = list->begin();
|
||||
for (; i != list->end(); ++i)
|
||||
EnableWindow(i->get()->GetMainWndHandle(), TRUE);
|
||||
_Context->Unlock();
|
||||
}
|
||||
|
||||
static void AddMenuItem(CefRefPtr<CefBrowser> browser, HMENU menu, int index,
|
||||
|
@ -233,19 +133,21 @@ static void AddMenuSeparator(HMENU menu, int index)
|
|||
InsertMenuItem(menu, index, TRUE, &mii);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::ShowContextMenu(WebView* webview,
|
||||
ContextNode in_node,
|
||||
int x,
|
||||
int y,
|
||||
const GURL& link_url,
|
||||
const GURL& image_url,
|
||||
const GURL& page_url,
|
||||
const GURL& frame_url,
|
||||
const std::wstring& selection_text,
|
||||
const std::wstring& misspelled_word,
|
||||
int edit_flags,
|
||||
const std::string& security_info,
|
||||
const std::string& frame_charset) {
|
||||
void BrowserWebViewDelegate::ShowContextMenu(
|
||||
WebView* webview,
|
||||
ContextNodeType node_type,
|
||||
int x,
|
||||
int y,
|
||||
const GURL& link_url,
|
||||
const GURL& image_url,
|
||||
const GURL& page_url,
|
||||
const GURL& frame_url,
|
||||
const ContextMenuMediaParams& media_params,
|
||||
const std::wstring& selection_text,
|
||||
const std::wstring& misspelled_word,
|
||||
int edit_flags,
|
||||
const std::string& security_info,
|
||||
const std::string& frame_charset) {
|
||||
|
||||
POINT screen_pt = { x, y };
|
||||
MapWindowPoints(browser_->GetMainWndHandle(), HWND_DESKTOP,
|
||||
|
@ -276,7 +178,7 @@ void BrowserWebViewDelegate::ShowContextMenu(WebView* webview,
|
|||
framestr = UTF8ToWide(frame_url.spec().c_str());
|
||||
securitystr = UTF8ToWide(security_info);
|
||||
|
||||
menuInfo.typeFlags = in_node.type;
|
||||
menuInfo.typeFlags = node_type.type;
|
||||
menuInfo.x = screen_pt.x;
|
||||
menuInfo.y = screen_pt.y;
|
||||
menuInfo.linkUrl = linkstr.c_str();
|
||||
|
@ -295,29 +197,30 @@ void BrowserWebViewDelegate::ShowContextMenu(WebView* webview,
|
|||
}
|
||||
|
||||
// Build the correct default context menu
|
||||
if (in_node.type & ContextNode::EDITABLE) {
|
||||
if (node_type.type & ContextNodeType::EDITABLE) {
|
||||
menu = CreatePopupMenu();
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_UNDO, L"Undo",
|
||||
!!(edit_flags & ContextNode::CAN_UNDO), label_list);
|
||||
!!(edit_flags & ContextNodeType::CAN_UNDO), label_list);
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_REDO, L"Redo",
|
||||
!!(edit_flags & ContextNode::CAN_REDO), label_list);
|
||||
!!(edit_flags & ContextNodeType::CAN_REDO), label_list);
|
||||
AddMenuSeparator(menu, -1);
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_CUT, L"Cut",
|
||||
!!(edit_flags & ContextNode::CAN_CUT), label_list);
|
||||
!!(edit_flags & ContextNodeType::CAN_CUT), label_list);
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_COPY, L"Copy",
|
||||
!!(edit_flags & ContextNode::CAN_COPY), label_list);
|
||||
!!(edit_flags & ContextNodeType::CAN_COPY), label_list);
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_PASTE, L"Paste",
|
||||
!!(edit_flags & ContextNode::CAN_PASTE), label_list);
|
||||
!!(edit_flags & ContextNodeType::CAN_PASTE), label_list);
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_DELETE, L"Delete",
|
||||
!!(edit_flags & ContextNode::CAN_DELETE), label_list);
|
||||
!!(edit_flags & ContextNodeType::CAN_DELETE), label_list);
|
||||
AddMenuSeparator(menu, -1);
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_SELECTALL, L"Select All",
|
||||
!!(edit_flags & MENU_CAN_SELECT_ALL), label_list);
|
||||
} else if(in_node.type & ContextNode::SELECTION) {
|
||||
} else if(node_type.type & ContextNodeType::SELECTION) {
|
||||
menu = CreatePopupMenu();
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_COPY, L"Copy",
|
||||
!!(edit_flags & ContextNode::CAN_COPY), label_list);
|
||||
} else if(in_node.type & (ContextNode::PAGE | ContextNode::FRAME)) {
|
||||
!!(edit_flags & ContextNodeType::CAN_COPY), label_list);
|
||||
} else if(node_type.type &
|
||||
(ContextNodeType::PAGE | ContextNodeType::FRAME)) {
|
||||
menu = CreatePopupMenu();
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_NAV_BACK, L"Back",
|
||||
browser_->UIT_CanGoBack(), label_list);
|
||||
|
@ -361,6 +264,95 @@ end:
|
|||
MessageLoop::current()->SetNestableTasksAllowed(old_state);
|
||||
}
|
||||
|
||||
// WebWidgetClient ---------------------------------------------------------
|
||||
|
||||
void BrowserWebViewDelegate::show(WebNavigationPolicy) {
|
||||
if (WebWidgetHost* host = GetWidgetHost()) {
|
||||
HWND root = GetAncestor(host->view_handle(), GA_ROOT);
|
||||
ShowWindow(root, SW_SHOW);
|
||||
UpdateWindow(root);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::closeWidgetSoon() {
|
||||
if (this == browser_->GetWebViewDelegate()) {
|
||||
PostMessage(browser_->GetMainWndHandle(), WM_CLOSE, 0, 0);
|
||||
} else if (this == browser_->GetPopupDelegate()) {
|
||||
browser_->UIT_ClosePopupWidget();
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didChangeCursor(
|
||||
const WebCursorInfo& cursor_info) {
|
||||
if (WebWidgetHost* host = GetWidgetHost()) {
|
||||
current_cursor_.InitFromCursorInfo(cursor_info);
|
||||
HINSTANCE mod_handle = GetModuleHandle(NULL);
|
||||
host->SetCursor(current_cursor_.GetCursor(mod_handle));
|
||||
}
|
||||
}
|
||||
|
||||
WebRect BrowserWebViewDelegate::windowRect() {
|
||||
if (WebWidgetHost* host = GetWidgetHost()) {
|
||||
RECT rect;
|
||||
::GetWindowRect(host->view_handle(), &rect);
|
||||
return gfx::Rect(rect);
|
||||
}
|
||||
return WebRect();
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::setWindowRect(const WebRect& rect) {
|
||||
if (this == browser_->GetWebViewDelegate()) {
|
||||
// ignored
|
||||
} else if (this == browser_->GetPopupDelegate()) {
|
||||
MoveWindow(browser_->GetPopupWndHandle(),
|
||||
rect.x, rect.y, rect.width, rect.height, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
WebRect BrowserWebViewDelegate::rootWindowRect() {
|
||||
if (WebWidgetHost* host = GetWidgetHost()) {
|
||||
RECT rect;
|
||||
HWND root_window = ::GetAncestor(host->view_handle(), GA_ROOT);
|
||||
::GetWindowRect(root_window, &rect);
|
||||
return gfx::Rect(rect);
|
||||
}
|
||||
return WebRect();
|
||||
}
|
||||
|
||||
WebRect BrowserWebViewDelegate::windowResizerRect() {
|
||||
// Not necessary on Windows.
|
||||
return WebRect();
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::runModal() {
|
||||
WebWidgetHost* host = GetWidgetHost();
|
||||
if (!host)
|
||||
return;
|
||||
|
||||
show(WebNavigationPolicy() /*XXX NEW_WINDOW*/);
|
||||
|
||||
CefContext::BrowserList *list;
|
||||
CefContext::BrowserList::const_iterator i;
|
||||
|
||||
_Context->Lock();
|
||||
list = _Context->GetBrowserList();
|
||||
i = list->begin();
|
||||
for (; i != list->end(); ++i) {
|
||||
if (i->get()->IsPopup())
|
||||
EnableWindow(i->get()->GetMainWndHandle(), FALSE);
|
||||
}
|
||||
_Context->Unlock();
|
||||
|
||||
browser_->UIT_SetIsModal(true);
|
||||
MessageLoop::current()->Run();
|
||||
|
||||
_Context->Lock();
|
||||
list = _Context->GetBrowserList();
|
||||
i = list->begin();
|
||||
for (; i != list->end(); ++i)
|
||||
EnableWindow(i->get()->GetMainWndHandle(), TRUE);
|
||||
_Context->Unlock();
|
||||
}
|
||||
|
||||
// Private methods -----------------------------------------------------------
|
||||
|
||||
|
|
|
@ -346,6 +346,7 @@ bool CefContext::Initialize(bool multi_threaded_message_loop,
|
|||
webprefs_->text_areas_are_resizable = true;
|
||||
webprefs_->java_enabled = true;
|
||||
webprefs_->allow_scripts_to_close_windows = false;
|
||||
webprefs_->xss_auditor_enabled = false;
|
||||
|
||||
if (multi_threaded_message_loop) {
|
||||
// Event that will be used to signal thread setup completion. Start
|
||||
|
|
|
@ -130,30 +130,6 @@
|
|||
<Filter
|
||||
Name="printing"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\printing\page_number.cc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\printing\page_number.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\printing\page_range.cc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\printing\page_range.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\printing\page_setup.cc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\printing\page_setup.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\printing\print_settings.cc"
|
||||
>
|
||||
|
@ -162,14 +138,6 @@
|
|||
RelativePath=".\printing\print_settings.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\printing\units.cc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\printing\units.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\printing\win_printing_context.cc"
|
||||
>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="libcef"
|
||||
InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\third_party\libpng\using_libpng.vsprops;$(SolutionDir)..\breakpad\using_breakpad.vsprops;$(SolutionDir)..\third_party\libxml\build\using_libxml.vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;.\libcef_webkit.vsprops"
|
||||
InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\third_party\libpng\using_libpng.vsprops;$(SolutionDir)..\breakpad\using_breakpad.vsprops;$(SolutionDir)..\third_party\libxml\build\using_libxml.vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;$(SolutionDir)..\third_party\ffmpeg\using_ffmpeg.vsprops;.\libcef_webkit.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
|
@ -12,7 +12,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib shlwapi.lib rpcrt4.lib winmm.lib"
|
||||
AdditionalDependencies="comctl32.lib shlwapi.lib rpcrt4.lib winmm.lib urlmon.lib"
|
||||
AdditionalLibraryDirectories=""$(OutDir)""
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(OutDir)\obj\WebCore";"$(OutDir)\obj\WebCore\JavaScriptHeaders";"$(OutDir)\obj\WebCore\JavaScriptHeaders\JavaScriptCore";"$(SolutionDir)..\webkit\pending\";"$(SolutionDir)..\webkit\port\platform";"$(SolutionDir)..\webkit\port\platform\image-decoders";"$(SolutionDir)..\webkit\port\platform\image-decoders\bmp";"$(SolutionDir)..\webkit\port\platform\image-decoders\gif";"$(SolutionDir)..\webkit\port\platform\image-decoders\ico";"$(SolutionDir)..\webkit\port\platform\image-decoders\jpeg";"$(SolutionDir)..\webkit\port\platform\image-decoders\png";"$(SolutionDir)..\webkit\port\platform\image-decoders\xbm";"$(SolutionDir)..\webkit";"$(SolutionDir)..\webkit\build";"$(ProjectDir)";"$(SolutionDir)..\third_party\WebKit\WebCore\";"$(SolutionDir)..\third_party\WebKit\WebCore\bindings\v8";"$(SolutionDir)..\third_party\WebKit\WebCore\bridge";"$(SolutionDir)..\third_party\WebKit\WebCore\bridge\c";"$(SolutionDir)..\third_party\WebKit\WebCore\css";"$(SolutionDir)..\third_party\WebKit\WebCore\dom";"$(SolutionDir)..\third_party\WebKit\WebCore\editing";"$(SolutionDir)..\third_party\WebKit\WebCore\history";"$(SolutionDir)..\third_party\WebKit\WebCore\html";"$(SolutionDir)..\third_party\WebKit\WebCore\loader";"$(SolutionDir)..\third_party\WebKit\WebCore\loader\appcache";"$(SolutionDir)..\third_party\WebKit\WebCore\loader\archive";"$(SolutionDir)..\third_party\WebKit\WebCore\loader\icon";"$(SolutionDir)..\third_party\WebKit\WebCore\page";"$(SolutionDir)..\third_party\WebKit\WebCore\platform";"$(SolutionDir)..\third_party\WebKit\WebCore\page\animation";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\text";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\chromium";"$(SolutionDir)..\third_party\WebKit\WebCore\svg\graphics";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\network";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\sql";"$(SolutionDir)..\third_party\WebKit\WebCore\rendering";"$(SolutionDir)..\third_party\WebKit\WebCore\rendering\style";"$(SolutionDir)..\third_party\WebKit\WebCore\storage";"$(SolutionDir)..\third_party\WebKit\WebCore\xml";"$(SolutionDir)..\third_party\WebKit\WebCore";"$(SolutionDir)..\third_party\WebKit\WebCore\os-win32";"$(SolutionDir)..\third_party\WebKit\WebCore\wtf";"$(SolutionDir)..\third_party\WebKit\JavaScriptCore";"$(SolutionDir)..\third_party\WebKit\JavaScriptCore\wtf";"$(SolutionDir)..\third_party\WebKit\JavaScriptCore\os-win32";"$(SolutionDir)..\third_party\WebKit\WebCore\svg";"$(SolutionDir)..\third_party\WebKit\WebCore\svg\animation";"$(SolutionDir)..\third_party\WebKit\WebCore\svg\graphics\filters";"$(SolutionDir)..\third_party\WebKit\WebCore\plugins";"$(SolutionDir)..\third_party\WebKit\WebCore\inspector";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\chromium";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\skia";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\network\chromium";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\animation";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\transforms";"$(SolutionDir)..\third_party\sqlite";"$(SDKIncludes)";"$(IntDir)\..\WebCore\DerivedSources";"
|
||||
AdditionalIncludeDirectories=""$(OutDir)\obj\WebCore";"$(OutDir)\obj\WebCore\JavaScriptHeaders";"$(OutDir)\obj\WebCore\JavaScriptHeaders\JavaScriptCore";"$(SolutionDir)..\webkit\pending\";"$(SolutionDir)..\webkit\port\platform";"$(SolutionDir)..\webkit\port\platform\image-decoders";"$(SolutionDir)..\webkit\port\platform\image-decoders\bmp";"$(SolutionDir)..\webkit\port\platform\image-decoders\gif";"$(SolutionDir)..\webkit\port\platform\image-decoders\ico";"$(SolutionDir)..\webkit\port\platform\image-decoders\jpeg";"$(SolutionDir)..\webkit\port\platform\image-decoders\png";"$(SolutionDir)..\webkit\port\platform\image-decoders\xbm";"$(SolutionDir)..\webkit";"$(SolutionDir)..\webkit\build";"$(ProjectDir)";"$(SolutionDir)..\third_party\WebKit\WebCore\";"$(SolutionDir)..\third_party\WebKit\WebCore\bindings\v8";"$(SolutionDir)..\third_party\WebKit\WebCore\bindings\v8\custom";"$(SolutionDir)..\third_party\WebKit\WebCore\bridge";"$(SolutionDir)..\third_party\WebKit\WebCore\bridge\c";"$(SolutionDir)..\third_party\WebKit\WebCore\css";"$(SolutionDir)..\third_party\WebKit\WebCore\dom";"$(SolutionDir)..\third_party\WebKit\WebCore\editing";"$(SolutionDir)..\third_party\WebKit\WebCore\history";"$(SolutionDir)..\third_party\WebKit\WebCore\html";"$(SolutionDir)..\third_party\WebKit\WebCore\loader";"$(SolutionDir)..\third_party\WebKit\WebCore\loader\appcache";"$(SolutionDir)..\third_party\WebKit\WebCore\loader\archive";"$(SolutionDir)..\third_party\WebKit\WebCore\loader\icon";"$(SolutionDir)..\third_party\WebKit\WebCore\page";"$(SolutionDir)..\third_party\WebKit\WebCore\platform";"$(SolutionDir)..\third_party\WebKit\WebCore\page\animation";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\text";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\chromium";"$(SolutionDir)..\third_party\WebKit\WebCore\svg\graphics";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\network";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\sql";"$(SolutionDir)..\third_party\WebKit\WebCore\rendering";"$(SolutionDir)..\third_party\WebKit\WebCore\rendering\style";"$(SolutionDir)..\third_party\WebKit\WebCore\storage";"$(SolutionDir)..\third_party\WebKit\WebCore\xml";"$(SolutionDir)..\third_party\WebKit\WebCore";"$(SolutionDir)..\third_party\WebKit\WebCore\os-win32";"$(SolutionDir)..\third_party\WebKit\WebCore\wtf";"$(SolutionDir)..\third_party\WebKit\JavaScriptCore";"$(SolutionDir)..\third_party\WebKit\JavaScriptCore\wtf";"$(SolutionDir)..\third_party\WebKit\JavaScriptCore\os-win32";"$(SolutionDir)..\third_party\WebKit\WebCore\svg";"$(SolutionDir)..\third_party\WebKit\WebCore\svg\animation";"$(SolutionDir)..\third_party\WebKit\WebCore\svg\graphics\filters";"$(SolutionDir)..\third_party\WebKit\WebCore\plugins";"$(SolutionDir)..\third_party\WebKit\WebCore\inspector";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\chromium";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\skia";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\network\chromium";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\animation";"$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\transforms";"$(SolutionDir)..\third_party\sqlite";"$(SDKIncludes)";"$(IntDir)\..\WebCore\DerivedSources";"
|
||||
/>
|
||||
</VisualStudioPropertySheet>
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
// 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 "precompiled_libcef.h"
|
||||
#include "page_number.h"
|
||||
#include "print_settings.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
namespace printing {
|
||||
|
||||
PageNumber::PageNumber(const PrintSettings& settings, int document_page_count) {
|
||||
Init(settings, document_page_count);
|
||||
}
|
||||
|
||||
PageNumber::PageNumber()
|
||||
: ranges_(NULL),
|
||||
page_number_(-1),
|
||||
page_range_index_(-1),
|
||||
document_page_count_(0) {
|
||||
}
|
||||
|
||||
void PageNumber::operator=(const PageNumber& other) {
|
||||
ranges_ = other.ranges_;
|
||||
page_number_ = other.page_number_;
|
||||
page_range_index_ = other.page_range_index_;
|
||||
document_page_count_ = other.document_page_count_;
|
||||
}
|
||||
|
||||
void PageNumber::Init(const PrintSettings& settings, int document_page_count) {
|
||||
DCHECK(document_page_count);
|
||||
ranges_ = settings.ranges.empty() ? NULL : &settings.ranges;
|
||||
document_page_count_ = document_page_count;
|
||||
if (ranges_) {
|
||||
page_range_index_ = 0;
|
||||
page_number_ = (*ranges_)[0].from;
|
||||
} else {
|
||||
if (document_page_count) {
|
||||
page_number_ = 0;
|
||||
} else {
|
||||
page_number_ = -1;
|
||||
}
|
||||
page_range_index_ = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int PageNumber::operator++() {
|
||||
if (!ranges_) {
|
||||
// Switch to next page.
|
||||
if (++page_number_ == document_page_count_) {
|
||||
// Finished.
|
||||
*this = npos();
|
||||
}
|
||||
} else {
|
||||
// Switch to next page.
|
||||
++page_number_;
|
||||
// Page ranges are inclusive.
|
||||
if (page_number_ > (*ranges_)[page_range_index_].to) {
|
||||
DCHECK(ranges_->size() <= static_cast<size_t>(
|
||||
std::numeric_limits<int>::max()));
|
||||
if (++page_range_index_ == static_cast<int>(ranges_->size())) {
|
||||
// Finished.
|
||||
*this = npos();
|
||||
} else {
|
||||
page_number_ = (*ranges_)[page_range_index_].from;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ToInt();
|
||||
}
|
||||
|
||||
bool PageNumber::operator==(const PageNumber& other) const {
|
||||
return page_number_ == other.page_number_ &&
|
||||
page_range_index_ == other.page_range_index_;
|
||||
}
|
||||
bool PageNumber::operator!=(const PageNumber& other) const {
|
||||
return page_number_ != other.page_number_ ||
|
||||
page_range_index_ != other.page_range_index_;
|
||||
}
|
||||
|
||||
} // namespace printing
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
// 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.
|
||||
|
||||
#ifndef _PRINTING_PAGE_NUMBER_H
|
||||
#define _PRINTING_PAGE_NUMBER_H
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include "page_range.h"
|
||||
|
||||
namespace printing {
|
||||
|
||||
class PrintSettings;
|
||||
|
||||
// Represents a page series following the array of page ranges defined in a
|
||||
// PrintSettings.
|
||||
class PageNumber {
|
||||
public:
|
||||
// Initializes the page to the first page in the settings's range or 0.
|
||||
PageNumber(const PrintSettings& settings, int document_page_count);
|
||||
|
||||
PageNumber();
|
||||
|
||||
void operator=(const PageNumber& other);
|
||||
|
||||
// Initializes the page to the first page in the setting's range or 0. It
|
||||
// initialize to npos if the range is empty and document_page_count is 0.
|
||||
void Init(const PrintSettings& settings, int document_page_count);
|
||||
|
||||
// Converts to a page numbers.
|
||||
int ToInt() const {
|
||||
return page_number_;
|
||||
}
|
||||
|
||||
// Calculates the next page in the serie.
|
||||
int operator++();
|
||||
|
||||
// Returns an instance that represents the end of a serie.
|
||||
static const PageNumber npos() {
|
||||
return PageNumber();
|
||||
}
|
||||
|
||||
// Equality operator. Only the current page number is verified so that
|
||||
// "page != PageNumber::npos()" works.
|
||||
bool operator==(const PageNumber& other) const;
|
||||
bool operator!=(const PageNumber& other) const;
|
||||
|
||||
private:
|
||||
// The page range to follow.
|
||||
const PageRanges* ranges_;
|
||||
|
||||
// The next page to be printed. -1 when not printing.
|
||||
int page_number_;
|
||||
|
||||
// The next page to be printed. -1 when not used. Valid only if
|
||||
// document()->settings().range.empty() is false.
|
||||
int page_range_index_;
|
||||
|
||||
// Number of expected pages in the document. Used when ranges_ is NULL.
|
||||
int document_page_count_;
|
||||
};
|
||||
|
||||
// Debug output support.
|
||||
template<class E, class T>
|
||||
inline typename std::basic_ostream<E,T>& operator<<(
|
||||
typename std::basic_ostream<E,T>& ss, const PageNumber& page) {
|
||||
return ss << page.ToInt();
|
||||
}
|
||||
|
||||
} // namespace printing
|
||||
|
||||
#endif // _PRINTING_PAGE_NUMBER_H
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
// 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 "precompiled_libcef.h"
|
||||
#include "page_range.h"
|
||||
|
||||
#include "base/stl_util-inl.h"
|
||||
|
||||
namespace printing {
|
||||
|
||||
std::vector<int> PageRange::GetPages(const PageRanges& ranges) {
|
||||
std::set<int> pages;
|
||||
for (unsigned i = 0; i < ranges.size(); ++i) {
|
||||
const PageRange& range = ranges[i];
|
||||
// Ranges are inclusive.
|
||||
for (int i = range.from; i <= range.to; ++i) {
|
||||
pages.insert(i);
|
||||
}
|
||||
}
|
||||
return SetToVector(pages);
|
||||
}
|
||||
|
||||
} // namespace printing
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
// 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.
|
||||
|
||||
#ifndef _PRINTING_PAGE_RANGE_H
|
||||
#define _PRINTING_PAGE_RANGE_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace printing {
|
||||
|
||||
struct PageRange;
|
||||
|
||||
typedef std::vector<PageRange> PageRanges;
|
||||
|
||||
// Print range is inclusive. To select one page, set from == to.
|
||||
struct PageRange {
|
||||
int from;
|
||||
int to;
|
||||
|
||||
bool operator==(const PageRange& rhs) const {
|
||||
return from == rhs.from && to == rhs.to;
|
||||
}
|
||||
|
||||
// Retrieves the sorted list of unique pages in the page ranges.
|
||||
static std::vector<int> GetPages(const PageRanges& ranges);
|
||||
};
|
||||
|
||||
} // namespace printing
|
||||
|
||||
#endif // _PRINTING_PAGE_RANGE_H
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
// 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 "precompiled_libcef.h"
|
||||
#include "page_setup.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
namespace printing {
|
||||
|
||||
PageMargins::PageMargins()
|
||||
: header(0),
|
||||
footer(0),
|
||||
left(0),
|
||||
right(0),
|
||||
top(0),
|
||||
bottom(0) {
|
||||
}
|
||||
|
||||
void PageMargins::Clear() {
|
||||
header = 0;
|
||||
footer = 0;
|
||||
left = 0;
|
||||
right = 0;
|
||||
top = 0;
|
||||
bottom = 0;
|
||||
}
|
||||
|
||||
bool PageMargins::Equals(const PageMargins& rhs) const {
|
||||
return header == rhs.header &&
|
||||
footer == rhs.footer &&
|
||||
left == rhs.left &&
|
||||
top == rhs.top &&
|
||||
right == rhs.right &&
|
||||
bottom == rhs.bottom;
|
||||
}
|
||||
|
||||
PageSetup::PageSetup() : text_height_(0) {
|
||||
}
|
||||
|
||||
void PageSetup::Clear() {
|
||||
physical_size_.SetSize(0, 0);
|
||||
printable_area_.SetRect(0, 0, 0, 0);
|
||||
overlay_area_.SetRect(0, 0, 0, 0);
|
||||
content_area_.SetRect(0, 0, 0, 0);
|
||||
effective_margins_.Clear();
|
||||
text_height_ = 0;
|
||||
}
|
||||
|
||||
bool PageSetup::Equals(const PageSetup& rhs) const {
|
||||
return physical_size_ == rhs.physical_size_ &&
|
||||
printable_area_ == rhs.printable_area_ &&
|
||||
overlay_area_ == rhs.overlay_area_ &&
|
||||
content_area_ == rhs.content_area_ &&
|
||||
effective_margins_.Equals(rhs.effective_margins_) &&
|
||||
requested_margins_.Equals(rhs.requested_margins_) &&
|
||||
text_height_ == rhs.text_height_;
|
||||
}
|
||||
|
||||
void PageSetup::Init(const gfx::Size& physical_size,
|
||||
const gfx::Rect& printable_area,
|
||||
int text_height) {
|
||||
DCHECK_LE(printable_area.right(), physical_size.width());
|
||||
// I've seen this assert triggers on Canon GP160PF PCL 5e and HP LaserJet 5.
|
||||
// Since we don't know the dpi here, just disable the check.
|
||||
// DCHECK_LE(printable_area.bottom(), physical_size.height());
|
||||
DCHECK_GE(printable_area.x(), 0);
|
||||
DCHECK_GE(printable_area.y(), 0);
|
||||
DCHECK_GE(text_height, 0);
|
||||
physical_size_ = physical_size;
|
||||
printable_area_ = printable_area;
|
||||
text_height_ = text_height;
|
||||
|
||||
// Calculate the effective margins. The tricky part.
|
||||
effective_margins_.header = std::max(requested_margins_.header,
|
||||
printable_area_.y());
|
||||
effective_margins_.footer = std::max(requested_margins_.footer,
|
||||
physical_size.height() -
|
||||
printable_area_.bottom());
|
||||
effective_margins_.left = std::max(requested_margins_.left,
|
||||
printable_area_.x());
|
||||
effective_margins_.top = std::max(std::max(requested_margins_.top,
|
||||
printable_area_.y()),
|
||||
effective_margins_.header + text_height);
|
||||
effective_margins_.right = std::max(requested_margins_.right,
|
||||
physical_size.width() -
|
||||
printable_area_.right());
|
||||
effective_margins_.bottom = std::max(std::max(requested_margins_.bottom,
|
||||
physical_size.height() -
|
||||
printable_area_.bottom()),
|
||||
effective_margins_.footer + text_height);
|
||||
|
||||
// Calculate the overlay area. If the margins are excessive, the overlay_area
|
||||
// size will be (0, 0).
|
||||
overlay_area_.set_x(effective_margins_.left);
|
||||
overlay_area_.set_y(effective_margins_.header);
|
||||
overlay_area_.set_width(std::max(0,
|
||||
physical_size.width() -
|
||||
effective_margins_.right -
|
||||
overlay_area_.x()));
|
||||
overlay_area_.set_height(std::max(0,
|
||||
physical_size.height() -
|
||||
effective_margins_.footer -
|
||||
overlay_area_.y()));
|
||||
|
||||
// Calculate the content area. If the margins are excessive, the content_area
|
||||
// size will be (0, 0).
|
||||
content_area_.set_x(effective_margins_.left);
|
||||
content_area_.set_y(effective_margins_.top);
|
||||
content_area_.set_width(std::max(0,
|
||||
physical_size.width() -
|
||||
effective_margins_.right -
|
||||
content_area_.x()));
|
||||
content_area_.set_height(std::max(0,
|
||||
physical_size.height() -
|
||||
effective_margins_.bottom -
|
||||
content_area_.y()));
|
||||
}
|
||||
|
||||
void PageSetup::SetRequestedMargins(const PageMargins& requested_margins) {
|
||||
requested_margins_ = requested_margins;
|
||||
if (physical_size_.width() && physical_size_.height())
|
||||
Init(physical_size_, printable_area_, text_height_);
|
||||
}
|
||||
|
||||
} // namespace printing
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
// 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.
|
||||
|
||||
#ifndef _PRINTING_PAGE_SETUP_H
|
||||
#define _PRINTING_PAGE_SETUP_H
|
||||
|
||||
#include "base/gfx/rect.h"
|
||||
|
||||
namespace printing {
|
||||
|
||||
// Margins for a page setup.
|
||||
class PageMargins {
|
||||
public:
|
||||
PageMargins();
|
||||
|
||||
void Clear();
|
||||
|
||||
// Equality operator.
|
||||
bool Equals(const PageMargins& rhs) const;
|
||||
|
||||
// Vertical space for the overlay from the top of the sheet.
|
||||
int header;
|
||||
// Vertical space for the overlay from the bottom of the sheet.
|
||||
int footer;
|
||||
// Margin on each side of the sheet.
|
||||
int left;
|
||||
int right;
|
||||
int top;
|
||||
int bottom;
|
||||
};
|
||||
|
||||
// Settings that define the size and printable areas of a page. Unit is
|
||||
// unspecified.
|
||||
class PageSetup {
|
||||
public:
|
||||
PageSetup();
|
||||
|
||||
void Clear();
|
||||
|
||||
// Equality operator.
|
||||
bool Equals(const PageSetup& rhs) const;
|
||||
|
||||
void Init(const gfx::Size& physical_size, const gfx::Rect& printable_area,
|
||||
int text_height);
|
||||
|
||||
void SetRequestedMargins(const PageMargins& requested_margins);
|
||||
|
||||
const gfx::Size& physical_size() const { return physical_size_; }
|
||||
const gfx::Rect& overlay_area() const { return overlay_area_; }
|
||||
const gfx::Rect& content_area() const { return content_area_; }
|
||||
const PageMargins& effective_margins() const {
|
||||
return effective_margins_;
|
||||
}
|
||||
|
||||
private:
|
||||
// Physical size of the page, including non-printable margins.
|
||||
gfx::Size physical_size_;
|
||||
|
||||
// The printable area as specified by the printer driver. We can't get
|
||||
// larger than this.
|
||||
gfx::Rect printable_area_;
|
||||
|
||||
// The printable area for headers and footers.
|
||||
gfx::Rect overlay_area_;
|
||||
|
||||
// The printable area as selected by the user's margins.
|
||||
gfx::Rect content_area_;
|
||||
|
||||
// Effective margins.
|
||||
PageMargins effective_margins_;
|
||||
|
||||
// Requested margins.
|
||||
PageMargins requested_margins_;
|
||||
|
||||
// Space that must be kept free for the overlays.
|
||||
int text_height_;
|
||||
};
|
||||
|
||||
} // namespace printing
|
||||
|
||||
#endif // _PRINTING_PAGE_SETUP_H
|
||||
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
#include "precompiled_libcef.h"
|
||||
#include "print_settings.h"
|
||||
#include "units.h"
|
||||
|
||||
#include "base/atomic_sequence_num.h"
|
||||
#include "base/logging.h"
|
||||
#include "printing/units.h"
|
||||
|
||||
namespace printing {
|
||||
|
||||
|
@ -18,6 +18,8 @@ PrintSettings::PrintSettings()
|
|||
: min_shrink(1.25),
|
||||
max_shrink(2.0),
|
||||
desired_dpi(72),
|
||||
selection_only(false),
|
||||
to_file(false),
|
||||
dpi_(0),
|
||||
landscape_(false) {
|
||||
}
|
||||
|
@ -27,6 +29,8 @@ void PrintSettings::Clear() {
|
|||
min_shrink = 1.25;
|
||||
max_shrink = 2.;
|
||||
desired_dpi = 72;
|
||||
selection_only = false;
|
||||
to_file = false;
|
||||
printer_name_.clear();
|
||||
device_name_.clear();
|
||||
page_setup_pixels_.Clear();
|
||||
|
@ -38,12 +42,16 @@ void PrintSettings::Clear() {
|
|||
void PrintSettings::Init(HDC hdc,
|
||||
const DEVMODE& dev_mode,
|
||||
const PageRanges& new_ranges,
|
||||
const std::wstring& new_device_name) {
|
||||
const std::wstring& new_device_name,
|
||||
bool print_selection_only,
|
||||
bool print_to_file) {
|
||||
DCHECK(hdc);
|
||||
printer_name_ = dev_mode.dmDeviceName;
|
||||
device_name_ = new_device_name;
|
||||
ranges = new_ranges;
|
||||
landscape_ = dev_mode.dmOrientation == DMORIENT_LANDSCAPE;
|
||||
selection_only = print_selection_only;
|
||||
to_file = print_to_file;
|
||||
|
||||
dpi_ = GetDeviceCaps(hdc, LOGPIXELSX);
|
||||
// No printer device is known to advertise different dpi in X and Y axis; even
|
||||
|
@ -71,20 +79,22 @@ void PrintSettings::SetPrinterPrintableArea(
|
|||
gfx::Size const& physical_size_pixels,
|
||||
gfx::Rect const& printable_area_pixels) {
|
||||
|
||||
int margin_printer_units = ConvertUnit(500, kHundrethsMMPerInch, dpi_);
|
||||
|
||||
// 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_));
|
||||
margin_printer_units);
|
||||
|
||||
// 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;
|
||||
margins.header = margin_printer_units;
|
||||
margins.footer = margin_printer_units;
|
||||
margins.left = margin_printer_units;
|
||||
margins.top = margin_printer_units;
|
||||
margins.right = margin_printer_units;
|
||||
margins.bottom = margin_printer_units;
|
||||
page_setup_pixels_.SetRequestedMargins(margins);
|
||||
}
|
||||
|
||||
|
@ -101,6 +111,8 @@ void PrintSettings::RenderParams(PrintParams* params) const {
|
|||
params->desired_dpi = desired_dpi;
|
||||
// Always use an invalid cookie.
|
||||
params->document_cookie = 0;
|
||||
params->selection_only = selection_only;
|
||||
params->to_file = to_file;
|
||||
}
|
||||
|
||||
bool PrintSettings::Equals(const PrintSettings& rhs) const {
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
#ifndef _PRINTING_PRINT_SETTINGS_H
|
||||
#define _PRINTING_PRINT_SETTINGS_H
|
||||
|
||||
#include "page_range.h"
|
||||
#include "page_setup.h"
|
||||
|
||||
#include "base/gfx/rect.h"
|
||||
#include "printing/page_range.h"
|
||||
#include "printing/page_setup.h"
|
||||
|
||||
typedef struct HDC__* HDC;
|
||||
typedef struct _devicemodeW DEVMODE;
|
||||
|
@ -35,13 +34,21 @@ struct PrintParams {
|
|||
// Cookie for the document to ensure correctness.
|
||||
int document_cookie;
|
||||
|
||||
// Indicates if the user only wants to print the current selection.
|
||||
bool selection_only;
|
||||
|
||||
// Indicates if the user wants to print to file.
|
||||
bool to_file;
|
||||
|
||||
// Warning: do not compare document_cookie.
|
||||
bool Equals(const PrintParams& rhs) const {
|
||||
return printable_size == rhs.printable_size &&
|
||||
dpi == rhs.dpi &&
|
||||
min_shrink == rhs.min_shrink &&
|
||||
max_shrink == rhs.max_shrink &&
|
||||
desired_dpi == rhs.desired_dpi;
|
||||
desired_dpi == rhs.desired_dpi &&
|
||||
selection_only == rhs.selection_only &&
|
||||
to_file == rhs.to_file;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -59,7 +66,9 @@ class PrintSettings {
|
|||
void Init(HDC hdc,
|
||||
const DEVMODE& dev_mode,
|
||||
const PageRanges& new_ranges,
|
||||
const std::wstring& new_device_name);
|
||||
const std::wstring& new_device_name,
|
||||
bool selection_only,
|
||||
bool to_file);
|
||||
#endif
|
||||
|
||||
// Set printer printable area in pixels.
|
||||
|
@ -104,6 +113,12 @@ class PrintSettings {
|
|||
// scaled to ScreenDpi/dpix*desired_dpi.
|
||||
int desired_dpi;
|
||||
|
||||
// Indicates if the user only wants to print the current selection.
|
||||
bool selection_only;
|
||||
|
||||
// Indicates if the user wants to print to file.
|
||||
bool to_file;
|
||||
|
||||
// Cookie generator. It is used to initialize PrintedDocument with its
|
||||
// associated PrintSettings, to be sure that each generated PrintedPage is
|
||||
// correctly associated with its corresponding PrintedDocument.
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
// 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 "precompiled_libcef.h"
|
||||
#include "units.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
namespace printing {
|
||||
|
||||
int ConvertUnit(int value, int old_unit, int new_unit) {
|
||||
DCHECK_GT(new_unit, 0);
|
||||
DCHECK_GT(old_unit, 0);
|
||||
// With integer arithmetic, to divide a value with correct rounding, you need
|
||||
// to add half of the divisor value to the dividend value. You need to do the
|
||||
// reverse with negative number.
|
||||
if (value >= 0) {
|
||||
return ((value * new_unit) + (old_unit / 2)) / old_unit;
|
||||
} else {
|
||||
return ((value * new_unit) - (old_unit / 2)) / old_unit;
|
||||
}
|
||||
}
|
||||
|
||||
double ConvertUnitDouble(double value, double old_unit, double new_unit) {
|
||||
DCHECK_GT(new_unit, 0);
|
||||
DCHECK_GT(old_unit, 0);
|
||||
return value * new_unit / old_unit;
|
||||
}
|
||||
|
||||
int ConvertMilliInchToHundredThousanthMeter(int milli_inch) {
|
||||
// 1" == 25.4 mm
|
||||
// 1" == 25400 um
|
||||
// 0.001" == 25.4 um
|
||||
// 0.001" == 2.54 cmm
|
||||
return ConvertUnit(milli_inch, 100, 254);
|
||||
}
|
||||
|
||||
int ConvertHundredThousanthMeterToMilliInch(int cmm) {
|
||||
return ConvertUnit(cmm, 254, 100);
|
||||
}
|
||||
|
||||
} // namespace printing
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
// 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.
|
||||
|
||||
#ifndef _PRINTING_UNITS_H
|
||||
#define _PRINTING_UNITS_H
|
||||
|
||||
namespace printing {
|
||||
|
||||
// Length of a thousanth of inches in 0.01mm unit.
|
||||
const int kHundrethsMMPerInch = 2540;
|
||||
|
||||
// Converts from one unit system to another using integer arithmetics.
|
||||
int ConvertUnit(int value, int old_unit, int new_unit);
|
||||
|
||||
// Converts from one unit system to another using doubles.
|
||||
double ConvertUnitDouble(double value, double old_unit, double new_unit);
|
||||
|
||||
// Converts from 0.001 inch unit to 0.00001 meter.
|
||||
int ConvertMilliInchToHundredThousanthMeter(int milli_inch);
|
||||
|
||||
// Converts from 0.00001 meter unit to 0.001 inch.
|
||||
int ConvertHundredThousanthMeterToMilliInch(int cmm);
|
||||
|
||||
} // namespace printing
|
||||
|
||||
#endif // _PRINTING_UNITS_H
|
||||
|
|
@ -8,11 +8,10 @@
|
|||
#include <winspool.h>
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/gfx/platform_canvas.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "base/time.h"
|
||||
#include "base/time_format.h"
|
||||
#include "skia/ext/platform_device_win.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
|
@ -50,8 +49,10 @@ PrintingContext::~PrintingContext() {
|
|||
ResetSettings();
|
||||
}
|
||||
|
||||
PrintingContext::Result PrintingContext::AskUserForSettings(HWND window,
|
||||
int max_pages) {
|
||||
PrintingContext::Result PrintingContext::AskUserForSettings(
|
||||
HWND window,
|
||||
int max_pages,
|
||||
bool has_selection) {
|
||||
DCHECK(window);
|
||||
DCHECK(!in_print_job_);
|
||||
dialog_box_dismissed_ = false;
|
||||
|
@ -66,12 +67,13 @@ PrintingContext::Result PrintingContext::AskUserForSettings(HWND window,
|
|||
// On failure, the settings are reset and FAILED is returned.
|
||||
PRINTDLGEX dialog_options = { sizeof(PRINTDLGEX) };
|
||||
dialog_options.hwndOwner = window;
|
||||
// Disables the Current Page and Selection radio buttons since WebKit can't
|
||||
// print a part of the webpage and we don't know which page is the current
|
||||
// one.
|
||||
// Disable options we don't support currently.
|
||||
// TODO(maruel): Reuse the previously loaded settings!
|
||||
dialog_options.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE |
|
||||
PD_NOSELECTION | PD_NOCURRENTPAGE | PD_HIDEPRINTTOFILE;
|
||||
PD_NOCURRENTPAGE;
|
||||
if (!has_selection)
|
||||
dialog_options.Flags |= PD_NOSELECTION;
|
||||
|
||||
PRINTPAGERANGE ranges[32];
|
||||
dialog_options.nStartPage = START_PAGE_GENERAL;
|
||||
if (max_pages) {
|
||||
|
@ -81,6 +83,7 @@ PrintingContext::Result PrintingContext::AskUserForSettings(HWND window,
|
|||
ranges[0].nToPage = max_pages;
|
||||
dialog_options.nPageRanges = 1;
|
||||
dialog_options.nMaxPageRanges = arraysize(ranges);
|
||||
dialog_options.nMinPage = 1;
|
||||
dialog_options.nMaxPage = max_pages;
|
||||
dialog_options.lpPageRanges = ranges;
|
||||
} else {
|
||||
|
@ -94,7 +97,6 @@ PrintingContext::Result PrintingContext::AskUserForSettings(HWND window,
|
|||
return FAILED;
|
||||
}
|
||||
}
|
||||
// TODO(maruel): Support PD_PRINTTOFILE.
|
||||
return ParseDialogResultEx(dialog_options);
|
||||
}
|
||||
|
||||
|
@ -151,7 +153,7 @@ PrintingContext::Result PrintingContext::NewDocument(
|
|||
const std::wstring& document_name) {
|
||||
DCHECK(!in_print_job_);
|
||||
if (!hdc_)
|
||||
return OnErrror();
|
||||
return OnError();
|
||||
|
||||
// Set the flag used by the AbortPrintJob dialog procedure.
|
||||
abort_printing_ = false;
|
||||
|
@ -160,17 +162,35 @@ PrintingContext::Result PrintingContext::NewDocument(
|
|||
|
||||
// Register the application's AbortProc function with GDI.
|
||||
if (SP_ERROR == SetAbortProc(hdc_, &AbortProc))
|
||||
return OnErrror();
|
||||
return OnError();
|
||||
|
||||
DOCINFO di = { sizeof(DOCINFO) };
|
||||
di.lpszDocName = document_name.c_str();
|
||||
|
||||
wchar_t szFileName[MAX_PATH] = L"";
|
||||
if (settings_.to_file) {
|
||||
// Prompt for the file name to use for the printed output.
|
||||
OPENFILENAME ofn = { sizeof(ofn) };
|
||||
|
||||
ofn.lpstrFilter = L"PostScript Files (*.ps)\0*.ps\0All Files (*.*)\0*.*\0";
|
||||
ofn.lpstrFile = szFileName;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.Flags = OFN_EXPLORER | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY |
|
||||
OFN_NOREADONLYRETURN | OFN_ENABLESIZING;
|
||||
ofn.lpstrDefExt = L"ps";
|
||||
|
||||
if(GetSaveFileName(&ofn))
|
||||
di.lpszOutput = szFileName;
|
||||
else
|
||||
return OnError();
|
||||
}
|
||||
|
||||
DCHECK_EQ(MessageLoop::current()->NestableTasksAllowed(), false);
|
||||
// Begin a print job by calling the StartDoc function.
|
||||
// NOTE: StartDoc() starts a message loop. That causes a lot of problems with
|
||||
// IPC. Make sure recursive task processing is disabled.
|
||||
if (StartDoc(hdc_, &di) <= 0)
|
||||
return OnErrror();
|
||||
return OnError();
|
||||
|
||||
#ifndef NDEBUG
|
||||
page_number_ = 0;
|
||||
|
@ -185,7 +205,7 @@ PrintingContext::Result PrintingContext::NewPage() {
|
|||
|
||||
// Inform the driver that the application is about to begin sending data.
|
||||
if (StartPage(hdc_) <= 0)
|
||||
return OnErrror();
|
||||
return OnError();
|
||||
|
||||
#ifndef NDEBUG
|
||||
++page_number_;
|
||||
|
@ -200,7 +220,7 @@ PrintingContext::Result PrintingContext::PageDone() {
|
|||
DCHECK(in_print_job_);
|
||||
|
||||
if (EndPage(hdc_) <= 0)
|
||||
return OnErrror();
|
||||
return OnError();
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -211,7 +231,7 @@ PrintingContext::Result PrintingContext::DocumentDone() {
|
|||
|
||||
// Inform the driver that document has ended.
|
||||
if (EndDoc(hdc_) <= 0)
|
||||
return OnErrror();
|
||||
return OnError();
|
||||
|
||||
ResetSettings();
|
||||
return OK;
|
||||
|
@ -232,7 +252,7 @@ void PrintingContext::DismissDialog() {
|
|||
}
|
||||
}
|
||||
|
||||
PrintingContext::Result PrintingContext::OnErrror() {
|
||||
PrintingContext::Result PrintingContext::OnError() {
|
||||
// This will close hdc_ and clear settings_.
|
||||
ResetSettings();
|
||||
return abort_printing_ ? CANCEL : FAILED;
|
||||
|
@ -251,8 +271,10 @@ BOOL PrintingContext::AbortProc(HDC hdc, int nCode) {
|
|||
bool PrintingContext::InitializeSettings(const DEVMODE& dev_mode,
|
||||
const std::wstring& new_device_name,
|
||||
const PRINTPAGERANGE* ranges,
|
||||
int number_ranges) {
|
||||
skia::PlatformDeviceWin::InitializeDC(hdc_);
|
||||
int number_ranges,
|
||||
bool selection_only,
|
||||
bool to_file) {
|
||||
skia::PlatformDevice::InitializeDC(hdc_);
|
||||
DCHECK(GetDeviceCaps(hdc_, CLIPCAPS));
|
||||
DCHECK(GetDeviceCaps(hdc_, RASTERCAPS) & RC_STRETCHDIB);
|
||||
DCHECK(GetDeviceCaps(hdc_, RASTERCAPS) & RC_BITMAP64);
|
||||
|
@ -271,17 +293,24 @@ bool PrintingContext::InitializeSettings(const DEVMODE& dev_mode,
|
|||
|
||||
DCHECK(!in_print_job_);
|
||||
DCHECK(hdc_);
|
||||
// Convert the PRINTPAGERANGE array to a PrintSettings::PageRanges vector.
|
||||
PageRanges ranges_vector;
|
||||
ranges_vector.reserve(number_ranges);
|
||||
for (int i = 0; i < number_ranges; ++i) {
|
||||
PageRange range;
|
||||
// Transfert from 1-based to 0-based.
|
||||
range.from = ranges[i].nFromPage - 1;
|
||||
range.to = ranges[i].nToPage - 1;
|
||||
ranges_vector.push_back(range);
|
||||
if (!selection_only) {
|
||||
// Convert the PRINTPAGERANGE array to a PrintSettings::PageRanges vector.
|
||||
ranges_vector.reserve(number_ranges);
|
||||
for (int i = 0; i < number_ranges; ++i) {
|
||||
PageRange range;
|
||||
// Transfer from 1-based to 0-based.
|
||||
range.from = ranges[i].nFromPage - 1;
|
||||
range.to = ranges[i].nToPage - 1;
|
||||
ranges_vector.push_back(range);
|
||||
}
|
||||
}
|
||||
settings_.Init(hdc_, dev_mode, ranges_vector, new_device_name);
|
||||
settings_.Init(hdc_,
|
||||
dev_mode,
|
||||
ranges_vector,
|
||||
new_device_name,
|
||||
selection_only,
|
||||
to_file);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -300,7 +329,8 @@ bool PrintingContext::GetPrinterSettings(HANDLE printer,
|
|||
ResetSettings();
|
||||
return false;
|
||||
}
|
||||
return InitializeSettings(*info_9->pDevMode, device_name, NULL, 0);
|
||||
return InitializeSettings(*info_9->pDevMode, device_name, NULL, 0, false,
|
||||
false);
|
||||
}
|
||||
buffer.reset();
|
||||
}
|
||||
|
@ -314,7 +344,8 @@ bool PrintingContext::GetPrinterSettings(HANDLE printer,
|
|||
ResetSettings();
|
||||
return false;
|
||||
}
|
||||
return InitializeSettings(*info_8->pDevMode, device_name, NULL, 0);
|
||||
return InitializeSettings(*info_8->pDevMode, device_name, NULL, 0, false,
|
||||
false);
|
||||
}
|
||||
buffer.reset();
|
||||
}
|
||||
|
@ -329,7 +360,8 @@ bool PrintingContext::GetPrinterSettings(HANDLE printer,
|
|||
ResetSettings();
|
||||
return false;
|
||||
}
|
||||
return InitializeSettings(*info_2->pDevMode, device_name, NULL, 0);
|
||||
return InitializeSettings(*info_2->pDevMode, device_name, NULL, 0, false,
|
||||
false);
|
||||
}
|
||||
buffer.reset();
|
||||
}
|
||||
|
@ -376,14 +408,26 @@ PrintingContext::Result PrintingContext::ParseDialogResultEx(
|
|||
bool success = false;
|
||||
if (dev_mode && !device_name.empty()) {
|
||||
hdc_ = dialog_options.hDC;
|
||||
PRINTPAGERANGE* page_ranges = NULL;
|
||||
DWORD num_page_ranges = 0;
|
||||
bool print_selection_only = false;
|
||||
bool print_to_file = false;
|
||||
if (dialog_options.Flags & PD_PAGENUMS) {
|
||||
success = InitializeSettings(*dev_mode,
|
||||
device_name,
|
||||
dialog_options.lpPageRanges,
|
||||
dialog_options.nPageRanges);
|
||||
} else {
|
||||
success = InitializeSettings(*dev_mode, device_name, NULL, 0);
|
||||
page_ranges = dialog_options.lpPageRanges;
|
||||
num_page_ranges = dialog_options.nPageRanges;
|
||||
}
|
||||
if (dialog_options.Flags & PD_SELECTION) {
|
||||
print_selection_only = true;
|
||||
}
|
||||
if (dialog_options.Flags & PD_PRINTTOFILE) {
|
||||
print_to_file = true;
|
||||
}
|
||||
success = InitializeSettings(*dev_mode,
|
||||
device_name,
|
||||
dialog_options.lpPageRanges,
|
||||
dialog_options.nPageRanges,
|
||||
print_selection_only,
|
||||
print_to_file);
|
||||
}
|
||||
|
||||
if (!success && dialog_options.hDC) {
|
||||
|
@ -447,7 +491,8 @@ PrintingContext::Result PrintingContext::ParseDialogResult(
|
|||
bool success = false;
|
||||
if (dev_mode && !device_name.empty()) {
|
||||
hdc_ = dialog_options.hDC;
|
||||
success = InitializeSettings(*dev_mode, device_name, NULL, 0);
|
||||
success = InitializeSettings(*dev_mode, device_name, NULL, 0, false,
|
||||
false);
|
||||
}
|
||||
|
||||
if (!success && dialog_options.hDC) {
|
||||
|
|
|
@ -32,7 +32,7 @@ class PrintingContext {
|
|||
|
||||
// Asks the user what printer and format should be used to print. Updates the
|
||||
// context with the select device settings.
|
||||
Result AskUserForSettings(HWND window, int max_pages);
|
||||
Result AskUserForSettings(HWND window, int max_pages, bool has_selection);
|
||||
|
||||
// Selects the user's default printer and format. Updates the context with the
|
||||
// default device settings.
|
||||
|
@ -82,10 +82,10 @@ class PrintingContext {
|
|||
// temporary object used during the Print... dialog display.
|
||||
class CallbackHandler;
|
||||
|
||||
// Does bookeeping when an error occurs.
|
||||
PrintingContext::Result OnErrror();
|
||||
// Does bookkeeping when an error occurs.
|
||||
PrintingContext::Result OnError();
|
||||
|
||||
// Used in response to the user cancelling the printing.
|
||||
// Used in response to the user canceling the printing.
|
||||
static BOOL CALLBACK AbortProc(HDC hdc, int nCode);
|
||||
|
||||
// Reads the settings from the selected device context. Updates settings_ and
|
||||
|
@ -93,7 +93,9 @@ class PrintingContext {
|
|||
bool InitializeSettings(const DEVMODE& dev_mode,
|
||||
const std::wstring& new_device_name,
|
||||
const PRINTPAGERANGE* ranges,
|
||||
int number_ranges);
|
||||
int number_ranges,
|
||||
bool selection_only,
|
||||
bool to_file);
|
||||
|
||||
// Retrieves the printer's default low-level settings. hdc_ is allocated with
|
||||
// this call.
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "base/logging.h"
|
||||
#include "base/string_util.h"
|
||||
#include "webkit/api/public/WebHTTPHeaderVisitor.h"
|
||||
#include "webkit/glue/glue_util.h"
|
||||
|
||||
|
||||
|
@ -92,33 +93,40 @@ void CefRequestImpl::Set(const std::wstring& url,
|
|||
Unlock();
|
||||
}
|
||||
|
||||
void CefRequestImpl::SetHeaderMap(const WebRequest::HeaderMap& map)
|
||||
void CefRequestImpl::GetHeaderMap(const WebKit::WebURLRequest& request,
|
||||
HeaderMap& map)
|
||||
{
|
||||
Lock();
|
||||
WebRequest::HeaderMap::const_iterator it = map.begin();
|
||||
for(; it != map.end(); ++it) {
|
||||
headermap_.insert(
|
||||
std::make_pair(
|
||||
UTF8ToWide(it->first.c_str()),
|
||||
UTF8ToWide(it->second.c_str())));
|
||||
}
|
||||
Unlock();
|
||||
class CefHTTPHeaderVisitor : public WebKit::WebHTTPHeaderVisitor {
|
||||
public:
|
||||
CefHTTPHeaderVisitor(HeaderMap* map) : map_(map) {}
|
||||
|
||||
virtual void visitHeader(const WebKit::WebString& name,
|
||||
const WebKit::WebString& value) {
|
||||
map_->insert(
|
||||
std::make_pair(
|
||||
UTF8ToWide(webkit_glue::WebStringToStdString(name)),
|
||||
UTF8ToWide(webkit_glue::WebStringToStdString(value))));
|
||||
}
|
||||
|
||||
private:
|
||||
HeaderMap* map_;
|
||||
};
|
||||
|
||||
CefHTTPHeaderVisitor visitor(&map);
|
||||
request.visitHTTPHeaderFields(&visitor);
|
||||
}
|
||||
|
||||
void CefRequestImpl::GetHeaderMap(WebRequest::HeaderMap& map)
|
||||
void CefRequestImpl::SetHeaderMap(const HeaderMap& map,
|
||||
WebKit::WebURLRequest& request)
|
||||
{
|
||||
Lock();
|
||||
HeaderMap::const_iterator it = headermap_.begin();
|
||||
for(; it != headermap_.end(); ++it) {
|
||||
map.insert(
|
||||
std::make_pair(
|
||||
WideToUTF8(it->first.c_str()),
|
||||
WideToUTF8(it->second.c_str())));
|
||||
HeaderMap::const_iterator it = map.begin();
|
||||
for(; it != map.end(); ++it) {
|
||||
request.setHTTPHeaderField(
|
||||
webkit_glue::StdStringToWebString(WideToUTF8(it->first.c_str())),
|
||||
webkit_glue::StdStringToWebString(WideToUTF8(it->second.c_str())));
|
||||
}
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
CefRefPtr<CefPostData> CefPostData::CreatePostData()
|
||||
{
|
||||
CefRefPtr<CefPostData> postdata(new CefPostDataImpl());
|
||||
|
@ -213,16 +221,55 @@ void CefPostDataImpl::Get(net::UploadData& data)
|
|||
{
|
||||
Lock();
|
||||
|
||||
net::UploadData::Element* element;
|
||||
net::UploadData::Element element;
|
||||
std::vector<net::UploadData::Element> data_elements;
|
||||
ElementVector::iterator it = elements_.begin();
|
||||
for(; it != elements_.end(); ++it) {
|
||||
element = new net::UploadData::Element();
|
||||
static_cast<CefPostDataElementImpl*>(it->get())->Set(*element);
|
||||
static_cast<CefPostDataElementImpl*>(it->get())->Get(element);
|
||||
data_elements.push_back(element);
|
||||
}
|
||||
data.set_elements(data_elements);
|
||||
|
||||
Unlock();
|
||||
}
|
||||
|
||||
void CefPostDataImpl::Set(const WebKit::WebHTTPBody& data)
|
||||
{
|
||||
Lock();
|
||||
|
||||
CefRefPtr<CefPostDataElement> postelem;
|
||||
WebKit::WebHTTPBody::Element element;
|
||||
size_t size = data.elementCount();
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
if (data.elementAt(i, element)) {
|
||||
postelem = CefPostDataElement::CreatePostDataElement();
|
||||
static_cast<CefPostDataElementImpl*>(postelem.get())->Set(element);
|
||||
AddElement(postelem);
|
||||
}
|
||||
}
|
||||
|
||||
Unlock();
|
||||
}
|
||||
|
||||
void CefPostDataImpl::Get(WebKit::WebHTTPBody& data)
|
||||
{
|
||||
Lock();
|
||||
|
||||
WebKit::WebHTTPBody::Element element;
|
||||
ElementVector::iterator it = elements_.begin();
|
||||
for(; it != elements_.end(); ++it) {
|
||||
static_cast<CefPostDataElementImpl*>(it->get())->Get(element);
|
||||
if(element.type == WebKit::WebHTTPBody::Element::TypeData) {
|
||||
data.appendData(element.data);
|
||||
} else if(element.type == WebKit::WebHTTPBody::Element::TypeFile) {
|
||||
data.appendFile(element.filePath);
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
Unlock();
|
||||
}
|
||||
|
||||
CefRefPtr<CefPostDataElement> CefPostDataElement::CreatePostDataElement()
|
||||
{
|
||||
|
@ -370,3 +417,37 @@ void CefPostDataElementImpl::Get(net::UploadData::Element& element)
|
|||
Unlock();
|
||||
}
|
||||
|
||||
void CefPostDataElementImpl::Set(const WebKit::WebHTTPBody::Element& element)
|
||||
{
|
||||
Lock();
|
||||
|
||||
if(element.type == WebKit::WebHTTPBody::Element::TypeData) {
|
||||
SetToBytes(element.data.size(),
|
||||
static_cast<const void*>(element.data.data()));
|
||||
} else if(element.type == WebKit::WebHTTPBody::Element::TypeFile) {
|
||||
SetToFile(UTF8ToWide(webkit_glue::WebStringToStdString(element.filePath)));
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
Unlock();
|
||||
}
|
||||
|
||||
void CefPostDataElementImpl::Get(WebKit::WebHTTPBody::Element& element)
|
||||
{
|
||||
Lock();
|
||||
|
||||
if(type_ == PDE_TYPE_BYTES) {
|
||||
element.type = WebKit::WebHTTPBody::Element::TypeData;
|
||||
element.data.assign(
|
||||
static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
|
||||
} else if(type_ == PDE_TYPE_FILE) {
|
||||
element.type = WebKit::WebHTTPBody::Element::TypeFile;
|
||||
element.filePath.assign(
|
||||
webkit_glue::StdStringToWebString(WideToUTF8(data_.filename)));
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
Unlock();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
#include "../include/cef.h"
|
||||
#include "net/base/upload_data.h"
|
||||
#include "webkit/glue/weburlrequest.h"
|
||||
#include "webkit/api/public/WebHTTPBody.h"
|
||||
#include "webkit/api/public/WebURLRequest.h"
|
||||
|
||||
|
||||
// Implementation of CefRequest
|
||||
|
@ -30,8 +31,10 @@ public:
|
|||
CefRefPtr<CefPostData> postData,
|
||||
const HeaderMap& headerMap);
|
||||
|
||||
void SetHeaderMap(const WebRequest::HeaderMap& map);
|
||||
void GetHeaderMap(WebRequest::HeaderMap& map);
|
||||
static void GetHeaderMap(const WebKit::WebURLRequest& request,
|
||||
HeaderMap& map);
|
||||
static void SetHeaderMap(const HeaderMap& map,
|
||||
WebKit::WebURLRequest& request);
|
||||
|
||||
protected:
|
||||
std::wstring url_;
|
||||
|
@ -55,6 +58,8 @@ public:
|
|||
|
||||
void Set(const net::UploadData& data);
|
||||
void Get(net::UploadData& data);
|
||||
void Set(const WebKit::WebHTTPBody& data);
|
||||
void Get(WebKit::WebHTTPBody& data);
|
||||
|
||||
protected:
|
||||
ElementVector elements_;
|
||||
|
@ -75,8 +80,12 @@ public:
|
|||
virtual size_t GetBytesCount();
|
||||
virtual size_t GetBytes(size_t size, void* bytes);
|
||||
|
||||
void* GetBytes() { return data_.bytes.bytes; }
|
||||
|
||||
void Set(const net::UploadData::Element& element);
|
||||
void Get(net::UploadData::Element& element);
|
||||
void Set(const WebKit::WebHTTPBody::Element& element);
|
||||
void Get(WebKit::WebHTTPBody::Element& element);
|
||||
|
||||
protected:
|
||||
Type type_;
|
||||
|
|
|
@ -11,26 +11,29 @@
|
|||
#include "base/logging.h"
|
||||
#include "base/win_util.h"
|
||||
#include "webkit/api/public/WebInputEvent.h"
|
||||
#include "webkit/api/public/WebPopupMenu.h"
|
||||
#include "webkit/api/public/WebScreenInfo.h"
|
||||
#include "webkit/api/public/WebSize.h"
|
||||
#include "webkit/api/public/win/WebInputEventFactory.h"
|
||||
#include "webkit/api/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::WebPopupMenu;
|
||||
using WebKit::WebScreenInfo;
|
||||
using WebKit::WebScreenInfoFactory;
|
||||
using WebKit::WebSize;
|
||||
using WebKit::WebWidget;
|
||||
using WebKit::WebWidgetClient;
|
||||
|
||||
static const wchar_t kWindowClassName[] = L"WebWidgetHost";
|
||||
|
||||
/*static*/
|
||||
WebWidgetHost* WebWidgetHost::Create(HWND parent_view,
|
||||
WebWidgetDelegate* delegate) {
|
||||
WebWidgetClient* client) {
|
||||
WebWidgetHost* host = new WebWidgetHost();
|
||||
|
||||
static bool registered_class = false;
|
||||
|
@ -53,7 +56,7 @@ WebWidgetHost* WebWidgetHost::Create(HWND parent_view,
|
|||
|
||||
win_util::SetWindowUserData(host->view_, host);
|
||||
|
||||
host->webwidget_ = WebWidget::Create(delegate);
|
||||
host->webwidget_ = WebPopupMenu::create(client);
|
||||
|
||||
return host;
|
||||
}
|
||||
|
@ -229,7 +232,7 @@ void WebWidgetHost::Paint() {
|
|||
}
|
||||
|
||||
// This may result in more invalidation
|
||||
webwidget_->Layout();
|
||||
webwidget_->layout();
|
||||
|
||||
// Scroll the canvas if necessary
|
||||
scroll_rect_ = client_rect.Intersect(scroll_rect_);
|
||||
|
@ -279,7 +282,7 @@ void WebWidgetHost::Resize(LPARAM lparam) {
|
|||
// Force an entire re-paint. TODO(darin): Maybe reuse this memory buffer.
|
||||
DiscardBackingStore();
|
||||
|
||||
webwidget_->Resize(WebSize(LOWORD(lparam), HIWORD(lparam)));
|
||||
webwidget_->resize(WebSize(LOWORD(lparam), HIWORD(lparam)));
|
||||
}
|
||||
|
||||
void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
|
||||
|
@ -305,27 +308,27 @@ void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
|
|||
ReleaseCapture();
|
||||
break;
|
||||
}
|
||||
webwidget_->HandleInputEvent(&event);
|
||||
webwidget_->handleInputEvent(event);
|
||||
}
|
||||
|
||||
void WebWidgetHost::WheelEvent(WPARAM wparam, LPARAM lparam) {
|
||||
const WebMouseWheelEvent& event = WebInputEventFactory::mouseWheelEvent(
|
||||
view_, WM_MOUSEWHEEL, wparam, lparam);
|
||||
webwidget_->HandleInputEvent(&event);
|
||||
webwidget_->handleInputEvent(event);
|
||||
}
|
||||
|
||||
void WebWidgetHost::KeyEvent(UINT message, WPARAM wparam, LPARAM lparam) {
|
||||
const WebKeyboardEvent& event = WebInputEventFactory::keyboardEvent(
|
||||
view_, message, wparam, lparam);
|
||||
webwidget_->HandleInputEvent(&event);
|
||||
webwidget_->handleInputEvent(event);
|
||||
}
|
||||
|
||||
void WebWidgetHost::CaptureLostEvent() {
|
||||
webwidget_->MouseCaptureLost();
|
||||
webwidget_->mouseCaptureLost();
|
||||
}
|
||||
|
||||
void WebWidgetHost::SetFocus(bool enable) {
|
||||
webwidget_->SetFocus(enable);
|
||||
webwidget_->setFocus(enable);
|
||||
}
|
||||
|
||||
void WebWidgetHost::TrackMouseLeave(bool track) {
|
||||
|
@ -358,6 +361,6 @@ void WebWidgetHost::PaintRect(const gfx::Rect& rect) {
|
|||
DCHECK(canvas_.get());
|
||||
|
||||
set_painting(true);
|
||||
webwidget_->Paint(canvas_.get(), rect);
|
||||
webwidget_->paint(canvas_.get(), rect);
|
||||
set_painting(false);
|
||||
}
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
#include "base/gfx/platform_canvas.h"
|
||||
#include "base/gfx/rect.h"
|
||||
#include "base/scoped_ptr.h"
|
||||
|
||||
class WebWidget;
|
||||
class WebWidgetDelegate;
|
||||
#include "skia/ext/platform_canvas.h"
|
||||
|
||||
namespace gfx {
|
||||
class Size;
|
||||
}
|
||||
|
||||
namespace WebKit {
|
||||
class WebWidget;
|
||||
class WebWidgetClient;
|
||||
struct WebScreenInfo;
|
||||
}
|
||||
|
||||
|
@ -29,14 +29,14 @@ class WebWidgetHost {
|
|||
// The newly created window should be resized after it is created, using the
|
||||
// MoveWindow (or equivalent) function.
|
||||
static WebWidgetHost* Create(gfx::NativeView parent_view,
|
||||
WebWidgetDelegate* delegate);
|
||||
WebKit::WebWidgetClient* client);
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
static void HandleEvent(gfx::NativeView view, NSEvent *event);
|
||||
#endif
|
||||
|
||||
gfx::NativeView window_handle() const { return view_; }
|
||||
WebWidget* webwidget() const { return webwidget_; }
|
||||
gfx::NativeView view_handle() const { return view_; }
|
||||
WebKit::WebWidget* webwidget() const { return webwidget_; }
|
||||
|
||||
void DidInvalidateRect(const gfx::Rect& rect);
|
||||
void DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect);
|
||||
|
@ -107,7 +107,7 @@ class WebWidgetHost {
|
|||
}
|
||||
|
||||
gfx::NativeView view_;
|
||||
WebWidget* webwidget_;
|
||||
WebKit::WebWidget* webwidget_;
|
||||
scoped_ptr<skia::PlatformCanvas> canvas_;
|
||||
|
||||
// specifies the portion of the webwidget that needs painting
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib shlwapi.lib rpcrt4.lib winmm.lib"
|
||||
AdditionalDependencies=""
|
||||
AdditionalLibraryDirectories=""$(OutDir)""
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
CEF development has faced delays in the past due to the time lapse between
|
||||
submitting patches to the Chromium and WebKit projects and having those patches
|
||||
accepted. A CEF developer will hopefully earn Chromium commit access at some
|
||||
point which should partly mitigate this problem but will not eliminate it
|
||||
completely. There may still be instances where CEF requires changes to the
|
||||
Chromium/WebKit code base that are not desired by the Chromium/WebKit projects
|
||||
as a whole. To address this situation in the near term and with a minimum of
|
||||
maintenance headaches (i.e. without forking) this project adds a patch
|
||||
capability as part of the CEF build process. The patch capability works as
|
||||
follows:
|
||||
|
||||
1. The CEF developer creates one or more patch files containing all required
|
||||
changes to the Chromium/WebKit code base and places those patch files in the
|
||||
"patches" subdirectory.
|
||||
2. The CEF developer adds an entry for each patch file in the "patch.cfg" file.
|
||||
3. The CEF "patch" project, which is a build dependency for the "webkit\config"
|
||||
project, applies the patches to the Chromium/WebKit source tree using the
|
||||
patcher.py tool in the tools directory. If necessary the patcher.py tool
|
||||
also rewrites the "patch_state.h" file which defines the CEF_PATCHES_APPLIED
|
||||
preprocessor value.
|
||||
|
||||
To disable automatic application of patches to the Chromium/WebKit code base
|
||||
create an empty "NOPATCH" file in the "patch" directory. Sections of the CEF
|
||||
code base that otherwise require patches will be disabled using the
|
||||
CEF_PATCHES_APPLIED preprocessor value defined in the "patch_state.h" file. Be
|
||||
warned that not applying all required patches may break important CEF
|
||||
functionality.
|
|
@ -0,0 +1,8 @@
|
|||
# An element of this array associates a patch file with a target directory.
|
||||
# All paths in the patch file must be relative to that directory. Each patch
|
||||
# file entry should be proceeded by the code review or bug report link that it
|
||||
# relates to.
|
||||
patches = {
|
||||
# http://codereview.chromium.org/160004
|
||||
"webkit_glue" : "../../webkit/glue/"
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="patch"
|
||||
ProjectGUID="{A6D0953E-899E-4C60-AB6B-CAE75A44B8E6}"
|
||||
RootNamespace="patch"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="10"
|
||||
InheritedPropertySheets="$(SolutionDir)..\build\debug.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="10"
|
||||
InheritedPropertySheets="$(SolutionDir)..\build\release.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="..\tools\patcher.bat"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="patcher"
|
||||
CommandLine="..\tools\patcher.bat
"
|
||||
AdditionalDependencies=""
|
||||
Outputs="$(IntDir)\patcher.out"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="patcher"
|
||||
CommandLine="..\tools\patcher.bat
"
|
||||
AdditionalDependencies=""
|
||||
Outputs="$(IntDir)\patcher.out"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -0,0 +1,49 @@
|
|||
Index: webframe.h
|
||||
===================================================================
|
||||
--- webframe.h (revision 21529)
|
||||
+++ webframe.h (working copy)
|
||||
@@ -404,6 +404,11 @@
|
||||
// size.
|
||||
virtual int PrintBegin(const WebKit::WebSize& page_size) = 0;
|
||||
|
||||
+ // Returns the page shrinking factor calculated by webkit (usually between
|
||||
+ // 1/1.25 and 1/2). Returns 0 if the page number is invalid or not in printing
|
||||
+ // mode.
|
||||
+ virtual float GetPrintPageShrink(int page) = 0;
|
||||
+
|
||||
// Prints one page, and returns the calculated page shrinking factor (usually
|
||||
// between 1/1.25 and 1/2). Returns 0 if the page number is invalid or not
|
||||
// in printing mode.
|
||||
Index: webframe_impl.cc
|
||||
===================================================================
|
||||
--- webframe_impl.cc (revision 21529)
|
||||
+++ webframe_impl.cc (working copy)
|
||||
@@ -1766,6 +1766,16 @@
|
||||
return print_context_->pageCount();
|
||||
}
|
||||
|
||||
+float WebFrameImpl::GetPrintPageShrink(int page) {
|
||||
+ // Ensure correct state.
|
||||
+ if (!print_context_.get() || page < 0) {
|
||||
+ NOTREACHED();
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return print_context_->getPageShrink(page);
|
||||
+}
|
||||
+
|
||||
float WebFrameImpl::PrintPage(int page, WebCanvas* canvas) {
|
||||
// Ensure correct state.
|
||||
if (!print_context_.get() || page < 0 || !frame() || !frame()->document()) {
|
||||
Index: webframe_impl.h
|
||||
===================================================================
|
||||
--- webframe_impl.h (revision 21529)
|
||||
+++ webframe_impl.h (working copy)
|
||||
@@ -195,6 +195,7 @@
|
||||
virtual WebKit::WebSize ScrollOffset() const;
|
||||
|
||||
virtual int PrintBegin(const WebKit::WebSize& page_size);
|
||||
+ virtual float GetPrintPageShrink(int page);
|
||||
virtual float PrintPage(int page, WebKit::WebCanvas* canvas);
|
||||
virtual void PrintEnd();
|
||||
|
|
@ -30,6 +30,13 @@ BOOL InitInstance(HINSTANCE, int);
|
|||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
// Convert a std::string to a std::wstring
|
||||
std::wstring StringToWString(const std::string& s)
|
||||
{
|
||||
std::wstring temp(s.length(),L' ');
|
||||
std::copy(s.begin(), s.end(), temp.begin());
|
||||
return temp;
|
||||
}
|
||||
|
||||
// Implementation of the V8 handler class for the "cef.test" extension.
|
||||
class ClientV8ExtensionHandler : public CefThreadSafeBase<CefV8Handler>
|
||||
|
@ -487,7 +494,7 @@ public:
|
|||
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
{
|
||||
if(!frame.get())
|
||||
if(!browser->IsPopup() && !frame.get())
|
||||
{
|
||||
Lock();
|
||||
// We've just started loading a page
|
||||
|
@ -507,7 +514,7 @@ public:
|
|||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
{
|
||||
if(!frame.get())
|
||||
if(!browser->IsPopup() && !frame.get())
|
||||
{
|
||||
Lock();
|
||||
// We've just finished loading a page
|
||||
|
@ -568,7 +575,58 @@ public:
|
|||
int loadFlags)
|
||||
{
|
||||
std::wstring url = request->GetURL();
|
||||
if(wcsstr(url.c_str(), L"logo.gif") != NULL) {
|
||||
if(url == L"http://tests/request") {
|
||||
// Show the request contents
|
||||
std::wstringstream ss;
|
||||
|
||||
ss << L"URL: " << url;
|
||||
ss << L"\nMethod: " << request->GetMethod();
|
||||
|
||||
CefRequest::HeaderMap headerMap;
|
||||
request->GetHeaderMap(headerMap);
|
||||
if(headerMap.size() > 0) {
|
||||
ss << L"\nHeaders:";
|
||||
CefRequest::HeaderMap::const_iterator it = headerMap.begin();
|
||||
for(; it != headerMap.end(); ++it) {
|
||||
ss << L"\n\t" << (*it).first << L": " << (*it).second;
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefPostData> postData = request->GetPostData();
|
||||
if(postData.get()) {
|
||||
CefPostData::ElementVector elements;
|
||||
postData->GetElements(elements);
|
||||
if(elements.size() > 0) {
|
||||
ss << L"\nPost Data:";
|
||||
CefRefPtr<CefPostDataElement> element;
|
||||
CefPostData::ElementVector::const_iterator it = elements.begin();
|
||||
for(; it != elements.end(); ++it) {
|
||||
element = (*it);
|
||||
if(element->GetType() == PDE_TYPE_BYTES) {
|
||||
// the element is composed of bytes
|
||||
ss << L"\n\tBytes: ";
|
||||
if(element->GetBytesCount() == 0)
|
||||
ss << L"(empty)";
|
||||
else {
|
||||
// retrieve the data.
|
||||
size_t size = element->GetBytesCount();
|
||||
char* bytes = new char[size];
|
||||
element->GetBytes(size, bytes);
|
||||
ss << StringToWString(std::string(bytes, size));
|
||||
delete [] bytes;
|
||||
}
|
||||
} else if(element->GetType() == PDE_TYPE_FILE) {
|
||||
ss << L"\n\tFile: " << element->GetFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring str = ss.str();
|
||||
resourceStream = CefStreamReader::CreateForData(
|
||||
(void*)str.c_str(), str.size() * sizeof(wchar_t));
|
||||
mimeType = L"text/plain";
|
||||
} else if(wcsstr(url.c_str(), L"logo.gif") != NULL) {
|
||||
// Any time we find "logo.gif" in the URL substitute in our own image
|
||||
DWORD dwSize;
|
||||
LPBYTE pBytes;
|
||||
|
@ -815,8 +873,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
wchar_t strPtr[MAX_URL_LENGTH] = {0};
|
||||
*((LPWORD)strPtr) = MAX_URL_LENGTH;
|
||||
LRESULT strLen = SendMessage(hWnd, EM_GETLINE, 0, (LPARAM)strPtr);
|
||||
if (strLen > 0)
|
||||
if (strLen > 0) {
|
||||
strPtr[strLen] = 0;
|
||||
browser->GetMainFrame()->LoadURL(strPtr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1021,6 +1081,35 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
L"about:blank", 0);
|
||||
}
|
||||
return 0;
|
||||
case ID_TESTS_REQUEST: // Test a request
|
||||
if(browser.get())
|
||||
{
|
||||
// Create a new request
|
||||
CefRefPtr<CefRequest> request(CefRequest::CreateRequest());
|
||||
|
||||
// Set the request URL
|
||||
request->SetURL(L"http://tests/request");
|
||||
|
||||
// Add post data to the request. The correct method and content-
|
||||
// type headers will be set by CEF.
|
||||
CefRefPtr<CefPostDataElement> postDataElement(
|
||||
CefPostDataElement::CreatePostDataElement());
|
||||
std::string data = "arg1=val1&arg2=val2";
|
||||
postDataElement->SetToBytes(data.length(), data.c_str());
|
||||
CefRefPtr<CefPostData> postData(CefPostData::CreatePostData());
|
||||
postData->AddElement(postDataElement);
|
||||
request->SetPostData(postData);
|
||||
|
||||
// Add a custom header
|
||||
CefRequest::HeaderMap headerMap;
|
||||
headerMap.insert(
|
||||
std::make_pair(L"X-My-Header", L"My Header Value"));
|
||||
request->SetHeaderMap(headerMap);
|
||||
|
||||
// Load the request
|
||||
browser->GetMainFrame()->LoadRequest(request);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -62,6 +62,7 @@ BEGIN
|
|||
MENUITEM "JavaScript Execute", ID_TESTS_JAVASCRIPT_EXECUTE
|
||||
MENUITEM "Plugin", ID_TESTS_PLUGIN
|
||||
MENUITEM "Popup Window", ID_TESTS_POPUP
|
||||
MENUITEM "Request", ID_TESTS_REQUEST
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#define ID_TESTS_JAVASCRIPT_EXECUTE 32773
|
||||
#define ID_TESTS_PLUGIN 32774
|
||||
#define ID_TESTS_POPUP 32775
|
||||
#define ID_TESTS_REQUEST 32776
|
||||
#define IDC_STATIC -1
|
||||
#define IDS_LOGO 1000
|
||||
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
# Copyright (c) 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.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import time
|
||||
|
||||
def read_file(name, normalize = True):
|
||||
""" Function for reading a file. """
|
||||
try:
|
||||
f = open(name, 'r')
|
||||
# read the data
|
||||
data = f.read()
|
||||
if normalize:
|
||||
# normalize line endings
|
||||
data = data.replace("\r\n", "\n")
|
||||
return data
|
||||
except IOError, (errno, strerror):
|
||||
sys.stderr.write('Failed to read file '+filename+': '+strerror)
|
||||
raise
|
||||
else:
|
||||
f.close()
|
||||
|
||||
def write_file(name, data):
|
||||
""" Function for writing a file. """
|
||||
try:
|
||||
f = open(name, 'w')
|
||||
# write the data
|
||||
f.write(data)
|
||||
except IOError, (errno, strerror):
|
||||
sys.stderr.write('Failed to write file '+name+': '+strerror)
|
||||
raise
|
||||
else:
|
||||
f.close()
|
||||
|
||||
def file_exists(name):
|
||||
""" Returns true if the file currently exists. """
|
||||
return os.path.exists(name)
|
||||
|
||||
def backup_file(name):
|
||||
""" Renames the file to a name that includes the current time stamp. """
|
||||
shutil.move(name, name+'.'+time.strftime('%Y-%m-%d-%H-%M-%S'))
|
|
@ -0,0 +1,551 @@
|
|||
""" Patch utility to apply unified diffs """
|
||||
""" Brute-force line-by-line parsing
|
||||
|
||||
Project home: http://code.google.com/p/python-patch/
|
||||
|
||||
This file is subject to the MIT license available here:
|
||||
http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
CEF Changes
|
||||
-----------
|
||||
|
||||
2009/07/22
|
||||
- Add a 'root_directory' argument to PatchInfo::apply
|
||||
- Fix a Python 2.4 compile error in PatchInfo::parse_stream
|
||||
|
||||
"""
|
||||
|
||||
__author__ = "techtonik.rainforce.org"
|
||||
__version__ = "8.12-1"
|
||||
|
||||
import copy
|
||||
import logging
|
||||
import re
|
||||
# cStringIO doesn't support unicode in 2.5
|
||||
from StringIO import StringIO
|
||||
from logging import debug, info, warning
|
||||
|
||||
from os.path import exists, isfile
|
||||
from os import unlink
|
||||
|
||||
debugmode = False
|
||||
|
||||
|
||||
def from_file(filename):
|
||||
""" read and parse patch file
|
||||
return PatchInfo() object
|
||||
"""
|
||||
|
||||
info("reading patch from file %s" % filename)
|
||||
fp = open(filename, "rb")
|
||||
patch = PatchInfo(fp)
|
||||
fp.close()
|
||||
return patch
|
||||
|
||||
|
||||
def from_string(s):
|
||||
""" parse text string and return PatchInfo() object """
|
||||
return PatchInfo(
|
||||
StringIO.StringIO(s)
|
||||
)
|
||||
|
||||
|
||||
class HunkInfo(object):
|
||||
""" parsed hunk data (hunk starts with @@ -R +R @@) """
|
||||
|
||||
def __init__(self):
|
||||
# define HunkInfo data members
|
||||
self.startsrc=None
|
||||
self.linessrc=None
|
||||
self.starttgt=None
|
||||
self.linestgt=None
|
||||
self.invalid=False
|
||||
self.text=[]
|
||||
|
||||
def copy(self):
|
||||
return copy.copy(self)
|
||||
|
||||
# def apply(self, estream):
|
||||
# """ write hunk data into enumerable stream
|
||||
# return strings one by one until hunk is
|
||||
# over
|
||||
#
|
||||
# enumerable stream are tuples (lineno, line)
|
||||
# where lineno starts with 0
|
||||
# """
|
||||
# pass
|
||||
|
||||
|
||||
|
||||
|
||||
class PatchInfo(object):
|
||||
""" patch information container """
|
||||
|
||||
def __init__(self, stream=None):
|
||||
""" parse incoming stream """
|
||||
|
||||
# define PatchInfo data members
|
||||
# table with a row for every source file
|
||||
|
||||
#: list of source filenames
|
||||
self.source=None
|
||||
self.target=None
|
||||
#: list of lists of hunks
|
||||
self.hunks=None
|
||||
#: file endings statistics for every hunk
|
||||
self.hunkends=None
|
||||
|
||||
if stream:
|
||||
self.parse_stream(stream)
|
||||
|
||||
def copy(self):
|
||||
return copy.copy(self)
|
||||
|
||||
def parse_stream(self, stream):
|
||||
""" parse unified diff """
|
||||
self.source = []
|
||||
self.target = []
|
||||
self.hunks = []
|
||||
self.hunkends = []
|
||||
|
||||
# define possible file regions that will direct the parser flow
|
||||
header = False # comments before the patch body
|
||||
filenames = False # lines starting with --- and +++
|
||||
|
||||
hunkhead = False # @@ -R +R @@ sequence
|
||||
hunkbody = False #
|
||||
hunkskip = False # skipping invalid hunk mode
|
||||
|
||||
header = True
|
||||
lineends = dict(lf=0, crlf=0, cr=0)
|
||||
nextfileno = 0
|
||||
nexthunkno = 0 #: even if index starts with 0 user messages number hunks from 1
|
||||
|
||||
# hunkinfo holds parsed values, hunkactual - calculated
|
||||
hunkinfo = HunkInfo()
|
||||
hunkactual = dict(linessrc=None, linestgt=None)
|
||||
|
||||
fe = enumerate(stream)
|
||||
for lineno, line in fe:
|
||||
|
||||
# analyze state
|
||||
if header and line.startswith("--- "):
|
||||
header = False
|
||||
# switch to filenames state
|
||||
filenames = True
|
||||
#: skip hunkskip and hunkbody code until you read definition of hunkhead
|
||||
if hunkbody:
|
||||
# process line first
|
||||
if re.match(r"^[- \+\\]", line):
|
||||
# gather stats about line endings
|
||||
if line.endswith("\r\n"):
|
||||
self.hunkends[nextfileno-1]["crlf"] += 1
|
||||
elif line.endswith("\n"):
|
||||
self.hunkends[nextfileno-1]["lf"] += 1
|
||||
elif line.endswith("\r"):
|
||||
self.hunkends[nextfileno-1]["cr"] += 1
|
||||
|
||||
if line.startswith("-"):
|
||||
hunkactual["linessrc"] += 1
|
||||
elif line.startswith("+"):
|
||||
hunkactual["linestgt"] += 1
|
||||
elif not line.startswith("\\"):
|
||||
hunkactual["linessrc"] += 1
|
||||
hunkactual["linestgt"] += 1
|
||||
hunkinfo.text.append(line)
|
||||
# todo: handle \ No newline cases
|
||||
else:
|
||||
warning("invalid hunk no.%d at %d for target file %s" % (nexthunkno, lineno+1, self.target[nextfileno-1]))
|
||||
# add hunk status node
|
||||
self.hunks[nextfileno-1].append(hunkinfo.copy())
|
||||
self.hunks[nextfileno-1][nexthunkno-1]["invalid"] = True
|
||||
# switch to hunkskip state
|
||||
hunkbody = False
|
||||
hunkskip = True
|
||||
|
||||
# check exit conditions
|
||||
if hunkactual["linessrc"] > hunkinfo.linessrc or hunkactual["linestgt"] > hunkinfo.linestgt:
|
||||
warning("extra hunk no.%d lines at %d for target %s" % (nexthunkno, lineno+1, self.target[nextfileno-1]))
|
||||
# add hunk status node
|
||||
self.hunks[nextfileno-1].append(hunkinfo.copy())
|
||||
self.hunks[nextfileno-1][nexthunkno-1]["invalid"] = True
|
||||
# switch to hunkskip state
|
||||
hunkbody = False
|
||||
hunkskip = True
|
||||
elif hunkinfo.linessrc == hunkactual["linessrc"] and hunkinfo.linestgt == hunkactual["linestgt"]:
|
||||
self.hunks[nextfileno-1].append(hunkinfo.copy())
|
||||
# switch to hunkskip state
|
||||
hunkbody = False
|
||||
hunkskip = True
|
||||
|
||||
# detect mixed window/unix line ends
|
||||
ends = self.hunkends[nextfileno-1]
|
||||
if ((ends["cr"]!=0) + (ends["crlf"]!=0) + (ends["lf"]!=0)) > 1:
|
||||
warning("inconsistent line ends in patch hunks for %s" % self.source[nextfileno-1])
|
||||
if debugmode:
|
||||
debuglines = dict(ends)
|
||||
debuglines.update(file=self.target[nextfileno-1], hunk=nexthunkno)
|
||||
debug("crlf: %(crlf)d lf: %(lf)d cr: %(cr)d\t - file: %(file)s hunk: %(hunk)d" % debuglines)
|
||||
|
||||
if hunkskip:
|
||||
match = re.match("^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))?", line)
|
||||
if match:
|
||||
# switch to hunkhead state
|
||||
hunkskip = False
|
||||
hunkhead = True
|
||||
elif line.startswith("--- "):
|
||||
# switch to filenames state
|
||||
hunkskip = False
|
||||
filenames = True
|
||||
if debugmode and len(self.source) > 0:
|
||||
debug("- %2d hunks for %s" % (len(self.hunks[nextfileno-1]), self.source[nextfileno-1]))
|
||||
|
||||
if filenames:
|
||||
if line.startswith("--- "):
|
||||
if nextfileno in self.source:
|
||||
warning("skipping invalid patch for %s" % self.source[nextfileno])
|
||||
del self.source[nextfileno]
|
||||
# double source filename line is encountered
|
||||
# attempt to restart from this second line
|
||||
re_filename = "^--- ([^\t]+)"
|
||||
match = re.match(re_filename, line)
|
||||
if not match:
|
||||
warning("skipping invalid filename at line %d" % lineno)
|
||||
# switch back to header state
|
||||
filenames = False
|
||||
header = True
|
||||
else:
|
||||
self.source.append(match.group(1))
|
||||
elif not line.startswith("+++ "):
|
||||
if nextfileno in self.source:
|
||||
warning("skipping invalid patch with no target for %s" % self.source[nextfileno])
|
||||
del self.source[nextfileno]
|
||||
else:
|
||||
# this should be unreachable
|
||||
warning("skipping invalid target patch")
|
||||
filenames = False
|
||||
header = True
|
||||
else:
|
||||
if nextfileno in self.target:
|
||||
warning("skipping invalid patch - double target at line %d" % lineno)
|
||||
del self.source[nextfileno]
|
||||
del self.target[nextfileno]
|
||||
nextfileno -= 1
|
||||
# double target filename line is encountered
|
||||
# switch back to header state
|
||||
filenames = False
|
||||
header = True
|
||||
else:
|
||||
re_filename = "^\+\+\+ ([^\t]+)"
|
||||
match = re.match(re_filename, line)
|
||||
if not match:
|
||||
warning("skipping invalid patch - no target filename at line %d" % lineno)
|
||||
# switch back to header state
|
||||
filenames = False
|
||||
header = True
|
||||
else:
|
||||
self.target.append(match.group(1))
|
||||
nextfileno += 1
|
||||
# switch to hunkhead state
|
||||
filenames = False
|
||||
hunkhead = True
|
||||
nexthunkno = 0
|
||||
self.hunks.append([])
|
||||
self.hunkends.append(lineends.copy())
|
||||
continue
|
||||
|
||||
|
||||
if hunkhead:
|
||||
match = re.match("^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))?", line)
|
||||
if not match:
|
||||
if nextfileno-1 not in self.hunks:
|
||||
warning("skipping invalid patch with no hunks for file %s" % self.target[nextfileno-1])
|
||||
# switch to header state
|
||||
hunkhead = False
|
||||
header = True
|
||||
continue
|
||||
else:
|
||||
# switch to header state
|
||||
hunkhead = False
|
||||
header = True
|
||||
else:
|
||||
hunkinfo.startsrc = int(match.group(1))
|
||||
if match.group(3):
|
||||
hunkinfo.linessrc = int(match.group(3))
|
||||
else:
|
||||
hunkinfo.linessrc = 1
|
||||
hunkinfo.starttgt = int(match.group(4))
|
||||
if match.group(6):
|
||||
hunkinfo.linestgt = int(match.group(6))
|
||||
else:
|
||||
hunkinfo.linestgt = 1
|
||||
hunkinfo.invalid = False
|
||||
hunkinfo.text = []
|
||||
|
||||
hunkactual["linessrc"] = hunkactual["linestgt"] = 0
|
||||
|
||||
# switch to hunkbody state
|
||||
hunkhead = False
|
||||
hunkbody = True
|
||||
nexthunkno += 1
|
||||
continue
|
||||
else:
|
||||
if not hunkskip:
|
||||
warning("patch file incomplete - %s" % filename)
|
||||
# sys.exit(?)
|
||||
else:
|
||||
# duplicated message when an eof is reached
|
||||
if debugmode and len(self.source) > 0:
|
||||
debug("- %2d hunks for %s" % (len(self.hunks[nextfileno-1]), self.source[nextfileno-1]))
|
||||
|
||||
info("total files: %d total hunks: %d" % (len(self.source), sum(len(hset) for hset in self.hunks)))
|
||||
|
||||
def apply(self, root_directory = None):
|
||||
""" apply parsed patch """
|
||||
|
||||
total = len(self.source)
|
||||
for fileno, filename in enumerate(self.source):
|
||||
|
||||
f2patch = filename
|
||||
if not root_directory is None:
|
||||
f2patch = root_directory + f2patch
|
||||
if not exists(f2patch):
|
||||
f2patch = self.target[fileno]
|
||||
if not exists(f2patch):
|
||||
warning("source/target file does not exist\n--- %s\n+++ %s" % (filename, f2patch))
|
||||
continue
|
||||
if not isfile(f2patch):
|
||||
warning("not a file - %s" % f2patch)
|
||||
continue
|
||||
filename = f2patch
|
||||
|
||||
info("processing %d/%d:\t %s" % (fileno+1, total, filename))
|
||||
|
||||
# validate before patching
|
||||
f2fp = open(filename)
|
||||
hunkno = 0
|
||||
hunk = self.hunks[fileno][hunkno]
|
||||
hunkfind = []
|
||||
hunkreplace = []
|
||||
validhunks = 0
|
||||
canpatch = False
|
||||
for lineno, line in enumerate(f2fp):
|
||||
if lineno+1 < hunk.startsrc:
|
||||
continue
|
||||
elif lineno+1 == hunk.startsrc:
|
||||
hunkfind = [x[1:].rstrip("\r\n") for x in hunk.text if x[0] in " -"]
|
||||
hunkreplace = [x[1:].rstrip("\r\n") for x in hunk.text if x[0] in " +"]
|
||||
#pprint(hunkreplace)
|
||||
hunklineno = 0
|
||||
|
||||
# todo \ No newline at end of file
|
||||
|
||||
# check hunks in source file
|
||||
if lineno+1 < hunk.startsrc+len(hunkfind)-1:
|
||||
if line.rstrip("\r\n") == hunkfind[hunklineno]:
|
||||
hunklineno+=1
|
||||
else:
|
||||
debug("hunk no.%d doesn't match source file %s" % (hunkno+1, filename))
|
||||
# file may be already patched, but we will check other hunks anyway
|
||||
hunkno += 1
|
||||
if hunkno < len(self.hunks[fileno]):
|
||||
hunk = self.hunks[fileno][hunkno]
|
||||
continue
|
||||
else:
|
||||
break
|
||||
|
||||
# check if processed line is the last line
|
||||
if lineno+1 == hunk.startsrc+len(hunkfind)-1:
|
||||
debug("file %s hunk no.%d -- is ready to be patched" % (filename, hunkno+1))
|
||||
hunkno+=1
|
||||
validhunks+=1
|
||||
if hunkno < len(self.hunks[fileno]):
|
||||
hunk = self.hunks[fileno][hunkno]
|
||||
else:
|
||||
if validhunks == len(self.hunks[fileno]):
|
||||
# patch file
|
||||
canpatch = True
|
||||
break
|
||||
else:
|
||||
if hunkno < len(self.hunks[fileno]):
|
||||
warning("premature end of source file %s at hunk %d" % (filename, hunkno+1))
|
||||
|
||||
f2fp.close()
|
||||
|
||||
if validhunks < len(self.hunks[fileno]):
|
||||
if check_patched(filename, self.hunks[fileno]):
|
||||
warning("already patched %s" % filename)
|
||||
else:
|
||||
warning("source file is different - %s" % filename)
|
||||
if canpatch:
|
||||
backupname = filename+".orig"
|
||||
if exists(backupname):
|
||||
warning("can't backup original file to %s - aborting" % backupname)
|
||||
else:
|
||||
import shutil
|
||||
shutil.move(filename, backupname)
|
||||
if patch_hunks(backupname, filename, self.hunks[fileno]):
|
||||
warning("successfully patched %s" % filename)
|
||||
unlink(backupname)
|
||||
else:
|
||||
warning("error patching file %s" % filename)
|
||||
shutil.copy(filename, filename+".invalid")
|
||||
warning("invalid version is saved to %s" % filename+".invalid")
|
||||
# todo: proper rejects
|
||||
shutil.move(backupname, filename)
|
||||
|
||||
# todo: check for premature eof
|
||||
|
||||
|
||||
|
||||
def check_patched(filename, hunks):
|
||||
matched = True
|
||||
fp = open(filename)
|
||||
|
||||
class NoMatch(Exception):
|
||||
pass
|
||||
|
||||
lineno = 1
|
||||
line = fp.readline()
|
||||
hno = None
|
||||
try:
|
||||
if not len(line):
|
||||
raise NoMatch
|
||||
for hno, h in enumerate(hunks):
|
||||
# skip to line just before hunk starts
|
||||
while lineno < h.starttgt-1:
|
||||
line = fp.readline()
|
||||
lineno += 1
|
||||
if not len(line):
|
||||
raise NoMatch
|
||||
for hline in h.text:
|
||||
# todo: \ No newline at the end of file
|
||||
if not hline.startswith("-") and not hline.startswith("\\"):
|
||||
line = fp.readline()
|
||||
lineno += 1
|
||||
if not len(line):
|
||||
raise NoMatch
|
||||
if line.rstrip("\r\n") != hline[1:].rstrip("\r\n"):
|
||||
warning("file is not patched - failed hunk: %d" % (hno+1))
|
||||
raise NoMatch
|
||||
except NoMatch:
|
||||
matched = False
|
||||
# todo: display failed hunk, i.e. expected/found
|
||||
|
||||
fp.close()
|
||||
return matched
|
||||
|
||||
|
||||
|
||||
def patch_stream(instream, hunks):
|
||||
""" given a source stream and hunks iterable, yield patched stream
|
||||
|
||||
converts lineends in hunk lines to the best suitable format
|
||||
autodetected from input
|
||||
"""
|
||||
|
||||
# todo: At the moment substituted lineends may not be the same
|
||||
# at the start and at the end of patching. Also issue a
|
||||
# warning/throw about mixed lineends (is it really needed?)
|
||||
|
||||
hunks = iter(hunks)
|
||||
|
||||
srclineno = 1
|
||||
|
||||
lineends = {'\n':0, '\r\n':0, '\r':0}
|
||||
def get_line():
|
||||
"""
|
||||
local utility function - return line from source stream
|
||||
collecting line end statistics on the way
|
||||
"""
|
||||
line = instream.readline()
|
||||
# 'U' mode works only with text files
|
||||
if line.endswith("\r\n"):
|
||||
lineends["\r\n"] += 1
|
||||
elif line.endswith("\n"):
|
||||
lineends["\n"] += 1
|
||||
elif line.endswith("\r"):
|
||||
lineends["\r"] += 1
|
||||
return line
|
||||
|
||||
|
||||
for hno, h in enumerate(hunks):
|
||||
debug("hunk %d" % (hno+1))
|
||||
# skip to line just before hunk starts
|
||||
while srclineno < h.startsrc:
|
||||
yield get_line()
|
||||
srclineno += 1
|
||||
|
||||
for hline in h.text:
|
||||
# todo: check \ No newline at the end of file
|
||||
if hline.startswith("-") or hline.startswith("\\"):
|
||||
get_line()
|
||||
srclineno += 1
|
||||
continue
|
||||
else:
|
||||
if not hline.startswith("+"):
|
||||
get_line()
|
||||
srclineno += 1
|
||||
line2write = hline[1:]
|
||||
# detect if line ends are consistent in source file
|
||||
if sum([bool(lineends[x]) for x in lineends]) == 1:
|
||||
newline = [x for x in lineends if lineends[x] != 0][0]
|
||||
yield line2write.rstrip("\r\n")+newline
|
||||
else: # newlines are mixed
|
||||
yield line2write
|
||||
|
||||
for line in instream:
|
||||
yield line
|
||||
|
||||
|
||||
|
||||
def patch_hunks(srcname, tgtname, hunks):
|
||||
src = open(srcname, "rb")
|
||||
tgt = open(tgtname, "wb")
|
||||
|
||||
debug("processing target file %s" % tgtname)
|
||||
|
||||
tgt.writelines(patch_stream(src, hunks))
|
||||
|
||||
tgt.close()
|
||||
src.close()
|
||||
return True
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
from optparse import OptionParser
|
||||
from os.path import exists
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
opt = OptionParser(usage="%prog [options] unipatch-file", version="python-patch %s" % __version__)
|
||||
opt.add_option("-d", action="store_true", dest="debugmode", help="debug mode")
|
||||
(options, args) = opt.parse_args()
|
||||
|
||||
if not args:
|
||||
opt.print_version()
|
||||
print("")
|
||||
opt.print_help()
|
||||
sys.exit()
|
||||
debugmode = options.debugmode
|
||||
patchfile = args[0]
|
||||
if not exists(patchfile) or not isfile(patchfile):
|
||||
sys.exit("patch file does not exist - %s" % patchfile)
|
||||
|
||||
|
||||
if debugmode:
|
||||
logging.basicConfig(level=logging.DEBUG, format="%(levelname)8s %(message)s")
|
||||
else:
|
||||
logging.basicConfig(level=logging.INFO, format="%(message)s")
|
||||
|
||||
|
||||
|
||||
patch = from_file(patchfile)
|
||||
#pprint(patch)
|
||||
patch.apply()
|
||||
|
||||
# todo: document and test line ends handling logic - patch.py detects proper line-endings
|
||||
# for inserted hunks and issues a warning if patched file has incosistent line ends
|
|
@ -0,0 +1,32 @@
|
|||
Chromium Embedded Framework (CEF) Patch Application Tool -- patcher.py
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Document Last Updated: July 23, 2009
|
||||
|
||||
|
||||
OVERVIEW
|
||||
--------
|
||||
|
||||
The CEF patch application tool is used by the patch project to apply patches
|
||||
to the Chromium and WebKit code bases. Currently only unified diff format is
|
||||
supported. See the README.txt file in the patch directory for information on
|
||||
how the patch project uses this tool.
|
||||
|
||||
The 'patcher.bat' file can be used to run the patch application tool with
|
||||
command-line arguments that match the default CEF directory structure and
|
||||
output options. Run 'patcher.py -h' for a complete list of available command-
|
||||
line arguments.
|
||||
|
||||
|
||||
CREDITS
|
||||
-------
|
||||
|
||||
Thanks go to techtonik for developing the python-patch script. The
|
||||
patch_util.py file is a slightly modified version of the original script which
|
||||
can be found here: http://code.google.com/p/python-patch/
|
||||
|
||||
|
||||
WORK REMAINING
|
||||
--------------
|
||||
|
||||
o Add support for the GIT patch format.
|
|
@ -0,0 +1,2 @@
|
|||
@echo off
|
||||
..\..\third_party\python_24\python.exe ..\tools\patcher.py --patch-dir ../patch/
|
|
@ -0,0 +1,90 @@
|
|||
# Copyright (c) 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.
|
||||
|
||||
import pickle
|
||||
from optparse import OptionParser
|
||||
from os.path import isfile
|
||||
import sys
|
||||
from file_util import *
|
||||
from patch_util import *
|
||||
|
||||
|
||||
# cannot be loaded as a module
|
||||
if __name__ != "__main__":
|
||||
sys.stderr.write('This file cannot be loaded as a module!')
|
||||
sys.exit()
|
||||
|
||||
|
||||
# parse command-line options
|
||||
disc = """
|
||||
This utility applies patch files.
|
||||
"""
|
||||
|
||||
parser = OptionParser(description=disc)
|
||||
parser.add_option('--patch-dir', dest='patchdir', metavar='DIR',
|
||||
help='source directory for patch files')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# the patchdir option is required
|
||||
if options.patchdir is None:
|
||||
parser.print_help(sys.stdout)
|
||||
sys.exit()
|
||||
|
||||
# normalize the directory value
|
||||
patchdir = options.patchdir.replace('\\', '/')
|
||||
if patchdir[-1] != '/':
|
||||
patchdir += '/'
|
||||
|
||||
# check if the patching should be skipped
|
||||
if isfile(patchdir + 'NOPATCH'):
|
||||
nopatch = True
|
||||
sys.stdout.write('NOPATCH exists -- files have not been patched.\n')
|
||||
else:
|
||||
nopatch = False
|
||||
# locate the patch configuration file
|
||||
patchcfg = patchdir + 'patch.cfg'
|
||||
if not isfile(patchcfg):
|
||||
sys.stderr.write('File '+patchcfg+' does not exist.\n')
|
||||
sys.exit()
|
||||
|
||||
scope = {}
|
||||
execfile(patchcfg, scope)
|
||||
patches = scope["patches"]
|
||||
|
||||
for name in patches.keys():
|
||||
file = patchdir+'patches/'+name+'.patch'
|
||||
if not isfile(file):
|
||||
sys.stderr.write('Patch file '+file+' does not exist.\n')
|
||||
else:
|
||||
sys.stderr.write('Reading patch file '+file+'\n')
|
||||
dir = patches[name]
|
||||
patchObj = from_file(file)
|
||||
patchObj.apply(dir)
|
||||
|
||||
# read the current include file, if any
|
||||
incfile = patchdir + 'patch_state.h'
|
||||
if nopatch:
|
||||
incnew = """// This file is generated by the patch tool and should not be edited manually.
|
||||
#ifndef _PATCH_STATE_H
|
||||
#define _PATCH_STATE_H
|
||||
// No patches have been applied to the Chromium/WebKit source base.
|
||||
#define CEF_PATCHES_APPLIED 0
|
||||
#endif // _PATCH_STATE_H
|
||||
"""
|
||||
else:
|
||||
incnew = """// This file is generated by the patch tool and should not be edited manually.
|
||||
#ifndef _PATCH_STATE_H
|
||||
#define _PATCH_STATE_H
|
||||
// Patches have been applied to the Chromium/WebKit source base.
|
||||
#define CEF_PATCHES_APPLIED 1
|
||||
#endif // _PATCH_STATE_H
|
||||
"""
|
||||
|
||||
inccur = ''
|
||||
if isfile(incfile):
|
||||
inccur = read_file(incfile)
|
||||
|
||||
if inccur != incnew:
|
||||
sys.stdout.write('Writing file '+incfile+'.\n')
|
||||
write_file(incfile, incnew)
|
Loading…
Reference in New Issue