Ubuntu/Debian Instructions
To start with, the package ia32-libs contains binaries needed to run 32-bit software in /usr/lib32. But there is no accompanying ia32-libs-dev package. You can work around it by:
Installing the 64-bit -dev package to get the headers.
Setting up ia32-libs symlinks in /usr/lib32 to make the linker happy.
Manually installing some 32-bit libraries as well.
For the second step, a recipe like the following (as root) does the trick:
cd /usr/lib32
for lib in gdk-x11-2.0 atk-1.0 gdk_pixbuf-2.0 \
pangocairo-1.0 pango-1.0 pangoft2-1.0 \
gobject-2.0 gmodule-2.0 glib-2.0 gtk-x11-2.0; do
ln -s -f lib$lib.so.0 lib$lib.so
done
ln -s -f libcairo.so.2 libcairo.so
ln -s -f libfreetype.so.6 libfreetype.so
ln -s -f libz.so.1 libz.so
ln -s -f libfontconfig.so.1 libfontconfig.so
Now, we need to manually install some 32-bit libraries that Ubuntu doesn't have packaged. I put them into /usr/local/lib32, and then told ldconfig to look there for more libraries, so that my manually installed ones wouldn't get mixed up with the package installed ones in /lib32 and /usr/lib32.
mkdir /usr/local/lib32
echo "/usr/local/lib32" > /etc/ld.so.conf.d/local-32.conf
For each of the following libraries, you need to:
download the i386 package from packages.ubuntu.com.
unpack the package to get at the contained library files (I usually just use 7zip).
move the files that the package would put in /usr/lib into /usr/local/lib32
create symlinks to the libraries' base names.
The libraries you need are libnss3-1d, libnspr4-0d, and. As an example, to set up libsnpr4, you would:
7z x libnspr4*deb
tar -xzvf data.tar.gz
sudo mv usr/lib/* /usr/local/lib32/
cd /usr/local/lib32
sudo ln -s libnspr4.so.0d libnspr4.so
sudo ln -s libplc4.so.0d libplc4.so
sudo ln -s libplds4.so.0d libplds4.so
sudo ldconfig
http://code.google.com/p/chromium/wiki/LinuxBuild64Bit
Saturday, November 1, 2008
Tuesday, September 16, 2008
7 Reasons For and Against Google Chrome
It may be a Canadian election year, and we're not just talking Conservatives and Liberals. The battle of the browsers is getting fierce, and Google wants you to sign up for its campaign.
The first beta of Chrome, Google's long-in-development Internet browser, became available Tuesday afternoon for Windows Vista and XP users, with Mac and Linux editions soon to follow. There's ample reason to be excited about the release, and just as much reason to be wary. Check out these screen shots, weigh the pros and cons, and then decide for yourself.
For further PCWorld.ca coverage of Chrome, see "Google Chrome Web Browser" and "Chrome vs. the World".
Seven Reasons Chrome Could Be Cool
1. It won't crash.
Perhaps Chrome's biggest draw is its multiprocess architecture, which, in a nutshell, protects you from having a bad Web page or application take your browser down. Every tab, window, and plug-in runs in its own environment--so one faulty site won't affect anything else that you have open. This approach also adds another layer of security by isolating each site and application within a limited environment.
2. It's really fast.
Again because of the multiprocess foundation, one slow site won't drag down the rest of your browsing. Instead, you can effortlessly click to another tab or window. With plug-ins, the arrangement works similarly: If you open a site that has a slow-loading Java ad, for example, the Java itself will be isolated and the rest of the page won't be affected. The program itself opens within seconds of when you click the icon, too--a distinct advantage over some slower-loading alternatives.
3. You barely notice it's there.
Calling the design of Chrome's interface streamlined is an understatement. The program barely looks like a program, and the vast majority of your screen space is devoted to the site you're visiting--with no buttons or logos hogging space. Chrome's designers say that they wanted people to forget they were even using a browser, and it comes pretty close to achieving that goal.
4. It makes searching simpler.
One of Chrome's signature features is its Omnibox, an integrated all-purpose bar at the top of the browser. You can type in a URL or a search term--or both--and Chrome takes you to the right place without asking any questions. Omnibox can learn what you like, too--a talent that goes beyond the obvious automatic completion function. Say that you want to use the PCWorld.com search function, for example. Once you've visited the site once, Chrome will remember that PCWorld.com has its own search box and will give you the option of using it right from Omnibox. The function thus automates keyword searches.
5. It gives you more control over tabs.
Chrome gives the idea of tabbed browsing new power. You can grab a tab and drag it out into its own individual window. Or you can drag and drop tabs into existing windows to combine them. Chrome also gives you the option of starting up in any tab configuration you want--whether a custom setup or the set of tabs you had open in your previous session. Other browsers require third-party add-ons to provide this capability.
6. It opens new doors on your home page.
Chrome comes with a default dynamic home page. As you use it, the program remembers the sites that you visit most often. The top nine of those appear in snapshots on your home page, along with your most commonly used search engines and bookmarks. There's no force-feeding here, though: You can override the dynamic home page with any home page you want, just as you can set the default search engine to any service you prefer.
7. It lets you stay incognito.
Like Internet Explorer 8's recent beta release, Chrome offers a private browsing option--one it calls Incognito. You can open a special type of new window and rest easy knowing nothing you do in it will be logged or saved on your computer. And unlike Internet Explorer's, Chrome's Incognito window is isolated from the rest of your browsing experience, so you can have your private window open alongside your regular windows, and each will operate independently.
The first beta of Chrome, Google's long-in-development Internet browser, became available Tuesday afternoon for Windows Vista and XP users, with Mac and Linux editions soon to follow. There's ample reason to be excited about the release, and just as much reason to be wary. Check out these screen shots, weigh the pros and cons, and then decide for yourself.
For further PCWorld.ca coverage of Chrome, see "Google Chrome Web Browser" and "Chrome vs. the World".
Seven Reasons Chrome Could Be Cool
1. It won't crash.
Perhaps Chrome's biggest draw is its multiprocess architecture, which, in a nutshell, protects you from having a bad Web page or application take your browser down. Every tab, window, and plug-in runs in its own environment--so one faulty site won't affect anything else that you have open. This approach also adds another layer of security by isolating each site and application within a limited environment.
2. It's really fast.
Again because of the multiprocess foundation, one slow site won't drag down the rest of your browsing. Instead, you can effortlessly click to another tab or window. With plug-ins, the arrangement works similarly: If you open a site that has a slow-loading Java ad, for example, the Java itself will be isolated and the rest of the page won't be affected. The program itself opens within seconds of when you click the icon, too--a distinct advantage over some slower-loading alternatives.
3. You barely notice it's there.
Calling the design of Chrome's interface streamlined is an understatement. The program barely looks like a program, and the vast majority of your screen space is devoted to the site you're visiting--with no buttons or logos hogging space. Chrome's designers say that they wanted people to forget they were even using a browser, and it comes pretty close to achieving that goal.
4. It makes searching simpler.
One of Chrome's signature features is its Omnibox, an integrated all-purpose bar at the top of the browser. You can type in a URL or a search term--or both--and Chrome takes you to the right place without asking any questions. Omnibox can learn what you like, too--a talent that goes beyond the obvious automatic completion function. Say that you want to use the PCWorld.com search function, for example. Once you've visited the site once, Chrome will remember that PCWorld.com has its own search box and will give you the option of using it right from Omnibox. The function thus automates keyword searches.
5. It gives you more control over tabs.
Chrome gives the idea of tabbed browsing new power. You can grab a tab and drag it out into its own individual window. Or you can drag and drop tabs into existing windows to combine them. Chrome also gives you the option of starting up in any tab configuration you want--whether a custom setup or the set of tabs you had open in your previous session. Other browsers require third-party add-ons to provide this capability.
6. It opens new doors on your home page.
Chrome comes with a default dynamic home page. As you use it, the program remembers the sites that you visit most often. The top nine of those appear in snapshots on your home page, along with your most commonly used search engines and bookmarks. There's no force-feeding here, though: You can override the dynamic home page with any home page you want, just as you can set the default search engine to any service you prefer.
7. It lets you stay incognito.
Like Internet Explorer 8's recent beta release, Chrome offers a private browsing option--one it calls Incognito. You can open a special type of new window and rest easy knowing nothing you do in it will be logged or saved on your computer. And unlike Internet Explorer's, Chrome's Incognito window is isolated from the rest of your browsing experience, so you can have your private window open alongside your regular windows, and each will operate independently.
Monday, September 15, 2008
64 bit Support
Chromium currently isn't supported by 64-bit platforms. 64-bit support would be nice to do in the future, but there are some hurdles.
Fundamental
* Many binary-only plugins are only available as 32-bit libraries, which means the plugin processes must remain 32-bit. On Linux this is already addressed by nspluginwrapper.
Issues that can more easily be fixed
In descending order of difficulty:
* V8 generates x86 code; it needs to be taught a new architecture. Workaround could be using JSC, but that negates a large benefit of Chromium.
* The Windows Sandbox is very "hardcoded" on the OS structure and native function prototypes. It would require significant work to make 64-bit safe.
* Chromium hasn't been made 64-bit safe. Though it probably isn't too much work, it's not worth doing until the other pieces are in place. This includes making the IPC system cross 64-bit/32-bit compatible for communication with plugins.
* Changing the installer to include both 64- and 32-bit binaries.
* Perhaps other third-party libraries don't work? But most of them are open-source and already work fine on 64-bit Linux.
Source : http://dev.chromium.org/developers/design-documents/64-bit-support
Fundamental
* Many binary-only plugins are only available as 32-bit libraries, which means the plugin processes must remain 32-bit. On Linux this is already addressed by nspluginwrapper.
Issues that can more easily be fixed
In descending order of difficulty:
* V8 generates x86 code; it needs to be taught a new architecture. Workaround could be using JSC, but that negates a large benefit of Chromium.
* The Windows Sandbox is very "hardcoded" on the OS structure and native function prototypes. It would require significant work to make 64-bit safe.
* Chromium hasn't been made 64-bit safe. Though it probably isn't too much work, it's not worth doing until the other pieces are in place. This includes making the IPC system cross 64-bit/32-bit compatible for communication with plugins.
* Changing the installer to include both 64- and 32-bit binaries.
* Perhaps other third-party libraries don't work? But most of them are open-source and already work fine on 64-bit Linux.
Source : http://dev.chromium.org/developers/design-documents/64-bit-support
Labels:
64 bit,
Google Chrome
Thursday, September 11, 2008
Chrome is not supported in Windows 2000
I was participating in a chrome dev forum and was shocked when I stumbled on this.
"Chrome will not be supported in Windows 2000".
If you sit back, relax and give it a thought, probably that's okay not to support Chrome in Windows 2000. There is hell a lot of difference between xp and 2000. There are lots of API which are supported in Windows xp but not in Windows 2000. Assume if we give support to chrome in windows 2000, there will be other platforms which will be affected by this. (The code might become bulkier and the complexity might increase).
So It's a good call by Google not to support Windows 2000.
"Chrome will not be supported in Windows 2000".
If you sit back, relax and give it a thought, probably that's okay not to support Chrome in Windows 2000. There is hell a lot of difference between xp and 2000. There are lots of API which are supported in Windows xp but not in Windows 2000. Assume if we give support to chrome in windows 2000, there will be other platforms which will be affected by this. (The code might become bulkier and the complexity might increase).
So It's a good call by Google not to support Windows 2000.
Labels:
Google Chrome,
support,
Win 2K,
Windows 2000
Wednesday, September 10, 2008
In Chrome every tab is a new process
The best thing which I like about Google Chrome is that every new tab is a new process. The advantage is that if one Window crashes the rest of the window would still continue to work fine.
There are several debates going on around this as to which is the better model. It is like a question "does apples taste good or oranges taste good??" It depends on person to person.
For people who are doing crucial stuffs in different tabs, I would say that Chrome is the best.
screen shot of the task manager showing different processes
There are several debates going on around this as to which is the better model. It is like a question "does apples taste good or oranges taste good??" It depends on person to person.
For people who are doing crucial stuffs in different tabs, I would say that Chrome is the best.
screen shot of the task manager showing different processes
Tuesday, September 9, 2008
Getting around the Google Chrome source code
I had tuff time when I downloaded Chrome on the first day. There wasn't much documentation to help me (or I didn't find this link).
http://dev.chromium.org/developers/how-tos/getting-around-the-chrome-source-code
This is one piece of awesome resource that one needs to start playing with Chrome.
This article explains in detail about the different files in teh source code and their respective logic and funtions.
It is such an extensive resource and i would certainly recommend you to look at it before you go into the code.
http://dev.chromium.org/developers/how-tos/getting-around-the-chrome-source-code
This is one piece of awesome resource that one needs to start playing with Chrome.
This article explains in detail about the different files in teh source code and their respective logic and funtions.
It is such an extensive resource and i would certainly recommend you to look at it before you go into the code.
Labels:
Google Chrome
How to contribute to Chrome
This is the best place to get started if you want to contribute to Chrome.
http://dev.chromium.org/developers/how-tos/getting-started
If you follow the steps mentioned in the link above, you will be ready to compile and play with Chrome.
Trace it, break it and debug it to know more about the internals of Chrome.
Alternate resources :
http://dev.chromium.org/developers
Watch our for my blog, I am planning to discuss few exciting things about internals of Chrome .
http://dev.chromium.org/developers/how-tos/getting-started
If you follow the steps mentioned in the link above, you will be ready to compile and play with Chrome.
Trace it, break it and debug it to know more about the internals of Chrome.
Alternate resources :
http://dev.chromium.org/developers
Watch our for my blog, I am planning to discuss few exciting things about internals of Chrome .
Labels:
How to contribute to Chrome
Write your own plugin for Google Chrome
If you want to write your own plugin for google chrome, this is the place to begin.
My first Google Chrome plugin
I have decided to spend a fair amount of time today on the Google Chrome code. My objective was to understand the functioning of the plugin framework. I have not been able to find any useful information on the web except the Plugin Architecture design document. This article will describe what I have learned and explain how to build a basic plugin that can be tested using the Google Chrome that you have downloaded from the Google website (so no custom modifications required.)
I have found several posts on the web that stated that the Chrome team was working on building the infrastructure that will enable the addition of plugins and extensions. For those who do not yet understand the difference between these two concepts, I will quote Nathan Marz:
Quote:
A software extension in an entity that adds significant unintended functionality to the software.
A software plugin is an entity that adds intended functionality to a plugin in a controlled manner.
But as he rightly adds, "[s]ometimes there is a gray area between these two distinctions." Right now, I don't know enough about Google Chrome to dispute that the difference is merely conceptual. I hope that someone can clarify.
The first thing that I learned is that the current release of Google does not offer the ability to load additional plugins. It seems that Google is planning to offer the ability to add plugins via the registration of these plugins under HKEY_CURRENT_USER\\Software\\Google\\Chrome\\Plugi ns. When Google Chrome starts, it will look at the key Path which seems to be the path of the DLL. There is an additional key (LoadOnStartup) which indicates if the plugin should be loaded during startup (as you might have guessed )
So since this logic is disabled in the current release, how are we going to enable the loading of the plugin that we will build? Well, we will name it gears.dll and replace the existing gears.dll. It is not nice as we might want to use gears.dll as well. Unfortunately, unless the Google Chrome team unable the startup load, we will have to do so. Indeed, it seems that the loading of gears.dll is hardcoded.
Ok, let's build this plugin. As you know, a plugin is not more than a DLL with several functions that have been exported. In the case of Google Chrome, just one function needs to be exported but let's do some boring stuff before starting coding. First, you have to follow the instructions available on dev.chromium.org that indicates how to build Google Chrome. The reason you need to do that is that you will use several of the static libraries that this build will produce when you compile your plugin (base.lib, icuuc.lib and googleurl.lib.)
There is a very important file that describes the Chrome Plugin API. It can be found at "chrome/common/chrome_plugin_api.h". Basically what happen, is that you "implement" this API. There are two sets of functions that needs to be implemented. One set relates to the functions that are offered by the plugin to the browser (the host) - the CPP functions, CPP for Chrome Plug-in: Plug-in Defined, but I am not sure - and the other set relates to the function that are offered by the browser to the plugin - the CPB functions, CPB for Chrome Plug-in: Browser Defined. In other terms the browser tells you: "this is a set of services that I want you to provide me with, I will interact with you via a call to a table of functions which have the following signatures. If you believe that I will need to use a particular service when the plugin is being used, please implement it." Technically, this table is a structure with members that are functions pointer. There is another set of functions which can be implemented by the plugin and/or the browser - the CPR and CPRR functions.
The only function that you need to export is
PHP Code:
CPError STDCALL CP_Initialize(CPID id, const CPBrowserFuncs* bfuncs, CPPluginFuncs* pfuncs)
This function is called by the host when the plugin is being loaded. As you can notice, the browser provides us with the two tables of function pointers. Once we do the mapping, then if the browser needs to interact with the plugin it will used these shared tables.
Our code will make use of two files: test.cpp and test.h (I used Visual Studio 2008.) I have borrowed close to 90% of the code from a chrome plugin file that is part of the source that you downloaded: "chrome/test/chrome_plugin/test_chrome_plugin.h" and "chrome/test/chrome_plugin/test_chrome_plugin.cc".
Let's code the CP_Initialize function:
PHP Code:
test.cpp:
CPError STDCALL CP_Initialize(CPID id, const CPBrowserFuncs* bfuncs,
CPPluginFuncs* pfuncs) {
if (bfuncs == NULL || pfuncs == NULL)
return CPERR_FAILURE;
if (CP_GET_MAJOR_VERSION(bfuncs->version) > CP_MAJOR_VERSION)
return CPERR_INVALID_VERSION;
if (bfuncs->size < sizeof(CPBrowserFuncs) ||
pfuncs->size < sizeof(CPPluginFuncs))
return CPERR_INVALID_VERSION;
CPERR_FAILURE and CPERR_INVALID_VERSION are defined in "chrome/common/chrome_plugin_api.h". They respectively indicate a generic failure and an incompatibility of API version used by the browser and the plugin. I don't think that I need to explain these verifications as they are pretty obvious, let's continue:
PHP Code:
pfuncs->version = CP_VERSION;
pfuncs->shutdown = CPP_Shutdown;
pfuncs->should_intercept_request = CPP_ShouldInterceptRequest;
static CPRequestFuncs request_funcs;
request_funcs.start_request = CPR_StartRequest;
request_funcs.end_request = CPR_EndRequest;
request_funcs.set_extra_request_headers = CPR_SetExtraRequestHeaders;
request_funcs.set_request_load_flags = CPR_SetRequestLoadFlags;
request_funcs.append_data_to_upload = CPR_AppendDataToUpload;
request_funcs.get_response_info = CPR_GetResponseInfo;
request_funcs.read = CPR_Read;
request_funcs.append_file_to_upload = CPR_AppendFileToUpload;
pfuncs->request_funcs = &request_funcs;
static CPResponseFuncs response_funcs;
response_funcs.received_redirect = CPRR_ReceivedRedirect;
response_funcs.start_completed = CPRR_StartCompleted;
response_funcs.read_completed = CPRR_ReadCompleted;
pfuncs->response_funcs = &response_funcs;
g_cpid = id;
g_cpbrowser_funcs = *bfuncs;
g_cprequest_funcs = *bfuncs->request_funcs;
g_cpresponse_funcs = *bfuncs->response_funcs;
g_cpbrowser_funcs = *bfuncs;
We started the mapping of the functions. As you can see, we will only implement two functions among the CPP functions (made available to the host): CPP_Shutdown (called when the browser is unloading the plugin) and CPP_ShouldInterceptRequest (indicates if the plugin is interested in handling a request.) We want to be able to issue some requests via the browser therefore we implement several CPR functions. We will also process several intercepted requests so we implement some CPRR functions. Finally, we store a reference to these structures as we will use them later.
PHP Code:
test.cpp:
const char* protocols[] = {kChromeTestPluginProtocol};
g_cpbrowser_funcs.enable_request_intercept(g_cpid, protocols, 1);
return CPERR_SUCCESS;
We end this function by informing the browser that the plugin wants to intercept a list of protocols. Let's define these protocols in the header file.
PHP Code:
test.h
const char kChromeTestPluginProtocol[] = "cptest";
So let's suppose that a user enters "cptest:sync" in the location bar. The browser knows that the plugin has requested to be able to process these requests. The browser will use our set of CPRR functions. We have implemented three of these functions: CPRR_ReceivedRedirect, CPRR_StartCompleted and CPRR_ReadCompleted. If you read carefully the description of these functions, you will find that it is CPRR_ReceivedRedirect which is then called. Then we read the data: call to CPR_Read which is followed by a call to CPRR_ReadCompleted. We can start issuing our request. I will stop here but I encourage you to use your debugger to understand the sequence of events.
As you can see in the code, the following requests are implemented: cptest:sync, cptest:async and cptest:blank. Once you install the plugin, you should try them. You will find the source code here.
Finally, if you want to see your plugin listed when you type about : plugins in your location bar, do not forget to add a VERSIONINFO Resource.
If you have any question related to this article, you can always reply to this post. Otherwise, use the other forums.
source : http://www.paperfrag.com/showthread.php?p=1
My first Google Chrome plugin
I have decided to spend a fair amount of time today on the Google Chrome code. My objective was to understand the functioning of the plugin framework. I have not been able to find any useful information on the web except the Plugin Architecture design document. This article will describe what I have learned and explain how to build a basic plugin that can be tested using the Google Chrome that you have downloaded from the Google website (so no custom modifications required.)
I have found several posts on the web that stated that the Chrome team was working on building the infrastructure that will enable the addition of plugins and extensions. For those who do not yet understand the difference between these two concepts, I will quote Nathan Marz:
Quote:
A software extension in an entity that adds significant unintended functionality to the software.
A software plugin is an entity that adds intended functionality to a plugin in a controlled manner.
But as he rightly adds, "[s]ometimes there is a gray area between these two distinctions." Right now, I don't know enough about Google Chrome to dispute that the difference is merely conceptual. I hope that someone can clarify.
The first thing that I learned is that the current release of Google does not offer the ability to load additional plugins. It seems that Google is planning to offer the ability to add plugins via the registration of these plugins under HKEY_CURRENT_USER\\Software\\Google\\Chrome\\Plugi ns. When Google Chrome starts, it will look at the key Path which seems to be the path of the DLL. There is an additional key (LoadOnStartup) which indicates if the plugin should be loaded during startup (as you might have guessed )
So since this logic is disabled in the current release, how are we going to enable the loading of the plugin that we will build? Well, we will name it gears.dll and replace the existing gears.dll. It is not nice as we might want to use gears.dll as well. Unfortunately, unless the Google Chrome team unable the startup load, we will have to do so. Indeed, it seems that the loading of gears.dll is hardcoded.
Ok, let's build this plugin. As you know, a plugin is not more than a DLL with several functions that have been exported. In the case of Google Chrome, just one function needs to be exported but let's do some boring stuff before starting coding. First, you have to follow the instructions available on dev.chromium.org that indicates how to build Google Chrome. The reason you need to do that is that you will use several of the static libraries that this build will produce when you compile your plugin (base.lib, icuuc.lib and googleurl.lib.)
There is a very important file that describes the Chrome Plugin API. It can be found at "chrome/common/chrome_plugin_api.h". Basically what happen, is that you "implement" this API. There are two sets of functions that needs to be implemented. One set relates to the functions that are offered by the plugin to the browser (the host) - the CPP functions, CPP for Chrome Plug-in: Plug-in Defined, but I am not sure - and the other set relates to the function that are offered by the browser to the plugin - the CPB functions, CPB for Chrome Plug-in: Browser Defined. In other terms the browser tells you: "this is a set of services that I want you to provide me with, I will interact with you via a call to a table of functions which have the following signatures. If you believe that I will need to use a particular service when the plugin is being used, please implement it." Technically, this table is a structure with members that are functions pointer. There is another set of functions which can be implemented by the plugin and/or the browser - the CPR and CPRR functions.
The only function that you need to export is
PHP Code:
CPError STDCALL CP_Initialize(CPID id, const CPBrowserFuncs* bfuncs, CPPluginFuncs* pfuncs)
This function is called by the host when the plugin is being loaded. As you can notice, the browser provides us with the two tables of function pointers. Once we do the mapping, then if the browser needs to interact with the plugin it will used these shared tables.
Our code will make use of two files: test.cpp and test.h (I used Visual Studio 2008.) I have borrowed close to 90% of the code from a chrome plugin file that is part of the source that you downloaded: "chrome/test/chrome_plugin/test_chrome_plugin.h" and "chrome/test/chrome_plugin/test_chrome_plugin.cc".
Let's code the CP_Initialize function:
PHP Code:
test.cpp:
CPError STDCALL CP_Initialize(CPID id, const CPBrowserFuncs* bfuncs,
CPPluginFuncs* pfuncs) {
if (bfuncs == NULL || pfuncs == NULL)
return CPERR_FAILURE;
if (CP_GET_MAJOR_VERSION(bfuncs->version) > CP_MAJOR_VERSION)
return CPERR_INVALID_VERSION;
if (bfuncs->size < sizeof(CPBrowserFuncs) ||
pfuncs->size < sizeof(CPPluginFuncs))
return CPERR_INVALID_VERSION;
CPERR_FAILURE and CPERR_INVALID_VERSION are defined in "chrome/common/chrome_plugin_api.h". They respectively indicate a generic failure and an incompatibility of API version used by the browser and the plugin. I don't think that I need to explain these verifications as they are pretty obvious, let's continue:
PHP Code:
pfuncs->version = CP_VERSION;
pfuncs->shutdown = CPP_Shutdown;
pfuncs->should_intercept_request = CPP_ShouldInterceptRequest;
static CPRequestFuncs request_funcs;
request_funcs.start_request = CPR_StartRequest;
request_funcs.end_request = CPR_EndRequest;
request_funcs.set_extra_request_headers = CPR_SetExtraRequestHeaders;
request_funcs.set_request_load_flags = CPR_SetRequestLoadFlags;
request_funcs.append_data_to_upload = CPR_AppendDataToUpload;
request_funcs.get_response_info = CPR_GetResponseInfo;
request_funcs.read = CPR_Read;
request_funcs.append_file_to_upload = CPR_AppendFileToUpload;
pfuncs->request_funcs = &request_funcs;
static CPResponseFuncs response_funcs;
response_funcs.received_redirect = CPRR_ReceivedRedirect;
response_funcs.start_completed = CPRR_StartCompleted;
response_funcs.read_completed = CPRR_ReadCompleted;
pfuncs->response_funcs = &response_funcs;
g_cpid = id;
g_cpbrowser_funcs = *bfuncs;
g_cprequest_funcs = *bfuncs->request_funcs;
g_cpresponse_funcs = *bfuncs->response_funcs;
g_cpbrowser_funcs = *bfuncs;
We started the mapping of the functions. As you can see, we will only implement two functions among the CPP functions (made available to the host): CPP_Shutdown (called when the browser is unloading the plugin) and CPP_ShouldInterceptRequest (indicates if the plugin is interested in handling a request.) We want to be able to issue some requests via the browser therefore we implement several CPR functions. We will also process several intercepted requests so we implement some CPRR functions. Finally, we store a reference to these structures as we will use them later.
PHP Code:
test.cpp:
const char* protocols[] = {kChromeTestPluginProtocol};
g_cpbrowser_funcs.enable_request_intercept(g_cpid, protocols, 1);
return CPERR_SUCCESS;
We end this function by informing the browser that the plugin wants to intercept a list of protocols. Let's define these protocols in the header file.
PHP Code:
test.h
const char kChromeTestPluginProtocol[] = "cptest";
So let's suppose that a user enters "cptest:sync" in the location bar. The browser knows that the plugin has requested to be able to process these requests. The browser will use our set of CPRR functions. We have implemented three of these functions: CPRR_ReceivedRedirect, CPRR_StartCompleted and CPRR_ReadCompleted. If you read carefully the description of these functions, you will find that it is CPRR_ReceivedRedirect which is then called. Then we read the data: call to CPR_Read which is followed by a call to CPRR_ReadCompleted. We can start issuing our request. I will stop here but I encourage you to use your debugger to understand the sequence of events.
As you can see in the code, the following requests are implemented: cptest:sync, cptest:async and cptest:blank. Once you install the plugin, you should try them. You will find the source code here.
Finally, if you want to see your plugin listed when you type about : plugins in your location bar, do not forget to add a VERSIONINFO Resource.
If you have any question related to this article, you can always reply to this post. Otherwise, use the other forums.
source : http://www.paperfrag.com/showthread.php?p=1
Google released Google Chrome - a Open source browser
On September 2 2008 Google released a new web browser called Google Chrome. At the same time, we are releasing all of the code as open source under a permissive BSD license. The open source project is called Chromium - after the metal used to make chrome.
Why did Google release the source code?
Primarily it's because one of the fundamental goals of the Chromium project is to help drive the web forward. Open source projects like Firefox and WebKit have led the way in defining the next generation of web technologies and standards, and we felt the best way we could help was to follow suit, and be as open as we could. To be clear, improving the web in this way also has some clear benefits for us as a company. With a richer set of APIs we can build more interesting apps allowing people to do more online. The more people do online, the more they can use our services. At any rate, we have worked on this project by ourselves for long enough - it's time for us to engage with the wider web community so that we can move on to the next set of challenges.
We believe that open source works not only because it allows people to join us and improve our products, but also (and more importantly) because it means other projects are able to use the code we've developed. Where we've developed innovative new technology, we hope that other projects can use it to make their products better, just as we've been able to adopt code from other open source projects to make our product better.
How will we be working with the open source community?
To begin with, we are engaging with the WebKit community to integrate our patches back into the main line of WebKit development. Because of Chromium's unique multi-process architecture, the integration of the V8 JavaScript engine, and other factors, we've built a fairly significant port of WebKit on Windows, and are developing the same for Mac OS X and Linux. We want to make sure that we can find a productive way to integrate and sync up with the WebKit community in this effort as we move forward.
Today, you can visit our project website at www.chromium.org, where you can get the latest source code or the freshest development build. If you're interested in keeping track of what's going on, you can join one of our discussion groups, where you can participate in development discussions and keep track of bugs as they're filed and fixed. Maybe you'll want to fix a few, too! You'll also find information on reporting bugs and all the various other aspects of the project. We hope you'll check it out!
This is the Chromium blog. The posts here will be of a mostly technical nature, discussing the design theory and implementation details of work we've done or are doing. Over the next few weeks there'll be a number of posts that give a high level tour of the most important aspects of the browser.
Finally, if you've not yet done so, take Google Chrome for a spin. You can download it from http://www.google.com/chrome/.
Why did Google release the source code?
Primarily it's because one of the fundamental goals of the Chromium project is to help drive the web forward. Open source projects like Firefox and WebKit have led the way in defining the next generation of web technologies and standards, and we felt the best way we could help was to follow suit, and be as open as we could. To be clear, improving the web in this way also has some clear benefits for us as a company. With a richer set of APIs we can build more interesting apps allowing people to do more online. The more people do online, the more they can use our services. At any rate, we have worked on this project by ourselves for long enough - it's time for us to engage with the wider web community so that we can move on to the next set of challenges.
We believe that open source works not only because it allows people to join us and improve our products, but also (and more importantly) because it means other projects are able to use the code we've developed. Where we've developed innovative new technology, we hope that other projects can use it to make their products better, just as we've been able to adopt code from other open source projects to make our product better.
How will we be working with the open source community?
To begin with, we are engaging with the WebKit community to integrate our patches back into the main line of WebKit development. Because of Chromium's unique multi-process architecture, the integration of the V8 JavaScript engine, and other factors, we've built a fairly significant port of WebKit on Windows, and are developing the same for Mac OS X and Linux. We want to make sure that we can find a productive way to integrate and sync up with the WebKit community in this effort as we move forward.
Today, you can visit our project website at www.chromium.org, where you can get the latest source code or the freshest development build. If you're interested in keeping track of what's going on, you can join one of our discussion groups, where you can participate in development discussions and keep track of bugs as they're filed and fixed. Maybe you'll want to fix a few, too! You'll also find information on reporting bugs and all the various other aspects of the project. We hope you'll check it out!
This is the Chromium blog. The posts here will be of a mostly technical nature, discussing the design theory and implementation details of work we've done or are doing. Over the next few weeks there'll be a number of posts that give a high level tour of the most important aspects of the browser.
Finally, if you've not yet done so, take Google Chrome for a spin. You can download it from http://www.google.com/chrome/.
Subscribe to:
Posts (Atom)