diff options
| author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-11 23:10:56 +0000 |
|---|---|---|
| committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-11 23:10:56 +0000 |
| commit | 50285fffa5e44c61cbf6141908c6297fbd0b20d4 (patch) | |
| tree | 5fb535a307298d93e4c885c40856303784cbf543 /chrome/common | |
| parent | 1ad795b4c02d1fd42743252685bd411619a2d4e2 (diff) | |
| download | chromium_src-50285fffa5e44c61cbf6141908c6297fbd0b20d4.zip chromium_src-50285fffa5e44c61cbf6141908c6297fbd0b20d4.tar.gz chromium_src-50285fffa5e44c61cbf6141908c6297fbd0b20d4.tar.bz2 | |
Remove Gears from Chrome.
There are probably a few more bits and pieces that can be removed, but I think this is the majority of it.
BUG=51934
Review URL: http://codereview.chromium.org/6576020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77888 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
23 files changed, 5 insertions, 1784 deletions
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc index c219f34..648ee3d 100644 --- a/chrome/common/chrome_constants.cc +++ b/chrome/common/chrome_constants.cc @@ -82,7 +82,6 @@ const FilePath::CharType kMediaCacheDirname[] = FPL("Media Cache"); const FilePath::CharType kOffTheRecordMediaCacheDirname[] = FPL("Incognito Media Cache"); const FilePath::CharType kAppCacheDirname[] = FPL("Application Cache"); -const FilePath::CharType kChromePluginDataDirname[] = FPL("Plugin Data"); const FilePath::CharType kThemePackFilename[] = FPL("Cached Theme.pak"); const FilePath::CharType kCookieFilename[] = FPL("Cookies"); const FilePath::CharType kExtensionsCookieFilename[] = FPL("Extension Cookies"); diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h index b1cbdda..530c69d 100644 --- a/chrome/common/chrome_constants.h +++ b/chrome/common/chrome_constants.h @@ -44,7 +44,6 @@ extern const FilePath::CharType kCacheDirname[]; extern const FilePath::CharType kMediaCacheDirname[]; extern const FilePath::CharType kOffTheRecordMediaCacheDirname[]; extern const FilePath::CharType kAppCacheDirname[]; -extern const FilePath::CharType kChromePluginDataDirname[]; extern const FilePath::CharType kThemePackFilename[]; extern const FilePath::CharType kCookieFilename[]; extern const FilePath::CharType kExtensionsCookieFilename[]; diff --git a/chrome/common/chrome_counters.cc b/chrome/common/chrome_counters.cc index 91ebf55..da6ee3b 100644 --- a/chrome/common/chrome_counters.cc +++ b/chrome/common/chrome_counters.cc @@ -42,14 +42,4 @@ StatsRate& Counters::spellcheck_lookup() { return *ctr; } -StatsCounterTimer& Counters::plugin_load() { - static StatsCounterTimer* ctr = new StatsCounterTimer("ChromePlugin.Load"); - return *ctr; -} - -StatsRate& Counters::plugin_intercept() { - static StatsRate* ctr = new StatsRate("ChromePlugin.Intercept"); - return *ctr; -} - } // namespace chrome diff --git a/chrome/common/chrome_counters.h b/chrome/common/chrome_counters.h index e53d5b2..742cbb4 100644 --- a/chrome/common/chrome_counters.h +++ b/chrome/common/chrome_counters.h @@ -29,12 +29,6 @@ class Counters { // Time/Count of spellcheck lookups. static base::StatsRate& spellcheck_lookup(); - - // Time spent loading the Chrome plugins. - static base::StatsCounterTimer& plugin_load(); - - // Time/Count of plugin network interception. - static base::StatsRate& plugin_intercept(); }; } // namespace chrome diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index afa0b7a..35c01d1 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -73,19 +73,6 @@ bool GetInternalPluginsDirectory(FilePath* result) { return PathService::Get(base::DIR_MODULE, result); } -bool GetGearsPluginPathFromCommandLine(FilePath* path) { -#ifndef NDEBUG - // for debugging, support a cmd line based override - FilePath plugin_path = - CommandLine::ForCurrentProcess()->GetSwitchValuePath( - switches::kGearsPluginPathOverride); - *path = plugin_path; - return !plugin_path.empty(); -#else - return false; -#endif -} - bool PathProvider(int key, FilePath* result) { // Some keys are just aliases... switch (key) { @@ -218,29 +205,6 @@ bool PathProvider(int key, FilePath* result) { return false; cur = cur.Append(FILE_PATH_LITERAL("script.log")); break; - case chrome::FILE_GEARS_PLUGIN: - if (!GetGearsPluginPathFromCommandLine(&cur)) { -#if defined(OS_WIN) - // Search for gears.dll alongside chrome.dll first. This new model - // allows us to package gears.dll with the Chrome installer and update - // it while Chrome is running. - if (!GetInternalPluginsDirectory(&cur)) - return false; - cur = cur.Append(FILE_PATH_LITERAL("gears.dll")); - - if (!file_util::PathExists(cur)) { - if (!PathService::Get(base::DIR_EXE, &cur)) - return false; - cur = cur.Append(FILE_PATH_LITERAL("plugins")); - cur = cur.Append(FILE_PATH_LITERAL("gears")); - cur = cur.Append(FILE_PATH_LITERAL("gears.dll")); - } -#else - // No gears.dll on non-Windows systems. - return false; -#endif - } - break; case chrome::FILE_FLASH_PLUGIN: if (!GetInternalPluginsDirectory(&cur)) return false; diff --git a/chrome/common/chrome_paths.h b/chrome/common/chrome_paths.h index 74f7920..008fea1 100644 --- a/chrome/common/chrome_paths.h +++ b/chrome/common/chrome_paths.h @@ -63,7 +63,6 @@ enum { FILE_RECORDED_SCRIPT, // Full path to the script.log file that // contains recorded browser events for // playback. - FILE_GEARS_PLUGIN, // Full path to the gears.dll plugin file. FILE_FLASH_PLUGIN, // Full path to the internal Flash plugin file. FILE_PDF_PLUGIN, // Full path to the internal PDF plugin file. FILE_NACL_PLUGIN, // Full path to the internal NaCl plugin file. diff --git a/chrome/common/chrome_plugin_api.h b/chrome/common/chrome_plugin_api.h deleted file mode 100644 index 2b3da55..0000000 --- a/chrome/common/chrome_plugin_api.h +++ /dev/null @@ -1,567 +0,0 @@ -// Copyright (c) 2009 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. -// -// This header specifies the Chrome Plugin API. It is based heavily on NPAPI. -// The key difference is that Chrome plugins can be loaded for the lifetime -// of the browser, and are not tied to a specific web page. -// -// NOTE: This API is not final and may change or go away at any point. -// -// All strings in the API are UTF8-encoded unless otherwise noted. - -#ifndef CHROME_COMMON_CHROME_PLUGIN_API_H__ -#define CHROME_COMMON_CHROME_PLUGIN_API_H__ -#pragma once - -#include "base/basictypes.h" - -#ifndef STDCALL -#ifdef WIN32 -#define STDCALL __stdcall -#else -#define STDCALL -#endif // WIN32 -#endif // STDCALL - -#ifdef __cplusplus -extern "C" { -#endif - -// The current version of the API, used by the 'version' field of CPPluginFuncs -// and CPBrowserFuncs. -#define CP_MAJOR_VERSION 0 -#define CP_MINOR_VERSION 11 -#define CP_VERSION ((CP_MAJOR_VERSION << 8) | (CP_MINOR_VERSION)) - -#define CP_GET_MAJOR_VERSION(version) ((version & 0xff00) >> 8) -#define CP_GET_MINOR_VERSION(version) (version & 0x00ff) - -typedef unsigned char CPBool; - -// Chrome plugins can be loaded into different process types. -typedef enum { - CP_PROCESS_BROWSER = 0, - CP_PROCESS_PLUGIN, - CP_PROCESS_RENDERER, -} CPProcessType; - -// Return codes. Error values are negative. -typedef enum { - // No error - CPERR_SUCCESS = 0, - - // (network) An asynchronous IO operation is not complete - CPERR_IO_PENDING = -1, - - // Generic failure - CPERR_FAILURE = -2, - - // The API versions used by plugin and host are incompatible - CPERR_INVALID_VERSION = -3, - - // The operation was cancelled - CPERR_CANCELLED = -4, - - // An invalid parameter was passed - CPERR_INVALID_PARAMETER = -5, -} CPError; - -// Types of response info metadata to query using CPP_GetResponseInfo. -typedef enum { - // HTTP status code. - CPRESPONSEINFO_HTTP_STATUS = 0, - - // Raw headers from the server, including the status line. Headers should - // be delimited by "\0", and end with "\0\0" (a blank line). - CPRESPONSEINFO_HTTP_RAW_HEADERS = 1, -} CPResponseInfoType; - -// An identifier for the plugin used by the browser. -typedef struct _CPID_t { - int unused; -} CPID_t; -typedef struct _CPID_t* CPID; - -// An identifier that encapsulates the browsing context needed by various APIs. -// This includes information about what tab a request was made from, and what -// profile is active. Note that this ID is global to all processes, so it can -// be passed from one process to another. The value 0 is reserved for an -// undefined context. -typedef uint32 CPBrowsingContext; - -// Types of context info to query using CPB_GetBrowsingContextInfo. -typedef enum { - // The data directory for the profile associated with this context as a - // pointer to a null-terminated string. The plugin can save persistent data - // to this directory. The returned pointer should be freed using CPB_Free. - CPBROWSINGCONTEXT_DATA_DIR_PTR = 0, - - // The locale language code used for the browser UI. The returned pointer - // should be freed using CPB_Free. - CPBROWSINGCONTEXT_UI_LOCALE_PTR = 1, -} CPBrowsingContextInfoType; - -// A network request object. -typedef struct _CPRequest { - void* pdata; // plugin private data - const char* url; // the URL being requested - const char* method; // the request method as an uppercase string (ex: "GET") - CPBrowsingContext context; // context in which this request was made -} CPRequest; - -typedef enum { - CPREQUESTLOAD_NORMAL = 0, - - // This is "normal reload", meaning an if-none-match/if-modified-since query - CPREQUESTLOAD_VALIDATE_CACHE = 1 << 0, - - // This is "shift-reload", meaning a "pragma: no-cache" end-to-end fetch - CPREQUESTLOAD_BYPASS_CACHE = 1 << 1, - - // This is a back/forward style navigation where the cached content should - // be preferred over any protocol specific cache validation. - CPREQUESTLOAD_PREFERRING_CACHE = 1 << 2, - - // This is a navigation that will fail if it cannot serve the requested - // resource from the cache (or some equivalent local store). - CPREQUESTLOAD_ONLY_FROM_CACHE = 1 << 3, - - // This is a navigation that will not use the cache at all. It does not - // impact the HTTP request headers. - CPREQUESTLOAD_DISABLE_CACHE = 1 << 4, - - // This navigation should not be intercepted by plugins. - CPREQUESTLOAD_DISABLE_INTERCEPT = 1 << 5, - - // This request should be loaded synchronously. What this means is that - // CPR_StartRequest and CPR_Read will never return CPERR_IO_PENDING - they - // will block until a response is available, and return success or failure. - CPREQUESTLOAD_SYNCHRONOUS = 1 << 20, -} CPRequestLoadFlags; - -// -// Functions provided by plugin to host. -// - -// Called when the browser is unloading the plugin. -typedef CPError (STDCALL *CPP_ShutdownFunc)(void); - -// Returns true if the plugin is interested in handling this request. -typedef CPBool (STDCALL *CPP_ShouldInterceptRequestFunc)(CPRequest* request); - -// Called when an HTML dialog was closed. json_retval is the JSON string -// containing the return value sent back by the dialog (using Chrome's -// JavaScript DOM bindings). -typedef void (STDCALL *CPP_HtmlDialogClosedFunc)( - void* plugin_context, const char* json_retval); - -// Asks the plugin to handle the given command. 'command_data' is command- -// specific data used for some builtin commands: see gears_api.h for -// possible types. It is only valid for the duration of this call. -typedef CPError (STDCALL *CPP_HandleCommandFunc)( - CPBrowsingContext context, int command, void* command_data); - -// -// Functions provided by host to plugin. -// - -// Asks the host to handle the given command. 'command_data' is -// command-specific data used for some builtin commands: see gears_api.h for -// possible types. It is only valid for the duration of this call. -typedef CPError (STDCALL *CPB_HandleCommandFunc)( - CPID id, CPBrowsingContext context, int command, void* command_data); - -// Asks the browser to enable/disable request interception for this plugin for -// the given schemes. 'schemes' is an array of strings containing the scheme -// names the plugin wishes to handle; case is ignored. If 'schemes' is NULL or -// empty, request interception is disabled for this plugin. Multiple calls to -// this function will add to the existing set of enabled schemes. The browser -// should call the plugin's CPP_ShouldInterceptRequestFunc for any network -// requests it makes that match a given scheme. The browser may choose not to -// allow the plugin to intercept certain protocols. -typedef void (STDCALL *CPB_EnableRequestInterceptFunc)( - CPID id, const char** schemes, uint32 num_schemes); - -// Asks the browser to create a request object for the given method/url. -// Returns CPERR_SUCCESS and puts the new object into the 'request' field on -// success, or an error code on failure. The plugin must call CPR_EndRequest -// to clean up the request object when it is done with it. -typedef CPError (STDCALL *CPB_CreateRequestFunc)( - CPID id, CPBrowsingContext context, const char* method, const char* url, - CPRequest** request); - -// Queries the browser's cookie store for cookies set for the given URL. -// Sets 'cookies' to an allocated string containing the cookies as -// semicolon-delimited "name=value" pairs on success, NULL on failure. -// The memory should be freed using CPB_Free when done. -typedef CPError (STDCALL *CPB_GetCookiesFunc)( - CPID id, CPBrowsingContext context, const char* url, char** cookies); - -// Allocates memory for the given size using the browser's allocator. Call -// CPB_Free when done. -typedef void* (STDCALL *CPB_AllocFunc)(uint32 size); - -// Frees a pointer allocated by CPB_Alloc. -typedef void (STDCALL *CPB_FreeFunc)(void* memory); - - -// Sets a flag that influences when the plugin process created to host -// the plugin is shutdown. Generally, the plugin process is terminated -// when no more plugin instances exist, this is the default behavior. -// If keep_alive is non-zero, the process will not be terminated when -// the instance count goes to zero. Note: a non-zero keep_alive value -// does not prevent the plugin process from being terminated upon -// overall browser shutdown. -typedef void (STDCALL *CPB_SetKeepProcessAliveFunc)(CPID id, - CPBool keep_alive); - -// Asks the browser to show an HTML dialog to the user. The dialog contents -// should be loaded from the given URL. The 'json_arguments' is a JSON string -// that the dialog can fetch using Chrome's JavaScript DOM bindings. This call -// will block until the dialog is closed. On success, 'json_retval' will -// contain the JSON string sent back by the dialog (using Chrome's JavaScript -// DOM bindings), and CPERR_SUCCESS is returned. 'json_retval' should be freed -// using CPB_Free when done. -typedef CPError (STDCALL *CPB_ShowHtmlDialogModalFunc)( - CPID id, CPBrowsingContext context, const char* url, int width, int height, - const char* json_arguments, char** json_retval); - -// Similar to CPB_ShowHtmlDialogModalFunc, but does not block. When the dialog -// is closed, CPP_HtmlDialogClosed is called with the JSON return value and the -// given 'plugin_context', which may be used by the plugin to associate other -// data with the dialog. -typedef CPError (STDCALL *CPB_ShowHtmlDialogFunc)( - CPID id, CPBrowsingContext context, const char* url, int width, int height, - const char* json_arguments, void* plugin_context); - -// Get the browsing context associated with the given NPAPI instance. -typedef CPBrowsingContext (STDCALL *CPB_GetBrowsingContextFromNPPFunc)( - struct _NPP* npp); - -// Queries for some meta data associated with the given browsing context. See -// CPBrowsingContextInfoType for possible queries. If buf_size is too small to -// contain the entire data, the return value will indicate the size required. -// Otherwise, the return value is a CPError or CPERR_SUCCESS. -typedef int (STDCALL *CPB_GetBrowsingContextInfoFunc)( - CPID id, CPBrowsingContext context, CPBrowsingContextInfoType type, - void* buf, uint32 buf_size); - -// Given an URL string, returns the string of command-line arguments that should -// be passed to start the browser at the given URL. 'arguments' should be freed -// using CPB_Free when done. -typedef CPError (STDCALL *CPB_GetCommandLineArgumentsFunc)( - CPID id, CPBrowsingContext context, const char* url, char** arguments); - -// Asks the browser to let the plugin handle the given UI command. When the -// command is invoked, the browser will call CPP_HandleCommand. 'command' -// should be an integer identifier. Currently only builtin commands are -// supported, but in the future we may want to let plugins add custom menu -// commands with their own descriptions. -typedef CPError (STDCALL *CPB_AddUICommandFunc)(CPID id, int command); - -// -// Functions related to making network requests. -// Both the host and plugin will implement their own versions of these. -// - -// Starts the request. Returns CPERR_SUCCESS if the request could be started -// immediately, at which point the response info is available to be read. -// Returns CPERR_IO_PENDING if an asynchronous operation was started, and the -// caller should wait for CPRR_StartCompleted to be called before reading the -// response info. Returns an error code on failure. -typedef CPError (STDCALL *CPR_StartRequestFunc)(CPRequest* request); - -// Stops or cancels the request. The caller should not access the request -// object after this call. If an asynchronous IO operation is pending, the -// operation is aborted and the caller will not receive a callback for it. -typedef void (STDCALL *CPR_EndRequestFunc)(CPRequest* request, CPError reason); - -// Sets the additional request headers to append to the standard headers that -// would normally be made with this request. Headers should be \r\n-delimited, -// with no terminating \r\n. Extra headers are not checked against the standard -// headers for duplicates. Must be called before CPRR_StartCompletedFunc. -// Plugins should avoid setting the following headers: User-Agent, -// Content-Length. -typedef void (STDCALL *CPR_SetExtraRequestHeadersFunc)(CPRequest* request, - const char* headers); - -// Sets the load flags for this request. 'flags' is a bitwise-OR of -// CPRequestLoadFlags. Must be called before CPRR_StartCompletedFunc. -typedef void (STDCALL *CPR_SetRequestLoadFlagsFunc)(CPRequest* request, - uint32 flags); - -// Appends binary data to the request body of a POST or PUT request. The caller -// should set the "Content-Type" header to the appropriate mime type using -// CPR_SetExtraRequestHeadersFunc. This can be called multiple times to append -// a sequence of data segments to upload. Must be called before -// CPR_StartRequestFunc. -typedef void (STDCALL *CPR_AppendDataToUploadFunc)( - CPRequest* request, const char* bytes, int bytes_len); - -// Appends the contents of a file to the request body of a POST or PUT request. -// 'offset' and 'length' can be used to append a subset of the file. Pass zero -// for 'length' and 'offset' to upload the entire file. 'offset' -// indicates where the data to upload begins in the file. 'length' indicates -// how much of the file to upload. A 'length' of zero is interpretted as to -// end-of-file. If 'length' and 'offset' indicate a range beyond end of file, -// the amount sent is clipped at eof. -// See CPR_AppendDataToUploadFunc for additional usage information. -// (added in v0.4) -typedef CPError (STDCALL *CPR_AppendFileToUploadFunc)( - CPRequest* request, const char* filepath, uint64 offset, uint64 length); - -// Queries for some response meta data. See CPResponseInfoType for possible -// queries. If buf_size is too small to contain the entire data, the return -// value will indicate the size required. Otherwise, the return value is a -// CPError or CPERR_SUCCESS. -typedef int (STDCALL *CPR_GetResponseInfoFunc)( - CPRequest* request, CPResponseInfoType type, - void* buf, uint32 buf_size); - -// Attempts to read a request's response data. The number of bytes read is -// returned; 0 indicates an EOF. CPERR_IO_PENDING is returned if an -// asynchronous operation was started, and CPRR_ReadCompletedFunc will be called -// when it completes; 'buf' must be available until the operation completes. -// Returns an error code on failure. -typedef int (STDCALL *CPR_ReadFunc)( - CPRequest* request, void* buf, uint32 buf_size); - -// -// Functions related to serving network requests. -// Both the host and plugin will implement their own versions of these. -// - -// Called upon a server-initiated redirect. The request will still hold the -// original URL, and 'new_url' will be the redirect destination. -typedef void (STDCALL *CPRR_ReceivedRedirectFunc)(CPRequest* request, - const char* new_url); - -// Called when an asynchronous CPR_StartRequest call has completed, once all -// redirects are followed. On success, 'result' holds CPERR_SUCCESS and the -// response info is available to be read via CPR_GetResponseInfo. On error, -// 'result' holds the error code. -typedef void (STDCALL *CPRR_StartCompletedFunc)(CPRequest* request, - CPError result); - -// Called when an asynchronous CPR_Read call has completed. On success, -// 'bytes_read' will hold the number of bytes read into the buffer that was -// passed to CPR_Read; 0 indicates an EOF, and the request object will be -// destroyed after the call completes. On failure, 'bytes_read' holds the error -// code. -typedef void (STDCALL *CPRR_ReadCompletedFunc)(CPRequest* request, - int bytes_read); - -// Called as upload progress is being made for async POST requests. -// (added in v0.5) -typedef void (STDCALL *CPRR_UploadProgressFunc)(CPRequest* request, - uint64 position, - uint64 size); - -// -// Functions to support the sending and receipt of messages between processes. -// - -// Returns true if the plugin process is running -typedef CPBool (STDCALL *CPB_IsPluginProcessRunningFunc)(CPID id); - -// Returns the type of the current process. -typedef CPProcessType (STDCALL *CPB_GetProcessTypeFunc)(CPID id); - -// Asks the browser to send raw data to the other process hosting an instance of -// this plugin. If needed, the plugin process will be started prior to sending -// the message. -typedef CPError (STDCALL *CPB_SendMessageFunc)(CPID id, - const void *data, - uint32 data_len); - -// Asks the browser to send raw data to the other process hosting an instance of -// this plugin. This function only works from the plugin or renderer process. -// This function blocks until the message is processed. The memory should be -// freed using CPB_Free when done. -typedef CPError (STDCALL *CPB_SendSyncMessageFunc)(CPID id, - const void *data, - uint32 data_len, - void **retval, - uint32 *retval_len); - -// This function asynchronously calls the provided function on the plugin -// thread. user_data is passed as the argument to the function. -typedef CPError (STDCALL *CPB_PluginThreadAsyncCallFunc)(CPID id, - void (*func)(void *), - void *user_data); - -// This function creates an open file dialog. The process is granted access -// to any files that are selected. |multiple_files| determines if more than -// one file can be selected. -typedef CPError (STDCALL *CPB_OpenFileDialogFunc)(CPID id, - CPBrowsingContext context, - bool multiple_files, - const char *title, - const char *filter, - void *user_data); - -// Informs the plugin of raw data having been sent from another process. -typedef void (STDCALL *CPP_OnMessageFunc)(void *data, uint32 data_len); - -// Informs the plugin of raw data having been sent from another process. -typedef void (STDCALL *CPP_OnSyncMessageFunc)(void *data, uint32 data_len, - void **retval, - uint32 *retval_len); - -// Informs the plugin that the file dialog has completed, and contains the -// results. -typedef void (STDCALL *CPP_OnFileDialogResultFunc)(void *data, - const char **files, - uint32 files_len); - -// Asks the browser to verify that NPObject* 'event' is the current drag event -// the browser is dispatching, and extract drag data from the event if so. On -// success, returns the drag 'identity' (an up-counter that the browser chrome -// increases each time a user drag enters a renderer tab), the drag 'event_id' -// and the 'drag_type' being a utf8 encoded string with values "Files", "Text" -// or "URL". If 'add_data' is true, also return the 'drag_data', again a utf8 -// encoded string with the data for the drag type. For drag type "Files", the -// data is a backspace delimited list of file paths. -// -// The call fails with a CPError if 'event' is an invalid drag event, and sets -// the 'identity' and 'event_id' to 0. Note: on success, non-NULL 'drag_type' -// and 'drag_data' should be freed with CPB_Free() when done. -typedef CPError (STDCALL *CPB_GetDragDataFunc)( - CPID id, CPBrowsingContext context, struct NPObject* event, bool add_data, - int32* identity, int32* event_id, char** drag_type, char** drag_data); - -// Asks the browser to verify that NPObject* 'event' is the current drag event -// the browser is dispatching and show the requested drop 'effect' if so. The -// browser displays drop effects during dragenter and dragover events, to give -// user visible feedback (with a drag cursor, typically) to indicate whether a -// subsequent drop event will succeed or not. The implementation supports the -// so-called "copy" and "none" effects. When 'effect' is non-zero, the "copy" -// effect is shown. Otherwise, the "none" effect is shown, which prevents the -// subsequent drop event from succeeding. Returns CPError on failure, meaning -// the 'event' is an invalid drag event. -// -// Note: 'effect' is int to allow for new effects in future. For example, the -// HTML5-defined drop effects "move" and "link". -typedef CPError (STDCALL *CPB_SetDropEffectFunc)( - CPID id, CPBrowsingContext context, struct NPObject* event, int effect); - -// For drag type "Files", the drag data returned by CPB_GetDragDataFunc() is a -// backspace delimited list of file paths. Use this routine to pass that data -// to the browser process to verify that the renderer has permission to access -// the files. Returns CPERR_SUCCESS if access is allowed. -typedef CPError (STDCALL *CPB_AllowFileDropFunc)( - CPID id, CPBrowsingContext context, const char* file_drag_data); - -// Function table for issuing requests using via the other side's network stack. -// For the plugin, this functions deal with issuing requests through the -// browser. For the browser, these functions deal with allowing the plugin to -// intercept requests. -typedef struct _CPRequestFuncs { - uint16 size; - CPR_SetExtraRequestHeadersFunc set_extra_request_headers; - CPR_SetRequestLoadFlagsFunc set_request_load_flags; - CPR_AppendDataToUploadFunc append_data_to_upload; - CPR_StartRequestFunc start_request; - CPR_EndRequestFunc end_request; - CPR_GetResponseInfoFunc get_response_info; - CPR_ReadFunc read; - CPR_AppendFileToUploadFunc append_file_to_upload; -} CPRequestFuncs; - -// Function table for handling requests issued by the other side. For the -// plugin, these deal with serving requests that the plugin has intercepted. For -// the browser, these deal with serving requests that the plugin has issued -// through us. -typedef struct _CPResponseFuncs { - uint16 size; - CPRR_ReceivedRedirectFunc received_redirect; - CPRR_StartCompletedFunc start_completed; - CPRR_ReadCompletedFunc read_completed; - CPRR_UploadProgressFunc upload_progress; -} CPResponseFuncs; - -// Function table of CPP functions (functions provided by plugin to host). This -// structure is filled in by the plugin in the CP_Initialize call, except for -// the 'size' field, which is set by the browser. The version fields should be -// set to those that the plugin was compiled using. -typedef struct _CPPluginFuncs { - uint16 size; - uint16 version; - CPRequestFuncs* request_funcs; - CPResponseFuncs* response_funcs; - CPP_ShutdownFunc shutdown; - CPP_ShouldInterceptRequestFunc should_intercept_request; - CPP_OnMessageFunc on_message; - CPP_HtmlDialogClosedFunc html_dialog_closed; - CPP_HandleCommandFunc handle_command; - CPP_OnSyncMessageFunc on_sync_message; - CPP_OnFileDialogResultFunc on_file_dialog_result; -} CPPluginFuncs; - -// Function table CPB functions (functions provided by host to plugin). -// This structure is filled in by the browser and provided to the plugin. The -// plugin will likely want to save a copy of this structure to make calls -// back to the browser. -typedef struct _CPBrowserFuncs { - uint16 size; - uint16 version; - CPRequestFuncs* request_funcs; - CPResponseFuncs* response_funcs; - CPB_EnableRequestInterceptFunc enable_request_intercept; - CPB_CreateRequestFunc create_request; - CPB_GetCookiesFunc get_cookies; - CPB_AllocFunc alloc; - CPB_FreeFunc free; - CPB_SetKeepProcessAliveFunc set_keep_process_alive; - CPB_ShowHtmlDialogModalFunc show_html_dialog_modal; - CPB_ShowHtmlDialogFunc show_html_dialog; - CPB_IsPluginProcessRunningFunc is_plugin_process_running; - CPB_GetProcessTypeFunc get_process_type; - CPB_SendMessageFunc send_message; - CPB_GetBrowsingContextFromNPPFunc get_browsing_context_from_npp; - CPB_GetBrowsingContextInfoFunc get_browsing_context_info; - CPB_GetCommandLineArgumentsFunc get_command_line_arguments; - CPB_AddUICommandFunc add_ui_command; - CPB_HandleCommandFunc handle_command; - CPB_SendSyncMessageFunc send_sync_message; - CPB_PluginThreadAsyncCallFunc plugin_thread_async_call; - CPB_OpenFileDialogFunc open_file_dialog; - CPB_GetDragDataFunc get_drag_data; - CPB_SetDropEffectFunc set_drop_effect; - CPB_AllowFileDropFunc allow_file_drop; -} CPBrowserFuncs; - - -// -// DLL exports -// - -// This export is optional. -// Prior to calling CP_Initialize, the browser may negotiate with the plugin -// regarding which version of the CPAPI to utilize. 'min_version' is the -// lowest version of the interface supported by the browser, 'max_version' is -// the highest supported version. The plugin can specify which version within -// the range should be used. This version will be reflected in the version field -// of the CPBrowserFuncs struct passed to CP_Initialize. If this function -// returns an error code, CP_Initialize will not be called. If function is not -// exported by the chrome plugin module, CP_Initiailize will be called with -// a version of the host's choosing. -typedef CPError (STDCALL *CP_VersionNegotiateFunc)( - uint16 min_version, uint16 max_version, uint16 *selected_version); - -// 'bfuncs' are the browser functions provided to the plugin. 'id' is the -// plugin identifier that the plugin should use when calling browser functions. -// The plugin should initialize 'pfuncs' with pointers to its own functions, -// or return an error code. -// All functions and entry points should be called on the same thread. The -// plugin should not attempt to call a browser function from a thread other -// than the one CP_InitializeFunc is called from. -typedef CPError (STDCALL *CP_InitializeFunc)( - CPID id, const CPBrowserFuncs* bfuncs, CPPluginFuncs* pfuncs); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // CHROME_COMMON_CHROME_PLUGIN_API_H_ diff --git a/chrome/common/chrome_plugin_lib.cc b/chrome/common/chrome_plugin_lib.cc deleted file mode 100644 index 7df1837..0000000 --- a/chrome/common/chrome_plugin_lib.cc +++ /dev/null @@ -1,292 +0,0 @@ -// Copyright (c) 2011 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 "chrome/common/chrome_plugin_lib.h" - -#include "base/command_line.h" -#include "base/hash_tables.h" -#include "base/message_loop.h" -#include "base/metrics/histogram.h" -#include "base/path_service.h" -#include "base/perftimer.h" -#include "base/string_util.h" -#include "base/threading/platform_thread.h" -#include "base/threading/thread.h" -#include "chrome/common/chrome_counters.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_switches.h" -#include "content/common/notification_service.h" -#include "webkit/plugins/npapi/plugin_list.h" - -#if defined(OS_WIN) -#include "base/win/registry.h" -#endif - -using base::TimeDelta; - -// TODO(port): revisit when plugins happier -#if defined(OS_WIN) -const wchar_t ChromePluginLib::kRegistryChromePlugins[] = - L"Software\\Google\\Chrome\\Plugins"; -static const wchar_t kRegistryLoadOnStartup[] = L"LoadOnStartup"; -static const wchar_t kRegistryPath[] = L"Path"; -#endif - -typedef base::hash_map<FilePath, scoped_refptr<ChromePluginLib> > - PluginMap; - -// A map of all the instantiated plugins. -static PluginMap* g_loaded_libs; - -// The thread plugins are loaded and used in, lazily initialized upon -// the first creation call. -static base::PlatformThreadId g_plugin_thread_id = 0; -static MessageLoop* g_plugin_thread_loop = NULL; - -static bool IsSingleProcessMode() { - // We don't support ChromePlugins in single-process mode. - return CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); -} - -// static -bool ChromePluginLib::IsInitialized() { - return (g_loaded_libs != NULL); -} - -// static -ChromePluginLib* ChromePluginLib::Create(const FilePath& filename, - const CPBrowserFuncs* bfuncs) { - // Keep a map of loaded plugins to ensure we only load each library once. - if (!g_loaded_libs) { - g_loaded_libs = new PluginMap(); - g_plugin_thread_id = base::PlatformThread::CurrentId(); - g_plugin_thread_loop = MessageLoop::current(); - } - DCHECK(IsPluginThread()); - - PluginMap::const_iterator iter = g_loaded_libs->find(filename); - if (iter != g_loaded_libs->end()) - return iter->second; - - scoped_refptr<ChromePluginLib> plugin(new ChromePluginLib(filename)); - if (!plugin->CP_Initialize(bfuncs)) - return NULL; - - (*g_loaded_libs)[filename] = plugin; - return plugin; -} - -// static -ChromePluginLib* ChromePluginLib::Find(const FilePath& filename) { - if (g_loaded_libs) { - PluginMap::const_iterator iter = g_loaded_libs->find(filename); - if (iter != g_loaded_libs->end()) - return iter->second; - } - return NULL; -} - -// static -void ChromePluginLib::Destroy(const FilePath& filename) { - DCHECK(g_loaded_libs); - PluginMap::iterator iter = g_loaded_libs->find(filename); - if (iter != g_loaded_libs->end()) { - iter->second->Unload(); - g_loaded_libs->erase(iter); - } -} - -// static -bool ChromePluginLib::IsPluginThread() { - return base::PlatformThread::CurrentId() == g_plugin_thread_id; -} - -// static -MessageLoop* ChromePluginLib::GetPluginThreadLoop() { - return g_plugin_thread_loop; -} - -// static -void ChromePluginLib::RegisterPluginsWithNPAPI() { - // We don't support ChromePlugins in single-process mode. - if (IsSingleProcessMode()) - return; - - FilePath path; - // Register Gears, if available. - if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &path)) - webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(path); -} - -static void LogPluginLoadTime(const TimeDelta &time) { - UMA_HISTOGRAM_TIMES("Gears.LoadTime", time); -} - -// static -void ChromePluginLib::LoadChromePlugins(const CPBrowserFuncs* bfuncs) { - static bool loaded = false; - if (loaded) - return; - loaded = true; - - // We don't support ChromePlugins in single-process mode. - if (IsSingleProcessMode()) - return; - - FilePath path; - if (!PathService::Get(chrome::FILE_GEARS_PLUGIN, &path)) - return; - - PerfTimer timer; - ChromePluginLib::Create(path, bfuncs); - LogPluginLoadTime(timer.Elapsed()); - - // TODO(mpcomplete): disabled loading of plugins from the registry until we - // phase out registry keys from the gears installer. -#if 0 - for (RegistryKeyIterator iter(HKEY_CURRENT_USER, kRegistryChromePlugins); - iter.Valid(); ++iter) { - // Use the registry to gather plugin across the file system. - std::wstring reg_path = kRegistryChromePlugins; - reg_path.append(L"\\"); - reg_path.append(iter.Name()); - base::win::RegKey key(HKEY_CURRENT_USER, reg_path.c_str()); - - DWORD is_persistent = 0; - key.ReadValueDW(kRegistryLoadOnStartup, &is_persistent); - if (is_persistent) { - std::wstring path; - if (key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { - ChromePluginLib::Create(path, bfuncs); - } - } - } -#endif -} - -// static -void ChromePluginLib::UnloadAllPlugins() { - if (g_loaded_libs) { - PluginMap::iterator it; - for (PluginMap::iterator it = g_loaded_libs->begin(); - it != g_loaded_libs->end(); ++it) { - it->second->Unload(); - } - delete g_loaded_libs; - g_loaded_libs = NULL; - } -} - -const CPPluginFuncs& ChromePluginLib::functions() const { - DCHECK(initialized_); - DCHECK(IsPluginThread()); - return plugin_funcs_; -} - -ChromePluginLib::ChromePluginLib(const FilePath& filename) - : filename_(filename), -#if defined(OS_WIN) - module_(0), -#endif - initialized_(false), - CP_VersionNegotiate_(NULL), - CP_Initialize_(NULL), - CP_Test_(NULL) { - memset((void*)&plugin_funcs_, 0, sizeof(plugin_funcs_)); -} - -ChromePluginLib::~ChromePluginLib() { -} - -bool ChromePluginLib::CP_Initialize(const CPBrowserFuncs* bfuncs) { - VLOG(1) << "ChromePluginLib::CP_Initialize(" << filename_.value() - << "): initialized=" << initialized_; - if (initialized_) - return true; - - if (!Load()) - return false; - - if (CP_VersionNegotiate_) { - uint16 selected_version = 0; - CPError rv = CP_VersionNegotiate_(CP_VERSION, CP_VERSION, - &selected_version); - if ((rv != CPERR_SUCCESS) || (selected_version != CP_VERSION)) - return false; - } - - plugin_funcs_.size = sizeof(plugin_funcs_); - CPError rv = CP_Initialize_(cpid(), bfuncs, &plugin_funcs_); - initialized_ = (rv == CPERR_SUCCESS) && - (CP_GET_MAJOR_VERSION(plugin_funcs_.version) == CP_MAJOR_VERSION) && - (CP_GET_MINOR_VERSION(plugin_funcs_.version) <= CP_MINOR_VERSION); - VLOG(1) << "ChromePluginLib::CP_Initialize(" << filename_.value() - << "): initialized=" << initialized_ << "): result=" << rv; - - return initialized_; -} - -void ChromePluginLib::CP_Shutdown() { - DCHECK(initialized_); - functions().shutdown(); - initialized_ = false; - memset((void*)&plugin_funcs_, 0, sizeof(plugin_funcs_)); -} - -int ChromePluginLib::CP_Test(void* param) { - DCHECK(initialized_); - if (!CP_Test_) - return -1; - return CP_Test_(param); -} - -bool ChromePluginLib::Load() { -#if !defined(OS_WIN) - // Mac and Linux won't implement Gears. - return false; -#else - DCHECK(module_ == 0); - - module_ = LoadLibrary(filename_.value().c_str()); - if (module_ == 0) - return false; - - // required initialization function - CP_Initialize_ = reinterpret_cast<CP_InitializeFunc> - (GetProcAddress(module_, "CP_Initialize")); - - if (!CP_Initialize_) { - FreeLibrary(module_); - module_ = 0; - return false; - } - - // optional version negotiation function - CP_VersionNegotiate_ = reinterpret_cast<CP_VersionNegotiateFunc> - (GetProcAddress(module_, "CP_VersionNegotiate")); - - // optional test function - CP_Test_ = reinterpret_cast<CP_TestFunc> - (GetProcAddress(module_, "CP_Test")); - - return true; -#endif -} - -void ChromePluginLib::Unload() { - NotificationService::current()->Notify( - NotificationType::CHROME_PLUGIN_UNLOADED, - Source<ChromePluginLib>(this), - NotificationService::NoDetails()); - - if (initialized_) - CP_Shutdown(); - -#if defined(OS_WIN) - if (module_) { - FreeLibrary(module_); - module_ = 0; - } -#endif -} diff --git a/chrome/common/chrome_plugin_lib.h b/chrome/common/chrome_plugin_lib.h deleted file mode 100644 index b8e447b..0000000 --- a/chrome/common/chrome_plugin_lib.h +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2010 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 CHROME_COMMON_CHROME_PLUGIN_LIB_H_ -#define CHROME_COMMON_CHROME_PLUGIN_LIB_H_ -#pragma once - -#include "base/basictypes.h" -#include "base/file_path.h" -#include "base/ref_counted.h" -#include "chrome/common/chrome_plugin_api.h" - -class MessageLoop; - -// A ChromePluginLib is a single Chrome Plugin Library. -// This class is used in the browser process (IO thread), and the plugin process -// (plugin thread). It should not be accessed on other threads, because it -// issues a NOTIFY_CHROME_PLUGIN_UNLOADED notification. -class ChromePluginLib : public base::RefCounted<ChromePluginLib> { - public: - static bool IsInitialized(); - static ChromePluginLib* Create(const FilePath& filename, - const CPBrowserFuncs* bfuncs); - static ChromePluginLib* Find(const FilePath& filename); - static void Destroy(const FilePath& filename); - static bool IsPluginThread(); - static MessageLoop* GetPluginThreadLoop(); - - static ChromePluginLib* FromCPID(CPID id) { - return reinterpret_cast<ChromePluginLib*>(id); - } - - // Adds Chrome plugins to the NPAPI plugin list. - static void RegisterPluginsWithNPAPI(); - - // Loads all the plugins that are marked as "LoadOnStartup" in the - // registry. This should only be called in the browser process. - static void LoadChromePlugins(const CPBrowserFuncs* bfuncs); - - // Unloads all the loaded plugins and cleans up the plugin map. - static void UnloadAllPlugins(); - - // Returns true if the plugin is currently loaded. - bool is_loaded() const { return initialized_; } - - // Get the Plugin's function pointer table. - const CPPluginFuncs& functions() const; - - CPID cpid() { return reinterpret_cast<CPID>(this); } - - const FilePath& filename() { return filename_; } - - // Plugin API functions - - // Method to call a test function in the plugin, used for unit tests. - int CP_Test(void* param); - -#if defined(OS_WIN) - // The registry path to search for Chrome Plugins/ - static const TCHAR kRegistryChromePlugins[]; -#endif // defined(OS_WIN) - - private: - friend class base::RefCounted<ChromePluginLib>; - - explicit ChromePluginLib(const FilePath& filename); - ~ChromePluginLib(); - - // Method to initialize a Plugin. - // Initialize can be safely called multiple times. - bool CP_Initialize(const CPBrowserFuncs* bfuncs); - - // Method to shutdown a Plugin. - void CP_Shutdown(); - - // Attempts to load the plugin. - // Returns true if it is a legitimate plugin, false otherwise - bool Load(); - - // Unloads the plugin. - void Unload(); - - FilePath filename_; // the path to the plugin -#if defined(OS_WIN) - // TODO(port): Remove ifdefs when we have portable replacement for HMODULE. - HMODULE module_; // the opened plugin handle -#endif // defined(OS_WIN) - bool initialized_; // is the plugin initialized - - // Exported symbols from the plugin, looked up by name. - CP_VersionNegotiateFunc CP_VersionNegotiate_; - CP_InitializeFunc CP_Initialize_; - - // Additional function pointers provided by the plugin. - CPPluginFuncs plugin_funcs_; - - // Used for unit tests. - typedef int (STDCALL *CP_TestFunc)(void*); - CP_TestFunc CP_Test_; - - DISALLOW_COPY_AND_ASSIGN(ChromePluginLib); -}; - -#endif // CHROME_COMMON_CHROME_PLUGIN_LIB_H_ diff --git a/chrome/common/chrome_plugin_util.cc b/chrome/common/chrome_plugin_util.cc deleted file mode 100644 index 1ed4b81..0000000 --- a/chrome/common/chrome_plugin_util.cc +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) 2011 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 "chrome/common/chrome_plugin_util.h" - -#include <algorithm> - -#include "base/command_line.h" -#include "base/file_util.h" -#include "base/message_loop.h" -#include "base/string_util.h" -#include "base/utf_string_conversions.h" -#include "chrome/common/chrome_plugin_lib.h" -#include "chrome/common/chrome_switches.h" -#include "content/common/notification_service.h" -#include "net/base/load_flags.h" -#include "net/http/http_response_headers.h" - -// -// ScopableCPRequest -// - -ScopableCPRequest::ScopableCPRequest(const char* u, const char* m, - CPBrowsingContext c) { - pdata = NULL; - data = NULL; -#if defined(OS_WIN) - url = _strdup(u); - method = _strdup(m); -#else - url = strdup(u); - method = strdup(m); -#endif - context = c; -} - -ScopableCPRequest::~ScopableCPRequest() { - pdata = NULL; - data = NULL; - free(const_cast<char*>(url)); - free(const_cast<char*>(method)); -} - -// -// PluginHelper -// - -// static -void PluginHelper::DestroyAllHelpersForPlugin(ChromePluginLib* plugin) { - NotificationService::current()->Notify( - NotificationType::CHROME_PLUGIN_UNLOADED, - Source<ChromePluginLib>(plugin), - NotificationService::NoDetails()); -} - -PluginHelper::PluginHelper(ChromePluginLib* plugin) : plugin_(plugin) { - DCHECK(CalledOnValidThread()); - registrar_.Add(this, NotificationType::CHROME_PLUGIN_UNLOADED, - Source<ChromePluginLib>(plugin_)); -} - -PluginHelper::~PluginHelper() { - DCHECK(CalledOnValidThread()); -} - -void PluginHelper::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - DCHECK(CalledOnValidThread()); - DCHECK(type == NotificationType::CHROME_PLUGIN_UNLOADED); - DCHECK(plugin_ == Source<ChromePluginLib>(source).ptr()); - - delete this; -} - -// -// PluginResponseUtils -// - -uint32 PluginResponseUtils::CPLoadFlagsToNetFlags(uint32 flags) { - uint32 net_flags = 0; -#define HANDLE_FLAG(name) \ - if (flags & CPREQUEST##name) \ - net_flags |= net::name - - HANDLE_FLAG(LOAD_VALIDATE_CACHE); - HANDLE_FLAG(LOAD_BYPASS_CACHE); - HANDLE_FLAG(LOAD_PREFERRING_CACHE); - HANDLE_FLAG(LOAD_ONLY_FROM_CACHE); - HANDLE_FLAG(LOAD_DISABLE_CACHE); - HANDLE_FLAG(LOAD_DISABLE_INTERCEPT); - - net_flags |= net::LOAD_ENABLE_UPLOAD_PROGRESS; - - return net_flags; -} - -int PluginResponseUtils::GetResponseInfo( - const net::HttpResponseHeaders* response_headers, - CPResponseInfoType type, void* buf, size_t buf_size) { - if (!response_headers) - return CPERR_FAILURE; - - switch (type) { - case CPRESPONSEINFO_HTTP_STATUS: - if (buf && buf_size) { - int status = response_headers->response_code(); - memcpy(buf, &status, std::min(buf_size, sizeof(status))); - } - break; - case CPRESPONSEINFO_HTTP_RAW_HEADERS: { - const std::string& headers = response_headers->raw_headers(); - if (buf_size < headers.size()+1) - return static_cast<int>(headers.size()+1); - if (buf) - memcpy(buf, headers.c_str(), headers.size()+1); - break; - } - default: - return CPERR_INVALID_VERSION; - } - - return CPERR_SUCCESS; -} - -CPError CPB_GetCommandLineArgumentsCommon(const char* url, - std::string* arguments) { - // TODO(aa): all of this code is only used by Gears, which we are removing. -#if defined(OS_WIN) - const CommandLine cmd = *CommandLine::ForCurrentProcess(); - std::wstring arguments_w; - - // Use the same UserDataDir for new launches that we currently have set. - FilePath user_data_dir = cmd.GetSwitchValuePath(switches::kUserDataDir); - if (!user_data_dir.empty()) { - // Make sure user_data_dir is an absolute path. - if (file_util::AbsolutePath(&user_data_dir) && - file_util::PathExists(user_data_dir)) { - // TODO(evanm): use CommandLine APIs instead of this. - arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kUserDataDir) + - L"=\"" + user_data_dir.value() + L"\" "; - } - } - - // Use '--app=url' instead of just 'url' to launch the browser with minimal - // chrome. - // Note: Do not change this flag! Old Gears shortcuts will break if you do! - std::string url_string(url); - ReplaceSubstringsAfterOffset(&url_string, 0, "\\", "%5C"); - ReplaceSubstringsAfterOffset(&url_string, 0, "\"", "%22"); - ReplaceSubstringsAfterOffset(&url_string, 0, ";", "%3B"); - ReplaceSubstringsAfterOffset(&url_string, 0, "$", "%24"); - // Windows shortcuts can't escape % so we use \x instead. - ReplaceSubstringsAfterOffset(&url_string, 0, "%", "\\x"); - std::wstring url_w = UTF8ToWide(url_string); - // TODO(evanm): use CommandLine APIs instead of this. - arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kApp) + - L"=\"" + url_w + L"\""; - - *arguments = WideToUTF8(arguments_w); -#else - // None of this code is used on non-Windows platforms. - NOTREACHED(); -#endif - - return CPERR_SUCCESS; -} - -// -// Host functions shared by browser and plugin processes -// - -void* STDCALL CPB_Alloc(uint32 size) { - return malloc(size); -} - -void STDCALL CPB_Free(void* memory) { - free(memory); -} diff --git a/chrome/common/chrome_plugin_util.h b/chrome/common/chrome_plugin_util.h deleted file mode 100644 index 17fdbe5..0000000 --- a/chrome/common/chrome_plugin_util.h +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2011 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 CHROME_COMMON_CHROME_PLUGIN_UTIL_H_ -#define CHROME_COMMON_CHROME_PLUGIN_UTIL_H_ -#pragma once - -#include <string> - -#include "base/basictypes.h" -#include "base/ref_counted.h" -#include "base/threading/non_thread_safe.h" -#include "chrome/common/chrome_plugin_api.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" - -class ChromePluginLib; -class MessageLoop; -namespace net { -class HttpResponseHeaders; -} - -// A helper struct to ensure the CPRequest data is cleaned up when done. -// This class is reused for requests made by the browser (and intercepted by the -// plugin) as well as those made by the plugin. -struct ScopableCPRequest : public CPRequest { - template<class T> - static T GetData(CPRequest* request) { - return static_cast<T>(static_cast<ScopableCPRequest*>(request)->data); - } - - ScopableCPRequest(const char* url, const char* method, - CPBrowsingContext context); - ~ScopableCPRequest(); - - void* data; -}; - -// This is a base class for plugin-related objects that need to go away when -// the plugin unloads. This object also verifies that it is created and -// destroyed on the same thread. -class PluginHelper : public NotificationObserver, - public base::NonThreadSafe { - public: - static void DestroyAllHelpersForPlugin(ChromePluginLib* plugin); - - explicit PluginHelper(ChromePluginLib* plugin); - virtual ~PluginHelper(); - - // NotificationObserver - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - - protected: - NotificationRegistrar registrar_; - - scoped_refptr<ChromePluginLib> plugin_; - - DISALLOW_COPY_AND_ASSIGN(PluginHelper); -}; - -// A class of utility functions for dealing with request responses. -class PluginResponseUtils { - public: - // Helper to convert request load flags from the plugin API to the net API - // versions. - static uint32 CPLoadFlagsToNetFlags(uint32 flags); - - // Common implementation of a CPR_GetResponseInfo call. - static int GetResponseInfo( - const net::HttpResponseHeaders* response_headers, - CPResponseInfoType type, void* buf, size_t buf_size); -}; - -// Helper to allocate a string using the given CPB_Alloc function. -inline char* CPB_StringDup(CPB_AllocFunc alloc, const std::string& str) { - char* cstr = static_cast<char*>(alloc(static_cast<uint32>(str.length() + 1))); - memcpy(cstr, str.c_str(), str.length() + 1); // Include null terminator. - return cstr; -} - -CPError CPB_GetCommandLineArgumentsCommon(const char* url, - std::string* arguments); - -void* STDCALL CPB_Alloc(uint32 size); -void STDCALL CPB_Free(void* memory); - -#endif // CHROME_COMMON_CHROME_PLUGIN_UTIL_H_ diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 5c845cd..ca1c6bf 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -817,10 +817,6 @@ const char kParentProfile[] = "parent-profile"; // See kRecordMode. const char kPlaybackMode[] = "playback-mode"; -// Specifies the plugin data directory, which is where plugins (Gears -// specifically) will store its state. -const char kPluginDataDir[] = "plugin-data-dir"; - // Controls speculative prerendering of pages, and content prefetching. Both // are dispatched from <link rel=prefetch href=...> elements. const char kPrerender[] = "prerender"; @@ -1188,9 +1184,6 @@ const char kDebugViewsPaint[] = "debug-views-paint"; // the expiration of credentials during testing. const char kClearTokenService[] = "clear-token-service"; -// Debug only switch to specify which gears plugin dll to load. -const char kGearsPluginPathOverride[] = "gears-plugin-path"; - // Sets a token in the token service, for testing. const char kSetToken[] = "set-token"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 0a50a3f..855a94e 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -232,7 +232,6 @@ extern const char kPackExtension[]; extern const char kPackExtensionKey[]; extern const char kParentProfile[]; extern const char kPlaybackMode[]; -extern const char kPluginDataDir[]; extern const char kPrerender[]; extern const char kPrerenderSwitchValueAuto[]; extern const char kPrerenderSwitchValueDisabled[]; @@ -354,7 +353,6 @@ extern const char kDebugViewsPaint[]; #ifndef NDEBUG extern const char kClearTokenService[]; -extern const char kGearsPluginPathOverride[]; extern const char kSetToken[]; extern const char kWebSocketLiveExperimentHost[]; #endif diff --git a/chrome/common/gears_api.h b/chrome/common/gears_api.h deleted file mode 100644 index 2b2f425..0000000 --- a/chrome/common/gears_api.h +++ /dev/null @@ -1,98 +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. -// -// This header specifies extensions to the Chrome Plugin API to support Gears. - -#ifndef CHROME_COMMON_GEARS_API_H__ -#define CHROME_COMMON_GEARS_API_H__ -#pragma once - -#include "chrome/common/chrome_plugin_api.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// CommandIDs used when Chrome calls into Gears using CPP_HandleCommand. -// Note: do not change the enum values. We want to preserve backwards -// compatibility. -typedef enum { - // Ask gears to show its settings dialog. Typical usage is for the plugin - // to display it using a call to CPB_ShowHtmlDialog. No command_data is - // provided. - GEARSPLUGINCOMMAND_SHOW_SETTINGS = 0, - - // Ask gears to create a shortcut to a web page. command_data points - // to a GearsShortcutData struct. - GEARSPLUGINCOMMAND_CREATE_SHORTCUT = 1, - - // Query gears for the list of installed shortcuts. command_data points - // to a GearsShortcutList struct. - GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST = 2, -} GearsPluginCommand; - -// CommandIDs used when Gears calls into Chrome using CPB_HandleCommand. -// Note: do not change the enum values. We want to preserve backwards -// compatibility. -typedef enum { - // Tell chrome that the GEARSPLUGINCOMMAND_CREATE_SHORTCUT command is done, - // and the user has closed the dialog. command_data points to the same - // GearsShortcutData struct that was passed to the plugin command. - GEARSBROWSERCOMMAND_CREATE_SHORTCUT_DONE = 1, - - // Notifies the browser of changes to the gears shortcuts database. - // command_data is null. - GEARSBROWSERCOMMAND_NOTIFY_SHORTCUTS_CHANGED = 3, -} GearsBrowserCommand; - -// Note: currently only 16x16, 32x32, 48x48, and 128x128 icons are supported. -typedef struct _GearsShortcutIcon { - const char* size; // unused - const char* url; // the URL of the icon, which should be a PNG image - int width; // width of the icon - int height; // height of the icon -} GearsShortcutIcon; - -// Command data for GEARSPLUGINCOMMAND_CREATE_SHORTCUT. -typedef struct _GearsShortcutData { - const char* name; // the shortcut's name (also used as the filename) - const char* url; // the URL that the shortcut should launch - const char* description; // an optional description - GearsShortcutIcon icons[4]; // list of icons to use for this shortcut -} GearsShortcutData; - -// Command data for GEARSPLUGINCOMMAND_CREATE_SHORTCUT used in 0.6 and later. -// This struct is backwards compatible with the first version. -// http://b/viewIssue?id=1331408 - Chrome sanitizes 'name' for compatibility -// with older versions of Gears that expect this. 'orig_name' is unsanitized, -// which allows Gears to do its own validation. -typedef struct _GearsShortcutData2 { - const char* name; // unused - for back compat with above struct - const char* url; // the URL that the shortcut should launch - const char* description; // an optional description - GearsShortcutIcon icons[4]; // list of icons to use for this shortcut - const char* orig_name; // the shortcut's unmodified filename (added in 0.6) -} GearsShortcutData2; - -// Command data for GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST. -typedef struct _GearsShortcutList { - // Note: these are output params, set by Gears. There are no input params. - // Memory for these shortcuts, including the strings they hold, should be - // freed by the browser using CPB_Free. - GearsShortcutData* shortcuts; // array of installed shortcuts - uint32 num_shortcuts; // size of the array -} GearsShortcutList; - -// Command data for GEARSBROWSERCOMMAND_CREATE_SHORTCUT_DONE -typedef struct _GearsCreateShortcutResult { - GearsShortcutData2* shortcut; // pointer to struct passed to - // GEARSPLUGINCOMMAND_CREATE_SHORTCUT - CPError result; // CPERR_SUCCESS if shortcut was created, or error otherwise -} GearsCreateShortcutResult; - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // CHROME_COMMON_GEARS_API_H_ diff --git a/chrome/common/geoposition.cc b/chrome/common/geoposition.cc index f8f087c..e3a2020 100644 --- a/chrome/common/geoposition.cc +++ b/chrome/common/geoposition.cc @@ -7,7 +7,7 @@ namespace { // Sentinel values to mark invalid data. (WebKit carries companion is_valid // bools for this purpose; we may eventually follow that approach, but -// sentinels worked OK in the gears code this is based on.) +// sentinels worked OK in the Gears code this is based on.) const double kBadLatitudeLongitude = 200; // Lowest point on land is at approximately -400 meters. const int kBadAltitude = -10000; diff --git a/chrome/common/net/url_fetcher_unittest.cc b/chrome/common/net/url_fetcher_unittest.cc index 5a3adbb..8e86d93 100644 --- a/chrome/common/net/url_fetcher_unittest.cc +++ b/chrome/common/net/url_fetcher_unittest.cc @@ -6,7 +6,6 @@ #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h" #include "build/build_config.h" -#include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/net/url_fetcher.h" #include "chrome/common/net/url_request_context_getter.h" #include "net/http/http_response_headers.h" @@ -96,8 +95,6 @@ class URLFetcherTest : public testing::Test, public URLFetcher::Delegate { io_message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); - // Ensure that any plugin operations done by other tests are cleaned up. - ChromePluginLib::UnloadAllPlugins(); #if defined(USE_NSS) net::EnsureOCSPInit(); #endif diff --git a/chrome/common/net/url_request_intercept_job.cc b/chrome/common/net/url_request_intercept_job.cc deleted file mode 100644 index 8b335a4..0000000 --- a/chrome/common/net/url_request_intercept_job.cc +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) 2011 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. -// -// This job type handles Chrome plugin network interception. When a plugin -// wants to intercept a request, a job of this type is created. The intercept -// job communicates with the plugin to retrieve the response headers and data. - -#include "chrome/common/net/url_request_intercept_job.h" - -#include <vector> - -#include "base/compiler_specific.h" -#include "base/message_loop.h" -#include "base/string_util.h" -#include "chrome/common/chrome_plugin_lib.h" -#include "content/common/notification_source.h" -#include "net/base/io_buffer.h" -#include "net/base/net_errors.h" -#include "net/base/x509_certificate.h" -#include "net/http/http_response_headers.h" -#include "net/url_request/url_request.h" - -using base::Time; -using base::TimeDelta; - -// -// URLRequestInterceptJob -// - -URLRequestInterceptJob::URLRequestInterceptJob(net::URLRequest* request, - ChromePluginLib* plugin, - ScopableCPRequest* cprequest) - : net::URLRequestJob(request), - cprequest_(cprequest), - plugin_(plugin), - read_buffer_(NULL), - ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { - cprequest_->data = this; // see FromCPRequest(). - - registrar_.Add(this, NotificationType::CHROME_PLUGIN_UNLOADED, - Source<ChromePluginLib>(plugin_)); -} - -URLRequestInterceptJob::~URLRequestInterceptJob() { - if (plugin_) { - plugin_->functions().request_funcs->end_request(cprequest_.get(), - CPERR_SUCCESS); - } -} - -void URLRequestInterceptJob::DetachPlugin() { - registrar_.RemoveAll(); - plugin_ = NULL; -} - -void URLRequestInterceptJob::Start() { - // Start reading asynchronously so that all error reporting and data - // callbacks happen as they would for network requests. - MessageLoop::current()->PostTask( - FROM_HERE, - method_factory_.NewRunnableMethod( - &URLRequestInterceptJob::StartAsync)); -} - -void URLRequestInterceptJob::Kill() { - if (plugin_) { - plugin_->functions().request_funcs->end_request(cprequest_.get(), - CPERR_CANCELLED); - DetachPlugin(); - } - net::URLRequestJob::Kill(); - method_factory_.RevokeAll(); -} - -bool URLRequestInterceptJob::ReadRawData(net::IOBuffer* dest, int dest_size, - int* bytes_read) { - DCHECK_NE(dest_size, 0); - DCHECK(bytes_read); - - if (!plugin_) - return false; - - int rv = plugin_->functions().request_funcs->read(cprequest_.get(), - dest->data(), dest_size); - if (rv >= 0) { - *bytes_read = rv; - return true; - } - - if (rv == CPERR_IO_PENDING) { - read_buffer_ = dest; - read_buffer_size_ = dest_size; - SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0)); - } else { - // TODO(mpcomplete): better error code - NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, - net::ERR_FAILED)); - } - - return false; -} - -bool URLRequestInterceptJob::GetMimeType(std::string* mime_type) const { - return request_->response_headers()->GetMimeType(mime_type); -} - -bool URLRequestInterceptJob::GetCharset(std::string* charset) { - return request_->response_headers()->GetCharset(charset); -} - -bool URLRequestInterceptJob::GetContentEncodings( - std::vector<net::Filter::FilterType>* encoding_types) { - DCHECK(encoding_types->empty()); - if (!request_->response_headers()) - return false; - - std::string encoding_type; - void* iter = NULL; - while (request_->response_headers()->EnumerateHeader( - &iter, "Content-Encoding", &encoding_type)) { - encoding_types->push_back( - net::Filter::ConvertEncodingToType(encoding_type)); - } - - // Even if encoding types are empty, there is a chance that we need to add - // some decoding, as some proxies strip encoding completely. In such cases, - // we may need to add (for example) SDCH filtering (when the context suggests - // it is appropriate). - net::Filter::FixupEncodingTypes(*this, encoding_types); - return !encoding_types->empty(); -} - -void URLRequestInterceptJob::GetResponseInfo(net::HttpResponseInfo* info) { - if (!plugin_) - return; - - std::string raw_headers; - int size = plugin_->functions().request_funcs->get_response_info( - cprequest_.get(), CPRESPONSEINFO_HTTP_RAW_HEADERS, NULL, 0); - int rv = size < 0 ? size : - plugin_->functions().request_funcs->get_response_info( - cprequest_.get(), CPRESPONSEINFO_HTTP_RAW_HEADERS, - WriteInto(&raw_headers, size+1), size); - if (rv != CPERR_SUCCESS) { - // TODO(mpcomplete): what should we do here? - raw_headers = "HTTP/1.1 404 Not Found"; - raw_headers.push_back('\0'); - } - - info->headers = new net::HttpResponseHeaders(raw_headers); - - if (request_->url().SchemeIsSecure()) { - // Make up a fake certificate for intercepted data since we don't have - // access to the real SSL info. - // TODO(mpcomplete): we should probably have the interception API transmit - // the SSL info, but the only consumer of this API (Gears) doesn't keep that - // around. We should change that. - const char* kCertIssuer = "Chrome Internal"; - const int kLifetimeDays = 100; - - DLOG(WARNING) << "Issuing a fake SSL certificate for interception of URL " - << request_->url(); - - info->ssl_info.cert = - new net::X509Certificate(request_->url().GetWithEmptyPath().spec(), - kCertIssuer, - Time::Now(), - Time::Now() + - TimeDelta::FromDays(kLifetimeDays)); - info->ssl_info.cert_status = 0; - info->ssl_info.security_bits = -1; - } -} - -int URLRequestInterceptJob::GetResponseCode() const { - if (!plugin_) - return -1; - - int status = 200; - plugin_->functions().request_funcs->get_response_info( - cprequest_.get(), CPRESPONSEINFO_HTTP_STATUS, &status, sizeof(status)); - - return status; -} - -bool URLRequestInterceptJob::IsRedirectResponse(GURL* location, - int* http_status_code) { - if (!request_->response_headers()) - return false; - - std::string value; - if (!request_->response_headers()->IsRedirect(&value)) - return false; - - *location = request_->url().Resolve(value); - *http_status_code = request_->response_headers()->response_code(); - return true; -} - -void URLRequestInterceptJob::StartAsync() { - // We may have been orphaned... - if (!request_ || !plugin_) - return; - - int rv = plugin_->functions().request_funcs->start_request(cprequest_.get()); - if (rv != CPERR_IO_PENDING) - OnStartCompleted(rv); -} - -void URLRequestInterceptJob::OnStartCompleted(int result) { - if (result != CPERR_SUCCESS) { - NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, - net::ERR_CONNECTION_FAILED)); - return; - } - - NotifyHeadersComplete(); -} - -void URLRequestInterceptJob::OnReadCompleted(int bytes_read) { - if (bytes_read < 0) { - NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, - net::ERR_FAILED)); - return; - } - - SetStatus(net::URLRequestStatus()); // clear the async flag - NotifyReadComplete(bytes_read); -} - -void URLRequestInterceptJob::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - DCHECK(type == NotificationType::CHROME_PLUGIN_UNLOADED); - DCHECK(plugin_ == Source<ChromePluginLib>(source).ptr()); - DetachPlugin(); -} diff --git a/chrome/common/net/url_request_intercept_job.h b/chrome/common/net/url_request_intercept_job.h deleted file mode 100644 index cc7312a..0000000 --- a/chrome/common/net/url_request_intercept_job.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2011 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 CHROME_COMMON_NET_URL_REQUEST_INTERCEPT_JOB_H_ -#define CHROME_COMMON_NET_URL_REQUEST_INTERCEPT_JOB_H_ -#pragma once - -#include <string> - -#include "base/scoped_ptr.h" -#include "base/task.h" -#include "chrome/common/chrome_plugin_api.h" -#include "chrome/common/chrome_plugin_util.h" -#include "content/common/notification_registrar.h" -#include "net/url_request/url_request_job.h" - -namespace net { -class URLRequest; -} // namespace net - -class ChromePluginLib; - -// A request job that handles network requests intercepted by a Chrome plugin. -class URLRequestInterceptJob : public net::URLRequestJob, - public NotificationObserver { - public: - static URLRequestInterceptJob* FromCPRequest(CPRequest* request) { - return ScopableCPRequest::GetData<URLRequestInterceptJob*>(request); - } - - URLRequestInterceptJob(net::URLRequest* request, ChromePluginLib* plugin, - ScopableCPRequest* cprequest); - virtual ~URLRequestInterceptJob(); - - // Plugin callbacks. - void OnStartCompleted(int result); - void OnReadCompleted(int bytes_read); - - // net::URLRequestJob - virtual void Start(); - virtual void Kill(); - virtual bool GetMimeType(std::string* mime_type) const; - virtual bool GetCharset(std::string* charset); - virtual void GetResponseInfo(net::HttpResponseInfo* info); - virtual int GetResponseCode() const; - virtual bool GetContentEncodings( - std::vector<net::Filter::FilterType>* encoding_types); - virtual bool IsRedirectResponse(GURL* location, int* http_status_code); - - // NotificationObserver - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - - protected: - virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); - - private: - void StartAsync(); - void DetachPlugin(); - - NotificationRegistrar registrar_; - scoped_ptr<ScopableCPRequest> cprequest_; - ChromePluginLib* plugin_; - net::IOBuffer* read_buffer_; - int read_buffer_size_; - ScopedRunnableMethodFactory<URLRequestInterceptJob> method_factory_; - - DISALLOW_COPY_AND_ASSIGN(URLRequestInterceptJob); -}; - -#endif // CHROME_COMMON_NET_URL_REQUEST_INTERCEPT_JOB_H_ diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h index f0f4f79..111c4c2 100644 --- a/chrome/common/plugin_messages_internal.h +++ b/chrome/common/plugin_messages_internal.h @@ -27,11 +27,6 @@ IPC_MESSAGE_CONTROL2(PluginProcessMsg_CreateChannel, int /* renderer_id */, bool /* off_the_record */) -// Allows a chrome plugin loaded in the browser process to send arbitrary -// data to an instance of the same plugin loaded in a plugin process. -IPC_MESSAGE_CONTROL1(PluginProcessMsg_PluginMessage, - std::vector<uint8> /* opaque data */) - // Tells the plugin process to notify every connected renderer of the pending // shutdown, so we don't mistake it for a crash. IPC_MESSAGE_CONTROL0(PluginProcessMsg_NotifyRenderersOfPendingShutdown) @@ -47,30 +42,7 @@ IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_ChannelCreated, IPC_SYNC_MESSAGE_CONTROL0_1(PluginProcessHostMsg_GetPluginFinderUrl, std::string /* plugin finder URL */) -// Allows a chrome plugin loaded in a plugin process to send arbitrary -// data to an instance of the same plugin loaded in the browser process. -IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_PluginMessage, - std::vector<uint8> /* opaque data */) - -// Allows a chrome plugin loaded in a plugin process to send arbitrary -// data to an instance of the same plugin loaded in the browser process. -IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_PluginSyncMessage, - std::vector<uint8> /* opaque data */, - std::vector<uint8> /* opaque data response */) - -// Used to get cookies for the given URL. The request_context is a -// CPBrowsingContext, but is passed as int32 to avoid compilation errors. -IPC_SYNC_MESSAGE_CONTROL2_1(PluginProcessHostMsg_GetCookies, - int32 /* request_context */, - GURL /* url */, - std::string /* cookies */) - -// Used by the plugin process to verify that its renderer |renderer_id| has -// permission to access the given |files|. -IPC_SYNC_MESSAGE_CONTROL2_1(PluginProcessHostMsg_AccessFiles, - int /* renderer_id */, - std::vector<std::string> /* files */, - bool /* allowed */) +IPC_MESSAGE_CONTROL0(PluginProcessHostMsg_ShutdownRequest) // Get the list of proxies to use for |url|, as a semicolon delimited list // of "<TYPE> <HOST>:<PORT>" | "DIRECT". See also ViewHostMsg_ResolveProxy @@ -81,11 +53,6 @@ IPC_SYNC_MESSAGE_CONTROL1_2(PluginProcessHostMsg_ResolveProxy, std::string /* proxy list */) #if defined(OS_WIN) -// Creates a child window of the given parent window on the UI thread. -IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_CreateWindow, - HWND /* parent */, - HWND /* child */) - // Destroys the given window's parent on the UI thread. IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginWindowDestroyed, HWND /* window */, @@ -333,33 +300,9 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies, GURL /* first_party_for_cookies */, std::string /* cookies */) -// Asks the browser to show a modal HTML dialog. The dialog is passed the -// given arguments as a JSON string, and returns its result as a JSON string -// through json_retval. -IPC_SYNC_MESSAGE_ROUTED4_1(PluginHostMsg_ShowModalHTMLDialog, - GURL /* url */, - int /* width */, - int /* height */, - std::string /* json_arguments */, - std::string /* json_retval */) - -IPC_SYNC_MESSAGE_ROUTED2_2(PluginHostMsg_GetDragData, - NPVariant_Param /* event */, - bool /* add_data */, - std::vector<NPVariant_Param> /* result_values */, - bool /* result_success */) - -IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_SetDropEffect, - NPVariant_Param /* event */, - int /* effect */, - bool /* result_success */) - IPC_MESSAGE_ROUTED1(PluginHostMsg_MissingPluginStatus, int /* status */) -IPC_SYNC_MESSAGE_ROUTED0_1(PluginHostMsg_GetCPBrowsingContext, - uint32 /* context */) - IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad) IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest, diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index e7068d5..3ec8c79 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -482,7 +482,6 @@ void ParamTraits<WebPreferences>::Log(const param_type& p, std::string* l) { } void ParamTraits<WebDropData>::Write(Message* m, const param_type& p) { - WriteParam(m, p.identity); WriteParam(m, p.url); WriteParam(m, p.url_title); WriteParam(m, p.download_metadata); @@ -498,7 +497,6 @@ void ParamTraits<WebDropData>::Write(Message* m, const param_type& p) { bool ParamTraits<WebDropData>::Read(const Message* m, void** iter, param_type* p) { return - ReadParam(m, iter, &p->identity) && ReadParam(m, iter, &p->url) && ReadParam(m, iter, &p->url_title) && ReadParam(m, iter, &p->download_metadata) && diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index dcbca37..f3dfdc8 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1655,13 +1655,6 @@ IPC_MESSAGE_ROUTED3(ViewHostMsg_SendSerializedHtmlData, std::string /* data buffer */, int32 /* complete status */) -IPC_SYNC_MESSAGE_ROUTED4_1(ViewHostMsg_ShowModalHTMLDialog, - GURL /* url */, - int /* width */, - int /* height */, - std::string /* json_arguments */, - std::string /* json_retval */) - IPC_MESSAGE_ROUTED2(ViewHostMsg_DidGetApplicationInfo, int32 /* page_id */, WebApplicationInfo) @@ -1688,10 +1681,10 @@ IPC_MESSAGE_ROUTED4(ViewHostMsg_DidDownloadFavIcon, bool /* true if there was a network error */, SkBitmap /* image_data */) -// Get the CPBrowsingContext associated with the renderer sending this +// Sent when the renderer process is done processing a DataReceived // message. -IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_GetCPBrowsingContext, - uint32 /* context */) +IPC_MESSAGE_ROUTED1(ViewHostMsg_DataReceived_ACK, + int /* request_id */) IPC_MESSAGE_CONTROL1(ViewHostMsg_RevealFolderInOS, FilePath /* path */) diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 18fdc80..7f5052d 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -19,7 +19,6 @@ const char kExtensionScheme[] = "chrome-extension"; const char kFileScheme[] = "file"; const char kFileSystemScheme[] = "filesystem"; const char kFtpScheme[] = "ftp"; -const char kGearsScheme[] = "gears"; const char kHttpScheme[] = "http"; const char kHttpsScheme[] = "https"; const char kJavaScriptScheme[] = "javascript"; @@ -254,7 +253,6 @@ void RegisterChromeSchemes() { // the new tab page. url_util::AddStandardScheme(kChromeDevToolsScheme); url_util::AddStandardScheme(kChromeUIScheme); - url_util::AddStandardScheme(kGearsScheme); url_util::AddStandardScheme(kExtensionScheme); url_util::AddStandardScheme(kMetadataScheme); #if defined(OS_CHROMEOS) diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index c4c8d4f..8c676a9 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -22,7 +22,6 @@ extern const char kExtensionScheme[]; extern const char kFileScheme[]; extern const char kFileSystemScheme[]; extern const char kFtpScheme[]; -extern const char kGearsScheme[]; extern const char kHttpScheme[]; extern const char kHttpsScheme[]; extern const char kJavaScriptScheme[]; |
