diff options
158 files changed, 83 insertions, 9705 deletions
@@ -315,7 +315,6 @@ include_rules = [ skip_child_includes = [ "breakpad", "chrome_frame", - "gears", "native_client", "o3d", "pdf", diff --git a/build/all.gyp b/build/all.gyp index 3ea4654..633fa8cd 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -106,7 +106,6 @@ '../chrome/app/locales/locales.gyp:*', '../chrome_frame/chrome_frame.gyp:*', '../courgette/courgette.gyp:*', - '../gears/gears.gyp:*', '../rlz/rlz.gyp:*', '../sandbox/sandbox.gyp:*', '../third_party/angle/src/build_angle.gyp:*', diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index ef2d1ca..1760a29 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -2324,7 +2324,7 @@ Other platform defines such as use_titlecase are declared in build/common.gypi. Wait for downloads to finish </message> - <!-- Gears shortcut strings --> + <!-- "Create application shortcuts" menu item --> <if expr="not pp_ifdef('use_titlecase')"> <message name="IDS_CREATE_SHORTCUTS" desc="Default installation menu label"> Create application &shortcuts... @@ -2336,7 +2336,7 @@ Other platform defines such as use_titlecase are declared in build/common.gypi. </message> </if> - <!-- "Create application shortcuts" dialog (non-Gears) --> + <!-- "Create application shortcuts" dialog --> <if expr="not pp_ifdef('use_titlecase') or os != 'linux2'"> <message name="IDS_CREATE_SHORTCUTS_TITLE" desc="Title of the dialog to create application shortcuts for current page."> Create application shortcuts @@ -7063,13 +7063,6 @@ Keep your key file in a safe place. You will need it to create new versions of y </message> </if> - <message name="IDS_OPTIONS_GEARSSETTINGS_GROUP_NAME" desc="The label of the 'Gears Settings' group"> - Gears: - </message> - <message name="IDS_OPTIONS_GEARSSETTINGS_CONFIGUREGEARS_BUTTON" desc="The label of the 'configure gears' button"> - Change Gears settings - </message> - <message name="IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE" desc="The label of the check-box that enables page translate"> Offer to translate pages that aren't in a language I read </message> diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc index 2ae2736..beb7ad6 100644 --- a/chrome/browser/automation/url_request_automation_job.cc +++ b/chrome/browser/automation/url_request_automation_job.cc @@ -105,12 +105,6 @@ net::URLRequestJob* URLRequestAutomationJob::Factory( if (request_info) { int child_id = request_info->child_id(); int route_id = request_info->route_id(); - - if (request_info->process_type() == ChildProcessInfo::PLUGIN_PROCESS) { - child_id = request_info->host_renderer_id(); - route_id = request_info->host_render_view_id(); - } - AutomationResourceMessageFilter::AutomationDetails details; if (AutomationResourceMessageFilter::LookupRegisteredRenderView( child_id, route_id, &details)) { diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index 7476f49..d37a45a 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -30,7 +30,6 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/switch_utils.h" @@ -121,11 +120,6 @@ void Shutdown() { // shutdown. base::ThreadRestrictions::SetIOAllowed(true); - // Unload plugins. This needs to happen on the IO thread. - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - NewRunnableFunction(&ChromePluginLib::UnloadAllPlugins)); - // Shutdown all IPC channels to service processes. ServiceProcessControlManager::GetInstance()->Shutdown(); diff --git a/chrome/browser/chrome_plugin_browsing_context.cc b/chrome/browser/chrome_plugin_browsing_context.cc deleted file mode 100644 index 380f074..0000000 --- a/chrome/browser/chrome_plugin_browsing_context.cc +++ /dev/null @@ -1,63 +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/browser/chrome_plugin_browsing_context.h" - -#include "base/message_loop.h" -#include "base/singleton.h" -#include "content/browser/browser_thread.h" -#include "content/common/notification_service.h" - -CPBrowsingContextManager* CPBrowsingContextManager::GetInstance() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - return Singleton<CPBrowsingContextManager>::get(); -} - -CPBrowsingContextManager::CPBrowsingContextManager() { - registrar_.Add(this, NotificationType::URL_REQUEST_CONTEXT_RELEASED, - NotificationService::AllSources()); -} - -CPBrowsingContextManager::~CPBrowsingContextManager() { -} - -CPBrowsingContext CPBrowsingContextManager::Allocate( - net::URLRequestContext* context) { - int32 map_id = map_.Add(context); - return static_cast<CPBrowsingContext>(map_id); -} - -net::URLRequestContext* CPBrowsingContextManager::ToURLRequestContext( - CPBrowsingContext id) { - return map_.Lookup(static_cast<int32>(id)); -} - -CPBrowsingContext CPBrowsingContextManager::Lookup( - net::URLRequestContext* context) { - ReverseMap::const_iterator it = reverse_map_.find(context); - if (it == reverse_map_.end()) { - CPBrowsingContext id = Allocate(context); - reverse_map_[context] = id; - return id; - } else { - return it->second; - } -} - -void CPBrowsingContextManager::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - DCHECK(type == NotificationType::URL_REQUEST_CONTEXT_RELEASED); - - net::URLRequestContext* context = - Source<net::URLRequestContext>(source).ptr(); - - // Multiple CPBrowsingContexts may refer to the same net::URLRequestContext. - for (Map::iterator it(&map_); !it.IsAtEnd(); it.Advance()) { - if (it.GetCurrentValue() == context) - map_.Remove(it.GetCurrentKey()); - } - - reverse_map_.erase(context); -} diff --git a/chrome/browser/chrome_plugin_browsing_context.h b/chrome/browser/chrome_plugin_browsing_context.h deleted file mode 100644 index 8ced746..0000000 --- a/chrome/browser/chrome_plugin_browsing_context.h +++ /dev/null @@ -1,64 +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_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H_ -#define CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H_ -#pragma once - -#include <map> - -#include "base/id_map.h" -#include "chrome/common/chrome_plugin_api.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" - -namespace net { -class URLRequestContext; -} // namespace net - -// This class manages the mapping between CPBrowsingContexts and -// net::URLRequestContexts. It observes when net::URLRequestContexts go away, -// and invalidates the corresponding CPBrowsingContexts. CPBrowsingContexts can -// be associated with other data as well, so there can be multiple ones -// referring to a given net::URLRequestContext. -// Note: This class should be used on the IO thread only. -class CPBrowsingContextManager : public NotificationObserver { - public: - static CPBrowsingContextManager* GetInstance(); - - // Note: don't call these directly - use Instance() above. They are public - // so Singleton can access them. - CPBrowsingContextManager(); - ~CPBrowsingContextManager(); - - // Generate a new unique CPBrowsingContext ID from the given - // net::URLRequestContext. Multiple CPBrowsingContexts can map to the same - // net::URLRequestContext. - CPBrowsingContext Allocate(net::URLRequestContext* context); - - // Return the net::URLRequestContext that this CPBrowsingContext refers to, or - // NULL if not found. - net::URLRequestContext* ToURLRequestContext(CPBrowsingContext id); - - // Return a CPBrowsingContext ID that corresponds to the given - // net::URLRequestContext. This function differs from Allocate in that calling - // this multiple times with the same argument gives the same ID. - CPBrowsingContext Lookup(net::URLRequestContext* context); - - private: - // NotificationObserver - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - - typedef IDMap<net::URLRequestContext> Map; - typedef std::map<net::URLRequestContext*, CPBrowsingContext> ReverseMap; - - NotificationRegistrar registrar_; - - Map map_; // map of CPBrowsingContext -> net::URLRequestContext - ReverseMap reverse_map_; // map of net::URLRequestContext -> CPBrowsingContext -}; - -#endif // CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H_ diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc deleted file mode 100644 index 4c069ab..0000000 --- a/chrome/browser/chrome_plugin_host.cc +++ /dev/null @@ -1,842 +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/browser/chrome_plugin_host.h" - -#include <set> -#include <string> -#include <vector> - -#include "base/basictypes.h" -#include "base/command_line.h" -#include "base/file_path.h" -#include "base/file_util.h" -#include "base/message_loop.h" -#include "base/metrics/histogram.h" -#include "base/path_service.h" -#include "base/perftimer.h" -#include "base/singleton.h" -#include "base/string_util.h" -#include "base/utf_string_conversions.h" -#include "chrome/browser/browser_list.h" -#include "chrome/browser/chrome_plugin_browsing_context.h" -#include "chrome/browser/gears_integration.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/webui/html_dialog_ui.h" -#include "chrome/common/chrome_constants.h" -#include "chrome/common/chrome_counters.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_plugin_lib.h" -#include "chrome/common/chrome_plugin_util.h" -#include "chrome/common/gears_api.h" -#include "chrome/common/net/url_request_context_getter.h" -#include "chrome/common/net/url_request_intercept_job.h" -#include "chrome/common/plugin_messages.h" -#include "chrome/common/render_messages.h" -#include "content/browser/browser_thread.h" -#include "content/browser/plugin_process_host.h" -#include "content/browser/plugin_service.h" -#include "content/browser/renderer_host/render_process_host.h" -#include "content/common/notification_service.h" -#include "net/base/cookie_monster.h" -#include "net/base/io_buffer.h" -#include "net/base/net_errors.h" -#include "net/http/http_request_headers.h" -#include "net/url_request/url_request.h" -#include "net/url_request/url_request_context.h" -#include "net/url_request/url_request_error_job.h" -#include "third_party/skia/include/core/SkBitmap.h" - - -using base::TimeDelta; - -// This class manages the interception of network requests. It queries the -// plugin on every request, and creates an intercept job if the plugin can -// intercept the request. -// NOTE: All methods must be called on the IO thread. -class PluginRequestInterceptor - : public PluginHelper, public net::URLRequest::Interceptor { - public: - static net::URLRequestJob* UninterceptedProtocolHandler( - net::URLRequest* request, const std::string& scheme) { - // This will get called if a plugin failed to intercept a request for a - // protocol it has registered. In that case, we return NULL and the request - // will result in an error. - return new net::URLRequestErrorJob(request, net::ERR_FILE_NOT_FOUND); - } - - explicit PluginRequestInterceptor(ChromePluginLib* plugin) - : PluginHelper(plugin) { - net::URLRequest::RegisterRequestInterceptor(this); - } - - virtual ~PluginRequestInterceptor() { - net::URLRequest::UnregisterRequestInterceptor(this); - - // Unregister our protocols. - for (HandledProtocolList::iterator it = registered_protocols_.begin(); - it != registered_protocols_.end(); ++it) { - net::URLRequest::ProtocolFactory* factory = - net::URLRequest::RegisterProtocolFactory(*it, NULL); - DCHECK(factory == UninterceptedProtocolHandler); - } - } - - void RegisterProtocol(const std::string& scheme) { - DCHECK(CalledOnValidThread()); - - std::string lower_scheme = StringToLowerASCII(scheme); - handled_protocols_.insert(lower_scheme); - - // Only add a protocol factory if the net::URLRequest doesn't already handle - // it. If we fail to intercept, the request will be treated as an error. - if (!net::URLRequest::IsHandledProtocol(lower_scheme)) { - registered_protocols_.insert(lower_scheme); - net::URLRequest::RegisterProtocolFactory(lower_scheme, - &UninterceptedProtocolHandler); - } - } - - // net::URLRequest::Interceptor - virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) { - // TODO(darin): This DCHECK fails in the unit tests because our interceptor - // is being persisted across unit tests. As a result, each time we get - // poked on a different thread, but never from more than one thread at a - // time. We need a way to have the URLRequestJobManager get reset between - // unit tests. - // DCHECK(CalledOnValidThread()); - - if (!IsHandledProtocol(request->url().scheme())) - return NULL; - - CPBrowsingContext context = - CPBrowsingContextManager::GetInstance()->Lookup(request->context()); - scoped_ptr<ScopableCPRequest> cprequest( - new ScopableCPRequest(request->url().spec().c_str(), - request->method().c_str(), - context)); - - PerfTimer timer; - if (!plugin_->functions().should_intercept_request(cprequest.get())) { - LogInterceptMissTime(timer.Elapsed()); - return NULL; - } - LogInterceptHitTime(timer.Elapsed()); - return new URLRequestInterceptJob(request, plugin_, cprequest.release()); - } - - private: - bool IsHandledProtocol(const std::string& scheme) { - return handled_protocols_.find(scheme) != handled_protocols_.end(); - } - - void LogInterceptHitTime(const TimeDelta& time) { - UMA_HISTOGRAM_TIMES("Gears.InterceptHit", time); - } - - void LogInterceptMissTime(const TimeDelta& time) { - UMA_HISTOGRAM_TIMES("Gears.InterceptMiss", time); - } - - typedef std::set<std::string> HandledProtocolList; - HandledProtocolList handled_protocols_; - HandledProtocolList registered_protocols_; -}; - -// This class manages a network request made by the plugin, also acting as -// the net::URLRequest delegate. -// NOTE: All methods must be called on the IO thread. -class PluginRequestHandler : public PluginHelper, - public net::URLRequest::Delegate { - public: - static PluginRequestHandler* FromCPRequest(CPRequest* request) { - return ScopableCPRequest::GetData<PluginRequestHandler*>(request); - } - - PluginRequestHandler(ChromePluginLib* plugin, ScopableCPRequest* cprequest) - : PluginHelper(plugin), cprequest_(cprequest), user_buffer_(NULL) { - cprequest_->data = this; // see FromCPRequest(). - - net::URLRequestContext* context = CPBrowsingContextManager::GetInstance()-> - ToURLRequestContext(cprequest_->context); - // TODO(mpcomplete): remove fallback case when Gears support is prevalent. - if (!context) - context = Profile::GetDefaultRequestContext()->GetURLRequestContext(); - - GURL gurl(cprequest_->url); - request_.reset(new net::URLRequest(gurl, this)); - request_->set_context(context); - request_->set_method(cprequest_->method); - request_->set_load_flags(PluginResponseUtils::CPLoadFlagsToNetFlags(0)); - } - - net::URLRequest* request() { return request_.get(); } - - // Wraper of net::URLRequest::Read() - bool Read(char* dest, int dest_size, int *bytes_read) { - CHECK(!my_buffer_.get()); - // We'll use our own buffer until the read actually completes. - user_buffer_ = dest; - my_buffer_ = new net::IOBuffer(dest_size); - - if (request_->Read(my_buffer_, dest_size, bytes_read)) { - memcpy(dest, my_buffer_->data(), *bytes_read); - my_buffer_ = NULL; - return true; - } - - if (!request_->status().is_io_pending()) - my_buffer_ = NULL; - - return false; - } - - // net::URLRequest::Delegate - virtual void OnReceivedRedirect(net::URLRequest* request, const GURL& new_url, - bool* defer_redirect) { - plugin_->functions().response_funcs->received_redirect( - cprequest_.get(), new_url.spec().c_str()); - } - - virtual void OnResponseStarted(net::URLRequest* request) { - // TODO(mpcomplete): better error codes - CPError result = - request_->status().is_success() ? CPERR_SUCCESS : CPERR_FAILURE; - plugin_->functions().response_funcs->start_completed( - cprequest_.get(), result); - } - - virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) { - CHECK(my_buffer_.get()); - CHECK(user_buffer_); - if (bytes_read > 0) { - memcpy(user_buffer_, my_buffer_->data(), bytes_read); - } else if (bytes_read < 0) { - // TODO(mpcomplete): better error codes - bytes_read = CPERR_FAILURE; - } - my_buffer_ = NULL; - plugin_->functions().response_funcs->read_completed( - cprequest_.get(), bytes_read); - } - - private: - scoped_ptr<ScopableCPRequest> cprequest_; - scoped_ptr<net::URLRequest> request_; - scoped_refptr<net::IOBuffer> my_buffer_; - char* user_buffer_; -}; - -// This class manages plugins that want to handle UI commands. Right now, we -// only allow 1 plugin to do this, so there's only ever 1 instance of this -// class at once. -// NOTE: All methods must be called on the IO thread. -class PluginCommandHandler : public PluginHelper { - public: - static void HandleCommand(int command, - CPCommandInterface* data, - int32 context_as_int32) { - CPBrowsingContext context = - static_cast<CPBrowsingContext>(context_as_int32); - // Ensure plugins are loaded before we try to talk to it. This will be a - // noop if plugins are loaded already. - ChromePluginLib::LoadChromePlugins(GetCPBrowserFuncsForBrowser()); - - DCHECK(ChromePluginLib::IsPluginThread()); - CPError rv = CPERR_INVALID_VERSION; - if (instance_ && instance_->plugin_->functions().handle_command) { - rv = instance_->plugin_->functions().handle_command( - context, command, data ? data->GetData() : NULL); - } - if (data) - data->OnCommandInvoked(rv); - } - - static void RegisterPlugin(ChromePluginLib* plugin) { - DCHECK(ChromePluginLib::IsPluginThread()); - // TODO(mpcomplete): We only expect to have Gears register a command handler - // at the moment. We should either add support for other plugins to do - // this, or verify that the plugin is Gears. - DCHECK(!instance_) << - "We only support a single plugin handling UI commands."; - if (instance_) - return; - // Deleted in response to a notification in PluginHelper. - new PluginCommandHandler(plugin); - } - - private: - explicit PluginCommandHandler(ChromePluginLib* plugin) - : PluginHelper(plugin) { - DCHECK(instance_ == NULL); - instance_ = this; - } - - virtual ~PluginCommandHandler() { - instance_ = NULL; - } - - static PluginCommandHandler* instance_; -}; - -PluginCommandHandler* PluginCommandHandler::instance_ = NULL; - -// This class acts as a helper to display the HTML dialog. It is created -// on demand on the plugin thread, and proxies calls to and from the UI thread -// to display the UI. -class ModelessHtmlDialogDelegate : public HtmlDialogUIDelegate { - public: - ModelessHtmlDialogDelegate(const GURL& url, - int width, int height, - const std::string& json_arguments, - void* plugin_context, - ChromePluginLib* plugin, - MessageLoop* main_message_loop, - gfx::NativeWindow parent_wnd) - : main_message_loop_(main_message_loop), - io_message_loop_(MessageLoop::current()), - plugin_(plugin), - plugin_context_(plugin_context), - parent_wnd_(parent_wnd) { - DCHECK(ChromePluginLib::IsPluginThread()); - params_.url = url; - params_.height = height; - params_.width = width; - params_.json_input = json_arguments; - - main_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, &ModelessHtmlDialogDelegate::Show)); - } - virtual ~ModelessHtmlDialogDelegate() { - DCHECK(ChromePluginLib::IsPluginThread()); - } - - // The following public methods are called from the UI thread. - - // HtmlDialogUIDelegate implementation: - virtual bool IsDialogModal() const { return false; } - virtual std::wstring GetDialogTitle() const { return L"Gears"; } - virtual GURL GetDialogContentURL() const { return params_.url; } - virtual void GetWebUIMessageHandlers( - std::vector<WebUIMessageHandler*>* handlers) const {} - virtual void GetDialogSize(gfx::Size* size) const { - size->set_width(params_.width); - size->set_height(params_.height); - } - virtual std::string GetDialogArgs() const { return params_.json_input; } - virtual void OnDialogClosed(const std::string& json_retval) { - io_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, &ModelessHtmlDialogDelegate::ReportResults, json_retval)); - } - virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) { } - virtual bool ShouldShowDialogTitle() const { return true; } - - private: - // Actually shows the dialog on the UI thread. - void Show() { - DCHECK(MessageLoop::current() == main_message_loop_); - Browser* browser = BrowserList::GetLastActive(); - browser->BrowserShowHtmlDialog(this, parent_wnd_); - } - - // Gives the JSON result string back to the plugin. - void ReportResults(const std::string& json_retval) { - DCHECK(MessageLoop::current() == io_message_loop_); - // The plugin may have unloaded before it was time to report the results. - if (plugin_->is_loaded()) - plugin_->functions().html_dialog_closed(plugin_context_, - json_retval.c_str()); - delete this; - } - - // The parameters needed to display a modal HTML dialog. - HtmlDialogUI::HtmlDialogParams params_; - - // Message loops for sending messages between UI and IO threads. - MessageLoop* main_message_loop_; - MessageLoop* io_message_loop_; - - // The plugin object that requested the dialog. This can only be accessed on - // the IO thread. - scoped_refptr<ChromePluginLib> plugin_; - - // The plugin's context argument to CPB_ShowHtmlDialog. - void* plugin_context_; - - // The window this dialog box should be parented to, or NULL for the last - // active browser window. - gfx::NativeWindow parent_wnd_; - - DISALLOW_COPY_AND_ASSIGN(ModelessHtmlDialogDelegate); -}; - -// Allows InvokeLater without adding refcounting. The object is only deleted -// when its last InvokeLater is run anyway. -DISABLE_RUNNABLE_METHOD_REFCOUNT(ModelessHtmlDialogDelegate); - -namespace { - -// -// Generic functions -// - -void STDCALL CPB_SetKeepProcessAlive(CPID id, CPBool keep_alive) { - // This is a no-op in the main browser process -} - -CPError STDCALL CPB_GetCookies(CPID id, CPBrowsingContext bcontext, - const char* url, char** cookies) { - CHECK(ChromePluginLib::IsPluginThread()); - net::URLRequestContext* context = CPBrowsingContextManager::GetInstance()-> - ToURLRequestContext(bcontext); - // TODO(mpcomplete): remove fallback case when Gears support is prevalent. - if (!context) { - context = Profile::GetDefaultRequestContext()->GetURLRequestContext(); - if (!context) - return CPERR_FAILURE; - } - std::string cookies_str = context->cookie_store()->GetCookies(GURL(url)); - *cookies = CPB_StringDup(CPB_Alloc, cookies_str); - return CPERR_SUCCESS; -} - -CPError STDCALL CPB_ShowHtmlDialogModal( - CPID id, CPBrowsingContext context, const char* url, int width, int height, - const char* json_arguments, char** json_retval) { - // Should not be called in browser process. - return CPERR_FAILURE; -} - -CPError STDCALL CPB_ShowHtmlDialog( - CPID id, CPBrowsingContext context, const char* url, int width, int height, - const char* json_arguments, void* plugin_context) { - CHECK(ChromePluginLib::IsPluginThread()); - ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); - CHECK(plugin); - -#if defined(OS_WIN) - HWND parent_hwnd = reinterpret_cast<HWND>(static_cast<uintptr_t>(context)); - PluginService* service = PluginService::GetInstance(); - if (!service) - return CPERR_FAILURE; - MessageLoop* main_message_loop = service->main_message_loop(); - ModelessHtmlDialogDelegate* delegate = - new ModelessHtmlDialogDelegate(GURL(url), width, height, json_arguments, - plugin_context, plugin, main_message_loop, - parent_hwnd); -#else - // TODO(port): port ModelessHtmlDialogDelegate - NOTIMPLEMENTED(); -#endif - - return CPERR_SUCCESS; -} - -CPError STDCALL CPB_GetCommandLineArguments( - CPID id, CPBrowsingContext context, const char* url, char** arguments) { - CHECK(ChromePluginLib::IsPluginThread()); - std::string arguments_str; - CPError rv = CPB_GetCommandLineArgumentsCommon(url, &arguments_str); - if (rv == CPERR_SUCCESS) - *arguments = CPB_StringDup(CPB_Alloc, arguments_str); - return rv; -} - -CPBrowsingContext STDCALL CPB_GetBrowsingContextFromNPP(struct _NPP* npp) { - CHECK(ChromePluginLib::IsPluginThread()); - NOTREACHED() << "NPP does not exist in the browser process."; - return 0; -} - -int STDCALL CPB_GetBrowsingContextInfo( - CPID id, CPBrowsingContext context, CPBrowsingContextInfoType type, - void* buf, uint32 buf_size) { - CHECK(ChromePluginLib::IsPluginThread()); - switch (type) { - case CPBROWSINGCONTEXT_DATA_DIR_PTR: { - if (buf_size < sizeof(char*)) - return sizeof(char*); - - // TODO(mpcomplete): http://b/1143021 - When we support multiple profiles, - // fetch the data dir from the context. - PluginService* service = PluginService::GetInstance(); - if (!service) - return CPERR_FAILURE; - FilePath path = service->GetChromePluginDataDir(); - // This is wrong -- we can't in general stuff a path through a std::string. - // But this code is Gears-specific, so Windows-only anyway for now. - std::string retval; -#if defined(OS_WIN) - retval = WideToUTF8(path.Append(chrome::kChromePluginDataDirname).value()); -#else - NOTREACHED(); -#endif - *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, retval); - return CPERR_SUCCESS; - } - case CPBROWSINGCONTEXT_UI_LOCALE_PTR: { - if (buf_size < sizeof(char*)) - return sizeof(char*); - - PluginService* service = PluginService::GetInstance(); - if (!service) - return CPERR_FAILURE; - const std::string& retval = service->GetUILocale(); - *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, retval); - return CPERR_SUCCESS; - } - } - - return CPERR_FAILURE; -} - -CPError STDCALL CPB_AddUICommand(CPID id, int command) { - CHECK(ChromePluginLib::IsPluginThread()); - ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); - CHECK(plugin); - - PluginCommandHandler::RegisterPlugin(plugin); - return CPERR_SUCCESS; -} - -static void NotifyGearsShortcutsChanged() { - DCHECK(MessageLoop::current() == - PluginService::GetInstance()->main_message_loop()); - - // TODO(michaeln): source should be the original profile, fix this - // when gears provides the correct browser context, and when we - // can relate that to an actual profile. - NotificationService::current()->Notify( - NotificationType::WEB_APP_INSTALL_CHANGED, - Source<Profile>(NULL), - NotificationService::NoDetails()); -} - -CPError STDCALL CPB_HandleCommand( - CPID id, CPBrowsingContext context, int command, void *data) { - CHECK(ChromePluginLib::IsPluginThread()); - ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); - CHECK(plugin); - - if (command == GEARSBROWSERCOMMAND_CREATE_SHORTCUT_DONE) { - GearsCreateShortcutResult* result = - static_cast<GearsCreateShortcutResult*>(data); - CHECK(result); - - GearsCreateShortcutData* shortcut_data = - static_cast<GearsCreateShortcutData*>(result->shortcut); - shortcut_data->command_interface->OnCommandResponse(result->result); - } else if (command == GEARSBROWSERCOMMAND_NOTIFY_SHORTCUTS_CHANGED) { - PluginService* service = PluginService::GetInstance(); - if (!service) - return CPERR_FAILURE; - service->main_message_loop()->PostTask(FROM_HERE, - NewRunnableFunction(NotifyGearsShortcutsChanged)); - return CPERR_SUCCESS; - } - return CPERR_FAILURE; -} - -CPError STDCALL CPB_GetDragData( - CPID id, CPBrowsingContext context, struct NPObject* event, bool add_data, - int32* identity, int32* event_id, char** drag_type, char** drag_data) { - *identity = *event_id = 0; - NOTREACHED() << "Should not be called in the browser process."; - return CPERR_FAILURE; -} - -CPError STDCALL CPB_SetDropEffect( - CPID id, CPBrowsingContext context, struct NPObject* event, int effect) { - NOTREACHED() << "Should not be called in the browser process."; - return CPERR_FAILURE; -} - -CPError STDCALL CPB_AllowFileDrop( - CPID id, CPBrowsingContext context, const char* file_drag_data) { - NOTREACHED() << "Should not be called in the browser process."; - return CPERR_FAILURE; -} - -// -// Functions related to network interception -// - -void STDCALL CPB_EnableRequestIntercept(CPID id, const char** schemes, - uint32 num_schemes) { - CHECK(ChromePluginLib::IsPluginThread()); - ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); - CHECK(plugin); - - if (schemes && num_schemes > 0) { - PluginRequestInterceptor* interceptor = - new PluginRequestInterceptor(plugin); - for (uint32 i = 0; i < num_schemes; ++i) - interceptor->RegisterProtocol(schemes[i]); - } else { - PluginRequestInterceptor::DestroyAllHelpersForPlugin(plugin); - } -} - -void STDCALL CPRR_ReceivedRedirect(CPRequest* request, const char* new_url) { -} - -void STDCALL CPRR_StartCompleted(CPRequest* request, CPError result) { - CHECK(ChromePluginLib::IsPluginThread()); - URLRequestInterceptJob* job = URLRequestInterceptJob::FromCPRequest(request); - CHECK(job); - job->OnStartCompleted(result); -} - -void STDCALL CPRR_ReadCompleted(CPRequest* request, int bytes_read) { - CHECK(ChromePluginLib::IsPluginThread()); - URLRequestInterceptJob* job = URLRequestInterceptJob::FromCPRequest(request); - CHECK(job); - job->OnReadCompleted(bytes_read); -} - -void STDCALL CPRR_UploadProgress(CPRequest* request, uint64 pos, uint64 size) { - // Does not apply, plugins do not yet intercept uploads -} - -// -// Functions related to serving network requests to the plugin -// - -CPError STDCALL CPB_CreateRequest(CPID id, CPBrowsingContext context, - const char* method, const char* url, - CPRequest** request) { - CHECK(ChromePluginLib::IsPluginThread()); - ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); - CHECK(plugin); - - ScopableCPRequest* cprequest = new ScopableCPRequest(url, method, context); - PluginRequestHandler* handler = new PluginRequestHandler(plugin, cprequest); - CHECK(handler); - - *request = cprequest; - return CPERR_SUCCESS; -} - -CPError STDCALL CPR_StartRequest(CPRequest* request) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandler* handler = PluginRequestHandler::FromCPRequest(request); - CHECK(handler); - handler->request()->Start(); - return CPERR_IO_PENDING; -} - -void STDCALL CPR_EndRequest(CPRequest* request, CPError reason) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandler* handler = PluginRequestHandler::FromCPRequest(request); - delete handler; -} - -void STDCALL CPR_SetExtraRequestHeaders(CPRequest* request, - const char* headers) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandler* handler = PluginRequestHandler::FromCPRequest(request); - CHECK(handler); - net::HttpRequestHeaders http_headers; - http_headers.AddHeadersFromString(headers); - handler->request()->SetExtraRequestHeaders(http_headers); -} - -void STDCALL CPR_SetRequestLoadFlags(CPRequest* request, uint32 flags) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandler* handler = PluginRequestHandler::FromCPRequest(request); - CHECK(handler); - uint32 net_flags = PluginResponseUtils::CPLoadFlagsToNetFlags(flags); - handler->request()->set_load_flags(net_flags); -} - -void STDCALL CPR_AppendDataToUpload(CPRequest* request, const char* bytes, - int bytes_len) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandler* handler = PluginRequestHandler::FromCPRequest(request); - CHECK(handler); - handler->request()->AppendBytesToUpload(bytes, bytes_len); -} - -CPError STDCALL CPR_AppendFileToUpload(CPRequest* request, const char* filepath, - uint64 offset, uint64 length) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandler* handler = PluginRequestHandler::FromCPRequest(request); - CHECK(handler); - - if (!length) length = kuint64max; - FilePath path(FilePath::FromWStringHack(UTF8ToWide(filepath))); - handler->request()->AppendFileRangeToUpload(path, offset, length, - base::Time()); - return CPERR_SUCCESS; -} - -int STDCALL CPR_GetResponseInfo(CPRequest* request, CPResponseInfoType type, - void* buf, uint32 buf_size) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandler* handler = PluginRequestHandler::FromCPRequest(request); - CHECK(handler); - return PluginResponseUtils::GetResponseInfo( - handler->request()->response_headers(), type, buf, buf_size); -} - -int STDCALL CPR_Read(CPRequest* request, void* buf, uint32 buf_size) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandler* handler = PluginRequestHandler::FromCPRequest(request); - CHECK(handler); - - int bytes_read; - if (handler->Read(static_cast<char*>(buf), buf_size, &bytes_read)) - return bytes_read; // 0 == CPERR_SUCESS - - if (handler->request()->status().is_io_pending()) - return CPERR_IO_PENDING; - - return CPERR_FAILURE; -} - -CPBool STDCALL CPB_IsPluginProcessRunning(CPID id) { - CHECK(ChromePluginLib::IsPluginThread()); - ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); - CHECK(plugin); - PluginService* service = PluginService::GetInstance(); - if (!service) - return false; - PluginProcessHost *host = service->FindNpapiPluginProcess(plugin->filename()); - return host ? true : false; -} - -CPProcessType STDCALL CPB_GetProcessType(CPID id) { - CHECK(ChromePluginLib::IsPluginThread()); - return CP_PROCESS_BROWSER; -} - -CPError STDCALL CPB_SendMessage(CPID id, const void *data, uint32 data_len) { - CHECK(ChromePluginLib::IsPluginThread()); - ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); - CHECK(plugin); - - PluginService* service = PluginService::GetInstance(); - if (!service) - return CPERR_FAILURE; - PluginProcessHost *host = - service->FindOrStartNpapiPluginProcess(plugin->filename()); - if (!host) - return CPERR_FAILURE; - - const unsigned char* data_ptr = static_cast<const unsigned char*>(data); - std::vector<uint8> v(data_ptr, data_ptr + data_len); -#if defined(OS_WIN) - if (!host->Send(new PluginProcessMsg_PluginMessage(v))) - return CPERR_FAILURE; -#else - // TODO(port): Implement PluginProcessMsg. - NOTIMPLEMENTED(); -#endif - - return CPERR_SUCCESS; -} - -CPError STDCALL CPB_SendSyncMessage(CPID id, const void *data, uint32 data_len, - void **retval, uint32 *retval_len) { - NOTREACHED() << "Sync messages should not be sent from the browser process."; - - return CPERR_FAILURE; -} - -CPError STDCALL CPB_PluginThreadAsyncCall(CPID id, - void (*func)(void *), - void *user_data) { - bool posted = BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - NewRunnableFunction(func, user_data)); - return posted ? CPERR_SUCCESS : CPERR_FAILURE; -} - -CPError STDCALL CPB_OpenFileDialog(CPID id, - CPBrowsingContext context, - bool multiple_files, - const char *title, - const char *filter, - void *user_data) { - NOTREACHED() << - "Open file dialog should only be called from the renderer process."; - - return CPERR_FAILURE; -} - -} // namespace - -CPBrowserFuncs* GetCPBrowserFuncsForBrowser() { - static CPBrowserFuncs browser_funcs; - static CPRequestFuncs request_funcs; - static CPResponseFuncs response_funcs; - static bool initialized = false; - if (!initialized) { - initialized = true; - - browser_funcs.size = sizeof(browser_funcs); - browser_funcs.version = CP_VERSION; - browser_funcs.enable_request_intercept = CPB_EnableRequestIntercept; - browser_funcs.create_request = CPB_CreateRequest; - browser_funcs.get_cookies = CPB_GetCookies; - browser_funcs.alloc = CPB_Alloc; - browser_funcs.free = CPB_Free; - browser_funcs.set_keep_process_alive = CPB_SetKeepProcessAlive; - browser_funcs.show_html_dialog_modal = CPB_ShowHtmlDialogModal; - browser_funcs.show_html_dialog = CPB_ShowHtmlDialog; - browser_funcs.is_plugin_process_running = CPB_IsPluginProcessRunning; - browser_funcs.get_process_type = CPB_GetProcessType; - browser_funcs.send_message = CPB_SendMessage; - browser_funcs.get_browsing_context_from_npp = CPB_GetBrowsingContextFromNPP; - browser_funcs.get_browsing_context_info = CPB_GetBrowsingContextInfo; - browser_funcs.get_command_line_arguments = CPB_GetCommandLineArguments; - browser_funcs.add_ui_command = CPB_AddUICommand; - browser_funcs.handle_command = CPB_HandleCommand; - - browser_funcs.request_funcs = &request_funcs; - browser_funcs.response_funcs = &response_funcs; - browser_funcs.send_sync_message = CPB_SendSyncMessage; - browser_funcs.plugin_thread_async_call = CPB_PluginThreadAsyncCall; - browser_funcs.open_file_dialog = CPB_OpenFileDialog; - browser_funcs.get_drag_data = CPB_GetDragData; - browser_funcs.set_drop_effect = CPB_SetDropEffect; - browser_funcs.allow_file_drop = CPB_AllowFileDrop; - - request_funcs.size = sizeof(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; - - response_funcs.size = sizeof(response_funcs); - response_funcs.received_redirect = CPRR_ReceivedRedirect; - response_funcs.start_completed = CPRR_StartCompleted; - response_funcs.read_completed = CPRR_ReadCompleted; - response_funcs.upload_progress = CPRR_UploadProgress; - } - - return &browser_funcs; -} - -void CPCommandInterface::OnCommandInvoked(CPError retval) { - delete this; -} - -void CPCommandInterface::OnCommandResponse(CPError retval) {} - -void CPHandleCommand(int command, CPCommandInterface* data, - CPBrowsingContext context) { - // Sadly if we try and pass context through, we seem to break cl's little - // brain trying to compile the Tuple3 ctor. This cast works. - int32 context_as_int32 = static_cast<int32>(context); - // Plugins can only be accessed on the IO thread. - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - NewRunnableFunction(PluginCommandHandler::HandleCommand, - command, data, context_as_int32)); -} diff --git a/chrome/browser/chrome_plugin_host.h b/chrome/browser/chrome_plugin_host.h deleted file mode 100644 index af8ee15..0000000 --- a/chrome/browser/chrome_plugin_host.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROME_PLUGIN_HOST_H__ -#define CHROME_BROWSER_CHROME_PLUGIN_HOST_H__ -#pragma once - -#include "chrome/common/chrome_plugin_api.h" - -// Returns the table of browser functions for use from the browser process. -CPBrowserFuncs* GetCPBrowserFuncsForBrowser(); - -// Interface for generic data passed to plugin UI command handlers. -// Note: All functions are called on the plugin thread. -class CPCommandInterface { - public: - virtual ~CPCommandInterface() {} - - // Returns the actual pointer to pass to the plugin. - virtual void *GetData() = 0; - - // Called when the command has been invoked. The default action is deletion, - // but some callers may want to use output or check the return value before - // deleting. - virtual void OnCommandInvoked(CPError retval); - - // Some commands have an asynchronous response. This is called some time - // after OnCommandInvoked. - virtual void OnCommandResponse(CPError retval); -}; - -// Called when a builtin or plugin-registered UI command is invoked by a user -// gesture. 'data' is an optional parameter that allows command-specific data -// to be passed to the plugin. Ownership of 'data' is transferred to the -// callee. CPBrowsingContext is some additional data the caller wishes to pass -// through to the receiver. OnCommandInvoked is called after the command has -// been invoked. -void CPHandleCommand(int command, CPCommandInterface* data, - CPBrowsingContext context); - -#endif // CHROME_BROWSER_CHROME_PLUGIN_HOST_H__ diff --git a/chrome/browser/chrome_plugin_unittest.cc b/chrome/browser/chrome_plugin_unittest.cc deleted file mode 100644 index d82e868..0000000 --- a/chrome/browser/chrome_plugin_unittest.cc +++ /dev/null @@ -1,294 +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. -// Tests exercising the Chrome Plugin API. - -#include "base/file_util.h" -#include "base/message_loop_proxy.h" -#include "base/path_service.h" -#include "base/string_util.h" -#include "chrome/browser/chrome_plugin_host.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/common/chrome_plugin_lib.h" -#include "chrome/common/net/url_request_context_getter.h" -#include "chrome/test/chrome_plugin/test_chrome_plugin.h" -#include "chrome/test/test_url_request_context_getter.h" -#include "content/browser/browser_thread.h" -#include "net/base/io_buffer.h" -#include "net/http/http_response_headers.h" -#include "net/url_request/url_request_test_job.h" -#include "net/url_request/url_request_test_util.h" -#include "net/test/test_server.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace { - -const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); -const char kPluginFilename[] = "test_chrome_plugin.dll"; -const int kResponseBufferSize = 4096; - -class ChromePluginTest : public testing::Test, - public net::URLRequest::Delegate { - public: - ChromePluginTest() - : io_thread_(BrowserThread::IO, &message_loop_), - request_(NULL), - response_buffer_(new net::IOBuffer(kResponseBufferSize)), - plugin_(NULL), - expected_payload_(NULL), - request_context_getter_(new TestURLRequestContextGetter()) { - test_funcs_.test_make_request = NULL; - } - - // Loads/unloads the chrome test plugin. - void LoadPlugin(); - void UnloadPlugin(); - - // Runs the test and expects the given payload as a response. If expectation - // is NULL, the request is expected to fail. - void RunTest(const GURL& url, const TestResponsePayload* expected_payload); - - // net::URLRequest::Delegate implementations - virtual void OnResponseStarted(net::URLRequest* request); - virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); - - // Helper called when the net::URLRequest is done. - void OnURLRequestComplete(); - - // testing::Test - virtual void SetUp() { - LoadPlugin(); - net::URLRequest::RegisterProtocolFactory("test", - &net::URLRequestTestJob::Factory); - - // We need to setup a default request context in order to issue HTTP - // requests. - DCHECK(!Profile::GetDefaultRequestContext()); - Profile::set_default_request_context(request_context_getter_.get()); - } - virtual void TearDown() { - UnloadPlugin(); - net::URLRequest::RegisterProtocolFactory("test", NULL); - - Profile::set_default_request_context(NULL); - - // Clear the request before flushing the message loop since killing the - // request can result in the generation of more tasks. - request_.reset(); - - // Flush the message loop to make Purify happy. - message_loop_.RunAllPending(); - } - protected: - MessageLoopForIO message_loop_; - BrowserThread io_thread_; - - // Note: we use net::URLRequest (instead of URLFetcher) because this allows - // the request to be intercepted. - scoped_ptr<net::URLRequest> request_; - scoped_refptr<net::IOBuffer> response_buffer_; - std::string response_data_; - - ChromePluginLib* plugin_; - TestFuncParams::PluginFuncs test_funcs_; - const TestResponsePayload* expected_payload_; - scoped_refptr<URLRequestContextGetter> request_context_getter_; -}; - -static void STDCALL CPT_Complete(CPRequest* request, bool success, - const std::string& raw_headers, - const std::string& body) { - GURL url(request->url); - if (url == GURL(kChromeTestPluginPayloads[0].url)) { - // This URL should fail, because the plugin should not have intercepted it. - EXPECT_FALSE(success); - MessageLoop::current()->Quit(); - return; - } - - scoped_refptr<net::HttpResponseHeaders> headers( - new net::HttpResponseHeaders(raw_headers)); - EXPECT_TRUE(success); - EXPECT_EQ(200, headers->response_code()); - - if (url == net::URLRequestTestJob::test_url_1()) { - EXPECT_EQ(net::URLRequestTestJob::test_data_1(), body); - } else if (url == net::URLRequestTestJob::test_url_2()) { - EXPECT_EQ(net::URLRequestTestJob::test_data_2(), body); - } else if (url.spec().find("echo") != std::string::npos) { - EXPECT_EQ(kChromeTestPluginPostData, body); - } - - MessageLoop::current()->Quit(); -} - -static void STDCALL CPT_InvokeLater(TestFuncParams::CallbackFunc callback, - void* callback_data, int delay_ms) { - MessageLoop::current()->PostDelayedTask(FROM_HERE, - NewRunnableFunction(callback, callback_data), delay_ms); -} - -void ChromePluginTest::LoadPlugin() { - FilePath path; - PathService::Get(base::DIR_EXE, &path); - path = path.AppendASCII(kPluginFilename); - plugin_ = ChromePluginLib::Create(path, GetCPBrowserFuncsForBrowser()); - ASSERT_TRUE(plugin_); - - // Exchange test APIs with the plugin. - TestFuncParams params; - params.bfuncs.test_complete = CPT_Complete; - params.bfuncs.invoke_later = CPT_InvokeLater; - EXPECT_EQ(CPERR_SUCCESS, plugin_->CP_Test(¶ms)); - test_funcs_ = params.pfuncs; -} - -void ChromePluginTest::UnloadPlugin() { - ChromePluginLib::UnloadAllPlugins(); - plugin_ = NULL; -} - -void ChromePluginTest::RunTest(const GURL& url, - const TestResponsePayload* expected_payload) { - expected_payload_ = expected_payload; - - response_data_.clear(); - request_.reset(new net::URLRequest(url, this)); - request_->set_context(new TestURLRequestContext()); - request_->Start(); - - MessageLoop::current()->Run(); -} - -void ChromePluginTest::OnResponseStarted(net::URLRequest* request) { - DCHECK(request == request_); - - int bytes_read = 0; - if (request_->status().is_success()) - request_->Read(response_buffer_, kResponseBufferSize, &bytes_read); - OnReadCompleted(request_.get(), bytes_read); -} - -void ChromePluginTest::OnReadCompleted(net::URLRequest* request, - int bytes_read) { - DCHECK(request == request_); - - do { - if (!request_->status().is_success() || bytes_read <= 0) - break; - response_data_.append(response_buffer_->data(), bytes_read); - } while (request_->Read(response_buffer_, kResponseBufferSize, &bytes_read)); - - if (!request_->status().is_io_pending()) { - OnURLRequestComplete(); - } -} - -void ChromePluginTest::OnURLRequestComplete() { - if (expected_payload_) { - EXPECT_TRUE(request_->status().is_success()); - - EXPECT_EQ(expected_payload_->status, request_->GetResponseCode()); - if (expected_payload_->mime_type) { - std::string mime_type; - EXPECT_TRUE(request_->response_headers()->GetMimeType(&mime_type)); - EXPECT_EQ(expected_payload_->mime_type, mime_type); - } - if (expected_payload_->body) { - EXPECT_EQ(expected_payload_->body, response_data_); - } - } else { - EXPECT_FALSE(request_->status().is_success()); - } - - MessageLoop::current()->Quit(); - // If MessageLoop::current() != main_loop_, it will be shut down when the - // main loop returns and this thread subsequently goes out of scope. -} - -// Tests that the plugin can intercept URLs. -TEST_F(ChromePluginTest, DoesIntercept) { - for (size_t i = 0; i < arraysize(kChromeTestPluginPayloads); ++i) { - RunTest(GURL(kChromeTestPluginPayloads[i].url), - &kChromeTestPluginPayloads[i]); - } -} - -// Tests that non-intercepted URLs are handled normally. -TEST_F(ChromePluginTest, DoesNotIntercept) { - TestResponsePayload about_blank = { - "about:blank", - false, - -1, - NULL, - "" - }; - RunTest(GURL(about_blank.url), &about_blank); -} - -// Tests that unloading the plugin correctly unregisters URL interception. -TEST_F(ChromePluginTest, UnregisterIntercept) { - UnloadPlugin(); - - RunTest(GURL(kChromeTestPluginPayloads[0].url), NULL); -} - -static void ProcessAllPendingMessages() { - while (net::URLRequestTestJob::ProcessOnePendingMessage()); -} - -// Tests that the plugin can issue a GET request and receives the data when -// it comes back synchronously. -TEST_F(ChromePluginTest, CanMakeGETRequestSync) { - // test_url_1 has a synchronous response - EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request( - "GET", net::URLRequestTestJob::test_url_1())); - - // Note: we must add this task after we make the request, so that - // net::URLRequestTestJob's StartAsync task is added and run first. - MessageLoop::current()->PostTask(FROM_HERE, - NewRunnableFunction(&ProcessAllPendingMessages)); - MessageLoop::current()->Run(); -} - -// Tests that the plugin can issue a GET request and receives the data when -// it comes back asynchronously. -TEST_F(ChromePluginTest, CanMakeGETRequestAsync) { - // test_url_2 has an asynchronous response - EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request( - "GET", net::URLRequestTestJob::test_url_2())); - - // Note: we must add this task after we make the request, so that - // net::URLRequestTestJob's StartAsync task is added and run first. - MessageLoop::current()->PostTask(FROM_HERE, - NewRunnableFunction(&ProcessAllPendingMessages)); - MessageLoop::current()->Run(); -} - -// Tests that the plugin can issue a POST request. -TEST_F(ChromePluginTest, CanMakePOSTRequest) { - net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)); - ASSERT_TRUE(test_server.Start()); - - GURL url = test_server.GetURL("echo"); - - EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request("POST", url)); - - // Note: we must add this task after we make the request, so that - // net::URLRequestTestJob's StartAsync task is added and run first. - MessageLoop::current()->PostTask(FROM_HERE, - NewRunnableFunction(&ProcessAllPendingMessages)); - MessageLoop::current()->Run(); -} - -// Tests that the plugin does not intercept its own requests. -TEST_F(ChromePluginTest, DoesNotInterceptOwnRequest) { - const TestResponsePayload& payload = kChromeTestPluginPayloads[0]; - - EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request( - "GET", GURL(payload.url))); - - MessageLoop::current()->Run(); -} - -} // namespace diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc index fb899fc..5dc96e9 100644 --- a/chrome/browser/content_settings/host_content_settings_map.cc +++ b/chrome/browser/content_settings/host_content_settings_map.cc @@ -36,7 +36,6 @@ static bool ShouldAllowAllContent(const GURL& url) { url.SchemeIs(chrome::kChromeInternalScheme) || url.SchemeIs(chrome::kChromeUIScheme) || url.SchemeIs(chrome::kExtensionScheme) || - url.SchemeIs(chrome::kGearsScheme) || url.SchemeIs(chrome::kUserScriptScheme); } diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index bf5d952..e877bcc 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc @@ -89,7 +89,7 @@ class DummyResourceHandler : public ResourceHandler { ResourceDispatcherHostRequestInfo* CreateRequestInfo(int request_id) { return new ResourceDispatcherHostRequestInfo( new DummyResourceHandler(), ChildProcessInfo::RENDER_PROCESS, 0, 0, - request_id, ResourceType::MAIN_FRAME, 0, false, false, false, -1, -1); + request_id, ResourceType::MAIN_FRAME, 0, false, false, false); } // A simple test net::URLRequestJob. We don't care what it does, only that diff --git a/chrome/browser/gears_integration.cc b/chrome/browser/gears_integration.cc deleted file mode 100644 index 648d255..0000000 --- a/chrome/browser/gears_integration.cc +++ /dev/null @@ -1,309 +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. - -#include "chrome/browser/gears_integration.h" - -#include <string> -#include <vector> - -#include "base/base64.h" -#include "base/logging.h" -#include "base/message_loop.h" -#include "base/scoped_ptr.h" -#include "base/utf_string_conversions.h" -#include "chrome/browser/chrome_plugin_host.h" -#include "chrome/common/chrome_plugin_util.h" -#include "chrome/common/gears_api.h" -#include "chrome/common/web_apps.h" -#include "googleurl/src/gurl.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "ui/gfx/codec/png_codec.h" - -// The following 2 helpers are borrowed from the Gears codebase. - -const size_t kUserPathComponentMaxChars = 64; - -// Returns true if and only if the char meets the following criteria: -// -// - visible ASCII -// - None of the following characters: / \ : * ? " < > | ; , -// -// This function is a heuristic that should identify most strings that are -// invalid pathnames on popular OSes. It's both overinclusive and -// underinclusive, though. -template<class CharT> -inline bool IsCharValidInPathComponent(CharT c) { - // Not visible ASCII? - // Note: the Gears version of this function excludes spaces (32) as well. We - // allow them for file names. - if (c < 32 || c >= 127) { - return false; - } - - // Illegal characters? - switch (c) { - case '/': - case '\\': - case ':': - case '*': - case '?': - case '"': - case '<': - case '>': - case '|': - case ';': - case ',': - return false; - - default: - return true; - } -} - -// Modifies a string, replacing characters that are not valid in a file path -// component with the '_' character. Also replaces leading and trailing dots -// with the '_' character. -// See IsCharValidInPathComponent -template<class StringT> -inline void EnsureStringValidPathComponent(StringT &s) { - if (s.empty()) { - return; - } - - typename StringT::iterator iter = s.begin(); - typename StringT::iterator end = s.end(); - - // Does it start with a dot? - if (*iter == '.') { - *iter = '_'; - ++iter; // skip it in the loop below - } - // Is every char valid? - while (iter != end) { - if (!IsCharValidInPathComponent(*iter)) { - *iter = '_'; - } - ++iter; - } - // Does it end with a dot? - --iter; - if (*iter == '.') { - *iter = '_'; - } - - // Is it too long? - if (s.size() > kUserPathComponentMaxChars) - s.resize(kUserPathComponentMaxChars); -} - -void GearsSettingsPressed(gfx::NativeWindow parent_wnd) { - CPBrowsingContext context = static_cast<CPBrowsingContext>( - reinterpret_cast<uintptr_t>(parent_wnd)); - CPHandleCommand(GEARSPLUGINCOMMAND_SHOW_SETTINGS, NULL, context); -} - -// Gears only supports certain icon sizes. -enum GearsIconSizes { - SIZE_16x16 = 0, - SIZE_32x32, - SIZE_48x48, - SIZE_128x128, - NUM_GEARS_ICONS, -}; - -// Helper function to convert a 16x16 favicon to a data: URL with the icon -// encoded as a PNG. -static GURL ConvertSkBitmapToDataURL(const SkBitmap& icon) { - DCHECK(!icon.isNull()); - DCHECK(icon.width() == 16 && icon.height() == 16); - - // Get the FavIcon data. - std::vector<unsigned char> icon_data; - gfx::PNGCodec::EncodeBGRASkBitmap(icon, false, &icon_data); - - // Base64-encode it (to make it a data URL). - std::string icon_data_str(reinterpret_cast<char*>(&icon_data[0]), - icon_data.size()); - std::string icon_base64_encoded; - base::Base64Encode(icon_data_str, &icon_base64_encoded); - GURL icon_url("data:image/png;base64," + icon_base64_encoded); - - return icon_url; -} - -// This class holds and manages the data passed to the -// GEARSPLUGINCOMMAND_CREATE_SHORTCUT plugin command. -class CreateShortcutCommand : public CPCommandInterface { - public: - CreateShortcutCommand( - const std::string& name, const std::string& orig_name, - const std::string& url, const std::string& description, - const std::vector<WebApplicationInfo::IconInfo> &icons, - const SkBitmap& fallback_icon, - GearsCreateShortcutCallback* callback) - : name_(name), url_(url), description_(description), - orig_name_(orig_name), callback_(callback), - calling_loop_(MessageLoop::current()) { - // shortcut_data_ has the same lifetime as our strings, so we just - // point it at their internal data. - memset(&shortcut_data_, 0, sizeof(shortcut_data_)); - shortcut_data_.name = name_.c_str(); - shortcut_data_.url = url_.c_str(); - shortcut_data_.description = description_.c_str(); - shortcut_data_.orig_name = orig_name_.c_str(); - - // Search the icons array for Gears-supported sizes and copy the strings. - bool has_icon = false; - - for (size_t i = 0; i < icons.size(); ++i) { - const WebApplicationInfo::IconInfo& icon = icons[i]; - if (icon.width == 16 && icon.height == 16) { - has_icon = true; - InitIcon(SIZE_16x16, icon.url, 16, 16); - } else if (icon.width == 32 && icon.height == 32) { - has_icon = true; - InitIcon(SIZE_32x32, icon.url, 32, 32); - } else if (icon.width == 48 && icon.height == 48) { - has_icon = true; - InitIcon(SIZE_48x48, icon.url, 48, 48); - } else if (icon.width == 128 && icon.height == 128) { - has_icon = true; - InitIcon(SIZE_128x128, icon.url, 128, 128); - } - } - - if (!has_icon) { - // Fall back to the favicon only if the site provides no icons at all. We - // assume if a site provides any icons, it wants to override default - // behavior. - InitIcon(SIZE_16x16, ConvertSkBitmapToDataURL(fallback_icon), 16, 16); - } - - shortcut_data_.command_interface = this; - } - virtual ~CreateShortcutCommand() { } - - // CPCommandInterface - virtual void* GetData() { return &shortcut_data_; } - virtual void OnCommandInvoked(CPError retval) { - if (retval != CPERR_IO_PENDING) { - // Older versions of Gears don't send a response, so don't wait for one. - OnCommandResponse(CPERR_FAILURE); - } - } - virtual void OnCommandResponse(CPError retval) { - calling_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, &CreateShortcutCommand::ReportResults, retval)); - } - - private: - void ReportResults(CPError retval) { - // Other code only knows about the original GearsShortcutData. Pass our - // GearsShortcutData2 off as one of those - but use the unmodified name. - // TODO(mpcomplete): this means that Gears will have stored its sanitized - // filename, but not expose it to us. We will use the unsanitized version, - // so our name will potentially differ. This is relevant because we store - // some prefs keyed off the webapp name. - shortcut_data_.name = shortcut_data_.orig_name; - callback_->Run(shortcut_data_, retval == CPERR_SUCCESS); - delete this; - } - - void InitIcon(GearsIconSizes size, const GURL& url, int width, int height) { - icon_urls_[size] = url.spec(); // keeps the string memory in scope - shortcut_data_.icons[size].url = icon_urls_[size].c_str(); - shortcut_data_.icons[size].width = width; - shortcut_data_.icons[size].height = height; - } - - GearsCreateShortcutData shortcut_data_; - std::string name_; - std::string url_; - std::string description_; - std::string icon_urls_[NUM_GEARS_ICONS]; - std::string orig_name_; - scoped_ptr<GearsCreateShortcutCallback> callback_; - MessageLoop* calling_loop_; -}; - -// Allows InvokeLater without adding refcounting. The object is only deleted -// when its last InvokeLater is run anyway. -DISABLE_RUNNABLE_METHOD_REFCOUNT(CreateShortcutCommand); - -void GearsCreateShortcut( - const WebApplicationInfo& app_info, - const string16& fallback_name, - const GURL& fallback_url, - const SkBitmap& fallback_icon, - GearsCreateShortcutCallback* callback) { - string16 name = - !app_info.title.empty() ? app_info.title : fallback_name; - std::string orig_name_utf8 = UTF16ToUTF8(name); - EnsureStringValidPathComponent(name); - - std::string name_utf8 = UTF16ToUTF8(name); - std::string description_utf8 = UTF16ToUTF8(app_info.description); - const GURL& url = - !app_info.app_url.is_empty() ? app_info.app_url : fallback_url; - - CreateShortcutCommand* command = - new CreateShortcutCommand(name_utf8, orig_name_utf8, url.spec(), - description_utf8, - app_info.icons, fallback_icon, callback); - CPHandleCommand(GEARSPLUGINCOMMAND_CREATE_SHORTCUT, command, 0); -} - -// This class holds and manages the data passed to the -// GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST plugin command. When the command is -// invoked, we proxy the results over to the calling thread. -class QueryShortcutsCommand : public CPCommandInterface { - public: - explicit QueryShortcutsCommand(GearsQueryShortcutsCallback* callback) : - callback_(callback), calling_loop_(MessageLoop::current()) { - shortcut_list_.shortcuts = NULL; - shortcut_list_.num_shortcuts = 0; - } - virtual ~QueryShortcutsCommand() { } - virtual void* GetData() { return &shortcut_list_; } - virtual void OnCommandInvoked(CPError retval) { - calling_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, &QueryShortcutsCommand::ReportResults, retval)); - } - - private: - void ReportResults(CPError retval) { - callback_->Run(retval == CPERR_SUCCESS ? &shortcut_list_ : NULL); - FreeGearsShortcutList(); - delete this; - } - - void FreeGearsShortcutList() { - for (size_t i = 0; i < shortcut_list_.num_shortcuts; ++i) { - CPB_Free(const_cast<char*>(shortcut_list_.shortcuts[i].description)); - CPB_Free(const_cast<char*>(shortcut_list_.shortcuts[i].name)); - CPB_Free(const_cast<char*>(shortcut_list_.shortcuts[i].url)); - for (size_t j = 0; j < 4; ++j) - CPB_Free(const_cast<char*>(shortcut_list_.shortcuts[i].icons[j].url)); - } - CPB_Free(shortcut_list_.shortcuts); - } - - GearsShortcutList shortcut_list_; - scoped_ptr<GearsQueryShortcutsCallback> callback_; - MessageLoop* calling_loop_; -}; - -// Allows InvokeLater without adding refcounting. The object is only deleted -// when its last InvokeLater is run anyway. -template <> -struct RunnableMethodTraits<QueryShortcutsCommand> { - void RetainCallee(QueryShortcutsCommand* command) {} - void ReleaseCallee(QueryShortcutsCommand* command) {} -}; - -void GearsQueryShortcuts(GearsQueryShortcutsCallback* callback) { - CPHandleCommand(GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST, - new QueryShortcutsCommand(callback), - 0); -} diff --git a/chrome/browser/gears_integration.h b/chrome/browser/gears_integration.h deleted file mode 100644 index 3c20555..0000000 --- a/chrome/browser/gears_integration.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_GEARS_INTEGRATION_H__ -#define CHROME_BROWSER_GEARS_INTEGRATION_H__ -#pragma once - -#include "base/callback.h" -#include "base/string16.h" -#include "chrome/common/gears_api.h" -#include "ui/gfx/native_widget_types.h" - -// TODO(michaeln): Rework this interface to match how other first class -// citizens of chrome are structured, as a GearsService with an accessor -// available via browser.gears_service(). - -class CPCommandInterface; -class GURL; -class SkBitmap; -struct WebApplicationInfo; - -// We use this in place of GearsShortcutData so we can keep browser-specific -// data on the structure. -struct GearsCreateShortcutData : public GearsShortcutData2 { - CPCommandInterface* command_interface; -}; - -// Called when the Gears Settings button is pressed. |parent_wnd| is the -// window the Gears Settings dialog should be parented to. -void GearsSettingsPressed(gfx::NativeWindow parent_wnd); - -// Calls into the Gears API to create a shortcut with the given parameters. -// 'app_info' is the optional information provided by the page. If any info is -// missing, we fallback to the given fallback params. 'fallback_icon' must be a -// 16x16 favicon. 'callback' will be called with a value indicating whether the -// shortcut has been created successfully. -typedef Callback2<const GearsShortcutData2&, bool>::Type - GearsCreateShortcutCallback; - -void GearsCreateShortcut(const WebApplicationInfo& app_info, - const string16& fallback_name, - const GURL& fallback_url, - const SkBitmap& fallback_icon, - GearsCreateShortcutCallback* callback); - -// Call into Gears to query the list of shortcuts. Results will be returned -// asynchronously via the callback. The callback's arguments will be NULL -// if there was an error. -typedef Callback1<GearsShortcutList*>::Type GearsQueryShortcutsCallback; - -void GearsQueryShortcuts(GearsQueryShortcutsCallback* callback); - -// When the Gears shortcut database is modified, the main thread is notified -// via the NotificationService, NOTIFY_WEB_APP_INSTALL_CHANGED. - -#endif // CHROME_BROWSER_GEARS_INTEGRATION_H__ diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 08317f7..dcb8ba7 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -101,6 +101,7 @@ #include "media/base/media_switches.h" #include "ui/base/ui_base_switches.h" #include "webkit/fileapi/file_system_path_manager.h" +#include "webkit/glue/resource_type.h" #include "webkit/plugins/plugin_switches.h" #if defined(OS_WIN) @@ -247,12 +248,12 @@ class RendererURLRequestContextOverride } virtual net::URLRequestContext* GetRequestContext( - const ResourceHostMsg_Request& resource_request) { + ResourceType::Type resource_type) { URLRequestContextGetter* request_context = request_context_; // If the request has resource type of ResourceType::MEDIA, we use a request // context specific to media for handling it because these resources have // specific needs for caching. - if (resource_request.resource_type == ResourceType::MEDIA) + if (resource_type == ResourceType::MEDIA) request_context = media_request_context_; return request_context->GetURLRequestContext(); } diff --git a/chrome/browser/resources/options/advanced_options.css b/chrome/browser/resources/options/advanced_options.css index bce0033..e2b6188 100644 --- a/chrome/browser/resources/options/advanced_options.css +++ b/chrome/browser/resources/options/advanced_options.css @@ -32,7 +32,6 @@ } #fontSettingsCustomizeFontsButton, -#gearSettingsConfigureGearsButton, #privacyClearDataButton { margin-left: 10px; } diff --git a/chrome/browser/resources/options/advanced_options.html b/chrome/browser/resources/options/advanced_options.html index 72c2d03..5f1030d 100644 --- a/chrome/browser/resources/options/advanced_options.html +++ b/chrome/browser/resources/options/advanced_options.html @@ -107,10 +107,6 @@ <button id="language-button" i18n-content="languageAndSpellCheckSettingsButton"></button> </if> -<if expr="os == 'win32'"> - <button id="gearSettingsConfigureGearsButton" - i18n-content="gearSettingsConfigureGearsButton"></button> -</if> <if expr="not pp_ifdef('chromeos') or os == 'win32'"> </div> </if> diff --git a/chrome/browser/resources/options/advanced_options.js b/chrome/browser/resources/options/advanced_options.js index 9082138..086a408 100644 --- a/chrome/browser/resources/options/advanced_options.js +++ b/chrome/browser/resources/options/advanced_options.js @@ -121,9 +121,6 @@ var OptionsPage = options.OptionsPage; chrome.send('useTLS1CheckboxAction', [String($('sslUseTLS1').checked)]); }; - $('gearSettingsConfigureGearsButton').onclick = function(event) { - chrome.send('showGearsSettings'); - }; } // 'cloudPrintProxyEnabled' is true for Chrome branded builds on diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index c4fe208..45f3988 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -31,7 +31,6 @@ #include "base/utf_string_conversions.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_plugin_util.h" #include "content/browser/browser_thread.h" #include "googleurl/src/gurl.h" #include "ui/gfx/codec/png_codec.h" diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 391f904d..c9266a9 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -1475,10 +1475,6 @@ bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { if (active_entry->IsViewSourceMode()) return false; - // Don't inspect HTML dialogs (doesn't work anyway). - if (active_entry->url().SchemeIs(chrome::kGearsScheme)) - return false; - // Don't inspect about:network, about:memory, etc. // However, we do want to inspect about:blank, which is often // used by ordinary web pages. diff --git a/chrome/browser/tab_contents/web_drop_target_win.cc b/chrome/browser/tab_contents/web_drop_target_win.cc index b137317..dfb85005 100644 --- a/chrome/browser/tab_contents/web_drop_target_win.cc +++ b/chrome/browser/tab_contents/web_drop_target_win.cc @@ -106,7 +106,7 @@ DWORD WebDropTarget::OnDragEnter(IDataObject* data_object, // TODO(tc): PopulateWebDropData can be slow depending on what is in the // IDataObject. Maybe we can do this in a background thread. - WebDropData drop_data(GetDragIdentity()); + WebDropData drop_data; WebDropData::PopulateWebDropData(data_object, &drop_data); if (drop_data.url.is_empty()) diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 9e7f252..86ddc67 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h @@ -245,9 +245,8 @@ class BrowserWindow { // has confirmed. virtual void ConfirmBrowserCloseWithPendingDownloads() = 0; - // Shows a dialog box with HTML content, e.g. for Gears. |parent_window| is - // the window the dialog should be opened modal to and is a native window - // handle. + // Shows a dialog box with HTML content. |parent_window| is the window the + // dialog should be opened modal to and is a native window handle. virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate, gfx::NativeWindow parent_window) = 0; diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm b/chrome/browser/ui/cocoa/page_info_bubble_controller.mm index 5a883a6..30b5b97 100644 --- a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/page_info_bubble_controller.mm @@ -382,8 +382,7 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, scoped_refptr<net::X509Certificate> cert; CertStore::GetInstance()->RetrieveCert(certID_, &cert); - // Don't bother showing certificates if there isn't one. Gears runs - // with no OS root certificate. + // Don't bother showing certificates if there isn't one. if (!cert.get() || !cert->os_cert_handle()) { // This should only ever happen in unit tests. [certButton setEnabled:NO]; diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc index b112a00..f6e2842 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info_bubble_view.cc @@ -98,9 +98,9 @@ PageInfoBubbleView::PageInfoBubbleView(gfx::NativeWindow parent_window, if (cert_id_ > 0) { scoped_refptr<net::X509Certificate> cert; CertStore::GetInstance()->RetrieveCert(cert_id_, &cert); - // When running with fake certificate (Chrome Frame) or Gears in offline - // mode, we have no os certificate, so there is no cert to show. Don't - // bother showing the cert info link in that case. + // When running with fake certificate (Chrome Frame), we have no os + // certificate, so there is no cert to show. Don't bother showing the cert + // info link in that case. if (!cert.get() || !cert->os_cert_handle()) cert_id_ = 0; } diff --git a/chrome/browser/ui/webui/options/advanced_options_handler.cc b/chrome/browser/ui/webui/options/advanced_options_handler.cc index d6e3b6d..f5cd522 100644 --- a/chrome/browser/ui/webui/options/advanced_options_handler.cc +++ b/chrome/browser/ui/webui/options/advanced_options_handler.cc @@ -45,7 +45,6 @@ #endif #if defined(OS_WIN) -#include "chrome/browser/gears_integration.h" #include "net/base/ssl_config_service_win.h" #endif @@ -81,8 +80,6 @@ void AdvancedOptionsHandler::GetLocalizedValues( IDS_OPTIONS_OPEN_FILE_TYPES_AUTOMATICALLY }, { "autoOpenFileTypesResetToDefault", IDS_OPTIONS_AUTOOPENFILETYPES_RESETTODEFAULT }, - { "gearSettingsConfigureGearsButton", - IDS_OPTIONS_GEARSSETTINGS_CONFIGUREGEARS_BUTTON }, { "translateEnableTranslate", IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE }, { "certificatesManageButton", @@ -307,9 +304,6 @@ void AdvancedOptionsHandler::RegisterMessages() { web_ui_->RegisterMessageCallback("useTLS1CheckboxAction", NewCallback(this, &AdvancedOptionsHandler::HandleUseTLS1Checkbox)); - web_ui_->RegisterMessageCallback("showGearsSettings", - NewCallback(this, - &AdvancedOptionsHandler::HandleShowGearsSettings)); #endif } @@ -433,12 +427,6 @@ void AdvancedOptionsHandler::HandleUseTLS1Checkbox(const ListValue* args) { UserMetricsRecordAction(UserMetricsAction(metric.c_str())); net::SSLConfigServiceWin::SetTLS1Enabled(enabled); } - -void AdvancedOptionsHandler::HandleShowGearsSettings(const ListValue* args) { - UserMetricsRecordAction(UserMetricsAction("Options_GearsSettings")); - GearsSettingsPressed( - web_ui_->tab_contents()->view()->GetTopLevelNativeWindow()); -} #endif #if !defined(OS_CHROMEOS) diff --git a/chrome/browser/ui/webui/options/advanced_options_handler.h b/chrome/browser/ui/webui/options/advanced_options_handler.h index d177c50..90049ab 100644 --- a/chrome/browser/ui/webui/options/advanced_options_handler.h +++ b/chrome/browser/ui/webui/options/advanced_options_handler.h @@ -77,9 +77,6 @@ class AdvancedOptionsHandler // Callback for the "Use TLS1" checkbox. This is needed so we can support // manual handling on Windows. void HandleUseTLS1Checkbox(const ListValue* args); - - // Callback for the "Show Gears Settings" button. - void HandleShowGearsSettings(const ListValue* args); #endif #if !defined(OS_CHROMEOS) diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index 1f930e2..d2da2ca 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -27,7 +27,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_plugin_util.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" #include "chrome/common/web_apps.h" @@ -642,7 +641,7 @@ void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { web_app::GetDataDir(profile_path_), shortcut_info_); // Ensure web_app_path exists. web_app_path could be missing for a legacy - // shortcut created by gears. + // shortcut created by Gears. if (!file_util::PathExists(web_app_path) && !file_util::CreateDirectory(web_app_path)) { NOTREACHED(); diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index f7a2c0f..daaab35 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -566,8 +566,6 @@ 'sources': [ # All .cc, .h, .m, and .mm files under plugins except for tests and # mocks. - 'plugin/chrome_plugin_host.cc', - 'plugin/chrome_plugin_host.h', 'plugin/npobject_base.h', 'plugin/npobject_proxy.cc', 'plugin/npobject_proxy.h', @@ -1646,7 +1644,6 @@ '../breakpad/breakpad.gyp:*', '../courgette/courgette.gyp:*', - '../gears/gears.gyp:*', '../rlz/rlz.gyp:*', '../sandbox/sandbox.gyp:*', '../tools/memory_watcher/memory_watcher.gyp:*', diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index e47898e..4f0f7f4 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -344,10 +344,6 @@ 'browser/character_encoding.h', 'browser/chrome_browser_application_mac.h', 'browser/chrome_browser_application_mac.mm', - 'browser/chrome_plugin_browsing_context.cc', - 'browser/chrome_plugin_browsing_context.h', - 'browser/chrome_plugin_host.cc', - 'browser/chrome_plugin_host.h', 'browser/chromeos/audio_handler.cc', 'browser/chromeos/audio_handler.h', 'browser/chromeos/audio_mixer.h', @@ -1090,8 +1086,6 @@ 'browser/fullscreen_linux.cc', 'browser/fullscreen_mac.mm', 'browser/fullscreen_win.cc', - 'browser/gears_integration.cc', - 'browser/gears_integration.h', 'browser/geolocation/access_token_store.cc', 'browser/geolocation/geolocation_content_settings_map.cc', 'browser/geolocation/geolocation_content_settings_map.h', @@ -3616,7 +3610,6 @@ '<(DEPTH)/third_party/wtl/include', ], 'dependencies': [ - '../gears/gears.gyp:gears', '../google_update/google_update.gyp:google_update', '../third_party/iaccessible2/iaccessible2.gyp:iaccessible2', '../third_party/isimpledom/isimpledom.gyp:isimpledom', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index cfa8da4..25a2cc1 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -195,11 +195,6 @@ 'common/chrome_content_client.cc', 'common/chrome_content_client.h', 'common/chrome_descriptors.h', - 'common/chrome_plugin_api.h', - 'common/chrome_plugin_lib.cc', - 'common/chrome_plugin_lib.h', - 'common/chrome_plugin_util.cc', - 'common/chrome_plugin_util.h', 'common/common_glue.cc', 'common/css_colors.h', 'common/database_util.cc', @@ -248,7 +243,6 @@ 'common/extensions/url_pattern.h', 'common/extensions/user_script.cc', 'common/extensions/user_script.h', - 'common/gears_api.h', 'common/important_file_writer.cc', 'common/important_file_writer.h', 'common/json_pref_store.cc', @@ -451,8 +445,6 @@ 'common/net/url_fetcher.h', 'common/net/url_request_context_getter.cc', 'common/net/url_request_context_getter.h', - 'common/net/url_request_intercept_job.cc', - 'common/net/url_request_intercept_job.h', 'common/net/gaia/gaia_auth_consumer.cc', 'common/net/gaia/gaia_auth_consumer.h', 'common/net/gaia/gaia_auth_fetcher.cc', diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi index 0661678d..eb0ed41 100644 --- a/chrome/chrome_dll.gypi +++ b/chrome/chrome_dll.gypi @@ -87,7 +87,6 @@ '../third_party/cld/cld.gyp:cld', '../views/views.gyp:views', '../webkit/support/webkit_support.gyp:webkit_resources', - '../gears/gears.gyp:gears', ], 'sources': [ 'app/chrome_command_ids.h', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 37027d9..9073e09 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1198,7 +1198,6 @@ 'browser/browsing_data_indexed_db_helper_unittest.cc', 'browser/browsing_data_local_storage_helper_unittest.cc', 'browser/chrome_browser_application_mac_unittest.mm', - 'browser/chrome_plugin_unittest.cc', 'browser/chromeos/customization_document_unittest.cc', 'browser/chromeos/external_metrics_unittest.cc', 'browser/chromeos/gview_request_interceptor_unittest.cc', @@ -1996,7 +1995,6 @@ 'installer_util_strings', '../third_party/iaccessible2/iaccessible2.gyp:iaccessible2', '../third_party/isimpledom/isimpledom.gyp:isimpledom', - 'test_chrome_plugin', # run time dependency ], 'conditions': [ ['win_use_allocator_shim==1', { @@ -3441,28 +3439,6 @@ },], ], }, - { - 'target_name': 'test_chrome_plugin', - 'type': 'shared_library', - 'msvs_guid': '7F0A70F6-BE3F-4C19-B435-956AB8F30BA4', - 'dependencies': [ - '../base/base.gyp:base', - '../build/temp_gyp/googleurl.gyp:googleurl', - ], - 'include_dirs': [ - '..', - ], - 'link_settings': { - 'libraries': [ - '-lwinmm.lib', - ], - }, - 'sources': [ - 'test/chrome_plugin/test_chrome_plugin.cc', - 'test/chrome_plugin/test_chrome_plugin.def', - 'test/chrome_plugin/test_chrome_plugin.h', - ], - }, ]}, # 'targets' ], # OS=="win" # If you change this condition, make sure you also change it in all.gyp 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[]; diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release index aa3589f..f30b33a 100644 --- a/chrome/installer/mini_installer/chrome.release +++ b/chrome/installer/mini_installer/chrome.release @@ -35,8 +35,7 @@ chrome.dll: %(VersionDir)s\ nacl64.exe: %(VersionDir)s\ nacl64.dll: %(VersionDir)s\ ppGoogleNaClPluginChrome.dll: %(VersionDir)s\ -icudt.dll: %(VersionDir)s\ -gears.dll: %(VersionDir)s\ +icudt46.dll: %(VersionDir)s\ resources.pak: %(VersionDir)s\ locales\*.dll: %(VersionDir)s\Locales Resources\Inspector\*.*: %(VersionDir)s\Resources\Inspector diff --git a/chrome/installer/util/google_update_constants.cc b/chrome/installer/util/google_update_constants.cc index a8fec38..cc73915 100644 --- a/chrome/installer/util/google_update_constants.cc +++ b/chrome/installer/util/google_update_constants.cc @@ -6,7 +6,6 @@ namespace google_update { -const wchar_t kGearsUpgradeCode[] = L"{D92DBAED-3E3E-4530-B30D-072D16C7DDD0}"; const wchar_t kChromeUpgradeCode[] = L"{8A69D345-D564-463C-AFF1-A69D9E530F96}"; const wchar_t kRegPathClients[] = L"Software\\Google\\Update\\Clients"; diff --git a/chrome/installer/util/google_update_constants.h b/chrome/installer/util/google_update_constants.h index 4ed18af..90580cc 100644 --- a/chrome/installer/util/google_update_constants.h +++ b/chrome/installer/util/google_update_constants.h @@ -10,10 +10,6 @@ namespace google_update { -// Strictly speaking Google Update doesn't care about this GUID but it is still -// related to install as it is used by MSI to identify Gears. -extern const wchar_t kGearsUpgradeCode[]; - // The GUID Google Update uses to keep track of Chrome upgrades. extern const wchar_t kChromeUpgradeCode[]; diff --git a/chrome/plugin/chrome_plugin_host.cc b/chrome/plugin/chrome_plugin_host.cc deleted file mode 100644 index f402f16e..0000000 --- a/chrome/plugin/chrome_plugin_host.cc +++ /dev/null @@ -1,731 +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/plugin/chrome_plugin_host.h" - -#include "base/command_line.h" -#include "base/file_path.h" -#include "base/file_util.h" -#include "base/message_loop.h" -#include "base/process_util.h" -#include "base/utf_string_conversions.h" -#include "base/string_split.h" -#include "chrome/common/chrome_constants.h" -#include "chrome/common/chrome_plugin_lib.h" -#include "chrome/common/chrome_plugin_util.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/common/plugin_messages.h" -#include "chrome/plugin/plugin_thread.h" -#include "chrome/plugin/webplugin_proxy.h" -#include "content/common/child_process.h" -#include "content/common/resource_dispatcher.h" -#include "net/base/data_url.h" -#include "net/base/io_buffer.h" -#include "net/base/upload_data.h" -#include "net/http/http_response_headers.h" -#include "webkit/appcache/appcache_interfaces.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/glue/resource_loader_bridge.h" -#include "webkit/glue/resource_type.h" -#include "webkit/glue/webkit_glue.h" - -namespace { - -using webkit_glue::ResourceLoaderBridge; -using webkit_glue::ResourceResponseInfo; - -static MessageLoop* g_plugin_thread_message_loop; - -// This class manages a network request made by the plugin, handling the -// data as it comes in from the ResourceLoaderBridge and is requested by the -// plugin. -// NOTE: All methods must be called on the Plugin thread. -class PluginRequestHandlerProxy - : public PluginHelper, public ResourceLoaderBridge::Peer { - public: - static PluginRequestHandlerProxy* FromCPRequest(CPRequest* request) { - return ScopableCPRequest::GetData<PluginRequestHandlerProxy*>(request); - } - - PluginRequestHandlerProxy(ChromePluginLib* plugin, - ScopableCPRequest* cprequest) - : PluginHelper(plugin), - cprequest_(cprequest), - sync_(false), - response_data_offset_(0), - completed_(false), - read_buffer_(NULL), - read_buffer_size_(0) { - load_flags_ = PluginResponseUtils::CPLoadFlagsToNetFlags(0); - cprequest_->data = this; // see FromCPRequest(). - } - - ~PluginRequestHandlerProxy() { - if (bridge_.get() && !completed_) { - bridge_->Cancel(); - } - } - - // ResourceLoaderBridge::Peer - virtual void OnUploadProgress(uint64 position, uint64 size) { - CPRR_UploadProgressFunc upload_progress = - plugin_->functions().response_funcs->upload_progress; - if (upload_progress) - upload_progress(cprequest_.get(), position, size); - } - - virtual bool OnReceivedRedirect( - const GURL& new_url, - const ResourceResponseInfo& info, - bool* has_new_first_party_for_cookies, - GURL* new_first_party_for_cookies) { - plugin_->functions().response_funcs->received_redirect( - cprequest_.get(), new_url.spec().c_str()); - // TODO(wtc): should we return a new first party for cookies URL? - *has_new_first_party_for_cookies = false; - return true; - } - - virtual void OnReceivedResponse(const ResourceResponseInfo& info) { - response_headers_ = info.headers; - plugin_->functions().response_funcs->start_completed( - cprequest_.get(), CPERR_SUCCESS); - } - - virtual void OnDownloadedData(int len) { - } - - virtual void OnReceivedData(const char* data, int len) { - response_data_.append(data, len); - if (read_buffer_) { - // If we had an asynchronous operation pending, read into that buffer - // and inform the plugin. - int rv = Read(read_buffer_, read_buffer_size_); - DCHECK(rv != CPERR_IO_PENDING); - read_buffer_ = NULL; - plugin_->functions().response_funcs->read_completed( - cprequest_.get(), rv); - } - } - - virtual void OnCompletedRequest(const net::URLRequestStatus& status, - const std::string& security_info, - const base::Time& completion_time) { - completed_ = true; - - if (!status.is_success()) { - // TODO(mpcomplete): better error codes - // Inform the plugin, calling the right function depending on whether - // we got the start_completed event or not. - if (response_headers_) { - plugin_->functions().response_funcs->start_completed( - cprequest_.get(), CPERR_FAILURE); - } else { - plugin_->functions().response_funcs->read_completed( - cprequest_.get(), CPERR_FAILURE); - } - } else if (read_buffer_) { - // The plugin was waiting for more data. Inform him we're done. - read_buffer_ = NULL; - plugin_->functions().response_funcs->read_completed( - cprequest_.get(), CPERR_SUCCESS); - } - } - - void set_extra_headers(const std::string& headers) { - extra_headers_ = headers; - } - void set_load_flags(uint32 flags) { - load_flags_ = flags; - } - void set_sync(bool sync) { - sync_ = sync; - } - void AppendDataToUpload(const char* bytes, int bytes_len) { - upload_content_.push_back(net::UploadData::Element()); - upload_content_.back().SetToBytes(bytes, bytes_len); - } - - void AppendFileToUpload(const FilePath &filepath) { - AppendFileRangeToUpload(filepath, 0, kuint64max); - } - - void AppendFileRangeToUpload(const FilePath &filepath, - uint64 offset, uint64 length) { - upload_content_.push_back(net::UploadData::Element()); - upload_content_.back().SetToFilePathRange(filepath, offset, length, - base::Time()); - } - - CPError Start(int renderer_id, int render_view_id) { - webkit_glue::ResourceLoaderBridge::RequestInfo request_info; - request_info.method = cprequest_->method; - request_info.url = GURL(cprequest_->url); - request_info.first_party_for_cookies = - GURL(cprequest_->url); // TODO(jackson): policy url? - request_info.referrer = GURL(); // TODO(mpcomplete): referrer? - request_info.headers = extra_headers_; - request_info.load_flags = load_flags_; - request_info.requestor_pid = base::GetCurrentProcId(); - request_info.request_type = ResourceType::OBJECT; - request_info.request_context = cprequest_->context; - request_info.appcache_host_id = appcache::kNoHostId; - request_info.routing_id = MSG_ROUTING_CONTROL; - bridge_.reset( - PluginThread::current()->resource_dispatcher()->CreateBridge( - request_info, - renderer_id, - render_view_id)); - if (!bridge_.get()) - return CPERR_FAILURE; - - for (size_t i = 0; i < upload_content_.size(); ++i) { - switch (upload_content_[i].type()) { - case net::UploadData::TYPE_BYTES: { - const std::vector<char>& bytes = upload_content_[i].bytes(); - bridge_->AppendDataToUpload(&bytes[0], - static_cast<int>(bytes.size())); - break; - } - case net::UploadData::TYPE_FILE: { - bridge_->AppendFileRangeToUpload( - upload_content_[i].file_path(), - upload_content_[i].file_range_offset(), - upload_content_[i].file_range_length(), - upload_content_[i].expected_file_modification_time()); - break; - } - default: { - NOTREACHED() << "Unknown UploadData::Element type"; - } - } - } - - if (sync_) { - ResourceLoaderBridge::SyncLoadResponse response; - bridge_->SyncLoad(&response); - response_headers_ = response.headers; - response_data_ = response.data; - completed_ = true; - return response.status.is_success() ? CPERR_SUCCESS : CPERR_FAILURE; - } else { - if (!bridge_->Start(this)) { - bridge_.reset(); - return CPERR_FAILURE; - } - return CPERR_IO_PENDING; - } - } - - int GetResponseInfo(CPResponseInfoType type, void* buf, uint32 buf_size) { - return PluginResponseUtils::GetResponseInfo( - response_headers_, type, buf, buf_size); - } - - int Read(void* buf, uint32 buf_size) { - uint32 avail = - static_cast<uint32>(response_data_.size()) - response_data_offset_; - uint32 count = buf_size; - if (count > avail) - count = avail; - - if (count) { - // Data is ready now. - memcpy(buf, &response_data_[0] + response_data_offset_, count); - response_data_offset_ += count; - } else if (!completed_) { - read_buffer_ = buf; - read_buffer_size_ = buf_size; - DCHECK(!sync_); - return CPERR_IO_PENDING; - } - - if (response_data_.size() == response_data_offset_) { - // Simple optimization for large requests. Generally the consumer will - // read the data faster than it comes in, so we can clear our buffer - // any time it has all been read. - response_data_.clear(); - response_data_offset_ = 0; - } - - read_buffer_ = NULL; - return count; - } - - private: - scoped_ptr<ScopableCPRequest> cprequest_; - scoped_ptr<ResourceLoaderBridge> bridge_; - std::vector<net::UploadData::Element> upload_content_; - std::string extra_headers_; - uint32 load_flags_; - bool sync_; - - scoped_refptr<net::HttpResponseHeaders> response_headers_; - std::string response_data_; - size_t response_data_offset_; - bool completed_; - void* read_buffer_; - uint32 read_buffer_size_; -}; - -// -// Generic functions -// - -void STDCALL CPB_SetKeepProcessAlive(CPID id, CPBool keep_alive) { - CHECK(ChromePluginLib::IsPluginThread()); - static bool g_keep_process_alive = false; - bool desired_value = keep_alive ? true : false; // smash to bool - if (desired_value != g_keep_process_alive) { - g_keep_process_alive = desired_value; - if (g_keep_process_alive) - ChildProcess::current()->AddRefProcess(); - else - ChildProcess::current()->ReleaseProcess(); - } -} - -CPError STDCALL CPB_GetCookies(CPID id, CPBrowsingContext context, - const char* url, char** cookies) { - CHECK(ChromePluginLib::IsPluginThread()); - std::string cookies_str; - - WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context); - // There are two contexts in which we can be asked for cookies: - // 1. From a script context. webplugin will be non-NULL. - // 2. From a global browser context (think: Gears UpdateTask). webplugin will - // be NULL and context will (loosely) represent a browser Profile. - // In case 1, we *must* route through the renderer process, otherwise we race - // with renderer script that may have set cookies. In case 2, we are running - // out-of-band with script, so we don't need to stay in sync with any - // particular renderer. - // See http://b/issue?id=1487502. - if (webplugin) { - cookies_str = webplugin->GetCookies(GURL(url), GURL(url)); - } else { - PluginThread::current()->Send( - new PluginProcessHostMsg_GetCookies(context, GURL(url), &cookies_str)); - } - - *cookies = CPB_StringDup(CPB_Alloc, cookies_str); - return CPERR_SUCCESS; -} - -CPError STDCALL CPB_ShowHtmlDialogModal( - CPID id, CPBrowsingContext context, const char* url, int width, int height, - const char* json_arguments, char** json_retval) { - CHECK(ChromePluginLib::IsPluginThread()); - - WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context); - if (!webplugin) - return CPERR_INVALID_PARAMETER; - - std::string retval_str; - webplugin->ShowModalHTMLDialog( - GURL(url), width, height, json_arguments, &retval_str); - *json_retval = CPB_StringDup(CPB_Alloc, retval_str); - return CPERR_SUCCESS; -} - -CPError STDCALL CPB_ShowHtmlDialog( - CPID id, CPBrowsingContext context, const char* url, int width, int height, - const char* json_arguments, void* plugin_context) { - // TODO(mpcomplete): support non-modal dialogs. - return CPERR_FAILURE; -} - -CPError STDCALL CPB_GetDragData( - CPID id, CPBrowsingContext context, struct NPObject* event, bool add_data, - int32 *identity, int32 *event_id, char **drag_type, char **drag_data) { - CHECK(ChromePluginLib::IsPluginThread()); - - *identity = *event_id = 0; - WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context); - if (!event || !webplugin) - return CPERR_INVALID_PARAMETER; - - std::string type_str, data_str; - if (!webplugin->GetDragData(event, add_data, - identity, event_id, &type_str, &data_str)) { - return CPERR_FAILURE; - } - - if (add_data) - *drag_data = CPB_StringDup(CPB_Alloc, data_str); - *drag_type = CPB_StringDup(CPB_Alloc, type_str); - return CPERR_SUCCESS; -} - -CPError STDCALL CPB_SetDropEffect( - CPID id, CPBrowsingContext context, struct NPObject* event, int effect) { - CHECK(ChromePluginLib::IsPluginThread()); - - WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context); - if (!event || !webplugin) - return CPERR_INVALID_PARAMETER; - - if (webplugin->SetDropEffect(event, effect)) - return CPERR_SUCCESS; - return CPERR_FAILURE; -} - -CPError STDCALL CPB_AllowFileDrop( - CPID id, CPBrowsingContext context, const char* file_drag_data) { - CHECK(ChromePluginLib::IsPluginThread()); - - WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context); - if (!webplugin || !file_drag_data) - return CPERR_INVALID_PARAMETER; - - const int renderer = webplugin->GetRendererId(); - if (renderer == -1) - return CPERR_FAILURE; - - static const char kDelimiter('\b'); - std::vector<std::string> files; - base::SplitStringDontTrim(file_drag_data, kDelimiter, &files); - - bool allowed = false; - if (!PluginThread::current()->Send( - new PluginProcessHostMsg_AccessFiles(renderer, files, &allowed))) { - return CPERR_FAILURE; - } - - if (allowed) - return CPERR_SUCCESS; - return CPERR_FAILURE; -} - -CPError STDCALL CPB_GetCommandLineArguments( - CPID id, CPBrowsingContext context, const char* url, char** arguments) { - CHECK(ChromePluginLib::IsPluginThread()); - std::string arguments_str; - CPError rv = CPB_GetCommandLineArgumentsCommon(url, &arguments_str); - if (rv == CPERR_SUCCESS) - *arguments = CPB_StringDup(CPB_Alloc, arguments_str); - return rv; -} - -CPBrowsingContext STDCALL CPB_GetBrowsingContextFromNPP(NPP npp) { - if (!npp) - return CPERR_INVALID_PARAMETER; - - webkit::npapi::PluginInstance* instance = - static_cast<webkit::npapi::PluginInstance *>(npp->ndata); - WebPluginProxy* webplugin = - static_cast<WebPluginProxy*>(instance->webplugin()); - - return webplugin->GetCPBrowsingContext(); -} - -int STDCALL CPB_GetBrowsingContextInfo( - CPID id, CPBrowsingContext context, CPBrowsingContextInfoType type, - void* buf, uint32 buf_size) { - CHECK(ChromePluginLib::IsPluginThread()); - -#if defined(OS_WIN) - switch (type) { - case CPBROWSINGCONTEXT_DATA_DIR_PTR: { - if (buf_size < sizeof(char*)) - return sizeof(char*); - - FilePath path = CommandLine::ForCurrentProcess()-> - GetSwitchValuePath(switches::kPluginDataDir); - DCHECK(!path.empty()); - std::string retval = WideToUTF8( - path.Append(chrome::kChromePluginDataDirname).value()); - *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, retval); - - return CPERR_SUCCESS; - } - case CPBROWSINGCONTEXT_UI_LOCALE_PTR: { - if (buf_size < sizeof(char*)) - return sizeof(char*); - - std::string retval = webkit_glue::GetWebKitLocale(); - *static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, retval); - return CPERR_SUCCESS; - } - } -#else - // TODO(aa): this code is only used by Gears, which we are removing. - NOTREACHED(); -#endif - - return CPERR_FAILURE; -} - -CPError STDCALL CPB_AddUICommand(CPID id, int command) { - // Not implemented in the plugin process - return CPERR_FAILURE; -} - -CPError STDCALL CPB_HandleCommand( - CPID id, CPBrowsingContext context, int command, void *data) { - // Not implemented in the plugin process - return CPERR_FAILURE; -} - -// -// Functions related to network interception -// - -void STDCALL CPB_EnableRequestIntercept( - CPID id, const char** schemes, uint32 num_schemes) { - // We ignore requests by the plugin to intercept from this process. That's - // handled in the browser process. -} - -void STDCALL CPRR_ReceivedRedirect(CPRequest* request, const char* new_url) { - NOTREACHED() << "Network interception should not happen in plugin process."; -} - -void STDCALL CPRR_StartCompleted(CPRequest* request, CPError result) { - NOTREACHED() << "Network interception should not happen in plugin process."; -} - -void STDCALL CPRR_ReadCompleted(CPRequest* request, int bytes_read) { - NOTREACHED() << "Network interception should not happen in plugin process."; -} - -void STDCALL CPRR_UploadProgress(CPRequest* request, uint64 pos, uint64 size) { - NOTREACHED() << "Network interception should not happen in plugin process."; -} - -// -// Functions related to serving network requests to the plugin -// - -CPError STDCALL CPB_CreateRequest(CPID id, CPBrowsingContext context, - const char* method, const char* url, - CPRequest** request) { - CHECK(ChromePluginLib::IsPluginThread()); - ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); - CHECK(plugin); - - ScopableCPRequest* cprequest = new ScopableCPRequest(url, method, context); - new PluginRequestHandlerProxy(plugin, cprequest); - - *request = cprequest; - return CPERR_SUCCESS; -} - -CPError STDCALL CPR_StartRequest(CPRequest* request) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandlerProxy* handler = - PluginRequestHandlerProxy::FromCPRequest(request); - CHECK(handler); - - int renderer_id = -1; - int render_view_id = -1; - - WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext( - request->context); - if (webplugin) { - renderer_id = webplugin->GetRendererId(); - if (renderer_id == -1) - return CPERR_FAILURE; - - render_view_id = webplugin->host_render_view_routing_id(); - if (render_view_id == -1) - return CPERR_FAILURE; - } - - return handler->Start(renderer_id, render_view_id); -} - -void STDCALL CPR_EndRequest(CPRequest* request, CPError reason) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandlerProxy* handler = - PluginRequestHandlerProxy::FromCPRequest(request); - delete handler; -} - -void STDCALL CPR_SetExtraRequestHeaders(CPRequest* request, - const char* headers) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandlerProxy* handler = - PluginRequestHandlerProxy::FromCPRequest(request); - CHECK(handler); - handler->set_extra_headers(headers); -} - -void STDCALL CPR_SetRequestLoadFlags(CPRequest* request, uint32 flags) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandlerProxy* handler = - PluginRequestHandlerProxy::FromCPRequest(request); - CHECK(handler); - - if (flags & CPREQUESTLOAD_SYNCHRONOUS) { - handler->set_sync(true); - } - - uint32 net_flags = PluginResponseUtils::CPLoadFlagsToNetFlags(flags); - handler->set_load_flags(net_flags); -} - -void STDCALL CPR_AppendDataToUpload(CPRequest* request, const char* bytes, - int bytes_len) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandlerProxy* handler = - PluginRequestHandlerProxy::FromCPRequest(request); - CHECK(handler); - handler->AppendDataToUpload(bytes, bytes_len); -} - -CPError STDCALL CPR_AppendFileToUpload(CPRequest* request, const char* filepath, - uint64 offset, uint64 length) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandlerProxy* handler = - PluginRequestHandlerProxy::FromCPRequest(request); - CHECK(handler); - - if (!length) length = kuint64max; - std::wstring wfilepath(UTF8ToWide(filepath)); - handler->AppendFileRangeToUpload(FilePath::FromWStringHack(wfilepath), offset, - length); - return CPERR_SUCCESS; -} - -int STDCALL CPR_GetResponseInfo(CPRequest* request, CPResponseInfoType type, - void* buf, uint32 buf_size) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandlerProxy* handler = - PluginRequestHandlerProxy::FromCPRequest(request); - CHECK(handler); - return handler->GetResponseInfo(type, buf, buf_size); -} - -int STDCALL CPR_Read(CPRequest* request, void* buf, uint32 buf_size) { - CHECK(ChromePluginLib::IsPluginThread()); - PluginRequestHandlerProxy* handler = - PluginRequestHandlerProxy::FromCPRequest(request); - CHECK(handler); - return handler->Read(buf, buf_size); -} - - -CPBool STDCALL CPB_IsPluginProcessRunning(CPID id) { - CHECK(ChromePluginLib::IsPluginThread()); - return true; -} - -CPProcessType STDCALL CPB_GetProcessType(CPID id) { - CHECK(ChromePluginLib::IsPluginThread()); - return CP_PROCESS_PLUGIN; -} - -CPError STDCALL CPB_SendMessage(CPID id, const void *data, uint32 data_len) { - CHECK(ChromePluginLib::IsPluginThread()); - const uint8* data_ptr = static_cast<const uint8*>(data); - std::vector<uint8> v(data_ptr, data_ptr + data_len); - if (!PluginThread::current()->Send(new PluginProcessHostMsg_PluginMessage(v))) - return CPERR_FAILURE; - - return CPERR_SUCCESS; -} - -CPError STDCALL CPB_SendSyncMessage(CPID id, const void *data, uint32 data_len, - void **retval, uint32 *retval_len) { - CHECK(ChromePluginLib::IsPluginThread()); - const uint8* data_ptr = static_cast<const uint8*>(data); - std::vector<uint8> v(data_ptr, data_ptr + data_len); - std::vector<uint8> r; - if (!PluginThread::current()->Send( - new PluginProcessHostMsg_PluginSyncMessage(v, &r))) { - return CPERR_FAILURE; - } - - if (r.size()) { - *retval_len = static_cast<uint32>(r.size()); - *retval = CPB_Alloc(*retval_len); - memcpy(*retval, &(r.at(0)), r.size()); - } else { - *retval = NULL; - *retval_len = 0; - } - - return CPERR_SUCCESS; -} - -CPError STDCALL CPB_PluginThreadAsyncCall(CPID id, - void (*func)(void *), - void *user_data) { - g_plugin_thread_message_loop->PostTask( - FROM_HERE, NewRunnableFunction(func, user_data)); - - return CPERR_SUCCESS; -} - -CPError STDCALL CPB_OpenFileDialog(CPID id, - CPBrowsingContext context, - bool multiple_files, - const char *title, - const char *filter, - void *user_data) { - NOTREACHED() << - "Open file dialog should only be called from the renderer process."; - - return CPERR_FAILURE; -} - -} // namespace - -CPBrowserFuncs* GetCPBrowserFuncsForPlugin() { - static CPBrowserFuncs browser_funcs; - static CPRequestFuncs request_funcs; - static CPResponseFuncs response_funcs; - static bool initialized = false; - if (!initialized) { - initialized = true; - - g_plugin_thread_message_loop = PluginThread::current()->message_loop(); - - browser_funcs.size = sizeof(browser_funcs); - browser_funcs.version = CP_VERSION; - browser_funcs.enable_request_intercept = CPB_EnableRequestIntercept; - browser_funcs.create_request = CPB_CreateRequest; - browser_funcs.get_cookies = CPB_GetCookies; - browser_funcs.alloc = CPB_Alloc; - browser_funcs.free = CPB_Free; - browser_funcs.set_keep_process_alive = CPB_SetKeepProcessAlive; - browser_funcs.show_html_dialog = CPB_ShowHtmlDialog; - browser_funcs.show_html_dialog_modal = CPB_ShowHtmlDialogModal; - browser_funcs.is_plugin_process_running = CPB_IsPluginProcessRunning; - browser_funcs.get_process_type = CPB_GetProcessType; - browser_funcs.send_message = CPB_SendMessage; - browser_funcs.get_browsing_context_from_npp = CPB_GetBrowsingContextFromNPP; - browser_funcs.get_browsing_context_info = CPB_GetBrowsingContextInfo; - browser_funcs.get_command_line_arguments = CPB_GetCommandLineArguments; - browser_funcs.add_ui_command = CPB_AddUICommand; - browser_funcs.handle_command = CPB_HandleCommand; - browser_funcs.send_sync_message = CPB_SendSyncMessage; - browser_funcs.plugin_thread_async_call = CPB_PluginThreadAsyncCall; - browser_funcs.open_file_dialog = CPB_OpenFileDialog; - browser_funcs.get_drag_data = CPB_GetDragData; - browser_funcs.set_drop_effect = CPB_SetDropEffect; - browser_funcs.allow_file_drop = CPB_AllowFileDrop; - - browser_funcs.request_funcs = &request_funcs; - browser_funcs.response_funcs = &response_funcs; - - request_funcs.size = sizeof(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; - - response_funcs.size = sizeof(response_funcs); - response_funcs.received_redirect = CPRR_ReceivedRedirect; - response_funcs.start_completed = CPRR_StartCompleted; - response_funcs.read_completed = CPRR_ReadCompleted; - response_funcs.upload_progress = CPRR_UploadProgress; - } - - return &browser_funcs; -} diff --git a/chrome/plugin/chrome_plugin_host.h b/chrome/plugin/chrome_plugin_host.h deleted file mode 100644 index 29a0958..0000000 --- a/chrome/plugin/chrome_plugin_host.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_PLUGIN_CHROME_PLUGIN_HOST_H_ -#define CHROME_PLUGIN_CHROME_PLUGIN_HOST_H_ -#pragma once - -#include "chrome/common/chrome_plugin_api.h" - -// Returns the table of browser functions for use from the plugin process. -CPBrowserFuncs* GetCPBrowserFuncsForPlugin(); - -#endif // CHROME_PLUGIN_CHROME_PLUGIN_HOST_H_ diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc index cbbb2fb..9d60b0e 100644 --- a/chrome/plugin/plugin_thread.cc +++ b/chrome/plugin/plugin_thread.cc @@ -19,11 +19,9 @@ #include "base/lazy_instance.h" #include "base/process_util.h" #include "base/threading/thread_local.h" -#include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" -#include "chrome/plugin/chrome_plugin_host.h" #include "chrome/plugin/npobject_util.h" #include "chrome/renderer/render_thread.h" #include "content/common/child_process.h" @@ -84,8 +82,6 @@ PluginThread::PluginThread() // Preload the library to avoid loading, unloading then reloading preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path_); - ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin()); - scoped_refptr<webkit::npapi::PluginLib> plugin( webkit::npapi::PluginLib::CreatePluginLib(plugin_path_)); if (plugin.get()) { @@ -116,7 +112,6 @@ PluginThread::~PluginThread() { } PluginChannelBase::CleanupChannels(); webkit::npapi::PluginLib::UnloadAllPlugins(); - ChromePluginLib::UnloadAllPlugins(); if (webkit_glue::ShouldForcefullyTerminatePluginProcess()) base::KillProcess(base::GetCurrentProcessHandle(), 0, /* wait= */ false); @@ -132,7 +127,6 @@ bool PluginThread::OnControlMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PluginThread, msg) IPC_MESSAGE_HANDLER(PluginProcessMsg_CreateChannel, OnCreateChannel) - IPC_MESSAGE_HANDLER(PluginProcessMsg_PluginMessage, OnPluginMessage) IPC_MESSAGE_HANDLER(PluginProcessMsg_NotifyRenderersOfPendingShutdown, OnNotifyRenderersOfPendingShutdown) IPC_MESSAGE_UNHANDLED(handled = false) @@ -157,20 +151,6 @@ void PluginThread::OnCreateChannel(int renderer_id, Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); } -void PluginThread::OnPluginMessage(const std::vector<unsigned char> &data) { - // We Add/Release ref here to ensure that something will trigger the - // shutdown mechanism for processes started in the absence of renderer's - // opening a plugin channel. - ChildProcess::current()->AddRefProcess(); - ChromePluginLib *chrome_plugin = ChromePluginLib::Find(plugin_path_); - if (chrome_plugin) { - void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); - uint32 data_len = static_cast<uint32>(data.size()); - chrome_plugin->functions().on_message(data_ptr, data_len); - } - ChildProcess::current()->ReleaseProcess(); -} - void PluginThread::OnNotifyRenderersOfPendingShutdown() { PluginChannel::NotifyRenderersOfPendingShutdown(); } diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc index c0919d3..390b2be 100644 --- a/chrome/plugin/webplugin_proxy.cc +++ b/chrome/plugin/webplugin_proxy.cc @@ -45,9 +45,6 @@ using webkit::npapi::WebPluginResourceClient; using webkit::npapi::WebPluginAcceleratedSurface; #endif -typedef std::map<CPBrowsingContext, WebPluginProxy*> ContextMap; -static base::LazyInstance<ContextMap> g_context_map(base::LINKER_INITIALIZED); - WebPluginProxy::WebPluginProxy( PluginChannel* channel, int route_id, @@ -56,7 +53,6 @@ WebPluginProxy::WebPluginProxy( int host_render_view_routing_id) : channel_(channel), route_id_(route_id), - cp_browsing_context_(0), window_npobject_(NULL), plugin_element_(NULL), delegate_(NULL), @@ -88,9 +84,6 @@ WebPluginProxy::WebPluginProxy( } WebPluginProxy::~WebPluginProxy() { - if (cp_browsing_context_) - g_context_map.Get().erase(cp_browsing_context_); - #if defined(USE_X11) if (windowless_shm_pixmap_ != None) XFreePixmap(ui::GetXDisplay(), windowless_shm_pixmap_); @@ -246,37 +239,10 @@ std::string WebPluginProxy::GetCookies(const GURL& url, return cookies; } -void WebPluginProxy::ShowModalHTMLDialog(const GURL& url, int width, int height, - const std::string& json_arguments, - std::string* json_retval) { - PluginHostMsg_ShowModalHTMLDialog* msg = - new PluginHostMsg_ShowModalHTMLDialog( - route_id_, url, width, height, json_arguments, json_retval); - - // Pump messages while waiting for a response (which won't come until the - // dialog is closed). This avoids a deadlock. - msg->EnableMessagePumping(); - Send(msg); -} - void WebPluginProxy::OnMissingPluginStatus(int status) { Send(new PluginHostMsg_MissingPluginStatus(route_id_, status)); } -CPBrowsingContext WebPluginProxy::GetCPBrowsingContext() { - if (cp_browsing_context_ == 0) { - Send(new PluginHostMsg_GetCPBrowsingContext(route_id_, - &cp_browsing_context_)); - g_context_map.Get()[cp_browsing_context_] = this; - } - return cp_browsing_context_; -} - -WebPluginProxy* WebPluginProxy::FromCPBrowsingContext( - CPBrowsingContext context) { - return g_context_map.Get()[context]; -} - WebPluginResourceClient* WebPluginProxy::GetResourceClient(int id) { ResourceClientMap::iterator iterator = resource_clients_.find(id); // The IPC messages which deal with streams are now asynchronous. It is @@ -350,54 +316,6 @@ void WebPluginProxy::HandleURLRequest(const char* url, Send(new PluginHostMsg_URLRequest(route_id_, params)); } -bool WebPluginProxy::GetDragData(struct NPObject* event, bool add_data, - int32* identity, int32* event_id, - std::string* type, std::string* data) { - DCHECK(event); - NPObjectProxy* proxy = NPObjectProxy::GetProxy(event); - if (!proxy) // NPObject* event should have/be a renderer proxy. - return false; - - NPVariant_Param event_param; - event_param.type = NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID; - event_param.npobject_routing_id = proxy->route_id(); - - std::vector<NPVariant_Param> values; - bool success = false; - Send(new PluginHostMsg_GetDragData(route_id_, event_param, add_data, - &values, &success)); - if (!success) - return false; - - DCHECK(values.size() == 4); - DCHECK(values[0].type == NPVARIANT_PARAM_INT); - *identity = static_cast<int32>(values[0].int_value); - DCHECK(values[1].type == NPVARIANT_PARAM_INT); - *event_id = static_cast<int32>(values[1].int_value); - DCHECK(values[2].type == NPVARIANT_PARAM_STRING); - type->swap(values[2].string_value); - if (add_data && (values[3].type == NPVARIANT_PARAM_STRING)) - data->swap(values[3].string_value); - - return true; -} - -bool WebPluginProxy::SetDropEffect(struct NPObject* event, int effect) { - DCHECK(event); - NPObjectProxy* proxy = NPObjectProxy::GetProxy(event); - if (!proxy) // NPObject* event should have/be a renderer proxy. - return false; - - NPVariant_Param event_param; - event_param.type = NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID; - event_param.npobject_routing_id = proxy->route_id(); - - bool success = false; - Send(new PluginHostMsg_SetDropEffect(route_id_, event_param, effect, - &success)); - return success; -} - void WebPluginProxy::Paint(const gfx::Rect& rect) { #if defined(OS_MACOSX) if (!windowless_context_.get()) @@ -737,4 +655,3 @@ void WebPluginProxy::ResourceClientDeleted( void WebPluginProxy::URLRedirectResponse(bool allow, int resource_id) { Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id)); } - diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h index acc89ab..4b3f2b4 100644 --- a/chrome/plugin/webplugin_proxy.h +++ b/chrome/plugin/webplugin_proxy.h @@ -21,7 +21,6 @@ #include "base/scoped_ptr.h" #include "base/shared_memory.h" #include "base/timer.h" -#include "chrome/common/chrome_plugin_api.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message.h" #include "webkit/plugins/npapi/webplugin.h" @@ -75,28 +74,9 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { virtual std::string GetCookies(const GURL& url, const GURL& first_party_for_cookies); - virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, - const std::string& json_arguments, - std::string* json_retval); - - // Called by gears over the CPAPI interface to verify that the given event is - // the current (javascript) drag event the browser is dispatching, and return - // the drag data, or control the drop effect (drag cursor), if so. - bool GetDragData(struct NPObject* event, bool add_data, int32* identity, - int32* event_id, std::string* type, std::string* data); - bool SetDropEffect(struct NPObject* event, int effect); - virtual void OnMissingPluginStatus(int status); // class-specific methods - // Retrieves the browsing context associated with the renderer this plugin - // is in. Calling multiple times will return the same value. - CPBrowsingContext GetCPBrowsingContext(); - - // Retrieves the WebPluginProxy for the given context that was returned by - // GetCPBrowsingContext, or NULL if not found. - static WebPluginProxy* FromCPBrowsingContext(CPBrowsingContext context); - // Returns a WebPluginResourceClient object given its id, or NULL if no // object with that id exists. webkit::npapi::WebPluginResourceClient* GetResourceClient(int id); @@ -203,7 +183,6 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { scoped_refptr<PluginChannel> channel_; int route_id_; - uint32 cp_browsing_context_; NPObject* window_npobject_; NPObject* plugin_element_; webkit::npapi::WebPluginDelegateImpl* delegate_; diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 27d0a12..3a59fdb 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -90,7 +90,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/extensions/v8/benchmarking_extension.h" -#include "webkit/extensions/v8/gears_extension.h" #include "webkit/extensions/v8/playback_extension.h" #include "webkit/glue/webkit_glue.h" #include "v8/include/v8.h" @@ -908,10 +907,6 @@ void RenderThread::EnsureWebKitInitialized() { WebString extension_scheme(ASCIIToUTF16(chrome::kExtensionScheme)); WebSecurityPolicy::registerURLSchemeAsSecure(extension_scheme); -#if defined(OS_WIN) - // We don't yet support Gears on non-Windows, so don't tell pages that we do. - RegisterExtension(extensions_v8::GearsExtension::Get(), false); -#endif RegisterExtension(extensions_v8::LoadTimesExtension::Get(), false); RegisterExtension(extensions_v8::ChromeAppExtension::Get(), false); RegisterExtension(extensions_v8::ExternalExtension::Get(), false); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 5934412..fa75844 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -1979,12 +1979,6 @@ void RenderView::OnAllowScriptToClose(bool script_can_close) { script_can_close_ = script_can_close; } -uint32 RenderView::GetCPBrowsingContext() { - uint32 context = 0; - Send(new ViewHostMsg_GetCPBrowsingContext(&context)); - return context; -} - void RenderView::AddSearchProvider( const std::string& url, const ViewHostMsg_PageHasOSDD_Type& provider_type) { @@ -3465,7 +3459,6 @@ void RenderView::didClearWindowObject(WebFrame* frame) { GURL frame_url = frame->url(); if (BindingsPolicy::is_web_ui_enabled(enabled_bindings_) && (frame_url.SchemeIs(chrome::kChromeUIScheme) || - frame_url.SchemeIs(chrome::kGearsScheme) || frame_url.SchemeIs(chrome::kDataScheme))) { GetWebUIBindings()->set_message_sender(this); GetWebUIBindings()->set_routing_id(routing_id_); @@ -3975,16 +3968,6 @@ void RenderView::DidStopLoadingForPlugin() { didStopLoading(); } -void RenderView::ShowModalHTMLDialogForPlugin( - const GURL& url, - const gfx::Size& size, - const std::string& json_arguments, - std::string* json_retval) { - SendAndRunNestedMessageLoop(new ViewHostMsg_ShowModalHTMLDialog( - routing_id_, url, size.width(), size.height(), json_arguments, - json_retval)); -} - WebCookieJar* RenderView::GetCookieJar() { return &cookie_jar_; } @@ -4602,7 +4585,7 @@ void RenderView::OnDragTargetDragEnter(const WebDropData& drop_data, WebDragOperationsMask ops) { WebDragOperation operation = webview()->dragTargetDragEnter( drop_data.ToDragData(), - drop_data.identity, + 0, // drag identity, unused client_point, screen_point, ops); diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 42e3ddb..705f12e 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -340,12 +340,6 @@ class RenderView : public RenderWidget, WebKit::WebPlugin* CreatePluginNoCheck(WebKit::WebFrame* frame, const WebKit::WebPluginParams& params); - // Asks the browser for the CPBrowsingContext associated with this renderer. - // This is an opaque identifier associated with the renderer for sending - // messages for the given "Chrome Plugin." The Chrome Plugin API is used - // only by gears and this function can be deleted when we remove gears. - uint32 GetCPBrowsingContext(); - #if defined(OS_MACOSX) // Informs the render view that the given plugin has gained or lost focus. void PluginFocusChanged(bool focused, int plugin_id); @@ -636,11 +630,6 @@ class RenderView : public RenderWidget, virtual void DidMovePlugin(const webkit::npapi::WebPluginGeometry& move); virtual void DidStartLoadingForPlugin(); virtual void DidStopLoadingForPlugin(); - virtual void ShowModalHTMLDialogForPlugin( - const GURL& url, - const gfx::Size& size, - const std::string& json_arguments, - std::string* json_retval); virtual WebKit::WebCookieJar* GetCookieJar(); // Please do not add your stuff randomly to the end here. If there is an diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc index 6b325b8..f61a011 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -229,7 +229,7 @@ bool IsProtocolSupportedForMedia(const GURL& url) { // static factory function ResourceLoaderBridge* ResourceLoaderBridge::Create( const ResourceLoaderBridge::RequestInfo& request_info) { - return ChildThread::current()->CreateBridge(request_info, -1, -1); + return ChildThread::current()->CreateBridge(request_info); } // static factory function diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 43929c8..f4ad26a 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -40,7 +40,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/blit.h" @@ -64,7 +63,6 @@ using WebKit::WebCursorInfo; using WebKit::WebDragData; using WebKit::WebInputEvent; using WebKit::WebString; -using WebKit::WebVector; using WebKit::WebView; // Proxy for WebPluginResourceClient. The object owns itself after creation, @@ -453,15 +451,9 @@ bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { OnGetPluginElement) IPC_MESSAGE_HANDLER(PluginHostMsg_SetCookie, OnSetCookie) IPC_MESSAGE_HANDLER(PluginHostMsg_GetCookies, OnGetCookies) - IPC_MESSAGE_HANDLER(PluginHostMsg_ShowModalHTMLDialog, - OnShowModalHTMLDialog) - IPC_MESSAGE_HANDLER(PluginHostMsg_GetDragData, OnGetDragData); - IPC_MESSAGE_HANDLER(PluginHostMsg_SetDropEffect, OnSetDropEffect); IPC_MESSAGE_HANDLER(PluginHostMsg_MissingPluginStatus, OnMissingPluginStatus) IPC_MESSAGE_HANDLER(PluginHostMsg_URLRequest, OnHandleURLRequest) - IPC_MESSAGE_HANDLER(PluginHostMsg_GetCPBrowsingContext, - OnGetCPBrowsingContext) IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad) IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest, OnInitiateHTTPRangeRequest) @@ -1152,137 +1144,11 @@ void WebPluginDelegateProxy::OnGetCookies(const GURL& url, *cookies = plugin_->GetCookies(url, first_party_for_cookies); } -void WebPluginDelegateProxy::OnShowModalHTMLDialog( - const GURL& url, int width, int height, const std::string& json_arguments, - std::string* json_retval) { - DCHECK(json_retval); - if (render_view_) { - render_view_->ShowModalHTMLDialogForPlugin( - url, gfx::Size(width, height), json_arguments, json_retval); - } -} - -static void EncodeDragData(const WebDragData& data, bool add_data, - NPVariant* drag_type, NPVariant* drag_data) { - const NPString* np_drag_type; - if (data.containsFilenames()) { - static const NPString kFiles = { "Files", 5 }; - np_drag_type = &kFiles; - } else { - static const NPString kEmpty = { "" , 0 }; - np_drag_type = &kEmpty; - add_data = false; - } - - STRINGN_TO_NPVARIANT(np_drag_type->UTF8Characters, - np_drag_type->UTF8Length, - *drag_type); - if (!add_data) { - VOID_TO_NPVARIANT(*drag_data); - return; - } - - WebVector<WebString> files; - data.filenames(files); - - static std::string utf8; - utf8.clear(); - for (size_t i = 0; i < files.size(); ++i) { - static const char kBackspaceDelimiter('\b'); - if (i != 0) - utf8.append(1, kBackspaceDelimiter); - utf8.append(files[i].utf8()); - } - - STRINGN_TO_NPVARIANT(utf8.data(), utf8.length(), *drag_data); -} - -void WebPluginDelegateProxy::OnGetDragData(const NPVariant_Param& object, - bool add_data, - std::vector<NPVariant_Param>* values, - bool* success) { - DCHECK(values && success); - *success = false; - - WebView* webview = NULL; - if (render_view_) - webview = render_view_->webview(); - if (!webview) - return; - - int event_id; - WebDragData data; - - DCHECK(object.type == NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID); - NPObjectBase* npobject_base = - channel_host_->GetNPObjectListenerForRoute(object.npobject_routing_id); - if (!npobject_base) { - DLOG(WARNING) << "Invalid routing id passed in" - << object.npobject_routing_id; - return; - } - - NPObject* event = npobject_base->GetUnderlyingNPObject(); - DCHECK(event != NULL); - - const int32 drag_id = webview->dragIdentity(); - if (!drag_id || !WebBindings::getDragData(event, &event_id, &data)) - return; - - NPVariant results[4]; - INT32_TO_NPVARIANT(drag_id, results[0]); - INT32_TO_NPVARIANT(event_id, results[1]); - EncodeDragData(data, add_data, &results[2], &results[3]); - - for (size_t i = 0; i < arraysize(results); ++i) { - values->push_back(NPVariant_Param()); - CreateNPVariantParam( - results[i], NULL, &values->back(), false, 0, page_url_); - } - - *success = true; -} - -void WebPluginDelegateProxy::OnSetDropEffect(const NPVariant_Param& object, - int effect, - bool* success) { - DCHECK(success); - *success = false; - - WebView* webview = NULL; - if (render_view_) - webview = render_view_->webview(); - if (!webview) - return; - - DCHECK(object.type == NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID); - NPObjectBase* npobject_base = - channel_host_->GetNPObjectListenerForRoute(object.npobject_routing_id); - if (!npobject_base) { - DLOG(WARNING) << "Invalid routing id passed in" - << object.npobject_routing_id; - return; - } - - NPObject* event = npobject_base->GetUnderlyingNPObject(); - DCHECK(event != NULL); - - const int32 drag_id = webview->dragIdentity(); - if (!drag_id || !WebBindings::isDragEvent(event)) - return; - - *success = webview->setDropEffect(effect != 0); -} - void WebPluginDelegateProxy::OnMissingPluginStatus(int status) { if (render_view_) render_view_->OnMissingPluginStatus(this, status); } -void WebPluginDelegateProxy::OnGetCPBrowsingContext(uint32* context) { - *context = render_view_ ? render_view_->GetCPBrowsingContext() : 0; -} - void WebPluginDelegateProxy::PaintSadPlugin(WebKit::WebCanvas* native_context, const gfx::Rect& rect) { // Lazily load the sad plugin image. diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h index 1c99113..3a84996 100644 --- a/chrome/renderer/webplugin_delegate_proxy.h +++ b/chrome/renderer/webplugin_delegate_proxy.h @@ -145,15 +145,7 @@ class WebPluginDelegateProxy const std::string& cookie); void OnGetCookies(const GURL& url, const GURL& first_party_for_cookies, std::string* cookies); - void OnShowModalHTMLDialog(const GURL& url, int width, int height, - const std::string& json_arguments, - std::string* json_retval); - void OnGetDragData(const NPVariant_Param& event, bool add_data, - std::vector<NPVariant_Param>* values, bool* success); - void OnSetDropEffect(const NPVariant_Param& event, int effect, - bool* success); void OnMissingPluginStatus(int status); - void OnGetCPBrowsingContext(uint32* context); void OnCancelDocumentLoad(); void OnInitiateHTTPRangeRequest(const std::string& url, const std::string& range_info, diff --git a/chrome/test/chrome_plugin/test_chrome_plugin.cc b/chrome/test/chrome_plugin/test_chrome_plugin.cc deleted file mode 100644 index 751a9c2..0000000 --- a/chrome/test/chrome_plugin/test_chrome_plugin.cc +++ /dev/null @@ -1,383 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/test/chrome_plugin/test_chrome_plugin.h" - -#include "base/at_exit.h" -#include "base/basictypes.h" -#include "base/logging.h" -#include "base/message_loop.h" -#include "base/string_util.h" -#include "chrome/common/chrome_plugin_api.h" -#include "googleurl/src/gurl.h" - -static CPID g_cpid; -static CPBrowserFuncs g_cpbrowser_funcs; -static CPRequestFuncs g_cprequest_funcs; -static CPResponseFuncs g_cpresponse_funcs; -static TestFuncParams::BrowserFuncs g_cptest_funcs; - -// Create a global AtExitManager so that our code can use code from base that -// uses Singletons, for example. We don't care about static constructors here. -static base::AtExitManager global_at_exit_manager; - -const TestResponsePayload* FindPayload(const char* url) { - for (size_t i = 0; i < arraysize(kChromeTestPluginPayloads); ++i) { - if (strcmp(kChromeTestPluginPayloads[i].url, url) == 0) - return &kChromeTestPluginPayloads[i]; - } - return NULL; -} - -std::string GetPayloadHeaders(const TestResponsePayload* payload) { - return StringPrintf( - "HTTP/1.1 200 OK%c" - "Content-type: %s%c" - "%c", 0, payload->mime_type, 0, 0); -} - -void STDCALL InvokeLaterCallback(void* data) { - Task* task = static_cast<Task*>(data); - task->Run(); - delete task; -} - -// ResponseStream: Manages the streaming of the payload data. - -class ResponseStream : public base::RefCounted<ResponseStream> { - public: - ResponseStream(const TestResponsePayload* payload, CPRequest* request); - - void Init(); - int GetResponseInfo(CPResponseInfoType type, void* buf, uint32 buf_size); - int ReadData(void* buf, uint32 buf_size); - - private: - friend class base::RefCounted<ResponseStream>; - - ~ResponseStream() { - request_->pdata = NULL; - } - - // Called asynchronously via InvokeLater. - void ResponseStarted(); - int ReadCompleted(void* buf, uint32 buf_size); - - enum ReadyStates { - READY_INVALID = 0, - READY_WAITING = 1, - READY_GOT_HEADERS = 2, - READY_GOT_DATA = 3, - }; - const TestResponsePayload* payload_; - uint32 offset_; - int ready_state_; - CPRequest* request_; -}; - -ResponseStream::ResponseStream(const TestResponsePayload* payload, - CPRequest* request) - : payload_(payload), offset_(0), ready_state_(READY_INVALID), - request_(request) { -} - -void ResponseStream::Init() { - if (payload_->async) { - // simulate an asynchronous start complete - ready_state_ = READY_WAITING; - g_cptest_funcs.invoke_later( - InvokeLaterCallback, - // downcast to Task before void, since we upcast from void to Task. - static_cast<Task*>( - NewRunnableMethod(this, &ResponseStream::ResponseStarted)), - 500); - } else { - ready_state_ = READY_GOT_DATA; - } -} - -int ResponseStream::GetResponseInfo(CPResponseInfoType type, void* buf, - uint32 buf_size) { - if (ready_state_ < READY_GOT_HEADERS) - return CPERR_FAILURE; - - switch (type) { - case CPRESPONSEINFO_HTTP_STATUS: - if (buf) - memcpy(buf, &payload_->status, buf_size); - break; - case CPRESPONSEINFO_HTTP_RAW_HEADERS: { - std::string headers = GetPayloadHeaders(payload_); - 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; -} - -int ResponseStream::ReadData(void* buf, uint32 buf_size) { - if (ready_state_ < READY_GOT_DATA) { - // simulate an asynchronous read complete - g_cptest_funcs.invoke_later( - InvokeLaterCallback, - // downcast to Task before void, since we upcast from void to Task. - static_cast<Task*>( - NewRunnableMethod(this, &ResponseStream::ReadCompleted, - buf, buf_size)), - 500); - return CPERR_IO_PENDING; - } - - // synchronously complete the read - return ReadCompleted(buf, buf_size); -} - -void ResponseStream::ResponseStarted() { - ready_state_ = READY_GOT_HEADERS; - g_cpresponse_funcs.start_completed(request_, CPERR_SUCCESS); -} - -int ResponseStream::ReadCompleted(void* buf, uint32 buf_size) { - uint32 size = static_cast<uint32>(strlen(payload_->body)); - uint32 avail = size - offset_; - uint32 count = buf_size; - if (count > avail) - count = avail; - - if (count) { - memcpy(buf, payload_->body + offset_, count); - } - - offset_ += count; - - if (ready_state_ < READY_GOT_DATA) { - ready_state_ = READY_GOT_DATA; - g_cpresponse_funcs.read_completed(request_, static_cast<int>(count)); - } - - return count; -} - -// CPP Funcs - -CPError STDCALL CPP_Shutdown() { - return CPERR_SUCCESS; -} - -CPBool STDCALL CPP_ShouldInterceptRequest(CPRequest* request) { - DCHECK(base::strncasecmp(request->url, kChromeTestPluginProtocol, - arraysize(kChromeTestPluginProtocol) - 1) == 0); - return FindPayload(request->url) != NULL; -} - -CPError STDCALL CPR_StartRequest(CPRequest* request) { - const TestResponsePayload* payload = FindPayload(request->url); - DCHECK(payload); - ResponseStream* stream = new ResponseStream(payload, request); - stream->AddRef(); // Released in CPR_EndRequest - stream->Init(); - request->pdata = stream; - return payload->async ? CPERR_IO_PENDING : CPERR_SUCCESS; -} - -void STDCALL CPR_EndRequest(CPRequest* request, CPError reason) { - ResponseStream* stream = static_cast<ResponseStream*>(request->pdata); - request->pdata = NULL; - stream->Release(); // balances AddRef in CPR_StartRequest -} - -void STDCALL CPR_SetExtraRequestHeaders(CPRequest* request, - const char* headers) { - // doesn't affect us -} - -void STDCALL CPR_SetRequestLoadFlags(CPRequest* request, uint32 flags) { - // doesn't affect us -} - -void STDCALL CPR_AppendDataToUpload(CPRequest* request, const char* bytes, - int bytes_len) { - // doesn't affect us -} - -CPError STDCALL CPR_AppendFileToUpload(CPRequest* request, const char* filepath, - uint64 offset, uint64 length) { - // doesn't affect us - return CPERR_FAILURE; -} - -int STDCALL CPR_GetResponseInfo(CPRequest* request, CPResponseInfoType type, - void* buf, uint32 buf_size) { - ResponseStream* stream = static_cast<ResponseStream*>(request->pdata); - return stream->GetResponseInfo(type, buf, buf_size); -} - -int STDCALL CPR_Read(CPRequest* request, void* buf, uint32 buf_size) { - ResponseStream* stream = static_cast<ResponseStream*>(request->pdata); - return stream->ReadData(buf, buf_size); -} - -// RequestResponse: manages the retrieval of response data from the host - -class RequestResponse { - public: - explicit RequestResponse(const std::string& raw_headers) - : raw_headers_(raw_headers), offset_(0) {} - void StartReading(CPRequest* request); - void ReadCompleted(CPRequest* request, int bytes_read); - - private: - std::string raw_headers_; - std::string body_; - int offset_; -}; - -void RequestResponse::StartReading(CPRequest* request) { - int rv = 0; - const uint32 kReadSize = 4096; - do { - body_.resize(offset_ + kReadSize); - rv = g_cprequest_funcs.read(request, &body_[offset_], kReadSize); - if (rv > 0) - offset_ += rv; - } while (rv > 0); - - if (rv != CPERR_IO_PENDING) { - // Either an error occurred, or we are done. - ReadCompleted(request, rv); - } -} - -void RequestResponse::ReadCompleted(CPRequest* request, int bytes_read) { - if (bytes_read > 0) { - offset_ += bytes_read; - StartReading(request); - return; - } - - body_.resize(offset_); - bool success = (bytes_read == 0); - g_cptest_funcs.test_complete(request, success, raw_headers_, body_); - g_cprequest_funcs.end_request(request, CPERR_CANCELLED); - delete this; -} - -void STDCALL CPRR_ReceivedRedirect(CPRequest* request, const char* new_url) { -} - -void STDCALL CPRR_StartCompleted(CPRequest* request, CPError result) { - DCHECK(!request->pdata); - - std::string raw_headers; - int size = g_cprequest_funcs.get_response_info( - request, CPRESPONSEINFO_HTTP_RAW_HEADERS, NULL, 0); - int rv = size < 0 ? size : g_cprequest_funcs.get_response_info( - request, CPRESPONSEINFO_HTTP_RAW_HEADERS, - WriteInto(&raw_headers, size+1), size); - if (rv != CPERR_SUCCESS) { - g_cptest_funcs.test_complete(request, false, std::string(), std::string()); - g_cprequest_funcs.end_request(request, CPERR_CANCELLED); - return; - } - - RequestResponse* response = new RequestResponse(raw_headers); - request->pdata = response; - response->StartReading(request); -} - -void STDCALL CPRR_ReadCompleted(CPRequest* request, int bytes_read) { - RequestResponse* response = - reinterpret_cast<RequestResponse*>(request->pdata); - response->ReadCompleted(request, bytes_read); -} - -int STDCALL CPT_MakeRequest(const char* method, const GURL& url) { - CPRequest* request = NULL; - if (g_cpbrowser_funcs.create_request(g_cpid, NULL, method, url.spec().c_str(), - &request) != CPERR_SUCCESS || - !request) { - return CPERR_FAILURE; - } - - g_cprequest_funcs.set_request_load_flags(request, - CPREQUESTLOAD_DISABLE_INTERCEPT); - - if (strcmp(method, "POST") == 0) { - g_cprequest_funcs.set_extra_request_headers( - request, "Content-Type: text/plain"); - g_cprequest_funcs.append_data_to_upload( - request, kChromeTestPluginPostData, - arraysize(kChromeTestPluginPostData) - 1); - } - - int rv = g_cprequest_funcs.start_request(request); - if (rv == CPERR_SUCCESS) { - CPRR_StartCompleted(request, CPERR_SUCCESS); - } else if (rv != CPERR_IO_PENDING) { - g_cprequest_funcs.end_request(request, CPERR_CANCELLED); - return CPERR_FAILURE; - } - - return CPERR_SUCCESS; -} - -// DLL entry points - -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; - - 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; - - const char* protocols[] = {kChromeTestPluginProtocol}; - g_cpbrowser_funcs.enable_request_intercept(g_cpid, protocols, 1); - return CPERR_SUCCESS; -} - -int STDCALL CP_Test(void* vparam) { - TestFuncParams* param = reinterpret_cast<TestFuncParams*>(vparam); - param->pfuncs.test_make_request = CPT_MakeRequest; - - g_cptest_funcs = param->bfuncs; - return CPERR_SUCCESS; -} diff --git a/chrome/test/chrome_plugin/test_chrome_plugin.def b/chrome/test/chrome_plugin/test_chrome_plugin.def deleted file mode 100644 index 18a26cb..0000000 --- a/chrome/test/chrome_plugin/test_chrome_plugin.def +++ /dev/null @@ -1,4 +0,0 @@ -EXPORTS - CP_Initialize @1 - CP_Test @2 - diff --git a/chrome/test/chrome_plugin/test_chrome_plugin.h b/chrome/test/chrome_plugin/test_chrome_plugin.h deleted file mode 100644 index 19d3310..0000000 --- a/chrome/test/chrome_plugin/test_chrome_plugin.h +++ /dev/null @@ -1,71 +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. -// Shared by the plugin DLL and the unittest code. - -#ifndef CHROME_TEST_CHROME_PLUGIN_TEST_CHROME_PLUGIN_H__ -#define CHROME_TEST_CHROME_PLUGIN_TEST_CHROME_PLUGIN_H__ -#pragma once - -#include <string> - -#include "base/basictypes.h" -#include "chrome/common/chrome_plugin_api.h" - -class GURL; - -struct TestResponsePayload { - const char* url; - bool async; - int status; - const char* mime_type; - const char* body; -}; - -const char kChromeTestPluginProtocol[] = "cptest"; - -const TestResponsePayload kChromeTestPluginPayloads[] = { - { - "cptest:sync", - false, - 200, - "text/html", - "<head><title>cptest:sync</title></head><body>SUCCESS</body>" - }, - { - "cptest:async", - true, - 200, - "text/plain", - "<head><title>cptest:async</title></head><body>SUCCESS</body>" - }, - { - "cptest:blank", - false, - 200, - "text/plain", - "" - }, -}; - -struct TestFuncParams { - typedef void (STDCALL *CallbackFunc)(void* data); - - struct PluginFuncs { - int (STDCALL *test_make_request)(const char* method, const GURL& url); - }; - PluginFuncs pfuncs; - - struct BrowserFuncs { - void (STDCALL *test_complete)(CPRequest* request, bool success, - const std::string& raw_headers, - const std::string& body); - void (STDCALL *invoke_later)(CallbackFunc callback, void* callback_data, - int delay_ms); - }; - BrowserFuncs bfuncs; -}; - -const char kChromeTestPluginPostData[] = "Test Data"; - -#endif // CHROME_TEST_CHROME_PLUGIN_TEST_CHROME_PLUGIN_H__ diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc index 8e0e826..9cc8541 100644 --- a/chrome/test/startup/startup_test.cc +++ b/chrome/test/startup/startup_test.cc @@ -44,7 +44,7 @@ class StartupTest : public UIPerfTest { }; // Load a file on startup rather than about:blank. This tests a longer - // startup path, including resource loading and the loading of gears.dll. + // startup path, including resource loading. void SetUpWithFileURL() { const FilePath file_url = ui_test_utils::GetTestFilePath( FilePath(FilePath::kCurrentDirectory), @@ -141,15 +141,6 @@ class StartupTest : public UIPerfTest { FilePath chrome_dll(dir_app.Append(FILE_PATH_LITERAL("chrome.dll"))); ASSERT_TRUE(EvictFileFromSystemCacheWrapper(chrome_dll)); #endif - -#if defined(OS_WIN) - // TODO(port): Re-enable once gears is working on mac/linux. - FilePath gears_dll; - ASSERT_TRUE(PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_dll)); - ASSERT_TRUE(EvictFileFromSystemCacheWrapper(gears_dll)); -#else - NOTIMPLEMENTED() << "gears not enabled yet"; -#endif } UITest::SetUp(); TimeTicks end_time = TimeTicks::Now(); @@ -370,21 +361,6 @@ TEST_F(StartupTest, MAYBE_PerfExtensionContentScript50) { ProxyLauncher::DEFAULT_THEME, 1, 0); } -#if defined(OS_WIN) -// TODO(port): Enable gears tests on linux/mac once gears is working. -TEST_F(StartupTest, PerfGears) { - SetUpWithFileURL(); - RunStartupTest("warm", "gears", WARM, NOT_IMPORTANT, - ProxyLauncher::DEFAULT_THEME, 1, 0); -} - -TEST_F(StartupTest, PerfColdGears) { - SetUpWithFileURL(); - RunStartupTest("cold", "gears", COLD, NOT_IMPORTANT, - ProxyLauncher::DEFAULT_THEME, 1, 0); -} -#endif - TEST_F(StartupTest, PerfComplexTheme) { RunStartupTest("warm", "t-theme", WARM, NOT_IMPORTANT, ProxyLauncher::COMPLEX_THEME, 0, 0); diff --git a/chrome/tools/build/win/FILES b/chrome/tools/build/win/FILES index 5136ca7..73ce368 100644 --- a/chrome/tools/build/win/FILES +++ b/chrome/tools/build/win/FILES @@ -7,7 +7,6 @@ chrome.dll nacl64.dll crash_service.exe First Run -gears.dll ppGoogleNaClPluginChrome.dll icudt.dll locales/ar.dll diff --git a/chrome/tools/build/win/FILES.cfg b/chrome/tools/build/win/FILES.cfg index 4817b15..41d9d18 100644 --- a/chrome/tools/build/win/FILES.cfg +++ b/chrome/tools/build/win/FILES.cfg @@ -61,12 +61,7 @@ FILES = [ 'buildtype': ['dev', 'official'], }, { - 'filename': 'gears.dll', - 'arch': ['32bit', '64bit'], - 'buildtype': ['dev', 'official'], - }, - { - 'filename': 'icudt.dll', + 'filename': 'icudt46.dll', 'arch': ['32bit', '64bit'], 'buildtype': ['dev', 'official'], }, diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py index ac0683a..b9638dc 100755 --- a/chrome/tools/build/win/create_installer_archive.py +++ b/chrome/tools/build/win/create_installer_archive.py @@ -142,10 +142,10 @@ def GetPrevVersion(output_dir, temp_dir, last_chrome_installer): lzma_exec = GetLZMAExec(options.output_dir) prev_archive_file = os.path.join(options.last_chrome_installer, options.output_name + ARCHIVE_SUFFIX) - cmd = '%s x -o"%s" "%s" Chrome-bin/*/gears.dll' % (lzma_exec, temp_dir, - prev_archive_file) + cmd = '%s x -o"%s" "%s" Chrome-bin/*/chrome.dll' % (lzma_exec, temp_dir, + prev_archive_file) RunSystemCommand(cmd) - dll_path = glob.glob(os.path.join(temp_dir, 'Chrome-bin', '*', 'gears.dll')) + dll_path = glob.glob(os.path.join(temp_dir, 'Chrome-bin', '*', 'chrome.dll')) return os.path.split(os.path.split(dll_path[0])[0])[1] def MakeStagingDirectories(output_dir): diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index 5cdb77b..a9c2f83 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -187,10 +187,6 @@ void FakeExternalTab::Initialize() { DCHECK(g_browser_process == NULL); ui::SystemMonitor system_monitor; - // The gears plugin causes the PluginRequestInterceptor to kick in and it - // will cause problems when it tries to intercept URL requests. - PathService::Override(chrome::FILE_GEARS_PLUGIN, FilePath()); - icu_util::Initialize(); app::RegisterPathProvider(); @@ -518,7 +514,6 @@ int main(int argc, char** argv) { watchdog.AddObserver(&credentials, "Windows Security", ""); testing::InitGoogleTest(&argc, argv); FilterDisabledTests(); - PluginService::EnableChromePlugins(false); test_suite.RunMainUIThread(); return 0; } diff --git a/chrome_frame/test/perf/chrome_frame_perftest.cc b/chrome_frame/test/perf/chrome_frame_perftest.cc index 3fdbd48..8a82c1a 100644 --- a/chrome_frame/test/perf/chrome_frame_perftest.cc +++ b/chrome_frame/test/perf/chrome_frame_perftest.cc @@ -296,8 +296,7 @@ class ChromeFrameStartupTest : public ChromeFramePerfTestBase { chrome_frame_dll_ = dir_app_.Append(FILE_PATH_LITERAL("servers")); chrome_frame_dll_ = chrome_frame_dll_.Append( FilePath::FromWStringHack(kChromeFrameDllName)); - icu_dll_ = dir_app_.Append(FILE_PATH_LITERAL("icudt.dll")); - gears_dll_ = dir_app_.Append(FILE_PATH_LITERAL("gears.dll")); + icu_dll_ = dir_app_.Append(FILE_PATH_LITERAL("icudt46.dll")); avcodec52_dll_ = dir_app_.Append(FILE_PATH_LITERAL("avcodec-52.dll")); avformat52_dll_ = dir_app_.Append(FILE_PATH_LITERAL("avformat-52.dll")); avutil50_dll_ = dir_app_.Append(FILE_PATH_LITERAL("avutil-50.dll")); @@ -358,7 +357,6 @@ class ChromeFrameStartupTest : public ChromeFramePerfTestBase { FilePath chrome_exe_; FilePath chrome_frame_dll_; FilePath icu_dll_; - FilePath gears_dll_; FilePath avcodec52_dll_; FilePath avformat52_dll_; FilePath avutil50_dll_; @@ -967,9 +965,10 @@ TEST_F(ChromeFrameBinariesLoadTest, PerfWarm) { TEST_F(ChromeFrameStartupTestActiveX, PerfCold) { SetConfigInt(L"PreRead", 0); - FilePath binaries_to_evict[] = { gears_dll_, avcodec52_dll_, - avformat52_dll_, avutil50_dll_, chrome_exe_, chrome_dll_, - chrome_frame_dll_}; + FilePath binaries_to_evict[] = { + avcodec52_dll_, avformat52_dll_, avutil50_dll_, chrome_exe_, chrome_dll_, + chrome_frame_dll_ + }; RunStartupTest("cold", "t", "about:blank", true /* cold */, arraysize(binaries_to_evict), binaries_to_evict, false /* not important */, false); @@ -978,9 +977,10 @@ TEST_F(ChromeFrameStartupTestActiveX, PerfCold) { TEST_F(ChromeFrameStartupTestActiveX, PerfColdPreRead) { SetConfigInt(L"PreRead", 1); - FilePath binaries_to_evict[] = { gears_dll_, avcodec52_dll_, - avformat52_dll_, avutil50_dll_, chrome_exe_, chrome_dll_, - chrome_frame_dll_}; + FilePath binaries_to_evict[] = { + avcodec52_dll_, avformat52_dll_, avutil50_dll_, chrome_exe_, chrome_dll_, + chrome_frame_dll_ + }; RunStartupTest("cold_preread", "t", "about:blank", true /* cold */, arraysize(binaries_to_evict), binaries_to_evict, false /* not important */, false); diff --git a/content/browser/browser_child_process_host.cc b/content/browser/browser_child_process_host.cc index 5142943..04b6c49 100644 --- a/content/browser/browser_child_process_host.cc +++ b/content/browser/browser_child_process_host.cc @@ -24,6 +24,7 @@ #include "chrome/installer/util/google_update_settings.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" +#include "content/browser/renderer_host/resource_message_filter.h" #if defined(OS_LINUX) #include "base/linux_util.h" @@ -60,34 +61,13 @@ class ChildNotificationTask : public Task { BrowserChildProcessHost::BrowserChildProcessHost( ChildProcessInfo::ProcessType type, - ResourceDispatcherHost* resource_dispatcher_host, - ResourceMessageFilter::URLRequestContextOverride* - url_request_context_override) - : ChildProcessInfo(type, -1), - ALLOW_THIS_IN_INITIALIZER_LIST(client_(this)), - resource_dispatcher_host_(resource_dispatcher_host) { - Initialize(url_request_context_override); -} - -BrowserChildProcessHost::BrowserChildProcessHost( - ChildProcessInfo::ProcessType type, ResourceDispatcherHost* resource_dispatcher_host) : ChildProcessInfo(type, -1), ALLOW_THIS_IN_INITIALIZER_LIST(client_(this)), resource_dispatcher_host_(resource_dispatcher_host) { - Initialize(NULL); -} - -void BrowserChildProcessHost::Initialize( - ResourceMessageFilter::URLRequestContextOverride* - url_request_context_override) { if (resource_dispatcher_host_) { ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( - id(), type(), resource_dispatcher_host_); - if (url_request_context_override) { - resource_message_filter->set_url_request_context_override( - url_request_context_override); - } + id(), type, resource_dispatcher_host_); AddFilter(resource_message_filter); } diff --git a/content/browser/browser_child_process_host.h b/content/browser/browser_child_process_host.h index 2010a79..dd1c4ff1b 100644 --- a/content/browser/browser_child_process_host.h +++ b/content/browser/browser_child_process_host.h @@ -9,7 +9,6 @@ #include <list> #include "content/browser/child_process_launcher.h" -#include "content/browser/renderer_host/resource_message_filter.h" #include "content/common/child_process_host.h" #include "content/common/child_process_info.h" @@ -57,16 +56,6 @@ class BrowserChildProcessHost : public ChildProcessHost, }; protected: - // |resource_dispatcher_host| may be NULL to indicate none is needed for - // this process type. - // |url_request_context_getter| allows derived classes to override the - // net::URLRequestContext. - BrowserChildProcessHost( - ChildProcessInfo::ProcessType type, - ResourceDispatcherHost* resource_dispatcher_host, - ResourceMessageFilter::URLRequestContextOverride* - url_request_context_override); - // A convenient constructor for those classes that want to use the default // net::URLRequestContext. BrowserChildProcessHost( @@ -121,9 +110,6 @@ class BrowserChildProcessHost : public ChildProcessHost, } private: - void Initialize(ResourceMessageFilter::URLRequestContextOverride* - url_request_context_override); - // By using an internal class as the ChildProcessLauncher::Client, we can // intercept OnProcessLaunched and do our own processing before // calling the subclass' implementation. diff --git a/content/browser/geolocation/gps_location_provider_linux.cc b/content/browser/geolocation/gps_location_provider_linux.cc index 8d9af32..4b5f787 100644 --- a/content/browser/geolocation/gps_location_provider_linux.cc +++ b/content/browser/geolocation/gps_location_provider_linux.cc @@ -21,8 +21,8 @@ const int kPollPeriodStationaryMillis = kPollPeriodMovingMillis * 3; // GPS reading must differ by more than this amount to be considered movement. const int kMovementThresholdMeters = 20; -// This algorithm is reused from the corresponding code in the gears project. -// The arbitrary delta is decreased (gears used 100 meters); if we need to +// This algorithm is reused from the corresponding code in the Gears project. +// The arbitrary delta is decreased (Gears used 100 meters); if we need to // decrease it any further we'll likely want to do some smarter filtering to // remove GPS location jitter noise. bool PositionsDifferSiginificantly(const Geoposition& position_1, diff --git a/content/browser/geolocation/location_provider.h b/content/browser/geolocation/location_provider.h index 064a59f..402ae75 100644 --- a/content/browser/geolocation/location_provider.h +++ b/content/browser/geolocation/location_provider.h @@ -3,8 +3,7 @@ // found in the LICENSE file. // A location provider provides position information from a particular source -// (GPS, network etc). The GearsGeolocation object uses a set of location -// providers to obtain a position fix. +// (GPS, network etc). // // This file declares a base class to be used by all location providers. // Primarily, this class declares interface methods to be implemented by diff --git a/content/browser/geolocation/osx_wifi.h b/content/browser/geolocation/osx_wifi.h index 35af9c1..27a4256 100644 --- a/content/browser/geolocation/osx_wifi.h +++ b/content/browser/geolocation/osx_wifi.h @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// The remainder of this file is copied from the Google Gear project: +// The remainder of this file is copied from the Gears project: // http://code.google.com/p/gears/source/browse/trunk/gears/geolocation/osx_wifi.h // The contents of this file are taken from Apple80211.h from the iStumbler diff --git a/content/browser/geolocation/win7_location_provider_win.cc b/content/browser/geolocation/win7_location_provider_win.cc index 44a992b..2e5c487 100644 --- a/content/browser/geolocation/win7_location_provider_win.cc +++ b/content/browser/geolocation/win7_location_provider_win.cc @@ -18,9 +18,9 @@ const int kPollPeriodStationaryMillis = kPollPeriodMovingMillis * 3; // Reading must differ by more than this amount to be considered movement. const int kMovementThresholdMeters = 20; -// This algorithm is reused from the corresponding code in the gears project +// This algorithm is reused from the corresponding code in the Gears project // and is also used in gps_location_provider_linux.cc -// The arbitrary delta is decreased (gears used 100 meters); if we need to +// The arbitrary delta is decreased (Gears used 100 meters); if we need to // decrease it any further we'll likely want to do some smarter filtering to // remove GPS location jitter noise. bool PositionsDifferSiginificantly(const Geoposition& position_1, diff --git a/content/browser/modal_html_dialog_delegate.cc b/content/browser/modal_html_dialog_delegate.cc deleted file mode 100644 index de58a26..0000000 --- a/content/browser/modal_html_dialog_delegate.cc +++ /dev/null @@ -1,77 +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 "content/browser/modal_html_dialog_delegate.h" - -#include <string> - -#include "chrome/browser/browser_list.h" -#include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" -#include "content/common/notification_source.h" -#include "ui/gfx/size.h" - -ModalHtmlDialogDelegate::ModalHtmlDialogDelegate( - const GURL& url, int width, int height, const std::string& json_arguments, - IPC::Message* sync_result, TabContents* contents) - : contents_(contents), - sync_response_(sync_result) { - // Listen for when the TabContents or its renderer dies. - registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED, - Source<TabContents>(contents_)); - - // This information is needed to show the dialog HTML content. - params_.url = url; - params_.height = height; - params_.width = width; - params_.json_input = json_arguments; -} - -ModalHtmlDialogDelegate::~ModalHtmlDialogDelegate() { -} - -void ModalHtmlDialogDelegate::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - DCHECK(type == NotificationType::TAB_CONTENTS_DISCONNECTED); - DCHECK(Source<TabContents>(source).ptr() == contents_); - registrar_.RemoveAll(); - contents_ = NULL; -} - -bool ModalHtmlDialogDelegate::IsDialogModal() const { - return true; -} - -std::wstring ModalHtmlDialogDelegate::GetDialogTitle() const { - return L"Gears"; -} - -GURL ModalHtmlDialogDelegate::GetDialogContentURL() const { - return params_.url; -} - -void ModalHtmlDialogDelegate::GetDialogSize(gfx::Size* size) const { - size->set_width(params_.width); - size->set_height(params_.height); -} - -std::string ModalHtmlDialogDelegate::GetDialogArgs() const { - return params_.json_input; -} - -void ModalHtmlDialogDelegate::OnDialogClosed(const std::string& json_retval) { - // Our TabContents may have died before this point. - if (contents_ && contents_->render_view_host()) { - contents_->render_view_host()->ModalHTMLDialogClosed(sync_response_, - json_retval); - } - - // We are done with this request, so delete us. - delete this; -} - -bool ModalHtmlDialogDelegate::ShouldShowDialogTitle() const { - return true; -} diff --git a/content/browser/modal_html_dialog_delegate.h b/content/browser/modal_html_dialog_delegate.h deleted file mode 100644 index 75d7d05..0000000 --- a/content/browser/modal_html_dialog_delegate.h +++ /dev/null @@ -1,68 +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 CONTENT_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_ -#define CONTENT_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_ -#pragma once - -#include <vector> - -#include "chrome/browser/ui/webui/html_dialog_ui.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" - -namespace gfx { -class Size; -} - -namespace IPC { -class Message; -} - -// This class can only be used on the UI thread. -class ModalHtmlDialogDelegate - : public HtmlDialogUIDelegate, - public NotificationObserver { - public: - ModalHtmlDialogDelegate(const GURL& url, - int width, int height, - const std::string& json_arguments, - IPC::Message* sync_result, - TabContents* contents); - ~ModalHtmlDialogDelegate(); - - // Notification service callback. - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - - // HTMLDialogUIDelegate implementation: - virtual bool IsDialogModal() const; - virtual std::wstring GetDialogTitle() const; - virtual GURL GetDialogContentURL() const; - virtual void GetWebUIMessageHandlers( - std::vector<WebUIMessageHandler*>* handlers) const { } - virtual void GetDialogSize(gfx::Size* size) const; - virtual std::string GetDialogArgs() const; - virtual void OnDialogClosed(const std::string& json_retval); - virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) { } - virtual bool ShouldShowDialogTitle() const; - - private: - NotificationRegistrar registrar_; - - // The TabContents that opened the dialog. - TabContents* contents_; - - // The parameters needed to display a modal HTML dialog. - HtmlDialogUI::HtmlDialogParams params_; - - // Once we get our reply in OnModalDialogResponse we'll need to respond to the - // plugin using this |sync_result| pointer so we store it between calls. - IPC::Message* sync_response_; - - DISALLOW_COPY_AND_ASSIGN(ModalHtmlDialogDelegate); -}; - -#endif // CONTENT_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_ diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index b2a2a3a4..25cdc75 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc @@ -21,12 +21,10 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_plugin_browsing_context.h" #include "chrome/browser/net/url_request_tracking.h" #include "chrome/browser/plugin_download_helper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/net/url_request_context_getter.h" @@ -34,13 +32,11 @@ #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" #include "content/browser/browser_thread.h" -#include "content/browser/child_process_security_policy.h" #include "content/browser/plugin_service.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/renderer_host/resource_message_filter.h" #include "content/common/resource_messages.h" #include "ipc/ipc_switches.h" -#include "net/base/cookie_store.h" #include "net/base/io_buffer.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" @@ -60,28 +56,6 @@ static const char kDefaultPluginFinderURL[] = "https://dl-ssl.google.com/edgedl/chrome/plugins/plugins2.xml"; -namespace { - -// Helper class that we pass to ResourceMessageFilter so that it can find the -// right net::URLRequestContext for a request. -class PluginURLRequestContextOverride - : public ResourceMessageFilter::URLRequestContextOverride { - public: - PluginURLRequestContextOverride() { - } - - virtual net::URLRequestContext* GetRequestContext( - const ResourceHostMsg_Request& resource_request) { - return CPBrowsingContextManager::GetInstance()->ToURLRequestContext( - resource_request.request_context); - } - - private: - virtual ~PluginURLRequestContextOverride() {} -}; - -} // namespace - #if defined(OS_WIN) void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) { // The window is destroyed at this point, we just care about its parent, which @@ -121,8 +95,7 @@ void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, PluginProcessHost::PluginProcessHost() : BrowserChildProcessHost( PLUGIN_PROCESS, - PluginService::GetInstance()->resource_dispatcher_host(), - new PluginURLRequestContextOverride()), + PluginService::GetInstance()->resource_dispatcher_host()), ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)) #if defined(OS_MACOSX) , plugin_cursor_visible_(true) @@ -241,12 +214,6 @@ bool PluginProcessHost::Init(const webkit::npapi::WebPluginInfo& info, cmd_line->AppendSwitchASCII(switches::kLang, locale); } - // Gears requires the data dir to be available on startup. - FilePath data_dir = - PluginService::GetInstance()->GetChromePluginDataDir(); - DCHECK(!data_dir.empty()); - cmd_line->AppendSwitchPath(switches::kPluginDataDir, data_dir); - cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); SetCrashReporterCommandLine(cmd_line); @@ -287,28 +254,12 @@ void PluginProcessHost::ForceShutdown() { BrowserChildProcessHost::ForceShutdown(); } -void PluginProcessHost::OnProcessLaunched() { - FilePath gears_path; - if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_path)) { - FilePath::StringType gears_path_lc = StringToLowerASCII(gears_path.value()); - FilePath::StringType plugin_path_lc = - StringToLowerASCII(info_.path.value()); - if (plugin_path_lc == gears_path_lc) { - // Give Gears plugins "background" priority. See http://b/1280317. - SetProcessBackgrounded(); - } - } -} - bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl, OnGetPluginFinderUrl) - IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage) - IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies) - IPC_MESSAGE_HANDLER(PluginProcessHostMsg_AccessFiles, OnAccessFiles) IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy, OnResolveProxy) #if defined(OS_WIN) @@ -379,43 +330,6 @@ void PluginProcessHost::OpenChannelToPlugin(Client* client) { RequestPluginChannel(client); } -void PluginProcessHost::OnGetCookies(uint32 request_context, - const GURL& url, - std::string* cookies) { - net::URLRequestContext* context = CPBrowsingContextManager::GetInstance()-> - ToURLRequestContext(request_context); - // TODO(mpcomplete): remove fallback case when Gears support is prevalent. - if (!context) - context = Profile::GetDefaultRequestContext()->GetURLRequestContext(); - - // Note: We don't have a first_party_for_cookies check because plugins bypass - // third-party cookie blocking. - if (context && context->cookie_store()) { - *cookies = context->cookie_store()->GetCookies(url); - } else { - DLOG(ERROR) << "Could not serve plugin cookies request."; - cookies->clear(); - } -} - -void PluginProcessHost::OnAccessFiles(int renderer_id, - const std::vector<std::string>& files, - bool* allowed) { - ChildProcessSecurityPolicy* policy = - ChildProcessSecurityPolicy::GetInstance(); - - for (size_t i = 0; i < files.size(); ++i) { - const FilePath path = FilePath::FromWStringHack(UTF8ToWide(files[i])); - if (!policy->CanReadFile(renderer_id, path)) { - VLOG(1) << "Denied unauthorized request for file " << files[i]; - *allowed = false; - return; - } - } - - *allowed = true; -} - void PluginProcessHost::OnResolveProxy(const GURL& url, IPC::Message* reply_msg) { resolve_proxy_msg_helper_.Start(url, reply_msg); @@ -469,15 +383,3 @@ void PluginProcessHost::OnGetPluginFinderUrl(std::string* plugin_finder_url) { plugin_finder_url->clear(); } } - -void PluginProcessHost::OnPluginMessage( - const std::vector<uint8>& data) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - - ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); - if (chrome_plugin) { - void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); - uint32 data_len = static_cast<uint32>(data.size()); - chrome_plugin->functions().on_message(data_ptr, data_len); - } -} diff --git a/content/browser/plugin_process_host.h b/content/browser/plugin_process_host.h index ad44aae..14d1a6f 100644 --- a/content/browser/plugin_process_host.h +++ b/content/browser/plugin_process_host.h @@ -106,17 +106,10 @@ class PluginProcessHost : public BrowserChildProcessHost, // for the given mime type. void RequestPluginChannel(Client* client); - virtual void OnProcessLaunched(); - // Message handlers. void OnChannelCreated(const IPC::ChannelHandle& channel_handle); void OnGetPluginFinderUrl(std::string* plugin_finder_url); - void OnGetCookies(uint32 request_context, const GURL& url, - std::string* cookies); - void OnAccessFiles(int renderer_id, const std::vector<std::string>& files, - bool* allowed); void OnResolveProxy(const GURL& url, IPC::Message* reply_msg); - void OnPluginMessage(const std::vector<uint8>& data); #if defined(OS_WIN) void OnPluginWindowDestroyed(HWND window, HWND parent); diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc index 95249f74d..bc6c026 100644 --- a/content/browser/plugin_service.cc +++ b/content/browser/plugin_service.cc @@ -14,12 +14,10 @@ #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_plugin_host.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/plugin_updater.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/default_plugin.h" #include "chrome/common/extensions/extension.h" @@ -77,18 +75,12 @@ class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { #endif // static -bool PluginService::enable_chrome_plugins_ = true; - -// static void PluginService::InitGlobalInstance(Profile* profile) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // We first group the plugins and then figure out which groups to // enable or disable. PluginUpdater::GetInstance()->UpdatePluginGroupsStateFromPrefs(profile); - - // Have Chrome plugins write their data to the profile directory. - GetInstance()->SetChromePluginDataDir(profile->GetPath()); } // static @@ -96,20 +88,12 @@ PluginService* PluginService::GetInstance() { return Singleton<PluginService>::get(); } -// static -void PluginService::EnableChromePlugins(bool enable) { - enable_chrome_plugins_ = enable; -} - PluginService::PluginService() : main_message_loop_(MessageLoop::current()), resource_dispatcher_host_(NULL), ui_locale_(g_browser_process->GetApplicationLocale()) { RegisterPepperPlugins(); - // Have the NPAPI plugin list search for Chrome plugins as well. - ChromePluginLib::RegisterPluginsWithNPAPI(); - // Load any specified on the command line as well. const CommandLine* command_line = CommandLine::ForCurrentProcess(); FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin); @@ -218,23 +202,6 @@ PluginService::~PluginService() { #endif } -void PluginService::LoadChromePlugins( - ResourceDispatcherHost* resource_dispatcher_host) { - if (!enable_chrome_plugins_) - return; - - resource_dispatcher_host_ = resource_dispatcher_host; - ChromePluginLib::LoadChromePlugins(GetCPBrowserFuncsForBrowser()); -} - -void PluginService::SetChromePluginDataDir(const FilePath& data_dir) { - chrome_plugin_data_dir_ = data_dir; -} - -const FilePath& PluginService::GetChromePluginDataDir() { - return chrome_plugin_data_dir_; -} - const std::string& PluginService::GetUILocale() { return ui_locale_; } diff --git a/content/browser/plugin_service.h b/content/browser/plugin_service.h index 4d0db82..e142a90 100644 --- a/content/browser/plugin_service.h +++ b/content/browser/plugin_service.h @@ -76,15 +76,6 @@ class PluginService // Returns the PluginService singleton. static PluginService* GetInstance(); - // Load all the plugins that should be loaded for the lifetime of the browser - // (ie, with the LoadOnStartup flag set). - void LoadChromePlugins(ResourceDispatcherHost* resource_dispatcher_host); - - // Sets/gets the data directory that Chrome plugins should use to store - // persistent data. - void SetChromePluginDataDir(const FilePath& data_dir); - const FilePath& GetChromePluginDataDir(); - // Gets the browser's UI locale. const std::string& GetUILocale(); @@ -137,8 +128,6 @@ class PluginService return resource_dispatcher_host_; } - static void EnableChromePlugins(bool enable); - private: friend struct DefaultSingletonTraits<PluginService>; @@ -184,9 +173,6 @@ class PluginService // The IO thread's resource dispatcher host. ResourceDispatcherHost* resource_dispatcher_host_; - // The data directory that Chrome plugins should use to store persistent data. - FilePath chrome_plugin_data_dir_; - // The browser's UI locale. const std::string ui_locale_; @@ -218,9 +204,6 @@ class PluginService std::vector<PepperPluginInfo> ppapi_plugins_; - // Set to true if chrome plugins are enabled. Defaults to true. - static bool enable_chrome_plugins_; - std::vector<OverriddenPlugin> overridden_plugins_; base::Lock overridden_plugins_lock_; diff --git a/content/browser/plugin_service_browsertest.cc b/content/browser/plugin_service_browsertest.cc index 3df43d0..54b6491 100644 --- a/content/browser/plugin_service_browsertest.cc +++ b/content/browser/plugin_service_browsertest.cc @@ -11,6 +11,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" +#include "content/browser/browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "webkit/plugins/npapi/plugin_list.h" diff --git a/content/browser/plugin_service_unittest.cc b/content/browser/plugin_service_unittest.cc index 4db9722..283f86d 100644 --- a/content/browser/plugin_service_unittest.cc +++ b/content/browser/plugin_service_unittest.cc @@ -42,17 +42,6 @@ class PluginServiceTest : public testing::Test { DISALLOW_COPY_AND_ASSIGN(PluginServiceTest); }; -TEST_F(PluginServiceTest, SetGetChromePluginDataDir) { - // Check that after setting the same plugin dir we just read it is set - // correctly. - FilePath plugin_data_dir = plugin_service_->GetChromePluginDataDir(); - FilePath new_plugin_data_dir(FILE_PATH_LITERAL("/a/bogus/dir")); - plugin_service_->SetChromePluginDataDir(new_plugin_data_dir); - EXPECT_EQ(new_plugin_data_dir, plugin_service_->GetChromePluginDataDir()); - plugin_service_->SetChromePluginDataDir(plugin_data_dir); - EXPECT_EQ(plugin_data_dir, plugin_service_->GetChromePluginDataDir()); -} - TEST_F(PluginServiceTest, GetUILocale) { // Check for a non-empty locale string. EXPECT_NE("", plugin_service_->GetUILocale()); diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 61822da..0a29798 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -15,7 +15,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/automation/automation_resource_message_filter.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_plugin_browsing_context.h" +#include "chrome/browser/clipboard_dispatcher.h" #include "chrome/browser/download/download_types.h" #include "chrome/browser/extensions/extension_message_service.h" #include "chrome/browser/metrics/histogram_synchronizer.h" @@ -367,8 +367,6 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message, IPC_MESSAGE_HANDLER(ViewHostMsg_CheckNotificationPermission, OnCheckNotificationPermission) IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) - IPC_MESSAGE_HANDLER(ViewHostMsg_GetCPBrowsingContext, - OnGetCPBrowsingContext) IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateSharedMemoryBuffer, OnAllocateSharedMemoryBuffer) IPC_MESSAGE_HANDLER(ViewHostMsg_ResourceTypeStats, OnResourceTypeStats) @@ -773,13 +771,6 @@ void RenderMessageFilter::OnCheckNotificationPermission( *result = notification_prefs_->HasPermission(source_url.GetOrigin()); } -void RenderMessageFilter::OnGetCPBrowsingContext(uint32* context) { - // Always allocate a new context when a plugin requests one, since it needs to - // be unique for that plugin instance. - *context = CPBrowsingContextManager::GetInstance()->Allocate( - request_context_->GetURLRequestContext()); -} - void RenderMessageFilter::OnAllocateSharedMemoryBuffer( uint32 buffer_size, base::SharedMemoryHandle* handle) { diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h index 2cb4547..2edcc53 100644 --- a/content/browser/renderer_host/render_message_filter.h +++ b/content/browser/renderer_host/render_message_filter.h @@ -186,9 +186,8 @@ class RenderMessageFilter : public BrowserMessageFilter, #endif void OnRevealFolderInOS(const FilePath& path); - void OnGetCPBrowsingContext(uint32* context); - // Used to ask the browser to allocate a block of shared memory for the +// Used to ask the browser to allocate a block of shared memory for the // renderer to send back data in, since shared memory can't be created // in the renderer on POSIX due to the sandbox. void OnAllocateSharedMemoryBuffer(uint32 buffer_size, diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index 07f2ceb..1ee71b1 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -589,15 +589,6 @@ void RenderViewHost::JavaScriptMessageBoxClosed(IPC::Message* reply_msg, delegate_->RendererUnresponsive(this, is_waiting); } -void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, - const std::string& json_retval) { - if (is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_) - StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); - - ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); - Send(reply_msg); -} - void RenderViewHost::CopyImageAt(int x, int y) { Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); } @@ -771,8 +762,6 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { OnMsgRunJavaScriptMessage) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, OnMsgRunBeforeUnloadConfirm) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ShowModalHTMLDialog, - OnMsgShowModalHTMLDialog) IPC_MESSAGE_HANDLER(ViewHostMsg_StartDragging, OnMsgStartDragging) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateDragCursor, OnUpdateDragCursor) IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) @@ -1236,13 +1225,6 @@ void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, delegate_->RunBeforeUnloadConfirm(message, reply_msg); } -void RenderViewHost::OnMsgShowModalHTMLDialog( - const GURL& url, int width, int height, const std::string& json_arguments, - IPC::Message* reply_msg) { - StopHangMonitorTimeout(); - delegate_->ShowModalHTMLDialog(url, width, height, json_arguments, reply_msg); -} - void RenderViewHost::MediaPlayerActionAt(const gfx::Point& location, const WebMediaPlayerAction& action) { // TODO(ajwong): Which thread should run this? Does it matter? diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h index bf36526..4c3f3f1 100644 --- a/content/browser/renderer_host/render_view_host.h +++ b/content/browser/renderer_host/render_view_host.h @@ -314,10 +314,6 @@ class RenderViewHost : public RenderWidgetHost { bool success, const std::wstring& prompt); - // Notifies the RenderView that the modal html dialog has been closed. - void ModalHTMLDialogClosed(IPC::Message* reply_msg, - const std::string& json_retval); - // Send an action to the media player element located at |location|. void MediaPlayerActionAt(const gfx::Point& location, const WebKit::WebMediaPlayerAction& action); @@ -605,9 +601,6 @@ class RenderViewHost : public RenderWidgetHost { void OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, const std::wstring& message, IPC::Message* reply_msg); - void OnMsgShowModalHTMLDialog(const GURL& url, int width, int height, - const std::string& json_arguments, - IPC::Message* reply_msg); void OnMsgStartDragging(const WebDropData& drop_data, WebKit::WebDragOperationsMask operations_allowed, const SkBitmap& image, diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index 888fecf..53fda27 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -518,10 +518,6 @@ class RenderViewHostDelegate : public IPC::Channel::Listener { virtual void RunBeforeUnloadConfirm(const std::wstring& message, IPC::Message* reply_msg) {} - virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, - const std::string& json_arguments, - IPC::Message* reply_msg) {} - // |url| is assigned to a server that can provide alternate error pages. If // the returned URL is empty, the default error page built into WebKit will // be used. diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc index c8c50ee..44ad9d2 100644 --- a/content/browser/renderer_host/resource_dispatcher_host.cc +++ b/content/browser/renderer_host/resource_dispatcher_host.cc @@ -362,7 +362,7 @@ void ResourceDispatcherHost::BeginRequest( int child_id = filter_->child_id(); ChromeURLRequestContext* context = filter_->GetURLRequestContext( - request_data); + request_data.resource_type); // Might need to resolve the blob references in the upload data. if (request_data.upload_data && context) { @@ -391,12 +391,6 @@ void ResourceDispatcherHost::BeginRequest( return; } - // Ensure the Chrome plugins are loaded, as they may intercept network - // requests. Does nothing if they are already loaded. - // TODO(mpcomplete): This takes 200 ms! Investigate parallelizing this by - // starting the load earlier in a BG thread. - PluginService::GetInstance()->LoadChromePlugins(this); - // Construct the event handler. scoped_refptr<ResourceHandler> handler; if (sync_result) { @@ -520,9 +514,7 @@ void ResourceDispatcherHost::BeginRequest( upload_size, false, // is download ResourceType::IsFrame(request_data.resource_type), // allow_download - request_data.has_user_gesture, - request_data.host_renderer_id, - request_data.host_render_view_id); + request_data.has_user_gesture); SetRequestInfo(request, extra_info); // Request takes ownership. chrome_browser_net::SetOriginPIDForRequest( request_data.origin_pid, request); @@ -649,9 +641,7 @@ ResourceDispatcherHost::CreateRequestInfoForBrowserRequest( 0, // upload_size download, // is_download download, // allow_download - false, // has_user_gesture - -1, // host renderer id - -1); // host render view id + false); // has_user_gesture } void ResourceDispatcherHost::OnClosePageACK( @@ -703,9 +693,6 @@ void ResourceDispatcherHost::BeginDownload( NewRunnableFunction(&download_util::NotifyDownloadInitiated, child_id, route_id)); - // Ensure the Chrome plugins are loaded, as they may intercept network - // requests. Does nothing if they are already loaded. - PluginService::GetInstance()->LoadChromePlugins(this); net::URLRequest* request = new net::URLRequest(url, this); request_id_--; @@ -756,10 +743,6 @@ void ResourceDispatcherHost::BeginSaveFile( if (is_shutdown_) return; - // Ensure the Chrome plugins are loaded, as they may intercept network - // requests. Does nothing if they are already loaded. - PluginService::GetInstance()->LoadChromePlugins(this); - scoped_refptr<ResourceHandler> handler( new SaveFileResourceHandler(child_id, route_id, diff --git a/content/browser/renderer_host/resource_dispatcher_host_request_info.cc b/content/browser/renderer_host/resource_dispatcher_host_request_info.cc index 14ff524..a88a13d 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_request_info.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_request_info.cc @@ -19,9 +19,7 @@ ResourceDispatcherHostRequestInfo::ResourceDispatcherHostRequestInfo( uint64 upload_size, bool is_download, bool allow_download, - bool has_user_gesture, - int host_renderer_id, - int host_render_view_id) + bool has_user_gesture) : resource_handler_(handler), cross_site_handler_(NULL), process_type_(process_type), @@ -42,9 +40,7 @@ ResourceDispatcherHostRequestInfo::ResourceDispatcherHostRequestInfo( is_paused_(false), called_on_response_started_(false), has_started_reading_(false), - paused_read_bytes_(0), - host_renderer_id_(host_renderer_id), - host_render_view_id_(host_render_view_id) { + paused_read_bytes_(0) { } ResourceDispatcherHostRequestInfo::~ResourceDispatcherHostRequestInfo() { diff --git a/content/browser/renderer_host/resource_dispatcher_host_request_info.h b/content/browser/renderer_host/resource_dispatcher_host_request_info.h index 13b6fa2..c89acdd 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_request_info.h +++ b/content/browser/renderer_host/resource_dispatcher_host_request_info.h @@ -40,9 +40,7 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData { uint64 upload_size, bool is_download, bool allow_download, - bool has_user_gesture, - int host_renderer_id, - int host_render_view_id); + bool has_user_gesture); virtual ~ResourceDispatcherHostRequestInfo(); // Top-level ResourceHandler servicing this request. @@ -145,9 +143,6 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData { int memory_cost() const { return memory_cost_; } void set_memory_cost(int cost) { memory_cost_ = cost; } - int host_renderer_id() const { return host_renderer_id_; } - int host_render_view_id() const { return host_render_view_id_; } - // We hold a reference to the requested blob data to ensure it doesn't // get finally released prior to the net::URLRequestJob being started. webkit_blob::BlobData* requested_blob_data() const { @@ -216,14 +211,6 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData { bool has_started_reading_; int paused_read_bytes_; - // The following two members are specified if the request is initiated by - // a plugin like Gears. - - // Contains the id of the host renderer. - int host_renderer_id_; - // Contains the id of the host render view. - int host_render_view_id_; - DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostRequestInfo); }; diff --git a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc index d3dc00e..e765536 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc @@ -7,7 +7,6 @@ #include "base/file_path.h" #include "base/message_loop.h" #include "base/process_util.h" -#include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" #include "content/browser/browser_thread.h" @@ -76,8 +75,6 @@ static ResourceHostMsg_Request CreateResourceRequest( request.request_context = 0; request.appcache_host_id = appcache::kNoHostId; request.download_to_file = false; - request.host_renderer_id = -1; - request.host_render_view_id = -1; return request; } @@ -193,10 +190,6 @@ class ResourceDispatcherHostTest : public testing::Test, ChildProcessSecurityPolicy::GetInstance()->Remove(0); - // The plugin lib is automatically loaded during these test - // and we want a clean environment for other tests. - ChromePluginLib::UnloadAllPlugins(); - // Flush the message loop to make Purify happy. message_loop_.RunAllPending(); } diff --git a/content/browser/renderer_host/resource_message_filter.cc b/content/browser/renderer_host/resource_message_filter.cc index 3988776..a4b4b8a 100644 --- a/content/browser/renderer_host/resource_message_filter.cc +++ b/content/browser/renderer_host/resource_message_filter.cc @@ -36,10 +36,10 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& message, } ChromeURLRequestContext* ResourceMessageFilter::GetURLRequestContext( - const ResourceHostMsg_Request& resource_request) { + ResourceType::Type type) { net::URLRequestContext* rv = NULL; if (url_request_context_override_.get()) - rv = url_request_context_override_->GetRequestContext(resource_request); + rv = url_request_context_override_->GetRequestContext(type); if (!rv) { URLRequestContextGetter* context_getter = diff --git a/content/browser/renderer_host/resource_message_filter.h b/content/browser/renderer_host/resource_message_filter.h index e3a6833..6fc8fe0 100644 --- a/content/browser/renderer_host/resource_message_filter.h +++ b/content/browser/renderer_host/resource_message_filter.h @@ -8,10 +8,10 @@ #include "base/scoped_ptr.h" #include "content/browser/browser_message_filter.h" #include "content/common/child_process_info.h" +#include "webkit/glue/resource_type.h" class ChromeURLRequestContext; class ResourceDispatcherHost; -struct ResourceHostMsg_Request; namespace net { class URLRequestContext; @@ -31,7 +31,7 @@ class ResourceMessageFilter : public BrowserMessageFilter { URLRequestContextOverride() {} virtual net::URLRequestContext* GetRequestContext( - const ResourceHostMsg_Request& resource_request) = 0; + ResourceType::Type request_type) = 0; protected: friend class base::RefCountedThreadSafe<URLRequestContextOverride>; @@ -51,7 +51,7 @@ class ResourceMessageFilter : public BrowserMessageFilter { // Returns the net::URLRequestContext for the given request. ChromeURLRequestContext* GetURLRequestContext( - const ResourceHostMsg_Request& resource_request); + ResourceType::Type request_type); void set_url_request_context_override(URLRequestContextOverride* u) { url_request_context_override_ = u; diff --git a/content/browser/renderer_host/resource_queue_unittest.cc b/content/browser/renderer_host/resource_queue_unittest.cc index ef6ed83..62d7b97 100644 --- a/content/browser/renderer_host/resource_queue_unittest.cc +++ b/content/browser/renderer_host/resource_queue_unittest.cc @@ -75,7 +75,7 @@ class DummyResourceHandler : public ResourceHandler { ResourceDispatcherHostRequestInfo* GetRequestInfo(int request_id) { return new ResourceDispatcherHostRequestInfo( new DummyResourceHandler(), ChildProcessInfo::RENDER_PROCESS, 0, 0, - request_id, ResourceType::MAIN_FRAME, 0, false, false, false, -1, -1); + request_id, ResourceType::MAIN_FRAME, 0, false, false, false); } void InitializeQueue(ResourceQueue* queue, ResourceQueueDelegate* delegate) { diff --git a/content/browser/renderer_host/socket_stream_dispatcher_host.cc b/content/browser/renderer_host/socket_stream_dispatcher_host.cc index ce6c855..c1e6ad4 100644 --- a/content/browser/renderer_host/socket_stream_dispatcher_host.cc +++ b/content/browser/renderer_host/socket_stream_dispatcher_host.cc @@ -7,7 +7,6 @@ #include "base/logging.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/net/url_request_context_getter.h" -#include "chrome/common/render_messages_params.h" #include "content/browser/renderer_host/socket_stream_host.h" #include "content/common/socket_stream.h" #include "content/common/socket_stream_messages.h" @@ -151,12 +150,8 @@ void SocketStreamDispatcherHost::DeleteSocketStreamHost(int socket_id) { net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { net::URLRequestContext* rv = NULL; if (url_request_context_override_.get()) { - // TODO(jam): temporary code until Gears is taken out, then - // GetRequestContext will take a different parameter and we can take out - // this struct and the #include "chrome/common/render_messages_params.h" - // above. - ResourceHostMsg_Request request; - rv = url_request_context_override_->GetRequestContext(request); + rv = url_request_context_override_->GetRequestContext( + ResourceType::SUB_RESOURCE); } if (!rv) { URLRequestContextGetter* context_getter = diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 2def379..220e769 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -75,7 +75,6 @@ #include "content/browser/child_process_security_policy.h" #include "content/browser/host_zoom_map.h" #include "content/browser/in_process_webkit/session_storage_namespace.h" -#include "content/browser/modal_html_dialog_delegate.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" @@ -2458,17 +2457,6 @@ void TabContents::RunBeforeUnloadConfirm(const std::wstring& message, RunBeforeUnloadDialog(this, message, reply_msg); } -void TabContents::ShowModalHTMLDialog(const GURL& url, int width, int height, - const std::string& json_arguments, - IPC::Message* reply_msg) { - if (delegate()) { - HtmlDialogUIDelegate* dialog_delegate = - new ModalHtmlDialogDelegate(url, width, height, json_arguments, - reply_msg, this); - delegate()->ShowHtmlDialog(dialog_delegate, NULL); - } -} - GURL TabContents::GetAlternateErrorPageURL() const { GURL url; // Disable alternate error pages when in OffTheRecord/Incognito mode. diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index e751d6f..6bea156 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -955,9 +955,6 @@ class TabContents : public PageNavigator, bool* did_suppress_message); virtual void RunBeforeUnloadConfirm(const std::wstring& message, IPC::Message* reply_msg); - virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, - const std::string& json_arguments, - IPC::Message* reply_msg); virtual GURL GetAlternateErrorPageURL() const; virtual RendererPreferences GetRendererPrefs(Profile* profile) const; virtual WebPreferences GetWebkitPrefs(); diff --git a/content/browser/webui/web_ui_factory.cc b/content/browser/webui/web_ui_factory.cc index 350d403..248de09 100644 --- a/content/browser/webui/web_ui_factory.cc +++ b/content/browser/webui/web_ui_factory.cc @@ -95,10 +95,6 @@ WebUI* NewWebUI<ExtensionWebUI>(TabContents* contents, const GURL& url) { // when invoked for a particular tab - see NewWebUI<ExtensionWebUI>. static WebUIFactoryFunction GetWebUIFactoryFunction(Profile* profile, const GURL& url) { - // Currently, any gears: URL means an HTML dialog. - if (url.SchemeIs(chrome::kGearsScheme)) - return &NewWebUI<HtmlDialogUI>; - if (url.host() == chrome::kChromeUIDialogHost || url.host() == chrome::kChromeUICollectedCookiesHost) { return &NewWebUI<ConstrainedHtmlUI>; @@ -115,7 +111,7 @@ static WebUIFactoryFunction GetWebUIFactoryFunction(Profile* profile, return &NewWebUI<ExternalHtmlDialogUI>; // This will get called a lot to check all URLs, so do a quick check of other - // schemes (gears was handled above) to filter out most URLs. + // schemes to filter out most URLs. if (!url.SchemeIs(chrome::kChromeDevToolsScheme) && !url.SchemeIs(chrome::kChromeInternalScheme) && !url.SchemeIs(chrome::kChromeUIScheme)) diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc index 8e80144..76e48a2 100644 --- a/content/browser/worker_host/worker_process_host.cc +++ b/content/browser/worker_host/worker_process_host.cc @@ -39,6 +39,7 @@ #include "net/base/mime_util.h" #include "ipc/ipc_switches.h" #include "net/base/registry_controlled_domain.h" +#include "webkit/glue/resource_type.h" #include "webkit/fileapi/file_system_path_manager.h" namespace { @@ -55,7 +56,7 @@ class URLRequestContextOverride virtual ~URLRequestContextOverride() {} virtual net::URLRequestContext* GetRequestContext( - const ResourceHostMsg_Request& resource_request) { + ResourceType::Type resource_type) { return url_request_context_; } diff --git a/content/common/child_thread.cc b/content/common/child_thread.cc index f2410e2..33c4496 100644 --- a/content/common/child_thread.cc +++ b/content/common/child_thread.cc @@ -119,11 +119,8 @@ IPC::Channel::Listener* ChildThread::ResolveRoute(int32 routing_id) { } webkit_glue::ResourceLoaderBridge* ChildThread::CreateBridge( - const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, - int host_renderer_id, - int host_render_view_id) { - return resource_dispatcher()-> - CreateBridge(request_info, host_renderer_id, host_render_view_id); + const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { + return resource_dispatcher()->CreateBridge(request_info); } ResourceDispatcher* ChildThread::resource_dispatcher() { diff --git a/content/common/child_thread.h b/content/common/child_thread.h index b4b07d3..33488fe 100644 --- a/content/common/child_thread.h +++ b/content/common/child_thread.h @@ -44,9 +44,7 @@ class ChildThread : public IPC::Channel::Listener, // Creates a ResourceLoaderBridge. // Tests can override this method if they want a custom loading behavior. virtual webkit_glue::ResourceLoaderBridge* CreateBridge( - const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, - int host_renderer_id, - int host_render_view_id); + const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); ResourceDispatcher* resource_dispatcher(); diff --git a/content/common/resource_dispatcher.cc b/content/common/resource_dispatcher.cc index d6c21c9..7542551 100644 --- a/content/common/resource_dispatcher.cc +++ b/content/common/resource_dispatcher.cc @@ -36,9 +36,7 @@ namespace webkit_glue { class IPCResourceLoaderBridge : public ResourceLoaderBridge { public: IPCResourceLoaderBridge(ResourceDispatcher* dispatcher, - const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, - int host_renderer_id, - int host_render_view_id); + const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); virtual ~IPCResourceLoaderBridge(); // ResourceLoaderBridge @@ -71,28 +69,15 @@ class IPCResourceLoaderBridge : public ResourceLoaderBridge { // The routing id used when sending IPC messages. int routing_id_; - - // The following two members are specified if the request is initiated by - // a plugin like Gears. - - // Contains the id of the host renderer. - int host_renderer_id_; - - // Contains the id of the host render view. - int host_render_view_id_; }; IPCResourceLoaderBridge::IPCResourceLoaderBridge( ResourceDispatcher* dispatcher, - const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, - int host_renderer_id, - int host_render_view_id) + const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) : peer_(NULL), dispatcher_(dispatcher), request_id_(-1), - routing_id_(request_info.routing_id), - host_renderer_id_(host_renderer_id), - host_render_view_id_(host_render_view_id) { + routing_id_(request_info.routing_id) { DCHECK(dispatcher_) << "no resource dispatcher"; request_.method = request_info.method; request_.url = request_info.url; @@ -106,8 +91,6 @@ IPCResourceLoaderBridge::IPCResourceLoaderBridge( request_.appcache_host_id = request_info.appcache_host_id; request_.download_to_file = request_info.download_to_file; request_.has_user_gesture = request_info.has_user_gesture; - request_.host_renderer_id = host_renderer_id_; - request_.host_render_view_id = host_render_view_id_; } IPCResourceLoaderBridge::~IPCResourceLoaderBridge() { @@ -554,12 +537,8 @@ void ResourceDispatcher::FlushDeferredMessages(int request_id) { } webkit_glue::ResourceLoaderBridge* ResourceDispatcher::CreateBridge( - const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, - int host_renderer_id, - int host_render_view_id) { - return new webkit_glue::IPCResourceLoaderBridge(this, request_info, - host_renderer_id, - host_render_view_id); + const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { + return new webkit_glue::IPCResourceLoaderBridge(this, request_info); } bool ResourceDispatcher::IsResourceDispatcherMessage( diff --git a/content/common/resource_dispatcher.h b/content/common/resource_dispatcher.h index 754446d..4f5c215 100644 --- a/content/common/resource_dispatcher.h +++ b/content/common/resource_dispatcher.h @@ -53,9 +53,7 @@ class ResourceDispatcher : public IPC::Channel::Listener { // this can be tested regardless of the ResourceLoaderBridge::Create // implementation. webkit_glue::ResourceLoaderBridge* CreateBridge( - const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, - int host_renderer_id, - int host_render_view_id); + const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); // Adds a request from the pending_requests_ list, returning the new // requests' ID diff --git a/content/common/resource_dispatcher_dummy.cc b/content/common/resource_dispatcher_dummy.cc index e87101e..5998027 100644 --- a/content/common/resource_dispatcher_dummy.cc +++ b/content/common/resource_dispatcher_dummy.cc @@ -25,9 +25,7 @@ bool ResourceDispatcher::OnMessageReceived(const IPC::Message& message) { } webkit_glue::ResourceLoaderBridge* ResourceDispatcher::CreateBridge( - const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, - int host_renderer_id, - int host_render_view_id) { + const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { // This function is used only by plugin and renderer code, so it should // never be called in a 64-bit Windows process. NOTREACHED(); diff --git a/content/common/resource_dispatcher_unittest.cc b/content/common/resource_dispatcher_unittest.cc index 9633cf0..659537e 100644 --- a/content/common/resource_dispatcher_unittest.cc +++ b/content/common/resource_dispatcher_unittest.cc @@ -160,7 +160,7 @@ class ResourceDispatcherTest : public testing::Test, request_info.appcache_host_id = appcache::kNoHostId; request_info.routing_id = 0; - return dispatcher_->CreateBridge(request_info, -1, -1); + return dispatcher_->CreateBridge(request_info); } std::vector<IPC::Message> message_queue_; diff --git a/content/common/resource_messages.h b/content/common/resource_messages.h index 73b9f8a..f46abe0 100644 --- a/content/common/resource_messages.h +++ b/content/common/resource_messages.h @@ -95,15 +95,6 @@ IPC_STRUCT_BEGIN(ResourceHostMsg_Request) // True if the request was user initiated. IPC_STRUCT_MEMBER(bool, has_user_gesture) - - // The following two members are specified if the request is initiated by - // a plugin like Gears. - - // Contains the id of the host renderer. - IPC_STRUCT_MEMBER(int, host_renderer_id) - - // Contains the id of the host render view. - IPC_STRUCT_MEMBER(int, host_render_view_id) IPC_STRUCT_END() // Resource messages sent from the browser to the renderer. diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 133bea4..028573a 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -160,8 +160,6 @@ 'browser/in_process_webkit/webkit_thread.h', 'browser/mime_registry_message_filter.cc', 'browser/mime_registry_message_filter.h', - 'browser/modal_html_dialog_delegate.cc', - 'browser/modal_html_dialog_delegate.h', 'browser/ppapi_plugin_process_host.cc', 'browser/ppapi_plugin_process_host.h', 'browser/plugin_process_host.cc', diff --git a/gears/DEPS b/gears/DEPS deleted file mode 100644 index ebbd96d..0000000 --- a/gears/DEPS +++ /dev/null @@ -1,28 +0,0 @@ -# We pull 3 components from the Chrome tree at the trunk. -chrome_rev = '' - -# We pull 2 components from the Gears tree at this revision. -gears_rev = '@3147' - -deps = { - "src/build": - "svn://chrome-svn.corp.google.com/chrome/trunk/src/build" + chrome_rev, - - "src/site_scons": - "svn://chrome-svn.corp.google.com/chrome/trunk/src/site_scons" + chrome_rev, - - "src/third_party/scons": - "svn://chrome-svn.corp.google.com/chrome/trunk/src/third_party/scons" + chrome_rev, - - "src/gears/gears": - "http://gears.googlecode.com/svn/trunk/gears" + gears_rev, - - "src/gears/third_party": - "http://gears.googlecode.com/svn/trunk/third_party" + gears_rev, -} - -# checkdeps.py shouldn't check include paths for files in these dirs: -skip_child_includes = [ - "gears", - "third_party", -] diff --git a/gears/README.chromium b/gears/README.chromium deleted file mode 100644 index eb1152c..0000000 --- a/gears/README.chromium +++ /dev/null @@ -1 +0,0 @@ -The binaries in this directory were an official build for chrome diff --git a/gears/SConscript b/gears/SConscript deleted file mode 100644 index 3d16d3e..0000000 --- a/gears/SConscript +++ /dev/null @@ -1,992 +0,0 @@ -# Copyright (c) 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. - -# Notes: -# This is the main Gears SConscript file. From here, we include sub-scripts -# that handle building various targets (third party libs, common exes, the -# browser plugins themselves, and installers). Some sub-scripts return a -# dictionary of variables to be appended to the environment, so other -# sub-scripts can use them. -# -# To check out the Gears sources, you need to make sure this directory is in -# your .gclient file, so its DEPS get processed. Example: -# { "name" : "src/gears", -# "url" : "svn://chrome-svn/chrome/trunk/src/gears", -# }, -# -# This is a work-in-progress conversion of the current Gears set of Makefiles. -# A lot of the stuff doesn't translate to SCons-land well, and I'm not sure -# how faithful we want to be to the original. -# -# Questions: -# Should we flatten the output directory into -# Hammer/gears/platform/browser/*.obj like Gears does now? If so, how? - -# Notes to self: -# - os.path.abspath('.') (the CWD) is variant_dir if it exists, else it's the -# toplevel_dir (which contains the SConstruct). -# - env.Entry('.') is the entry representing the variant_dir. -# - env.Entry('#') is the entry representing the toplevel_dir. -# - str(entry) gives the path relative to variant_dir, or abspath if the entry -# is outside the variant_dir. -# - entry.path gives the path relative to toplevel_dir. -# - entry.abspath gives the absolute path. - -import os - -Import('env') - -env = env.Clone( - OPEN_DIR = "gears", - PRIVATE_DIR = "gears_internal", - THIRD_PARTY_DIR = "third_party", - PRIVATE_THIRD_PARTY_DIR = "third_party_internal", -) - -if not os.path.exists(env.Dir('#/$OPEN_DIR').abspath): - print 'Skipping Gears build: no perforce tree checked out.' - Return() - -# Argument switches - -# TODO: how do we detect linux vs osx? -os_guess = env['PLATFORM'] -if os_guess == 'posix': - os_guess = 'linux' -elif os_guess == 'darwin': - os_guess = 'osx' - -# Map of OS -> valid browser targets for that OS. -os_browsers_map = { - 'win32': ['IE', 'FF2', 'FF3', 'NPAPI'], - 'wince': ['IE'], - 'linux': ['FF2', 'FF3'], - 'osx': ['SF', 'FF2', 'FF3'], - 'android': ['NPAPI'], - 'symbian': ['NPAPI'], -} - -vars = Variables(None, ARGUMENTS) -vars.AddVariables( - EnumVariable('OS', - 'Which OS is the target', os_guess, os_browsers_map.keys()), - EnumVariable('MODE', - 'Type of binary to generate', 'dbg', ['dbg', 'opt']), - BoolVariable('OFFICIAL_BUILD', - 'Create a binary suitable for public release', 0), - BoolVariable('GEARS_STATIC_LIB', - 'Create a static library for linking with Chrome', 0), -) -vars.Update(env) - -env['VALID_BROWSERS'] = os_browsers_map[env['OS']] - -# Add BROWSER last, since its valid inputs depend on $OS. -vars.Add( - EnumVariable('BROWSER', - 'Which browser we want to build the plugin for. "all" builds all ' - 'browsers for this OS.', - 'all', env['VALID_BROWSERS'] + ['all'])) -vars.Update(env) - -env.Replace( - USING_CCTESTS = (env['MODE'] == 'dbg' or not env['OFFICIAL_BUILD']) -) - -# Version -env.Replace( - MAJOR = '0', - MINOR = '5', - BUILD = '7', - PATCH = '0', - VERSION = '${MAJOR}.${MINOR}.${BUILD}.${PATCH}', - - FRIENDLY_NAME = 'Google Gears', - SHORT_NAME = 'gears', -) - -# Platform -# TODO: Symbian builds will override this value. -# For other platforms we set just one value. -if env['OS'] in ['wince', 'android']: - env.Replace(ARCH = 'arm') -elif env['OS'] == 'osx': - # On OSX we build a fat binary. - env.Replace(ARCH = 'i386+ppc') -else: - env.Replace(ARCH = 'i386') - -# Output dirs -env.Replace( - BASE_OUTDIR = '$GEARS_DIR/$OS-$ARCH-$MODE', - COMMON_OUTDIR = '$BASE_OUTDIR/common', - BROWSER_OUTDIR = '$BASE_OUTDIR/${BROWSER.lower()}', - IE_OUTDIR = '$BASE_OUTDIR/ie', - FF2_OUTDIR = '$BASE_OUTDIR/ff2', - FF3_OUTDIR = '$BASE_OUTDIR/ff3', - NPAPI_OUTDIR = '$BASE_OUTDIR/npapi', - SF_OUTDIR = '$BASE_OUTDIR/sf', - - GENFILES_DIR = "$BROWSER_OUTDIR/genfiles", - COMMON_GENFILES_DIR = "$COMMON_OUTDIR/genfiles", - - INSTALLER_OUTDIR = '$BASE_OUTDIR/installers', -) - -# Outputs -env.Replace( - INSTALLER_BASENAME = 'gears-${OS}-${MODE}-${VERSION}', - - FF_XPI = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.xpi', - WIN32_INSTALLER_MSI = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.msi', - WINCE_INSTALLER_CAB = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.cab', - # Keyston SF Metapackage installer, bundled with Keystone as part of a - # DMG. - SF_KEYSTONE_INSTALLER_DMG = '$INSTALLER_OUTDIR/${INSTALLER_BASENAME}.dmg', - SF_KEYSTONE_INSTALLER_MPKG = '$INSTALLER_OUTDIR/Safari/${FRIENDLY_NAME}.mpkg', - - SF_INSTALLER_PLUGIN_BUNDLE = '$INSTALLER_OUTDIR/Safari/StatsPane.bundle', - SF_PLUGIN_BUNDLE = '$INSTALLER_OUTDIR/Safari/Gears.bundle', - SF_PLUGIN_PROXY_BUNDLE = '$INSTALLER_OUTDIR/Safari/Gears.plugin', - SF_INPUTMANAGER_BUNDLE = '$INSTALLER_OUTDIR/Safari/GearsEnabler', - SF_INSTALLER_PKG = '$INSTALLER_OUTDIR/Safari/Gears.pkg', -) - -# Library flags -env.Replace( - MOZJS_INCLUDE_PATHS = [ - '$MOZJS_DIR', - '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include', - '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include/private', - '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include/obsolete', - '$OSX_SDK_ROOT/Developer/Headers/FlatCarbon/', - ], - MOZJS_DIR = '$THIRD_PARTY_DIR/spidermonkey', -) - -# Add our tools to the PATH. -if env['OS'] in ['win32', 'wince']: - if os.path.exists(env.Dir('#/$PRIVATE_THIRD_PARTY_DIR').abspath): - # Clear out our environment so we don't accidentally use the system's - # libs. - env['ENV']['PATH'] = '' - env['ENV']['LIB'] = '' - env['ENV']['INCLUDE'] = '' - - paths = [] - - # Keep system32 for 'xcopy'. - paths += [env.subst('${ENV["SYSTEMROOT"]}/system32')] - if env['OS'] == 'win32': - env.Append( - VC80 = env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/vc_80/files').abspath) - paths += [ - env.subst('$VC80/common7/ide'), - env.subst('$VC80/vc/bin'), - env.subst('$VC80/common7/tools'), - env.subst('$VC80/common7/tools/bin'), - env.subst('$VC80/team_tools/performance_tools'), - ] - else: # wince - env.Append( - VC80 = env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/vc_80ce/files').abspath) - paths += [ - env.subst('$VC80/bin/x86_arm'), - env.subst('$VC80/common7/ide'), - env.subst('$VC80/common7/tools'), - env.subst('$VC80/common7/tools/bin'), - env.subst('$VC80/vc/bin'), - env.subst('$VC80/smartdevices/sdktools'), - ] - - paths += [ - env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/wix/v3_0_2925/files').abspath] - - paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/gnu/files').abspath] - paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/python_24').abspath] - - # Prepend them so our tools come first. - for each in reversed(paths): - env.PrependENVPath('PATH', each) - else: - # If we don't have a private third_party dir, we expect the system - # environment to be set up correctly to point to tool paths. - env['ENV']['PATH'] = os.environ['PATH'] - env['ENV']['LIB'] = os.environ['LIB'] - env['ENV']['INCLUDE'] = os.environ['INCLUDE'] - - mtcom = 'echo Manifest creation disabled, since it breaks a lot.' - env['MANIFEST_COM'] = mtcom - env['SHMANIFEST_COM'] = mtcom - -# Building M4 files -env.Tool('m4') - -env.Append( - M4ARCH = (env['ARCH'] == 'i386' and 'x86' or '$ARCH'), - M4FLAGS = [ - '--prefix-builtins', - '-DPRODUCT_VERSION=$VERSION', - '-DPRODUCT_VERSION_MAJOR=$MAJOR', - '-DPRODUCT_VERSION_MINOR=$MINOR', - '-DPRODUCT_VERSION_BUILD=$BUILD', - '-DPRODUCT_VERSION_PATCH=$PATCH', - '-DPRODUCT_OS=$OS', - '-DPRODUCT_ARCH="$M4ARCH"', - '-DPRODUCT_GCC_VERSION="gcc3"', - '-DPRODUCT_MAINTAINER="google"', - '-DPRODUCT_FRIENDLY_NAME_UQ="$FRIENDLY_NAME"', - '-DPRODUCT_SHORT_NAME_UQ="$SHORT_NAME"', - '-DI18N_LANGUAGES="(${",".join(I18N_LANGS)})"', - ], - M4PATH = [ - '$OPEN_DIR', - '.', - ], -) - -# SCons magic to make M4PATH work. -env.Replace( - M4INCPREFIX = '-I', - M4INCSUFFIX = '', - _M4INCFLAGS = ('${_concat(M4INCPREFIX, M4PATH, M4INCSUFFIX, ' - '__env__, RDirs, TARGET, SOURCE)}'), - M4COM = '$M4 $M4FLAGS ${_M4INCFLAGS} $SOURCE > $TARGET', -) - -# TODO: Dependency scanner for m4 files - doesn't work. It can't detect files -# that don't exist! -#m4_include_re = re.compile(r'm4_include\((.*)\)', re.M) -#def m4_scan(node, env, path): -# contents = node.get_contents() -# includes = m4_include_re.findall(contents) -# ret_includes = [] -# for include in includes: -# for dir in path: -# file = os.path.join(dir, include) -# if os.path.exists(file): -# ret_includes.append(file) -# break -# return ret_includes -# -#m4_scanner = Scanner(function = m4_scan, skeys = ['.m4', '.html_m4']) -#env.Append(SCANNERS = m4_scanner) - - -# OS X Iceberg package builder - -env.Replace(ICEBERG = '/usr/local/bin/freeze') -if env.WhereIs('$ICEBERG'): - env.Replace(ICEBERGCOM = '"$ICEBERG" -v $SOURCE') -else: - env.Replace(ICEBERGCOM = - 'echo To create a Safari installer for Gears, you must install Iceberg' - ' from http://s.sudre.free.fr/Software/Iceberg.html. You can install' - ' the Safari version manually by running the' - ' $OPEN_DIR/tools/osx/install_gears.sh script.') - -iceberg_builder = Builder(action = '$ICEBERGCOM', - suffix = '.pkg', src_suffix = '.packproj') -env.Append(BUILDERS = {'Iceberg': iceberg_builder}) - - -# C++ build flags. - -# Clear out the inherited defines from Chrome's build. I want to match Gears' -# current build as closely as possible until we switch everyone to SCons, then -# gradually integrate. -env.Replace( - CPPPATH = [ - '$OPEN_DIR', - '$OPEN_DIR/..', - '$THIRD_PARTY_DIR', - '$THIRD_PARTY_DIR/googleurl', - '$THIRD_PARTY_DIR/npapi', - '$THIRD_PARTY_DIR/zlib', - '$THIRD_PARTY_DIR/v8/bindings_local', - '.', - '$COMMON_OUTDIR', - ], - CFLAGS = [], - CCFLAGS = [], - CXXFLAGS = [], - CCPDBFLAGS = [], - CPPDEFINES = [ - # SpiderMonkey (the Firefox JS engine)'s JS_GET_CLASS macro in jsapi.h needs - # this defined to work with the gecko SDK that we've built. - # The definition of JS_THREADSAFE must be kept in sync with MOZJS_CPPFLAGS. - 'JS_THREADSAFE' - ], - FRAMEWORKPATH = [], - FRAMEWORKS = [], - LIBS = [], - LIBPATH = ['$COMPONENT_LIBRARY_DIR'], - COMMON_LINKFLAGS = [], # for both executables and shared libs - LINKFLAGS = ['$COMMON_LINKFLAGS'], # for executables - SHLINKFLAGS = ['$COMMON_LINKFLAGS'], # for shared libs - COMPONENT_LIBRARY_DIR = '$COMMON_OUTDIR/lib', -) - -if env['MODE'] == 'dbg': - env.Append( - CPPDEFINES = [ - 'DEBUG=1', - '_DEBUG=1', - ], - M4FLAGS = '-DDEBUG=1', - ) -else: - env.Append( - CPPDEFINES = 'NDEBUG=1', - M4FLAGS = '-DNDEBUG=1', - ) -if env['USING_CCTESTS']: - env.Append( - CPPDEFINES = 'USING_CCTESTS=1', - M4FLAGS = '-DUSING_CCTESTS=1', - ) -if env['OFFICIAL_BUILD']: - env.Append( - CPPDEFINES = 'OFFICIAL_BUILD=1', - M4FLAGS = '-DOFFICIAL_BUILD=1', - ) -if env['GEARS_STATIC_LIB']: - env.Append( - CPPDEFINES = 'GEARS_STATIC_LIB=1', - ) - -# TODO: if USING_LIBPNG -env.Append( - CPPDEFINES = [ - 'PNG_USER_CONFIG', - 'CHROME_PNG_WRITE_SUPPORT', - ] -) -if not env['GEARS_STATIC_LIB']: - # If we're not linking with Chrome, don't prefix all the symbols with - # webkit_. - env.Append(CPPDEFINES = ['GEARS_PNG_BUILD']) - - -# TODO: if USING_ZLIB -env.Append( - CPPDEFINES = [ - 'NO_GZIP', - 'NO_GZCOMPRESS', - ] -) -if env['OS'] == 'wince': - env.Append(CPPDEFINES = 'NO_ERRNO_H') - -# Languages - -env['I18N_LANGS'] = [ - 'en-US', - 'ar', - 'bg', - 'ca', - 'cs', - 'da', - 'de', - 'el', - 'en-GB', - 'es', - 'et', - 'fa', - 'fi', - 'fil', - 'fr', - 'he', - 'hi', - 'hr', - 'hu', - 'id', - 'is', - 'it', - 'ja', - 'ko', - 'lt', - 'lv', - 'ms', - 'nl', - 'no', - 'pl', - 'pt-BR', - 'pt-PT', - 'ro', - 'ru', - 'sk', - 'sl', - 'sr', - 'sv', - 'th', - 'tr', - 'uk', - 'ur', - 'vi', - 'zh-CN', - 'zh-TW', - 'ml', - 'te', - 'gu', - 'kn', - 'or', - 'bn', - 'ta', - 'mr', -] - -# Platform-specific flags follow. - -if env['OS'] in ['win32', 'wince']: - env.Replace(ARFLAGS = []) - env.Append( - CPPDEFINES = [ - 'STRICT', - '_UNICODE', - 'UNICODE', - '_USRDLL', - 'WIN32', - '_WINDLL', - '_CRT_SECURE_NO_DEPRECATE', - 'NOMINMAX', - -# In VC8, the way to disable exceptions is to remove all /EH* flags, and to -# define _HAS_EXCEPTIONS=0 (for C++ headers) and _ATL_NO_EXCEPTIONS (for ATL). - '_HAS_EXCEPTIONS=0', - '_ATL_NO_EXCEPTIONS', -# Do not export UTF functions. - 'U_STATIC_IMPLEMENTATION', - ], -# Static lib flags. - ARFLAGS = [ - '/NOLOGO', - ], -# Shared lib and exe flags. - COMMON_LINKFLAGS = [ - '/NOLOGO', - '/DEBUG', - '/RELEASE', - '/PDB:${TARGET.base}.pdb', - ], - SHLINKFLAGS = [ - '/DLL', -# Set the preferred base address. This value was chosen because (a) it's near -# the top of the valid address range, and (b) it doesn't conflict with other -# DLLs loaded by Chrome in either the browser or plugin process. - '/BASE:0x65000000', - ], - CPPFLAGS = [ - '/nologo', - '/c', - '/W3', - '/WX', - '/GR-', - '/Fd"${TARGET.base}.pdb"', - ], - CXXFLAGS = [ - '/TP', - '/J', - ], - CPPPATH = [ - '$VC80_CPPPATH', - '$THIRD_PARTY_DIR/breakpad/src', - ], - CCPDBFLAGS = [ - '/Zi', # TODO: Chrome defines /Z7, no idea what these are. - ], - LIBPATH = [ - '$VC80_LIBPATH', - ], - ) - if env['OS'] == 'win32': - env.Append( - CPPDEFINES = [ -# We require APPVER=5.0 for things like HWND_MESSAGE. -# When APPVER=5.0, win32.mak in the Platform SDK sets: -# C defines: WINVER=0x0500 -# _WIN32_WINNT=0x0500 -# _WIN32_IE=0x0500 -# _RICHEDIT_VER=0x0010 -# RC defines: WINVER=0x0500 -# MIDL flags: /target NT50 -# Note: _WIN32_WINDOWS was replaced by _WIN32_WINNT for post-Win95 builds. -# Note: XP_WIN is only used by Firefox headers - '_WINDOWS', - 'WINVER=0x0500', - '_WIN32_WINNT=0x0500', - '_WIN32_IE=0x0500', - '_RICHEDIT_VER=0x0010', - '_MERGE_PROXYSTUB', - 'BREAKPAD_AVOID_STREAMS', - 'XP_WIN', - ], - ARFLAGS = [ - '/MACHINE:X86', - ], - COMMON_LINKFLAGS = [ - '/MACHINE:X86', - '/NODEFAULTLIB:msvcrt', -# Flags for security hardening (only available for win32, not wince). - '/DYNAMICBASE', - '/SAFESEH', - ], - SHLINKFLAGS = [ -# We only use /SUBSYSTEM on DLLs. For EXEs we omit the flag, and -# the presence of main() or WinMain() determines the subsystem. - '/SUBSYSTEM:WINDOWS', - ], - VC80_CPPPATH = [ -# TODO: switch over to Chrome's SDK. -# Note: these must come after $THIRD_PARTY_DIR/npapi because we want our own -# npapi.h to take precedence. - '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/include', - '$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/include', - '$PRIVATE_THIRD_PARTY_DIR/vc_80/files/vc/include', - ], - VC80_LIBPATH = [ - '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/lib', - '$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/lib', - '$PRIVATE_THIRD_PARTY_DIR/vc_80/files/vc/lib', - ], - ) - else: # OS=wince - env.Append( - CPPDEFINES = [ -# For Windows Mobile we need: -# C defines: _WIN32_WCE=0x0501 -# _UNDER_CE=0x0501 - '_WIN32_WCE=0x501', - 'WINVER=_WIN32_WCE', - 'UNDER_CE=0x501', - 'OS_WINCE', - 'WIN32_PLATFORM_PSPC', - 'ARM', - '_ARM_', - 'POCKETPC2003_UI_MODEL', - '_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA', - '_CE_CRT_ALLOW_WIN_MINMAX', - ], - ARFLAGS = [ - '/MACHINE:THUMB', - ], - COMMON_LINKFLAGS = [ - '/MACHINE:THUMB', - '/NODEFAULTLIB:secchk.lib', - '/NODEFAULTLIB:oldnames.lib', - ], - SHLINKFLAGS = [ - '/SUBSYSTEM:WINDOWSCE,5.01', - ], - VC80_CPPPATH = [ - '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80ce/files/include', - '$PRIVATE_THIRD_PARTY_DIR/vc_80ce/files/include', -# Visual Studio must be setup before the PocketPC SDK. - '$PRIVATE_THIRD_PARTY_DIR/pocketpc_sdk_ce_50/files/include/armv4i', - ], - VC80_LIBPATH = [ - '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80ce/files/lib/armv4i', - '$PRIVATE_THIRD_PARTY_DIR/vc_80ce/files/lib/armv4i', - '$PRIVATE_THIRD_PARTY_DIR/pocketpc_sdk_ce_50/files/lib/armv4i', - ], - ) - - if env['MODE'] == 'dbg': - env.Append( - CPPFLAGS = [ - '/MTd', - ], - ) - else: # MODE=opt - env.Append( - CPPFLAGS = [ - '/MT', - '/O2', - ], - COMMON_LINKFLAGS = [ - '/INCREMENTAL:NO', - '/OPT:REF', - '/OPT:ICF', - ], - ) - if not env['GEARS_STATIC_LIB']: - # Build with 2-byte wchar_t's only if we're building a DLL. To link with - # Chrome, we need 4-byte wchar_t. - env.Append( - CPPFLAGS = [ - '/Zc:wchar_t-', - ], - ) - -#--------------------------- LINUX --------------------------- -elif env['OS'] == 'linux': - env.Append( - CPPDEFINES = [ - 'LINUX', - ], - CPPPATH = [ - '$THIRD_PARTY_DIR/gtk/include/gtk-2.0', - '$THIRD_PARTY_DIR/gtk/include/atk-1.0', - '$THIRD_PARTY_DIR/gtk/include/glib-2.0', - '$THIRD_PARTY_DIR/gtk/include/pango-1.0', - '$THIRD_PARTY_DIR/gtk/include/cairo', - '$THIRD_PARTY_DIR/gtk/lib/gtk-2.0/include', - '$THIRD_PARTY_DIR/gtk/lib/glib-2.0/include', - ], - CCFLAGS = [ - '-fPIC', - '-fmessage-length=0', - '-Wall', - '-Werror', -# NS_LITERAL_STRING does not work properly without this compiler option - '-fshort-wchar', -# Additions to compile on hardy - '-Wno-unused-variable', - '-Wno-missing-braces', - '-Wno-address', - '-m32', - ], - CXXFLAGS = [ - '-fno-exceptions', - '-fno-rtti', - '-Wno-non-virtual-dtor', - '-Wno-ctor-dtor-privacy', - '-funsigned-char', - '-Wno-char-subscripts', - ], - COMMON_LINKFLAGS = [ - '-fPIC', - '-Bsymbolic', - '-pthread', - ], - SHLINKFLAGS = [ - '-shared', - '-Wl,--version-script', - '-Wl,$OPEN_DIR/tools/xpcom-ld-script', -# Additions to compile on hardy - '-m32', - ], - ) - if env['MODE'] == 'dbg': - env.Append( - CPPFLAGS = [ - '-g', - '-O0', - ], - ) - else: # MODE=opt - env.Append( - CPPFLAGS = [ - '-O2', - ], - ) -#--------------------------- OSX --------------------------- -elif env['OS'] == 'osx': -# Gears uses the 10.4 SDK, so we need to build with g++-4.0. -# Chrome uses g++-4.2 so we override this here. - env['CC'] = 'gcc-4.0' - env['CXX'] = 'g++-4.0' -# Compile assembly files with the same command line as C files. - env['ASCOM'] = '$CCCOM' - - env.Append(OSX_SDK_ROOT = '/Developer/SDKs/MacOSX10.4u.sdk') - - env.Append( - CPPDEFINES = [ - 'OSX', - 'OS_MACOSX', -# for breakpad - 'USE_PROTECTED_ALLOCATIONS=1', - ], - CPPPATH = [ -# Breakpad assumes it is in the include path - '$THIRD_PARTY_DIR/breakpad_osx/src', - ], - CCFLAGS = [ - '-mmacosx-version-min=10.4', - ('-arch', 'ppc'), - ('-arch', 'i386'), - '-fPIC', - '-fmessage-length=0', -# TODO -# '-Wall', -# NS_LITERAL_STRING does not work properly without this compiler option - '-fshort-wchar', - '-fvisibility=hidden', -# Breakpad on OSX needs debug symbols to use the STABS format, rather than the -# default DWARF debug symbols format. Note that we enable gstabs for debug & -# opt; we strip them later in opt. - '-gstabs+', - ], - CXXFLAGS = [ - '-fvisibility-inlines-hidden', - '-fno-exceptions', - '-fno-rtti', - ('-Wall', - '-Wno-non-virtual-dtor', - '-Wno-ctor-dtor-privacy', - '-Wno-char-subscripts', -# When a function is deprecated in gcc, it stupidly warns about all functions -# and member functions that have the same name, regardless of signature. -# Example: Standard osx headers deprecate 'SetPort', which causes a warning for -# url_canon::Replacements::SetPort(). - '-Wno-deprecated-declarations', - ), - '-funsigned-char', - ('-include', env.File('#/$OPEN_DIR/base/safari/prefix_header.h').abspath), - ('-isysroot', '$OSX_SDK_ROOT') - ], - COMMON_LINKFLAGS = [ - '-mmacosx-version-min=10.4', - '-fPIC', - '-Bsymbolic', - ('-arch', 'ppc'), - ('-arch', 'i386'), - ('-isysroot', '$OSX_SDK_ROOT'), - '-Wl,-dead_strip', - ], - SHLINKFLAGS = [ - '-bundle', # DLLFLAGS - ], - FRAMEWORKS = [ - 'Carbon', - 'CoreServices', - 'Cocoa', - 'WebKit', - ], - M4FLAGS = [ - '-DGEARS_ENABLER_PATH="$SF_INPUTMANAGER_BUNDLE"', - '-DGEARS_PLUGIN_PATH="$SF_PLUGIN_PROXY_BUNDLE"', - '-DGEARS_INSTALLER_OUT_DIR="$INSTALLER_OUTDIR/Safari"', - - # Keystone - '-DKEYSTONE_BASE_DIR="$MAIN_DIR/$PRIVATE_THIRD_PARTY_DIR/googlemac/Releases/Keystone/"', - '-DGEARS_INSTALLER_PACKAGE="$SF_INSTALLER_PKG"', - '-DGEARS_GENFILES_DIR="$SF_OUTDIR/genfiles"', - '-DGEARS_TOOLS_DIR="$MAIN_DIR/$PRIVATE_DIR/tools"', - ], - ) - if env['MODE'] == 'dbg': - env.Append( - CPPFLAGS = [ - '-g', - '-O0', - ], - ) - else: # MODE=opt - env.Append( - CPPFLAGS = [ - '-O2', - ], - ) -#--------------------------- ANDROID --------------------------- -elif env['OS'] == 'android': - if not os.environ['ANDROID_BUILD_TOP']: - print ("Please set ANDROID_BUILD_TOP to the top" - " level of your Android source.") - Return() - - if not os.environ['ANDROID_TOOLCHAIN']: - print ("Cannot determine location of the target toolchain." - " Please set ANDROID_TOOLCHAIN manually.") - Return() - - env['ANDROID_BUILD_TOP'] = os.environ['ANDROID_BUILD_TOP'] - - # Figure out the cross-compile prefix by finding the *-gcc executable - # and taking the '*' as the prefix for the rest. - cross_prefix_command = os.popen( - r"ls %s/*-gcc | sed 's|\(.*/.*\-\)gcc|\1|g'" % - os.environ['ANDROID_TOOLCHAIN']) - cross_prefix = cross_prefix_command.read().strip() - if cross_prefix_command.close() != None: - Return() - - # Find the output directory. Assume the only target output directory. - product_out_command = os.popen("ls %s/out/target/product/*" % - os.environ['ANDROID_BUILD_TOP']) - product_out = product_out_command.read().strip() - if product_out_command.close() != None: - Return() - - env['CC'] = cross_prefix + 'gcc' - env['CXX'] = cross_prefix + 'g++' - - env.Append( - CPPPATH = [ - '$OPEN_DIR/base/android', - '$THIRD_PARTY_DIR/stlport/stlport', - '$THIRD_PARTY_DIR/stlport/stlport/stl', - '$THIRD_PARTY_DIR/stlport/stlport/stl/config', - '$THIRD_PARTY_DIR/spidermonkey/nspr/pr/include', - '$ANDROID_BUILD_TOP/include', - '$ANDROID_BUILD_TOP/include/nativehelper', - '$ANDROID_BUILD_TOP/system', - '$ANDROID_BUILD_TOP/system/bionic/include', - '$ANDROID_BUILD_TOP/system/bionic/arch-arm/include', - '$ANDROID_BUILD_TOP/system/kernel_headers', - '$ANDROID_BUILD_TOP/system/bionic/kernel/arch-arm', - '$ANDROID_BUILD_TOP/system/bionic/kernel/common', - '$ANDROID_BUILD_TOP/system/libm/include ', - '$ANDROID_BUILD_TOP/bionic', - '$ANDROID_BUILD_TOP/bionic/libc/include', - '$ANDROID_BUILD_TOP/bionic/libc/arch-arm', - '$ANDROID_BUILD_TOP/bionic/libc/arch-arm/include', - '$ANDROID_BUILD_TOP/bionic/libc/kernel/arch-arm', - '$ANDROID_BUILD_TOP/bionic/libc/kernel/common', - '$ANDROID_BUILD_TOP/bionic/libm/include', - '$ANDROID_BUILD_TOP/dalvik/libnativehelper/include', - '$ANDROID_BUILD_TOP/extlibs', - '$ANDROID_BUILD_TOP/extlibs/icu4c-3.8/common', - '$ANDROID_BUILD_TOP/extlibs/icu4c-3.8/i18n', - '$ANDROID_BUILD_TOP/extlibs/jpeg-6b', - '$ANDROID_BUILD_TOP/extlibs/sqlite', - '$ANDROID_BUILD_TOP/extlibs/zlib-1.2.3', - '$ANDROID_BUILD_TOP/external', - '$ANDROID_BUILD_TOP/external/icu4c/common', - '$ANDROID_BUILD_TOP/external/icu4c/i18n', - '$ANDROID_BUILD_TOP/external/jpeg', - '$ANDROID_BUILD_TOP/external/sqlite/dist', - '$ANDROID_BUILD_TOP/external/zlib', - '$ANDROID_BUILD_TOP/frameworks/base/include', - '$ANDROID_BUILD_TOP/system/core/include', - ], - CPPFLAGS = [ - '-g', - '-c', - '-fPIC', - '-fmessage-length=0', - '-Wall', - '-fvisibility=hidden', -# NS_LITERAL_STRING does not work properly without this compiler option - '-fshort-wchar', - '-funsigned-char', - '-march=armv5te', - '-mtune=xscale', - '-mthumb-interwork', - '-ffunction-sections', - '-fdata-sections', - '-fno-exceptions', - ], - CXXFLAGS = [ - '-fno-rtti', - '-fvisibility-inlines-hidden', - '-Wno-non-virtual-dtor', - '-Wno-ctor-dtor-privacy', - ], - CPPDEFINES = [ - 'OS_ANDROID', - 'ANDROID', - 'TARGET_OS=android', - 'BUILD_OSNAME=android', - 'OSNAME=android', - 'COMPILER_NAME=gcc', - '__SGI_STL_INTERNAL_PAIR_H', - '_CPP_UTILITY', - '_LITTLE_ENDIAN=1234', - '_BIG_ENDIAN=4321', - '_PDP_ENDIAN=3412', - '_BYTE_ORDER=_LITTLE_ENDIAN', - ], - COMMON_LINKFLAGS = [ - '-g', - '-fPIC', - '-Bsymbolic', - '-nostdlib', - ], - SHLINKFLAGS = [ - '-shared', - '-Wl,--gc-sections', - '-L$ANDROID_PRODUCT_OUT/system/lib', -# Workaround for the Android C library not implementing -# __aeabi_atexit, which is used to destruct static C++ objects. This -# causes all calls to be rewritten by the linker to -# __wrap___aeabi_atexit, which we then implement. - '-Wl,--wrap,__aeabi_atexit', - ], - ) - if env['MODE'] == 'dbg': - env.Append( - CPPFLAGS = [ - '-g', - '-O', - '-funwind-tables', - '-mapcs-frame', - ], - ) - else: # MODE=opt - env.Append( - CPPFLAGS = [ - '-O2', - '-mthumb', - '-fomit-frame-pointer', - ], - ) - -# Custom builder to work around a scons and/or hammer bug. ComponentLibrary -# tries to install the library to COMPONENT_LIBRARY_DIR, but since we overrode -# that value, scons gets confused. I'm not sure who is at fault here. -# See http://code.google.com/p/chromium/issues/detail?id=4177. -def GearsStaticLibrary(env, *args, **kw): - lib = env.ChromeLibrary(*args, **kw) - env.Install('$COMPONENT_LIBRARY_DIR', lib[0]) - return lib -env.AddMethod(GearsStaticLibrary) - -# Load all the components - -sconscripts = [ - 'SConscript.googleurl', - 'SConscript.libjpeg', - 'SConscript.libpng', - 'SConscript.libmozjs', - 'SConscript.sqlite', - 'SConscript.zlib', - 'SConscript.libbreakpad_osx', - 'SConscript.libgd', -] - -for each in sconscripts: - env.SConscript(each, - exports=['env'], - variant_dir='$COMMON_OUTDIR', - duplicate=0) - -# Order of execution is important here. Each sub-script adds to the -# environment, for use by later scripts. -env = env.SConscript('SConscript.inputs', exports=['env']) - -outputs = env.SConscript('SConscript.common', - exports=['env'], - variant_dir='$COMMON_OUTDIR', - duplicate=0) -env.Append(**outputs) - -browsers = [env['BROWSER']] -if browsers[0] == 'all': - browsers = env['VALID_BROWSERS'] -print 'Building:', browsers - -# We run the browser script once for each browser target we want to build. -# Each script adds variables to the environment in the form of -# '${BROWSER}_foo = bar' for use by the installers script. -for each in browsers: - env.Replace(BROWSER = each) - outputs = env.SConscript('SConscript.browser', - exports=['env'], - variant_dir='$BROWSER_OUTDIR', - duplicate=0) - browser_outputs = {} - for key, value in outputs.iteritems(): - browser_outputs[each + '_' + key] = value - env.Append(**browser_outputs) - -# Note: even though the installers write to $INSTALLER_OUTDIR, they need to -# read files from other dirs, so we give them a variant_dir at the toplevel. -env.SConscript('SConscript.installers', - exports=['env'], - variant_dir='$BASE_OUTDIR', - duplicate=0) - -env.Alias('gears-installers', 'gears') diff --git a/gears/SConscript.browser b/gears/SConscript.browser deleted file mode 100644 index c6b4d48..0000000 --- a/gears/SConscript.browser +++ /dev/null @@ -1,551 +0,0 @@ -# Copyright (c) 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. - -import os -import utils - -Import('env') - -env = env.Clone() - -# TODO: move all these builders out to site_scons or somesuch. - -# TODO: all the other ports, including third-party libs -# - SAFARI, android, symbian -# - breakpad[_osx] -# - glint -# - growl -# - spidermonkey -# - libspeex -# - libtremor -# TODO: other targets -# - installer (safari, android, ...) - -# Initialize our BROWSER_* input files. -env.InitBrowserInputs() - - -# Building .stab files, using M4FLAGS. - -env.Replace( - STAB = 'python $OPEN_DIR/tools/parse_stab.py', - I18N_INPUTS_BASEDIR = '$OPEN_DIR/ui/generated', - STABCOM = \ - '$STAB $M4FLAGS ${_M4INCFLAGS} $TARGET $SOURCE $I18N_INPUTS_BASEDIR', -) -stab_builder = Builder(action = '$STABCOM', src_suffix = '.stab') -env.Append(BUILDERS = {'Stab': stab_builder}) - - -# Building .idl files. -# This is a total mess. MIDL needs to be run from $OPEN_DIR because it's too -# stupid to apply its include paths to a relative path like "ui/ie/bla.idl" -# (it only looks in the current dir). So we have to jump through hoops to fix -# up our relative include paths and output files. -env.Tool('midl') - -if env['BROWSER'] == 'IE': - env.Replace( - SCONS_DIR = '..', # the scons dir relative to OPEN_DIR - IDLINCPREFIX = '/I$SCONS_DIR/', - IDLINCSUFFIX = '', - _IDLINCFLAGS = ('${_concat(IDLINCPREFIX, CPPPATH, IDLINCSUFFIX, ' - '__env__, RDirs, TARGET, SOURCE)}'), - IDLDEFPREFIX = '/D', - IDLDEFSUFFIX = '', - _IDLDEFFLAGS = ('${_defines(IDLDEFPREFIX, CPPDEFINES, ' - 'IDLDEFSUFFIX, __env__)}'), - MIDLCOM = ( - 'cd $OPEN_DIR && ' - '$MIDL ${_IDLDEFFLAGS} ${_IDLINCFLAGS} -env win32 -Oicf ' - '/tlb $SCONS_DIR/${TARGET.base}.tlb ' - '/h $SCONS_DIR/${TARGET.base}.h ' - '/iid $SCONS_DIR/${TARGET.base}_i.c ' - '/proxy $SCONS_DIR/${TARGET.base}_p.c ' - '/dlldata $SCONS_DIR/${TARGET.base}_data.c ' - '$SCONS_DIR/$SOURCE' - ), - ) -elif env['BROWSER'] in ['FF2', 'FF3']: - env.Replace( - GECKO_SDK = '$GECKO_BASE/$OS', - GECKO_BIN = '$GECKO_SDK/gecko_sdk/bin', - GECKO_LIB = '$GECKO_SDK/gecko_sdk/lib', - MIDLCOM = ( - 'xpidl -I $GECKO_SDK/gecko_sdk/idl -I $GECKO_BASE ' - '-m header -o ${TARGET.base} $SOURCE && ' - 'xpidl -I $GECKO_SDK/gecko_sdk/idl -I $GECKO_BASE ' - '-m typelib -o ${TARGET.base} $SOURCE' - ), - ) - if env['BROWSER'] == 'FF2': - env['GECKO_BASE'] = '$THIRD_PARTY_DIR/gecko_1.8' - else: - env['GECKO_BASE'] = '$THIRD_PARTY_DIR/gecko_1.9' - - env.PrependENVPath('PATH', env.Dir('#/$GECKO_BIN').abspath) - -def MyIdlEmitter(target, source, env): - """Produce the list of outputs generated by our IDL compiler. Outputs - differ depending on whether we're using xpidl (Firefox) or midl (IE).""" - base = os.path.splitext(str(target[0]))[0] - if 'xpidl' in env['MIDLCOM']: - # Firefox's IDL compiler only generates .h and .xpt files. - target = [base + '.h', base + '.xpt'] - else: - # MIDL generates the following. Depending on the IDL, a .tlb is - # generated, but since we can't know, we'll just ignore that. - target = [base + '.h', base + '_i.c', base + '_p.c', base + '_data.c'] - return (target, source) -# Copy the builder object so we don't overwrite everyone's -# emitter with ours. -import copy -env['BUILDERS']['TypeLibrary'] = copy.copy(env['BUILDERS']['TypeLibrary']) -env['BUILDERS']['TypeLibrary'].emitter = MyIdlEmitter - - -# Building .xpt files. - -if env['BROWSER'] in ['FF2', 'FF3']: - env.Replace( - XPTLINK = 'xpt_link', - XPTLINKCOM = '$XPTLINK $TARGET $SOURCES', - ) - xpt_builder = Builder(action = '$XPTLINKCOM', src_suffix = '.xpt') - env.Append(BUILDERS = {'XptLink': xpt_builder}) - - -# C++ defines - -env.Prepend( - CPPDEFINES = [ - 'BROWSER_${BROWSER}=1', - ], -) - -if env['BROWSER'] in ['FF2', 'FF3']: - - if env['OS'] == 'osx': - env.Prepend( - CPPDEFINES = [ - 'LINUX' - ] - ) - - env.Prepend( - CPPDEFINES = [ -# TODO(cprince): Update source files so we don't need this compatibility define? - 'BROWSER_FF=1', - 'MOZILLA_STRICT_API', -# SpiderMonkey (the Firefox JS engine)'s JS_GET_CLASS macro in jsapi.h needs -# this defined to work with the gecko SDK that we've built. -# The definition of JS_THREADSAFE must be kept in sync with MOZJS_CPPFLAGS. - 'JS_THREADSAFE', - ], - CPPPATH = [ - '$GECKO_BASE', - '$GECKO_SDK', - '$GECKO_SDK/gecko_sdk/include', - ], - ) -elif env['BROWSER'] == 'NPAPI' and env['OS'] == 'win32': - env.Prepend( - CPPDEFINES = [ - 'BROWSER_CHROME=1', - ], - ) -elif env['BROWSER'] == 'SF': - env.Replace( -# Enable breakpad for Safari on MacOSX. - USING_BREAKPAD_OSX = '1') - - env.Append( - CPPDEFINES = [ -# Remove these - During development, it was convenient to have these defined in -# the Safari port. Before release we want to clean this up, and replace these -# with a single BROWSER_SF symbol. -# We also want to consolidate the include paths, so we don't have to add these -# paths here. - 'BROWSER_NPAPI', - 'BROWSER_WEBKIT', - 'BROWSER_SAFARI' - ], - CCFLAGS = [ -# These flags are needed so that instead of exporting all symbols defined in -# the code, we just export those specifically marked, this reduces the output -# size. - '-fvisibility=hidden' - ], - CPPPATH = ['$THIRD_PARTY/spidermonkey/nspr/pr/include'] - ) - -env.Append( - LIBS = [ - 'googleurl-gears', - 'png-gears', - 'sqlite-gears', - 'zlib-gears', - ], -) - -if env['OS'] == 'osx': - env.Append( - LIBS = [ - 'mozjs-gears', - 'curl', - 'crypto', - 'leopard_support', - 'breakpad_osx-gears' - ], - LIBPATH = [ - '$OPEN_DIR/tools/osx' - ], - ) - -# Add in libraries for in-development APIs for non-official builds. -if not env['OFFICIAL_BUILD']: - env.Append(LIBS = [ - 'jpeg-gears', - 'gd', - ]) - - # Except on these platforms. - if env['OS'] == 'wince': - env.FilterOut(LIBS = [ - 'gd', - 'jpeg-gears', - ]) - -if env['OS'] == 'android': - env.Append(LIBS = [ - 'mozjs-gears', - ]) - env.FilterOut(LIBS = [ - 'googleurl-gears', - 'sqlite-gears', - 'png-gears', - 'zlib-gears', - 'jpeg-gears', - 'gd', - ]) - -if env['BROWSER'] == 'IE': - if env['OS'] == 'win32': - env.Append( - LIBS = [ - 'kernel32.lib', - 'user32.lib', - 'gdi32.lib', - 'uuid.lib', - 'sensapi.lib', - 'shlwapi.lib', - 'shell32.lib', - 'advapi32.lib', - 'wininet.lib', - 'comdlg32.lib', - 'user32.lib', - ], - ) - else: # OS=wince - env.Append( - LIBS = [ - 'wininet.lib', - 'ceshell.lib', - 'coredll.lib', - 'corelibc.lib', - 'ole32.lib', - 'oleaut32.lib', - 'uuid.lib', - 'commctrl.lib', - 'atlosapis.lib', - 'piedocvw.lib', - 'cellcore.lib', - 'htmlview.lib', - 'imaging.lib', - 'toolhelp.lib', - 'aygshell.lib', - 'iphlpapi.lib', - 'gpsapi.lib', - ], - ) -elif env['BROWSER'] in ['FF2', 'FF3']: - env.Append(LIBPATH = '$GECKO_LIB') - - if env['BROWSER'] == 'FF2': - env.Append(LIBS = '$FF2_LIBS') - else: - env.Append(LIBS = '$FF3_LIBS') - - if env['OS'] == 'win32': - env.Append( - LIBS = [ - 'xpcom', - 'xpcomglue_s', - 'nspr4.lib', - 'js3250.lib', - 'ole32.lib', - 'shell32.lib', - 'shlwapi.lib', - 'advapi32.lib', - 'wininet.lib', - 'comdlg32.lib', - 'user32.lib', - ], - ) - elif env['OS'] == 'linux': - env.Append( - LIBS = [ - 'xpcom', - 'xpcomglue_s', - ], -# Although the 1.9 SDK contains libnspr4, it is better to link against -# libxul, which in turn depends on libnspr4. In Ubuntu 8.04, libnspr4 was -# not listed in /usr/lib, only libxul was. - FF2_LIBS = ['nspr4'], - FF3_LIBS = ['xul'], - ) - elif env['OS'] == 'osx': - env.Append( - LIBS = [ - 'xpcom', - 'mozjs', - 'nspr4', - 'plds4', - 'plc4', - ], - FF2_LIBS = ['xpcom_core'], -# TODO(mpcomplete): the Makefiles specify many more libs, but we link fine with -# just this. Why? - FF3_LIBS = ['xpcomglue_s'], - ) -elif env['BROWSER'] == 'NPAPI': - if env['OS'] == 'win32': - env.Append( - LIBS = [ - 'delayimp.lib', - 'comdlg32.lib', - ], - SHLINKFLAGS = [ - '/DELAYLOAD:"comdlg32.dll"', - ], - ) - - -# Building resources. -if env['OS'] in ['win32', 'wince']: - env_res = env.Clone() - env_res.Replace( - CPPDEFINES = [ - '_UNICODE', - 'UNICODE', - '$EXTRA_DEFINES', - ], - EXTRA_DEFINES = [ - 'BROWSER_${BROWSER}=1', - ], - CPPPATH = [ - '$COMMON_GENFILES_DIR/..', - '$GENFILES_DIR/..', - '$OPEN_DIR', - '$VC80_CPPPATH', - ], - ) - - if env['MODE'] == 'dbg': - env_res.Append(CPPDEFINES = 'DEBUG=1') - else: - env_res.Append(CPPDEFINES = 'NDEBUG=1') - - env_res.Append(RCFLAGS = [('/l', '0x409')]) - if env['OS'] == 'win32': - env_res.Append( - CPPPATH = [ - '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/include', - ], - ) - elif env['OS'] == 'wince': - env_res.Append( - CPPDEFINES = [ - 'OS_WINCE', - '_WIN32', - '_WIN32_WCE', - 'UNDER_CE', - ], - CPPPATH = [ - '$OPEN_DIR/..', - '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80ce/files/include', - ], - RCFLAGS = [ - '-N', - ] - ) -else: - env_res = None - -if env['OS'] == 'win32': - # TODO: move to breakpad - env.Append(CPPFLAGS = ['/wd4018']) - -# TODO(playmobil): Create builder to generate required header files. -# browser_specific_objects += \ -# env.SharedObject('$OPEN_DIR/base/safari/resource_archive.cc') - -#----------------------------------------------------------------------------- -# Generate the dependency tree. - -def PatternRule(t, s): return utils.PatternRule(t, s, env) -def GetInputs(var): return utils.GetInputs(var, env) - -outputs = {} - -# genfiles/%: %.m4 -m4s = [env.M4(*PatternRule('$GENFILES_DIR/${SOURCE.filebase}', src)) - for src in GetInputs('$BROWSER_M4SRCS')] -outputs['M4S'] = m4s - -# genfiles/%.html: %.html_m4 -html_m4s = [env.M4( - *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.html', src)) - for src in GetInputs('$BROWSER_HTML_M4SRCS')] - -# genfiles/i18n/%: %.m4 -# This magic grabs the last *2* components from the path ("en-US/foo.m4") -def PathEnd(path, n): - """Returns the last n components of the given path. - Example: PathEnd('/foo/bar/baz', 2) == 'bar/baz'""" - split_path = os.path.normpath(path).split(os.sep) - return os.sep.join(split_path[-n:]) -env['PathEnd'] = PathEnd -tmp_pattern = '$GENFILES_DIR/i18n/${PathEnd(str(SOURCE.base), 2)}' -i18n_m4s = [env.M4(*PatternRule(tmp_pattern, src)) - for src in GetInputs('$BROWSER_I18N_M4SRCS')] - -# genfiles/%.js: %.js.stab -stabs = [env.Stab( - *PatternRule('$GENFILES_DIR/${SOURCE.filebase}', src)) - for src in GetInputs('$BROWSER_STABSRCS')] - -# genfiles/%.html: %.js -for stab in stabs: - env.Depends(*PatternRule('${SOURCE.base}.html', stab)) - -# genfiles/%.tlb: %.idl -xptsrcs = [] -for src in GetInputs('$BROWSER_IDLSRCS'): - idl = env.TypeLibrary( - *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.tlb', src)) - env.Append(BROWSER_CPPSRCS = [x for x in idl if str(x).endswith('_i.c')]) - if env['BROWSER'] in ['FF2', 'FF3']: - xptsrcs += [x for x in idl if str(x).endswith('.xpt')] - -if env['BROWSER'] in ['FF2', 'FF3']: - outputs['MODULE_TYPELIB'] = env.XptLink('gears.xpt', xptsrcs) - -if env_res: - # genfiles/%.res: %.rc - env.Append(BROWSER_SHLINKSRCS = [ - [env_res.RES( - *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.res', src)) - for src in GetInputs('$BROWSER_RESSRCS')] - ]) - -# TODO: figure out why the .rc scanner doesn't notice these dependencies. -if env['OS'] in ['win32', 'wince'] and env['BROWSER'] in ['NPAPI', 'IE']: - env.Depends('$GENFILES_DIR/ui_resources.rc', html_m4s) - env.Depends('$OPEN_DIR/base/npapi/module.rc', m4s) - -# Safari resources -if env['BROWSER'] == 'SF': - env.Replace( - WEBARCHIVER = '$OPEN_DIR/tools/osx/webarchiver/webarchiver', - GEN_RESOURCE_LIST = 'python $OPEN_DIR/tools/osx/gen_resource_list.py', - GEN_RESOURCES = ['$GENFILES_DIR/resource_list.h'], - ) - def WebArchiver(src): - src_basename = os.path.basename(os.path.splitext(src)[0]) - return ('$WEBARCHIVER "$GENFILES_DIR/%s.webarchive" "%s" ' - ' $COMMON_RESOURCES' % (src_basename, src)) - def XXD(src): - src_basename = os.path.basename(os.path.splitext(src)[0]) - env.Append(GEN_RESOURCES = ['$GENFILES_DIR/%s.h' % src_basename]) - return 'xxd -i "%s" > "$GENFILES_DIR/%s.h"' % (src, src_basename) - resource_list_h = env.Command( - '$GENFILES_DIR/resource_list.h', - GetInputs('$COMMON_RESOURCES') + html_m4s, - [WebArchiver('$GENFILES_DIR/permissions_dialog.html'), - WebArchiver('$GENFILES_DIR/shortcuts_dialog.html'), - WebArchiver('$GENFILES_DIR/settings_dialog.html'), - XXD('$GENFILES_DIR/permissions_dialog.webarchive'), - XXD('$GENFILES_DIR/shortcuts_dialog.webarchive'), - XXD('$GENFILES_DIR/settings_dialog.webarchive'), - XXD('$OPEN_DIR/ui/common/location_data.png'), - XXD('$OPEN_DIR/ui/common/local_data.png'), - '$GEN_RESOURCE_LIST $GEN_RESOURCES'], - ) - resource_obj = env.SharedObject( - '$GENFILES_DIR/resources', - '$OPEN_DIR/base/safari/resource_archive.cc') - env.Depends(resource_obj, resource_list_h) - env.Append(BROWSER_LINKSRCS = resource_obj) - - -# HACK: gears, vista_broker, and wince_setup share some inputs, but the -# Chrome* helpers muck with the environment, so SCons complains if we try to -# compile those inputs differently. So we try to precompile them before -# passing them to those methods first. So far, only *_CPPSRCS inputs -# are shared. - -module = env.ChromeSharedLibrary('gears-$OS-$ARCH-$MODE-${BROWSER}', - env.SharedObject(GetInputs('$BROWSER_CPPSRCS')) + - GetInputs('$BROWSER_LINKSRCS $BROWSER_SHLINKSRCS')) -outputs['MODULE'] = env.InstallAs('${SHLIBPREFIX}gears${SHLIBSUFFIX}', module) -if env['OS'] in ['win32', 'wince'] and env['MODE'] == 'dbg': - outputs['MODULE_PDB'] = env.InstallAs('gears.pdb', - 'gears-$OS-$ARCH-$MODE-${BROWSER}.pdb') - -if env['GEARS_STATIC_LIB']: - if env['OS'] == 'win32' and env['BROWSER'] == 'NPAPI': - lib = env.ChromeLibrary('gears-static', - env.SharedObject(GetInputs('$BROWSER_CPPSRCS')) + - GetInputs('$BROWSER_LINKSRCS')) - env.Alias('gears', lib) -else: - env.Alias('gears', outputs['MODULE']) - if 'MODULE_PDB' in outputs: - env.Alias('gears', outputs['MODULE_PDB']) - -if env['OS'] == 'wince': - env.Append(WINCE_SETUP_LINKSRCS = [ - [env_res.RES(*PatternRule('$GENFILES_DIR/${SOURCE.filebase}.res', src)) - for src in GetInputs('$WINCE_SETUP_RESSRCS')] - ]) - outputs['WINCE_SETUP_DLL'] = env.ChromeSharedLibrary('setup', - env.SharedObject(GetInputs('$WINCE_SETUP_CPPSRCS')) + - GetInputs('$WINCE_SETUP_LINKSRCS')) - -if env['OS'] == 'win32' and env['BROWSER'] == 'IE': -# Note: We use IE_OUTDIR so that relative path from gears.dll is same in -# development environment as deployment environment. -# Note: vista_broker.exe needs to stay in sync with name used in -# desktop_win32.cc. -# TODO(aa): This can move to common_outdir like crash_sender.exe - env.Append(VISTA_BROKER_LINKSRCS = [ - [env_res.RES('$GENFILES_DIR/vista_broker_${SOURCE.filebase}.res', - env_res.File(src), EXTRA_DEFINES = 'VISTA_BROKER=1') - for src in GetInputs('$VISTA_BROKER_RESSRCS')] - ]) - outputs['VISTA_BROKER_EXE'] = env.ChromeProgram('vista_broker', - env.SharedObject(GetInputs('$VISTA_BROKER_CPPSRCS')) + - GetInputs('$VISTA_BROKER_LINKSRCS')) - env.Alias('gears', outputs['VISTA_BROKER_EXE']) - -if env['BROWSER'] == 'SF': - outputs['PROXY_DLL'] = env.ChromeSharedLibrary('gears_proxy', - GetInputs('$SF_PROXY_DLL_CPPSRCS')) - outputs['INPUTMANAGER_EXE'] = env.ChromeProgram('GearsEnabler', - GetInputs('$SF_INPUTMANAGER_CPPSRCS'), - FRAMEWORKS = env['FRAMEWORKS'] + Split('Foundation AppKit')) - -# See main SConscript for how 'outputs' is used. -Return('outputs') diff --git a/gears/SConscript.common b/gears/SConscript.common deleted file mode 100644 index 773f50a..0000000 --- a/gears/SConscript.common +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (c) 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. - -import os - -import utils - -Import('env') - -env = env.Clone() - - -# Building .from_bin.cc files. - -# Must be run from within the gears dir. More hoops to jump through to fix up -# path names and arguments. -env.Replace( -# len() + 1 to include trailing '/' -# TODO: is there a better way to strip off $OPEN_DIR from $SOURCE? - LEN_OPEN_DIR = len(os.path.normpath(env.subst('$OPEN_DIR'))) + 1, - BIN2CPP = 'cd $OPEN_DIR && python tools/bin2cpp.py', - BIN2CPPCOM = '$BIN2CPP ${str(SOURCE)[LEN_OPEN_DIR:]} > ${TARGET.abspath}', -) -bin2cpp_builder = Builder(action = '$BIN2CPPCOM') -env.Append(BUILDERS = {'Bin2cpp': bin2cpp_builder}) - - -# C++ flags. - -env.Prepend( - CPPDEFINES = [ -# Common items, like notifier, are not related to any browser. - 'BROWSER_NONE=1', - ] -) - -# OS X needs to be 'LINUX' in common sources. -# TODO(nigeltao): Should we instead have a UNIX flag, rather than calling -# Mac OS X a "flavor of Linux"?? -if env['OS'] == 'osx': - env.Append(CPPDEFINES = ['LINUX']) - - -#----------------------------------------------------------------------------- -# Generate the dependency tree. - -def PatternRule(t, s): return utils.PatternRule(t, s, env) -def GetInputs(var): return utils.GetInputs(var, env) - -outputs = {} - -# genfiles/%: %.m4 -outputs['COMMON_M4S'] = \ - [env.M4(*PatternRule('$COMMON_GENFILES_DIR/${SOURCE.filebase}', src)) - for src in GetInputs('$COMMON_M4SRCS')] - -# genfiles/%.from_bin.cc: % -if GetInputs('$COMMON_BINSRCS'): - bins = [env.Bin2cpp(*PatternRule( - '$COMMON_GENFILES_DIR/${SOURCE.file}.from_bin.cc', src)) - for src in GetInputs('$COMMON_BINSRCS')] - outputs['BROWSER_LINKSRCS'] = [env.SharedObject(bin) for bin in bins] - -outputs['IPC_TEST_EXE'] = env.ChromeProgram('ipc_test', - GetInputs('$IPC_TEST_CPPSRCS')) - -# Note: crash_sender.exe name needs to stay in sync with name used in -# exception_handler_win32.cc and exception_handler_osx/google_breakpad.mm. -outputs['CRASH_SENDER_EXE'] = None -if env['OS'] == 'win32': - outputs['CRASH_SENDER_EXE'] = env.ChromeProgram('crash_sender', - GetInputs('$CRASH_SENDER_CPPSRCS'), - LIBS = Split('advapi32.lib shell32.lib wininet.lib')) -elif env['OS'] == 'osx': - outputs['CRASH_SENDER_EXE'] = env.ChromeProgram('crash_sender', - GetInputs('$CRASH_SENDER_CPPSRCS'), - FRAMEWORKS = env['FRAMEWORKS'] + - Split('Carbon Cocoa Foundation IOKit SystemConfiguration'), - LIBS = env['LIBS'] + ['crypto', 'stdc++']) -env.Alias('gears', outputs['CRASH_SENDER_EXE']) - -if env['OS'] == 'osx': -# Crash inspector is launched by the crashed process from it's exception -# handler and is what actually communicates with the crashed process to -# extract the minidump. It then launches crash_sender in order to actually -# send the minidump over the wire. - outputs['OSX_CRASH_INSPECTOR_EXE'] = env.ChromeProgram('crash_inspector', - GetInputs('$OSX_CRASH_INSPECTOR_CPPSRCS'), - FRAMEWORKS = env['FRAMEWORKS'] + ['Carbon'], - LIBS = env['LIBS'] + ['breakpad_osx-gears']) - - outputs['OSX_LAUNCHURL_EXE'] = env.ChromeProgram('launch_url_with_browser', - GetInputs('$OSX_LAUNCHURL_CPPSRCS'), - FRAMEWORKS = env['FRAMEWORKS'] + - Split('CoreFoundation ApplicationServices'), - LIBS = env['LIBS'] + ['stdc++']) - - outputs['SF_INSTALLER_PLUGIN_EXE'] = env.ChromeSharedLibrary('stats_pane', - GetInputs('$SF_INSTALLER_PLUGIN_CPPSRCS'), - FRAMEWORKS = env['FRAMEWORKS'] + Split('Cocoa InstallerPlugins')) - -# See main SConscript for how 'outputs' is used. -Return('outputs') diff --git a/gears/SConscript.googleurl b/gears/SConscript.googleurl deleted file mode 100644 index 14605b9..0000000 --- a/gears/SConscript.googleurl +++ /dev/null @@ -1,93 +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. - -Import('env') - -env = env.Clone() - -env.Replace( - GURL_DIR = '$THIRD_PARTY_DIR/googleurl', - ICU38_DIR = '$THIRD_PARTY_DIR/icu38', - CPPPATH = [ - '$GURL_DIR', - '$GURL_DIR/..', - '$ICU38_DIR/public/common', - '$ICU38_DIR/public/i18n', - '$VC80_CPPPATH', - ], -) - -env.Append( - CPPDEFINES = [ -# 'U_STATIC_IMPLEMENTATION', - ], -) - -if env['OS'] == 'win32': - env.Append( - CCFLAGS = [ -# '/TP', -# '/J', - ], - ) -elif env['OS'] == 'linux': - env.Append(CCFLAGS = '-Wno-char-subscripts') - -input_files = [ - '$GURL_DIR/src/gurl.cc', - '$GURL_DIR/src/url_canon_etc.cc', - '$GURL_DIR/src/url_canon_fileurl.cc', - '$GURL_DIR/src/url_canon_host.cc', -# '$GURL_DIR/src/url_canon_icu.cc', - '$GURL_DIR/src/url_canon_internal.cc', - '$GURL_DIR/src/url_canon_ip.cc', - '$GURL_DIR/src/url_canon_mailtourl.cc', - '$GURL_DIR/src/url_canon_path.cc', - '$GURL_DIR/src/url_canon_pathurl.cc', - '$GURL_DIR/src/url_canon_query.cc', - '$GURL_DIR/src/url_canon_relative.cc', - '$GURL_DIR/src/url_canon_stdurl.cc', - '$GURL_DIR/src/url_parse.cc', - '$GURL_DIR/src/url_parse_file.cc', - '$GURL_DIR/src/url_util.cc', -] - -# ICU files needed for Gears. -input_files += [ - '$ICU38_DIR/source/common/utf_impl.cc', -] - -env.GearsStaticLibrary('googleurl-gears', input_files) - -#env_tests = env.Clone() -# -#env_tests.Append( -# CPPPATH = [ -# '$GTEST_DIR/include', -# ], -# CPPDEFINES = [ -# 'UNIT_TEST', -# ], -# LIBS = [ -# 'googleurl', -# 'base', -# env_tests['ICU_LIBS'], # TODO(sgk): '$ICU_LIBS' when scons is fixed -# 'gtest', -# ] -#) -# -#test_files = [ -# 'src/gurl_unittest.cc', -# 'src/url_canon_unittest.cc', -# 'src/url_parse_unittest.cc', -# 'src/url_util_unittest.cc', -# -# # The version of gtest that googleurl uses provides a main() function; ours -# # doesn't so include our own main function. -# '$CHROME_SRC_DIR/base/run_all_unittests.cc' -#] -# -#gurl_unittests = env_tests.ChromeTestProgram('googleurl_unittests', test_files) -# -#installed_gurl_unittests = env.Install('$TARGET_ROOT', gurl_unittests) diff --git a/gears/SConscript.inputs b/gears/SConscript.inputs deleted file mode 100644 index 60ee805..0000000 --- a/gears/SConscript.inputs +++ /dev/null @@ -1,1072 +0,0 @@ -# Copyright (c) 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. - -Import('env') - -types = ['CPPSRCS', 'M4SRCS', 'HTML_M4SRCS', 'I18N_M4SRCS', 'STABSRCS', - 'IDLSRCS', 'RESSRCS', 'LINKSRCS', 'SHLINKSRCS'] - -# Set up aliases for shared inputs. -for type in types: - env['FF2_' + type] = ['$FF3_' + type] - env['NPAPI_' + type] = ['$USING_NPAPI_' + type] - env['SF_' + type] = ['$USING_NPAPI_' + type] - -def InitBrowserInputs(env): - """Set up $BROWSER_XXXSRC = $${BROWSER}_XXXSRC. Must be called by - SConscript.browser, when we have a BROWSER variable available.""" - for type in types: - eval('env.Append(BROWSER_%s = ["$%s_%s"])' % (type, env['BROWSER'], type)) -env.AddMethod(InitBrowserInputs) - - -#----------------------------------------------------------------------------- -# crash_sender - -if env['OS'] == 'win32': - env.Append(CRASH_SENDER_CPPSRCS = [ - '$OPEN_DIR/crash_sender/crash_sender_win32.cc', - '$THIRD_PARTY_DIR/breakpad/src/client/windows/sender/crash_report_sender.cc', - '$THIRD_PARTY_DIR/breakpad/src/common/windows/http_upload.cc', - ]) -elif env['OS'] == 'osx': - env.Append(CRASH_SENDER_CPPSRCS = [ - '$OPEN_DIR/base/common/exception_handler_osx/nshost_macaddress.m', - '$OPEN_DIR/crash_sender/crash_sender_osx.m', - '$THIRD_PARTY_DIR/breakpad/src/common/mac/HTTPMultipartUpload.m', - ]) - - env.Append(OSX_CRASH_INSPECTOR_CPPSRCS = [ - '$THIRD_PARTY_DIR/breakpad_osx/src/common/convert_UTF.c', - '$OPEN_DIR/base/common/exception_handler_osx/inspector.mm', - '$OPEN_DIR/base/common/exception_handler_osx/mach_ipc.mm', - '$OPEN_DIR/base/common/exception_handler_osx/on_demand_server.mm', - '$OPEN_DIR/base/common/exception_handler_osx/simple_string_dictionary.mm', - ]) - -#----------------------------------------------------------------------------- -# launch_url_with_browser - -env.Append(OSX_LAUNCHURL_CPPSRCS = [ - '$OPEN_DIR/base/safari/launch_url_in_browser.cc', -]) - -#----------------------------------------------------------------------------- -# ipc_test - -env.Append(COMMON_M4SRCS = [ - '$OPEN_DIR/base/common/product_constants.h.m4', -]) - -env.Append(IPC_TEST_CPPSRCS = [ - '$OPEN_DIR/base/common/event.cc', - '$OPEN_DIR/base/common/ipc_message_queue_linux.cc', - '$OPEN_DIR/base/common/ipc_message_queue_null.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test_linux.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test_win32.cc', - '$OPEN_DIR/base/common/ipc_message_queue_win32.cc', - '$OPEN_DIR/base/common/mutex.cc', - '$OPEN_DIR/base/common/mutex_posix.cc', - '$OPEN_DIR/base/common/mutex_win32.cc', - '$OPEN_DIR/base/common/serialization.cc', - '$OPEN_DIR/base/common/stopwatch.cc', - '$OPEN_DIR/base/common/stopwatch_posix.cc', - '$OPEN_DIR/base/common/stopwatch_win32.cc', - '$OPEN_DIR/base/common/string16.cc', - '$OPEN_DIR/base/common/string_utils.cc', - '$OPEN_DIR/base/common/string_utils_osx.cc', - '$OPEN_DIR/base/common/thread.cc', - '$OPEN_DIR/base/common/thread_posix.cc', - '$OPEN_DIR/base/common/thread_win32.cc', - '$OPEN_DIR/base/common/time_utils_win32.cc', -]) - -if env['OS'] == 'osx': - env.Append(IPC_TEST_CPPSRCS = [ - '$OPEN_DIR/base/common/common_osx.mm', - '$OPEN_DIR/base/common/ipc_message_queue_test_osx.mm', - ]) - -env.Append(IPC_TEST_CPPSRCS = [ - '$THIRD_PARTY_DIR/convert_utf/ConvertUTF.c' -]) - -#----------------------------------------------------------------------------- -# inspector - -if not env['OFFICIAL_BUILD']: - env.Append(COMMON_BINSRCS = [ - '$OPEN_DIR/inspector/console.html', - '$OPEN_DIR/inspector/database.html', - '$OPEN_DIR/inspector/index.html', - '$OPEN_DIR/inspector/localserver.html', - '$OPEN_DIR/inspector/common/alert-35.png', - '$OPEN_DIR/inspector/common/database.gif', - '$OPEN_DIR/inspector/common/error-35.png', - '$OPEN_DIR/inspector/common/ie6hacks.css', - '$OPEN_DIR/inspector/common/inspector_links.js', - '$OPEN_DIR/inspector/common/lightbulb-35.png', - '$OPEN_DIR/inspector/common/localserver.gif', - '$OPEN_DIR/inspector/common/question-35.png', - '$OPEN_DIR/inspector/common/styles.css', - '$OPEN_DIR/inspector/common/workerpool.gif', - '$OPEN_DIR/sdk/gears_init.js', - '$OPEN_DIR/ui/common/base.js', - '$OPEN_DIR/ui/common/dom.js', - '$OPEN_DIR/ui/common/icon_32x32.png', - ]) - -#----------------------------------------------------------------------------- -# installer - -env.Append(COMMON_M4SRCS = [ - '$OPEN_DIR/installer/npapi_msi.wxs.m4', - '$OPEN_DIR/installer/win32_msi.wxs.m4', - '$OPEN_DIR/installer/wince_cab_ie.inf.m4', - '$OPEN_DIR/installer/wince_cab_op.inf.m4', -]) - -#----------------------------------------------------------------------------- -# installer/safari - -env.Append(SF_M4SRCS = [ - '$OPEN_DIR/installer/safari/installer.packproj.m4', - '$OPEN_DIR/tools/osx/Info.plist.m4', -]) - -#----------------------------------------------------------------------------- -# Keystone - -env.Append(SF_M4SRCS = [ - '$PRIVATE_DIR/tools/osx/installer/InstallationCheck.strings.m4', - '$PRIVATE_DIR/tools/osx/installer/keystone_installer.packproj.m4', - '$PRIVATE_DIR/tools/osx/installer/postflight.sh.m4', -]) - -#----------------------------------------------------------------------------- -# mozjs bindings - -mozjs_sources = [ - '$MOZJS_DIR/gears_npapi_bindings/mozjs_npruntime.cc', - '$MOZJS_DIR/gears_npapi_bindings/mozjs_npruntime_utils.cc', - '$OPEN_DIR/base/common/js_standalone_engine_mozjs.cc', - '$MOZJS_DIR/gears_npapi_bindings/mozjs_npapi_storage.cc' -] - -def MozjsSources(env): - return env.SharedObject(mozjs_sources, - CPPPATH = env['CPPPATH'] + env['MOZJS_INCLUDE_PATHS']) -env['MozjsSources'] = MozjsSources - -env.Append(SF_LINKSRCS = '${MozjsSources(__env__)}') - -#----------------------------------------------------------------------------- -# third_party/breakpad - -if env['OS'] == 'win32': - env.Append(NPAPI_CPPSRCS = [ - '$THIRD_PARTY_DIR/breakpad/src/client/exception_handler_stub.cc', - ]) - - env.Append(IE_CPPSRCS = [ - '$THIRD_PARTY_DIR/breakpad/src/client/windows/handler/exception_handler.cc', - '$THIRD_PARTY_DIR/breakpad/src/common/windows/guid_string.cc', - '$OPEN_DIR/base/common/exception_handler_win32.cc', - ]) - - env.Append(FF3_CPPSRCS = [ - '$THIRD_PARTY_DIR/breakpad/src/client/windows/handler/exception_handler.cc', - '$THIRD_PARTY_DIR/breakpad/src/common/windows/guid_string.cc', - '$OPEN_DIR/base/common/exception_handler_win32.cc', - ]) - -#----------------------------------------------------------------------------- -# third_party/breakpad_osx - -env.Append(SF_CPPSRCS = [ - '$OPEN_DIR/base/common/exception_handler_osx.mm', - '$OPEN_DIR/base/common/exception_handler_osx/google_breakpad.mm', - '$OPEN_DIR/base/common/exception_handler_osx/mach_ipc.mm', - '$OPEN_DIR/base/common/exception_handler_osx/on_demand_server.mm', - '$OPEN_DIR/base/common/exception_handler_osx/simple_string_dictionary.mm' -]) - -#----------------------------------------------------------------------------- -# third_party/v8/bindings - -if env['OS'] == 'win32': - env.Append(NPAPI_CPPSRCS = [ - '$THIRD_PARTY_DIR/v8/bindings_local/npruntime.cc', - '$THIRD_PARTY_DIR/v8/bindings_local/np_v8object.cc', - '$THIRD_PARTY_DIR/v8/bindings_local/v8_helpers.cc', - '$THIRD_PARTY_DIR/v8/bindings_local/v8_np_utils.cc', - '$THIRD_PARTY_DIR/v8/bindings_local/v8_npobject.cc', - ]) - -#----------------------------------------------------------------------------- -# third_party/convert_utf - -env.Append(BROWSER_CPPSRCS = [ - '$THIRD_PARTY_DIR/convert_utf/ConvertUTF.c' -]) - -#----------------------------------------------------------------------------- -# third_party/jsoncpp - -env.Append(BROWSER_CPPSRCS = [ - '$THIRD_PARTY_DIR/jsoncpp/json_reader.cc', - '$THIRD_PARTY_DIR/jsoncpp/json_value.cc', - '$THIRD_PARTY_DIR/jsoncpp/json_writer.cc', -]) - -#----------------------------------------------------------------------------- -# third_party/modp_b64 - -env.Append(BROWSER_CPPSRCS = [ - '$THIRD_PARTY_DIR/modp_b64/modp_b64.cc', -]) - -#----------------------------------------------------------------------------- -# base/common - -env.Append(BROWSER_M4SRCS = [ - '$OPEN_DIR/base/common/product_version.rc.m4' -]) - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/base/common/async_router.cc', - '$OPEN_DIR/base/common/base_class.cc', - '$OPEN_DIR/base/common/base64.cc', - '$OPEN_DIR/base/common/byte_store.cc', - '$OPEN_DIR/base/common/byte_store_test.cc', - '$OPEN_DIR/base/common/circular_buffer_test.cc', - '$OPEN_DIR/base/common/common_np_android.cc', - '$OPEN_DIR/base/common/common_win32.cc', - '$OPEN_DIR/base/common/database_name_table.cc', - '$OPEN_DIR/base/common/event.cc', - '$OPEN_DIR/base/common/event_test.cc', - '$OPEN_DIR/base/common/file.cc', - '$OPEN_DIR/base/common/file_posix.cc', - '$OPEN_DIR/base/common/file_test.cc', - '$OPEN_DIR/base/common/file_win32.cc', - '$OPEN_DIR/base/common/file_wince.cc', - '$OPEN_DIR/base/common/html_event_monitor.cc', - '$OPEN_DIR/base/common/http_utils.cc', - '$OPEN_DIR/base/common/js_dom_element.cc', - '$OPEN_DIR/base/common/js_marshal.cc', - '$OPEN_DIR/base/common/js_runner_utils.cc', - '$OPEN_DIR/base/common/js_types.cc', - '$OPEN_DIR/base/common/leak_counter.cc', - '$OPEN_DIR/base/common/memory_buffer.cc', - '$OPEN_DIR/base/common/memory_buffer_test.cc', - '$OPEN_DIR/base/common/message_queue.cc', - '$OPEN_DIR/base/common/message_queue_android.cc', - '$OPEN_DIR/base/common/message_service.cc', - '$OPEN_DIR/base/common/message_service_test.cc', - '$OPEN_DIR/base/common/mime_detect.cc', - '$OPEN_DIR/base/common/mutex.cc', - '$OPEN_DIR/base/common/mutex_posix.cc', - '$OPEN_DIR/base/common/mutex_test.cc', - '$OPEN_DIR/base/common/mutex_win32.cc', - '$OPEN_DIR/base/common/name_value_table.cc', - '$OPEN_DIR/base/common/name_value_table_test.cc', - '$OPEN_DIR/base/common/paths.cc', - '$OPEN_DIR/base/common/paths_android.cc', - '$OPEN_DIR/base/common/permissions_db.cc', - '$OPEN_DIR/base/common/permissions_db_test.cc', - '$OPEN_DIR/base/common/permissions_manager.cc', - '$OPEN_DIR/base/common/position_table.cc', - '$OPEN_DIR/base/common/process_utils_win32.cc', - '$OPEN_DIR/base/common/png_utils.cc', - '$OPEN_DIR/base/common/scoped_refptr_test.cc', - '$OPEN_DIR/base/common/security_model.cc', - '$OPEN_DIR/base/common/security_model_test.cc', - '$OPEN_DIR/base/common/serialization.cc', - '$OPEN_DIR/base/common/serialization_test.cc', - '$OPEN_DIR/base/common/shortcut_table.cc', - '$OPEN_DIR/base/common/sqlite_wrapper.cc', - '$OPEN_DIR/base/common/sqlite_wrapper_test.cc', - '$OPEN_DIR/base/common/stopwatch.cc', - '$OPEN_DIR/base/common/stopwatch_posix.cc', - '$OPEN_DIR/base/common/stopwatch_win32.cc', - '$OPEN_DIR/base/common/string16.cc', - '$OPEN_DIR/base/common/string_utils.cc', - '$OPEN_DIR/base/common/string_utils_osx.cc', - '$OPEN_DIR/base/common/string_utils_test.cc', - '$OPEN_DIR/base/common/thread.cc', - '$OPEN_DIR/base/common/thread_locals.cc', - '$OPEN_DIR/base/common/thread_posix.cc', - '$OPEN_DIR/base/common/thread_win32.cc', - '$OPEN_DIR/base/common/timed_call.cc', - '$OPEN_DIR/base/common/timed_call_test.cc', - '$OPEN_DIR/base/common/time_utils_win32.cc', - '$OPEN_DIR/base/common/url_utils.cc', - '$OPEN_DIR/base/common/url_utils_test.cc', - '$OPEN_DIR/base/common/user_config.cc', - '$OPEN_DIR/base/common/vista_utils.cc', - '$OPEN_DIR/base/common/wince_compatibility.cc', -]) - -if env['OS'] == 'osx': - env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/base/common/common_osx.mm', - '$OPEN_DIR/base/safari/nsstring_utils.mm', - '$OPEN_DIR/base/common/user_config_osx.cc', - '$OPEN_DIR/notifier/notifier_process_osx.mm', - ]) - -#----------------------------------------------------------------------------- -# base/firefox - -env.Append(FF3_M4SRCS = [ - '$OPEN_DIR/base/firefox/install.rdf.m4', -]) - -env.Append(FF3_IDLSRCS = [ - '$OPEN_DIR/base/firefox/interfaces.idl', -]) - -env.Append(FF3_CPPSRCS = [ - '$OPEN_DIR/base/common/html_event_monitor_ff.cc', - '$OPEN_DIR/base/common/ipc_message_queue_linux.cc', - '$OPEN_DIR/base/common/ipc_message_queue_null.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test_linux.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test_win32.cc', - '$OPEN_DIR/base/common/ipc_message_queue_win32.cc', - '$OPEN_DIR/base/common/js_runner_ff.cc', - '$OPEN_DIR/base/common/js_runner_ff_marshaling.cc', - '$OPEN_DIR/base/common/message_queue_ff.cc', - '$OPEN_DIR/base/common/paths_ff.cc', - '$OPEN_DIR/base/firefox/dom_utils.cc', - '$OPEN_DIR/base/firefox/module.cc', - '$OPEN_DIR/base/firefox/ns_file_utils.cc', - '$OPEN_DIR/base/firefox/xpcom_dynamic_load.cc', -]) - -if env['OS'] == 'osx': - env.Append(FF3_CPPSRCS = [ - '$OPEN_DIR/base/common/ipc_message_queue_test_osx.mm', - ]) - -#----------------------------------------------------------------------------- -# base/ie - -env.Append(IE_M4SRCS = [ - '$OPEN_DIR/base/ie/bho.rgs.m4', - '$OPEN_DIR/base/ie/interfaces.idl.m4', - '$OPEN_DIR/base/ie/module.rgs.m4', -]) - -env.Append(IE_IDLSRCS = [ - '$GENFILES_DIR/interfaces.idl', -]) - -env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/base/ie/activex_utils.cc', - '$OPEN_DIR/base/ie/bho.cc', - '$OPEN_DIR/base/common/detect_version_collision_win32.cc', - '$OPEN_DIR/base/ie/dispatcher_to_idispatch.cc', - '$OPEN_DIR/base/common/ipc_message_queue_null.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test_win32.cc', - '$OPEN_DIR/base/common/ipc_message_queue_win32.cc', - '$OPEN_DIR/base/common/js_runner_ie.cc', - '$OPEN_DIR/base/common/message_queue_win32.cc', - '$OPEN_DIR/base/ie/module.cc', - '$OPEN_DIR/base/ie/module_wrapper.cc', - '$OPEN_DIR/base/common/paths_ie.cc', -]) - -if env['OS'] == 'win32': - env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/base/common/html_event_monitor_ie.cc', - '$OPEN_DIR/base/ie/browser_listener.cc', - '$OPEN_DIR/base/ie/ie_version.cc', - ]) -elif env['OS'] == 'wince': - env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/base/common/html_event_monitor_iemobile.cc', - ]) - -#----------------------------------------------------------------------------- -# base/chrome + npapi - -env.Append(NPAPI_CPPSRCS = [ - '$OPEN_DIR/base/common/html_event_monitor_np.cc', - '$OPEN_DIR/base/common/ipc_message_queue_linux.cc', - '$OPEN_DIR/base/common/ipc_message_queue_null.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test_linux.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test_win32.cc', - '$OPEN_DIR/base/common/ipc_message_queue_win32.cc', - '$OPEN_DIR/base/npapi/browser_utils.cc', - '$OPEN_DIR/base/npapi/module.cc', - '$OPEN_DIR/base/npapi/np_utils.cc', - '$OPEN_DIR/base/npapi/npn_bindings.cc', - '$OPEN_DIR/base/npapi/npp_bindings.cc', - '$OPEN_DIR/base/npapi/plugin.cc', -]) - -if env['OS'] == 'win32': - env.Append(NPAPI_CPPSRCS = [ - '$OPEN_DIR/base/chrome/module_cr.cc', - '$OPEN_DIR/base/common/js_runner_cr.cc', - '$OPEN_DIR/base/common/paths_cr.cc', - '$OPEN_DIR/base/common/detect_version_collision_win32.cc', - '$OPEN_DIR/base/common/message_queue_cr.cc', - '$OPEN_DIR/base/ie/ie_version.cc', - ]) - -#----------------------------------------------------------------------------- -# base/safari -env.Append(SF_CPPSRCS = [ - '$OPEN_DIR/base/common/common_sf.mm', - '$OPEN_DIR/base/common/detect_version_collision_osx.cc', - '$OPEN_DIR/base/common/html_event_monitor_np.cc', - '$OPEN_DIR/base/common/ipc_message_queue_linux.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test.cc', - '$OPEN_DIR/base/common/ipc_message_queue_test_osx.mm', - '$OPEN_DIR/base/common/js_runner_np.cc', - '$OPEN_DIR/base/common/message_queue_sf.cc', - '$OPEN_DIR/base/common/paths_sf.mm', - '$OPEN_DIR/base/common/paths_sf_more.mm', - '$OPEN_DIR/base/npapi/browser_utils.cc', - '$OPEN_DIR/base/npapi/module.cc', - '$OPEN_DIR/base/npapi/np_utils.cc', - '$OPEN_DIR/base/npapi/npn_bindings.cc', - '$OPEN_DIR/base/npapi/npp_bindings.cc', - '$OPEN_DIR/base/npapi/plugin.cc', - '$OPEN_DIR/base/safari/browser_load_hook.mm', - '$OPEN_DIR/base/safari/browser_utils_sf.cc', - '$OPEN_DIR/base/safari/curl_downloader.mm', - '$OPEN_DIR/base/safari/messagebox.mm', - '$OPEN_DIR/base/safari/proxy_resolver_mac.cc', - '$OPEN_DIR/base/safari/safari_workarounds.m', -]) - -#----------------------------------------------------------------------------- -# console - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/console/console.cc', - '$OPEN_DIR/console/js_callback_logging_backend.cc', -]) - -#----------------------------------------------------------------------------- -# canvas - -# The Canvas API is not yet enabled in official builds. -if not env['OFFICIAL_BUILD'] and env['OS'] in ['win32', 'osx']: - env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/canvas/blob_backed_skia_input_stream.cc', - '$OPEN_DIR/canvas/blob_backed_skia_output_stream.cc', - '$OPEN_DIR/canvas/canvas.cc', - '$OPEN_DIR/canvas/canvas_rendering_context_2d.cc', - ]) - -#----------------------------------------------------------------------------- -# database - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/database/database.cc', - '$OPEN_DIR/database/database_utils.cc', - '$OPEN_DIR/database/database_utils_test.cc', - '$OPEN_DIR/database/result_set.cc', -]) - -#----------------------------------------------------------------------------- -# database2 - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/database2/connection.cc', - '$OPEN_DIR/database2/commands.cc', - '$OPEN_DIR/database2/database2.cc', - '$OPEN_DIR/database2/database2_common.cc', - '$OPEN_DIR/database2/database2_metadata.cc', - '$OPEN_DIR/database2/interpreter.cc', - '$OPEN_DIR/database2/manager.cc', - '$OPEN_DIR/database2/result_set2.cc', - '$OPEN_DIR/database2/statement.cc', - '$OPEN_DIR/database2/transaction.cc', -]) - -#----------------------------------------------------------------------------- -# desktop - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/desktop/desktop.cc', - '$OPEN_DIR/desktop/desktop_android.cc', - '$OPEN_DIR/desktop/desktop_linux.cc', - '$OPEN_DIR/desktop/desktop_osx.cc', - '$OPEN_DIR/desktop/desktop_test.cc', - '$OPEN_DIR/desktop/desktop_win32.cc', - '$OPEN_DIR/desktop/dll_data_wince.cc', - '$OPEN_DIR/desktop/drop_target_base.cc', - '$OPEN_DIR/desktop/drop_target_registration.cc', - '$OPEN_DIR/desktop/notification_message_orderer.cc', - '$OPEN_DIR/desktop/shortcut_utils_win32.cc', -]) - -if env['OS'] == 'win32': - env.Append(NPAPI_CPPSRCS = [ - '$OPEN_DIR/desktop/desktop_cr.cc', - ]) - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/desktop/file_dialog.cc', - '$OPEN_DIR/desktop/file_dialog_gtk.cc', - '$OPEN_DIR/desktop/file_dialog_osx.cc', - '$OPEN_DIR/desktop/file_dialog_win32.cc', - '$OPEN_DIR/desktop/file_dialog_android.cc', -]) - -# The browser module also needs these files, to communicate with the notifier. -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/notifier/const_notifier.cc', - '$OPEN_DIR/notifier/notifier_process_linux.cc', - '$OPEN_DIR/notifier/notifier_process_posix.cc', - '$OPEN_DIR/notifier/notifier_process_win32.cc', - '$OPEN_DIR/notifier/notifier_proxy.cc', - '$OPEN_DIR/notifier/notifier_utils_win32.cc', - '$OPEN_DIR/notifier/notification.cc', -]) - -if not env['OFFICIAL_BUILD']: - # The Drag-and-Drop API has not been finalized for official builds. - env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/desktop/drag_and_drop_utils_common.cc', - ]) - - env.Append(FF3_CPPSRCS = [ - '$OPEN_DIR/desktop/drag_and_drop_utils_ff.cc', - '$OPEN_DIR/desktop/drop_target_ff.cc', - ]) - - env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/desktop/drag_and_drop_utils_ie.cc', - '$OPEN_DIR/desktop/drop_target_ie.cc', - ]) - - env.Append(SF_CPPSRCS = [ - '$OPEN_DIR/desktop/drag_and_drop_utils_sf.mm', - '$OPEN_DIR/desktop/drop_target_sf.cc', - ]) - -#----------------------------------------------------------------------------- -# localserver/common - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/localserver/common/async_task_test.cc', - '$OPEN_DIR/localserver/common/blob_store.cc', - '$OPEN_DIR/localserver/common/capture_task.cc', - '$OPEN_DIR/localserver/common/file_store.cc', - '$OPEN_DIR/localserver/common/http_constants.cc', - '$OPEN_DIR/localserver/common/localserver.cc', - '$OPEN_DIR/localserver/common/localserver_db.cc', - '$OPEN_DIR/localserver/common/localserver_perf_test.cc', - '$OPEN_DIR/localserver/common/managed_resource_store.cc', - '$OPEN_DIR/localserver/common/manifest.cc', - '$OPEN_DIR/localserver/common/progress_event.cc', - '$OPEN_DIR/localserver/common/resource_store.cc', - '$OPEN_DIR/localserver/common/safe_http_request.cc', - '$OPEN_DIR/localserver/common/update_task.cc', - '$OPEN_DIR/localserver/common/update_task_single_process.cc', - '$OPEN_DIR/localserver/file_submitter.cc', - '$OPEN_DIR/localserver/localserver_module.cc', - '$OPEN_DIR/localserver/managed_resource_store_module.cc', - '$OPEN_DIR/localserver/resource_store_module.cc', -]) - -env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/localserver/common/http_cookies.cc', -]) - -env.Append(FF3_CPPSRCS = [ - '$OPEN_DIR/localserver/common/http_cookies.cc', -]) - -env.Append(SF_CPPSRCS = [ - '$OPEN_DIR/localserver/common/http_cookies.cc', -]) - -#----------------------------------------------------------------------------- -# localserver/chrome + npapi - -env.Append(NPAPI_CPPSRCS = [ - '$OPEN_DIR/localserver/npapi/async_task_np.cc', -]) - -if env['OS'] == 'win32': - env.Append(NPAPI_CPPSRCS = [ - '$OPEN_DIR/localserver/chrome/gears_protocol_handler.cc', - '$OPEN_DIR/localserver/chrome/network_intercept_cr.cc', - '$OPEN_DIR/localserver/chrome/http_cookies_cr.cc', - '$OPEN_DIR/localserver/chrome/http_request_cr.cc', - '$OPEN_DIR/localserver/chrome/update_task_cr.cc', - ]) - -#----------------------------------------------------------------------------- -# localserver/safari - -env.Append(SF_CPPSRCS = [ - '$OPEN_DIR/localserver/safari/async_task_sf.mm', - '$OPEN_DIR/localserver/safari/http_cookies_sf.mm', - '$OPEN_DIR/localserver/safari/http_handler.mm', - '$OPEN_DIR/localserver/safari/http_request_delegate.mm', - '$OPEN_DIR/localserver/safari/http_request_sf.mm', - '$OPEN_DIR/localserver/safari/localserver_db_proxy.mm', - '$OPEN_DIR/localserver/safari/progress_input_stream.mm', - '$OPEN_DIR/localserver/safari/ui_thread.cc' -]) - -#----------------------------------------------------------------------------- -# localserver/firefox - -env.Append(FF3_CPPSRCS = [ - '$OPEN_DIR/localserver/firefox/async_task_ff.cc', - '$OPEN_DIR/localserver/firefox/cache_intercept.cc', - '$OPEN_DIR/localserver/firefox/http_request_ff.cc', - '$OPEN_DIR/localserver/firefox/progress_input_stream.cc', -]) - -#----------------------------------------------------------------------------- -# localserver/ie - -env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/localserver/ie/async_task_ie.cc', - '$OPEN_DIR/localserver/ie/file_submit_behavior.cc', - '$OPEN_DIR/localserver/ie/http_handler_ie.cc', - '$OPEN_DIR/localserver/ie/http_request_ie.cc', - '$OPEN_DIR/localserver/ie/progress_input_stream.cc', - '$OPEN_DIR/localserver/ie/update_task_ie.cc', - '$OPEN_DIR/localserver/ie/urlmon_utils.cc', -]) - -#----------------------------------------------------------------------------- -# dummy_module - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/dummy/dummy_module.cc', -]) - -#----------------------------------------------------------------------------- -# test - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/cctests/test.cc', -]) - -#----------------------------------------------------------------------------- -# ui/generated -# -# Anything with the _I18N suffix will be expanded for each language in -# I18N_LANGS - -env.Append(BROWSER_HTML_M4SRCS = [ - '$OPEN_DIR/ui/common/alert_dialog.html_m4', - '$OPEN_DIR/ui/common/permissions_dialog.html_m4', - '$OPEN_DIR/ui/common/settings_dialog.html_m4', - '$OPEN_DIR/ui/common/shortcuts_dialog.html_m4', -]) - -env.Append(FF3_I18N_M4SRCS = [ - '$OPEN_DIR/ui/generated/' + lang + '/i18n.dtd.m4' - for lang in env['I18N_LANGS'] -]) - -#----------------------------------------------------------------------------- -# ui/common (built for all browsers) - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/ui/common/alert_dialog.cc', - '$OPEN_DIR/ui/common/html_dialog.cc', - '$OPEN_DIR/ui/common/i18n_strings.cc', - '$OPEN_DIR/ui/common/permissions_dialog.cc', - '$OPEN_DIR/ui/common/window_utils.cc', -]) - -env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/ui/common/settings_dialog.cc', -]) - -env.Append(FF3_CPPSRCS = [ - '$OPEN_DIR/ui/common/settings_dialog.cc', -]) - -env.Append(SF_CPPSRCS = [ - '$OPEN_DIR/ui/common/settings_dialog.cc', -]) - -env.Append(BROWSER_STABSRCS = [ - '$OPEN_DIR/ui/common/alert_dialog.js.stab', - '$OPEN_DIR/ui/common/permissions_dialog.js.stab', - '$OPEN_DIR/ui/common/settings_dialog.js.stab', - '$OPEN_DIR/ui/common/shortcuts_dialog.js.stab', -]) - -#----------------------------------------------------------------------------- -# ui/npapi - -env.Append(NPAPI_M4SRCS = [ - '$OPEN_DIR/ui/ie/ui_resources.rc.m4', -]) - -#----------------------------------------------------------------------------- -# ui/chrome - -if env['OS'] == 'win32': - env.Append(NPAPI_CPPSRCS = [ - '$OPEN_DIR/ui/chrome/settings_dialog_cr.cc', - '$OPEN_DIR/ui/chrome/html_dialog_cr.cc', - ]) - -#----------------------------------------------------------------------------- -# ui/safari - -env.Append(SF_CPPSRCS = [ - '$OPEN_DIR/ui/safari/html_dialog_sf.mm', - '$OPEN_DIR/ui/safari/html_modeless_dialog_sf.mm', - '$OPEN_DIR/ui/safari/native_dialogs_osx.mm', - '$OPEN_DIR/ui/safari/settings_menu.mm', -]) - -#----------------------------------------------------------------------------- -# ui/factory - -env.Append(FF3_M4SRCS = [ - '$OPEN_DIR/ui/firefox/browser-overlay.js.m4', - '$OPEN_DIR/ui/firefox/browser-overlay.xul.m4', - '$OPEN_DIR/ui/firefox/chrome.manifest.m4', -]) - -env.Append(FF3_IDLSRCS = [ - '$OPEN_DIR/ui/firefox/ui_utils.idl', -]) - -env.Append(FF3_CPPSRCS = [ - '$OPEN_DIR/ui/firefox/html_dialog_ff.cc', - '$OPEN_DIR/ui/firefox/ui_utils.cc', -]) - -#----------------------------------------------------------------------------- -# ui/ie - -env.Append(IE_M4SRCS = [ - '$OPEN_DIR/ui/ie/tools_menu_item.rgs.m4', - '$OPEN_DIR/ui/ie/ui_resources.rc.m4', -]) - -env.Append(IE_IDLSRCS = [ - '$OPEN_DIR/ui/ie/html_dialog_host.idl', -]) - -env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/ui/ie/html_dialog_ie.cc', - '$OPEN_DIR/ui/ie/tools_menu_item.cc', -]) - -env.Append(IE_STABSRCS = [ - '$OPEN_DIR/ui/ie/string_table.rc.stab', -]) - -# Additional files specific to Win32 or WinCE. -if env['OS'] == 'win32': - env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/ui/ie/html_dialog_host.cc', - ]) -elif env['OS'] == 'wince': - env.Append(IE_M4SRCS = [ - '$OPEN_DIR/ui/ie/html_dialog_bridge_iemobile.rgs.m4', - ]) - - env.Append(IE_IDLSRCS = [ - '$OPEN_DIR/ui/ie/html_dialog_host_iemobile.idl', - '$OPEN_DIR/ui/ie/html_dialog_bridge_iemobile.idl', - ]) - - env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/ui/ie/html_dialog_host_iemobile.cc', - '$OPEN_DIR/ui/ie/html_dialog_bridge_iemobile.cc', - ]) - -#----------------------------------------------------------------------------- -# workerpool/npapi - -env.Append(USING_NPAPI_CPPSRCS = [ - '$OPEN_DIR/workerpool/common/workerpool_utils.cc', - '$OPEN_DIR/workerpool/npapi/pool_threads_manager.cc', - '$OPEN_DIR/workerpool/workerpool.cc', -]) - -#----------------------------------------------------------------------------- -# workerpool/firefox - -env.Append(FF3_CPPSRCS = [ - '$OPEN_DIR/workerpool/common/workerpool_utils.cc', - '$OPEN_DIR/workerpool/firefox/pool_threads_manager.cc', - '$OPEN_DIR/workerpool/workerpool.cc', -]) - -#----------------------------------------------------------------------------- -# workerpool/ie - -env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/workerpool/common/workerpool_utils.cc', - '$OPEN_DIR/workerpool/ie/pool_threads_manager.cc', - '$OPEN_DIR/workerpool/workerpool.cc', -]) - -#----------------------------------------------------------------------------- -# timer - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/timer/timer.cc', -]) - -#----------------------------------------------------------------------------- -# httprequest - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/httprequest/httprequest.cc', - '$OPEN_DIR/httprequest/httprequest_upload.cc', -]) - -#----------------------------------------------------------------------------- -# blob - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/blob/blob.cc', - '$OPEN_DIR/blob/blob_builder.cc', - '$OPEN_DIR/blob/blob_builder_module.cc', - '$OPEN_DIR/blob/blob_interface.cc', - '$OPEN_DIR/blob/blob_test.cc', - '$OPEN_DIR/blob/blob_utils.cc', - '$OPEN_DIR/blob/buffer_blob.cc', - '$OPEN_DIR/blob/fail_blob.cc', - '$OPEN_DIR/blob/file_blob.cc', - '$OPEN_DIR/blob/join_blob.cc', - '$OPEN_DIR/blob/slice_blob.cc', -]) - -# TODO(bpm): Make this cross-browser, not Firefox- or Safari-specific. -env.Append(FF3_CPPSRCS = [ - '$OPEN_DIR/blob/blob_input_stream_ff.cc', - '$OPEN_DIR/blob/blob_input_stream_ff_test.cc', -]) - -env.Append(SF_CPPSRCS = [ - '$OPEN_DIR/blob/blob_input_stream_sf.mm', - '$OPEN_DIR/blob/blob_input_stream_sf_test.mm', -]) - -#----------------------------------------------------------------------------- -# inspector - -if not env['OFFICIAL_BUILD']: - env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/inspector/inspector_resources.cc', - ]) - -#----------------------------------------------------------------------------- -# installer/wince - -if env['OS'] == 'wince': - env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/installer/common/cab_updater.cc', - '$OPEN_DIR/installer/common/download_task.cc', - '$OPEN_DIR/installer/common/installer_utils.cc', - '$OPEN_DIR/installer/common/periodic_checker.cc', - '$OPEN_DIR/installer/common/process_restarter.cc', - ]) - - env.Append(IE_STABSRCS = [ - '$OPEN_DIR/installer/iemobile/setup.rc.stab', - ]) - - env.Append(WINCE_SETUP_CPPSRCS = [ - '$OPEN_DIR/installer/common/process_restarter.cc', - '$OPEN_DIR/installer/iemobile/setup.cc', - ]) - - env.Append(WINCE_SETUP_RESSRCS = [ - '$GENFILES_DIR/setup.rc', - ]) - -#----------------------------------------------------------------------------- -# image - -# The Image API is not yet enabled in official builds. -if not env['OFFICIAL_BUILD'] and env['OS'] != 'wince': - env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/image/backing_image.cc', - '$OPEN_DIR/image/image.cc', - '$OPEN_DIR/image/image_loader.cc', - ]) - -#----------------------------------------------------------------------------- -# factory/npapi - -env.Append(USING_NPAPI_CPPSRCS = [ - '$OPEN_DIR/factory/factory_impl.cc', - '$OPEN_DIR/factory/factory_np.cc', - '$OPEN_DIR/factory/factory_utils.cc', -]) - -#----------------------------------------------------------------------------- -# factory/firefox - -env.Append(FF3_CPPSRCS = [ - '$OPEN_DIR/factory/factory_impl.cc', - '$OPEN_DIR/factory/factory_ff.cc', - '$OPEN_DIR/factory/factory_utils.cc', -]) - -#----------------------------------------------------------------------------- -# factory/ie - -env.Append(IE_M4SRCS = [ - '$OPEN_DIR/factory/factory_ie.rgs.m4', -]) - -env.Append(IE_CPPSRCS = [ - '$OPEN_DIR/factory/factory_impl.cc', - '$OPEN_DIR/factory/factory_ie.cc', - '$OPEN_DIR/factory/factory_utils.cc', -]) - -#----------------------------------------------------------------------------- -# geolocation - -env.Append(BROWSER_CPPSRCS = [ - '$OPEN_DIR/geolocation/access_token_manager.cc', - '$OPEN_DIR/geolocation/backoff_manager.cc', - '$OPEN_DIR/geolocation/empty_device_data_provider.cc', - '$OPEN_DIR/geolocation/geolocation.cc', - '$OPEN_DIR/geolocation/geolocation_db.cc', - '$OPEN_DIR/geolocation/geolocation_db_test.cc', - '$OPEN_DIR/geolocation/geolocation_test.cc', - '$OPEN_DIR/geolocation/gps_device_android.cc', - '$OPEN_DIR/geolocation/gps_device_wince.cc', - '$OPEN_DIR/geolocation/gps_location_provider.cc', - '$OPEN_DIR/geolocation/location_provider.cc', - '$OPEN_DIR/geolocation/location_provider_pool.cc', - '$OPEN_DIR/geolocation/looper_thread_android.cc', - '$OPEN_DIR/geolocation/network_location_provider.cc', - '$OPEN_DIR/geolocation/network_location_request.cc', - '$OPEN_DIR/geolocation/radio_data_provider_android.cc', - '$OPEN_DIR/geolocation/radio_data_provider_wince.cc', - '$OPEN_DIR/geolocation/reverse_geocoder.cc', - '$OPEN_DIR/geolocation/timed_callback.cc', - '$OPEN_DIR/geolocation/wifi_data_provider_android.cc', - '$OPEN_DIR/geolocation/wifi_data_provider_common.cc', - '$OPEN_DIR/geolocation/wifi_data_provider_linux.cc', - '$OPEN_DIR/geolocation/wifi_data_provider_osx.cc', - '$OPEN_DIR/geolocation/wifi_data_provider_win32.cc', - '$OPEN_DIR/geolocation/wifi_data_provider_wince.cc', - '$OPEN_DIR/geolocation/wifi_data_provider_windows_common.cc', -]) - -#----------------------------------------------------------------------------- -# vista_broker - -env.Append(VISTA_BROKER_CPPSRCS = [ - '$OPEN_DIR/base/common/process_utils_win32.cc', - '$OPEN_DIR/base/common/string16.cc', - '$OPEN_DIR/base/common/string_utils.cc', - '$OPEN_DIR/desktop/shortcut_utils_win32.cc', - '$OPEN_DIR/vista_broker/vista_broker.cc', - - '$THIRD_PARTY_DIR/convert_utf/ConvertUTF.c' -]) - -env.Append(VISTA_BROKER_RESSRCS = [ - '$GENFILES_DIR/string_table.rc', - '$OPEN_DIR/vista_broker/vista_broker.rc', -]) - -#----------------------------------------------------------------------------- -# Safari Installer Plugin - -env.Append(SF_INSTALLER_PLUGIN_CPPSRCS = [ - '$OPEN_DIR/base/safari/advanced_stats_sheet.m', -]) - -#----------------------------------------------------------------------------- -# Safari InputManager - -env.Append(SF_INPUTMANAGER_CPPSRCS = [ - '$OPEN_DIR/base/safari/enabler.m', - '$OPEN_DIR/base/safari/loader.mm', -]) - -#----------------------------------------------------------------------------- -# Safari Proxy DLL - -env.Append(SF_PROXY_DLL_CPPSRCS = [ - '$OPEN_DIR/base/safari/plugin_proxy.mm', -]) - -#----------------------------------------------------------------------------- -# resources - -env.Append(NPAPI_RESSRCS = [ - '$GENFILES_DIR/ui_resources.rc', - '$OPEN_DIR/base/npapi/module.rc', -]) - -# The string table uses multiple languages, which are not supported by -# LoadString on WinCE. -if env['OS'] != 'wince': - env.Append(IE_RESSRCS = [ - '$GENFILES_DIR/string_table.rc', - ]) - -env.Append(IE_RESSRCS = [ - '$GENFILES_DIR/ui_resources.rc', - '$OPEN_DIR/base/npapi/module.rc', -]) - -env.Append(FF3_RESOURCES = [ - '$FF3_OUTDIR/genfiles/browser-overlay.js', - '$FF3_OUTDIR/genfiles/browser-overlay.xul', - '$FF3_OUTDIR/genfiles/permissions_dialog.html', - '$FF3_OUTDIR/genfiles/settings_dialog.html', - '$FF3_OUTDIR/genfiles/shortcuts_dialog.html', -]) - -env.Append(COMMON_RESOURCES = [ - '$OPEN_DIR/ui/common/blank.gif', - '$OPEN_DIR/ui/common/button_bg.gif', - '$OPEN_DIR/ui/common/button_corner_black.gif', - '$OPEN_DIR/ui/common/button_corner_blue.gif', - '$OPEN_DIR/ui/common/button_corner_grey.gif', - '$OPEN_DIR/ui/common/icon_32x32.png', - '$OPEN_DIR/ui/common/local_data.png', - '$OPEN_DIR/ui/common/location_data.png', -]) - -#----------------------------------------------------------------------------- -# libs - -if not env['OFFICIAL_BUILD'] and env['OS'] in ['win32', 'osx']: - env.Append( - LIBPATH = ['$THIRD_PARTY_DIR/skia'], - LIBS = ['${LIBPREFIX}skia-${MODE}-${OS}-${ARCH}${LIBSUFFIX}'], - ) - -if env['OS'] == 'win32': - env.Append(NPAPI_SHLINKSRCS = [ - '$THIRD_PARTY_DIR/v8/bin-${MODE}/v8_base.lib', - '$THIRD_PARTY_DIR/v8/bin-${MODE}/v8_snapshot.lib', - ]) - env.Append(NPAPI_SHLINKSRCS = [ - '$OPEN_DIR/base/chrome/module.def', - ]) - env.Append(IE_SHLINKSRCS = [ - '$OPEN_DIR/tools/mscom.def', - ]) - -Return('env') diff --git a/gears/SConscript.installers b/gears/SConscript.installers deleted file mode 100644 index 4cefdb1..0000000 --- a/gears/SConscript.installers +++ /dev/null @@ -1,391 +0,0 @@ -# Copyright (c) 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. - -import fnmatch -import os -import re -import shutil -import subprocess -import utils -import SCons.Node - -Import('env') - -env = env.Clone() - -if env['OS'] in ['win32', 'wince']: - env.Append(DATE = 'echo %DATE%.%TIME%') -else: - env.Append(DATE = 'date') - -def GetInputs(var): return utils.GetInputs(var, env) - -def Shell(cmd): - """Execute a shell command and return the output.""" - cmd[0] = env.Entry(cmd[0]).abspath - cmd = env.subst(cmd) - return subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE).communicate()[0] - -if env['OS'] == 'win32': - def GGUIDGen(value): - """Generate a GGUID for the given value.""" - return Shell(['$GGUIDGEN', '$NAMESPACE_GUID', value + '-$VERSION']) - env.Replace( - GGUIDGEN = '#/$OPEN_DIR/tools/gguidgen.exe', - NAMESPACE_GUID = '36F65206-5D4E-4752-9D52-27708E10DA79', -# MSI version numbers must have the form <major>.<minor>.<build>. To meet this, -# we combine our build and patch version numbers like so: -# MSI_VERSION = <major>.<minor>.<BUILD * 100 + PATCH>. -# Note: This assumes that the BUILD and PATCH variables adhere to the range -# requirements in version.mk. See comments in version.mk for more details. - MSI_BUILD = eval(env.subst('$BUILD * 100 + $PATCH')), - MSI_VERSION = '${MAJOR}.${MINOR}.${MSI_BUILD}', - ) - - # Building wxiobjs with candle - env.Replace( - CANDLEDEFPREFIX = '-d', - CANDLEDEFSUFFIX = '', - _CANDLEDEFFLAGS = ('${_defines(CANDLEDEFPREFIX, CANDLEDEFINES, ' - 'CANDLEDEFSUFFIX, __env__)}'), - CANDLECOM = 'candle.exe -out $TARGET $SOURCE ${_CANDLEDEFFLAGS}', - ) - env.Append( -# Note: Since light.exe is run from $OPEN_DIR, candle.exe must generate -# output with paths relative to that dir. - SCONS_DIR = '..', # the scons dir relative to OPEN_DIR -# You can change the names of ProductId vars, but NEVER change their values! - CANDLEDEFINES = [ - ('OurWin32ProductId', - GGUIDGen('OUR_PRODUCT_ID')), - ('OurComponentGUID_FFComponentsDirFiles', - GGUIDGen('OUR_COMPONENT_GUID_FF_COMPONENTS_DIR_FILES')), - ('OurComponentGUID_FFContentDirFiles', - GGUIDGen('OUR_COMPONENT_GUID_FF_CONTENT_DIR_FILES')), - ('OurComponentGUID_FFDirFiles', - GGUIDGen('OUR_COMPONENT_GUID_FF_DIR_FILES')), - ('OurComponentGUID_FFLibDirFiles', - GGUIDGen('OUR_COMPONENT_GUID_FF_LIB_DIR_FILES')), - ('OurComponentGUID_FFRegistry', - GGUIDGen('OUR_COMPONENT_GUID_FF_REGISTRY')), - ('OurComponentGUID_IEFiles', - GGUIDGen('OUR_COMPONENT_GUID_IE_FILES')), - ('OurComponentGUID_IERegistry', - GGUIDGen('OUR_COMPONENT_GUID_IE_REGISTRY')), - ('OurComponentGUID_SharedFiles', - GGUIDGen('OUR_COMPONENT_GUID_SHARED_FILES')), - ('OurComponentGUID_SharedVersionedFiles', - GGUIDGen('OUR_COMPONENT_GUID_SHARED_VERSIONED_FILES')), - ('OurComponentGUID_SharedRegistry', - GGUIDGen('OUR_COMPONENT_GUID_SHARED_REGISTRY')), - ('OurNpapiProductId', - GGUIDGen('OUR_2ND_PRODUCT_ID')), - ('OurComponentGUID_NpapiFiles', - GGUIDGen('OUR_COMPONENT_GUID_NPAPI_FILES')), - ('OurComponentGUID_NpapiRegistry', - GGUIDGen('OUR_COMPONENT_GUID_NPAPI_REGISTRY')), - ('OurMsiVersion', '$MSI_VERSION'), - ('OurCommonPath', '$COMMON_OUTDIR'), - ('OurIEPath', '$IE_OUTDIR'), - ('OurIpcTestPath', '$COMMON_OUTDIR'), - ('OurFFPath', '$INSTALLER_OUTDIR/$INSTALLER_BASENAME'), - ('OurNpapiPath', '$NPAPI_OUTDIR'), - ] - ) - wix_langs = [re.sub('-', '_', lang) for lang in env['I18N_LANGS']] - env.Append( - CANDLEDEFINES = - [('OurComponentGUID_FFLang' + lang + 'DirFiles', - GGUIDGen('OUR_COMPONENT_GUID_FF_' + lang + '_DIR_FILES')) - for lang in wix_langs], - ) - -def SafeMkdir(dir): - """Like the builtin Mkdir, but doesn't fail if the dir exists.""" - def Func(target, source, env): - dir_subst = env.subst(dir, target=target) - if not os.path.exists(dir_subst): - os.makedirs(dir_subst) - return 0 - return Action(Func, 'SafeMkdir("' + dir + '")') - -def RecursiveDelete(pattern): - """Recursively deletes directories matching a pattern.""" - def Func(target, source, env): - # strip off '.dir' suffix - target_dir = env.subst('${TARGET.base}', target=target) - for root, dirs, files in os.walk(target_dir): - if fnmatch.fnmatch(os.path.normpath(root), pattern): - print 'Deleting', root - shutil.rmtree(root) - return 0 - return Action(Func, 'RecursiveDelete("' + pattern + '")') - -def ToUnixPath(path): - """Converts windows-style \ to unix-style /.""" - return re.sub(r'\\', r'/', path) - -def DirBuilder(env, dirtarget, dirsrcs): - """Builder that makes a directory tree by copying source files to - corresponding locations inside 'dirtarget'. 'dirsrcs' specifies the list of - mappings from source file/directory to the target location. It's formatted - like: - (<target file or dir>, <list of source files>) - - Note: source files that come from an output directory must be explicitly - specified relative to the toplevel dir '#'. - Note: as shorthand, if the target ends with a '/', then the sources will - be placed into that dir. Otherwise, source is renamed into the target. - """ - - srcs = [] - actions = [Delete('${TARGET.base}')] - for target, sources in dirsrcs: - target_is_dir = target.endswith('/') - if target_is_dir: - actions.append(SafeMkdir('${TARGET.base}/' + target)) - else: - actions.append(SafeMkdir('${TARGET.base}/' + os.path.dirname(target))) - for source in env.Flatten(sources): - source = env.subst(source, conv=lambda x:x) - srcs.append(source) - - # Special-case for Nodes and Node lists: use their absolute paths for - # the Copy() action, otherwise it will be relative to our variant dir - # (not what Copy expects). - if isinstance(source, list): source = source[0] - if isinstance(source, SCons.Node.Node): source = source.abspath - - # HACK: Compensate for the workaround below. We want the .dir file - # to be the dependency to the Command() builder, but we want to copy - # the actual directory - so strip the extension here. - if source.endswith('.dir'): - source = source[:-4] - - if target_is_dir: - actions.append( - Copy('${TARGET.base}/' + target + os.path.basename(source), - source)) - else: - actions.append(Copy('${TARGET.base}/' + target, source)) - - # Remove any .svn directories that were copied. - actions.append(RecursiveDelete('*/.svn')) - - # HACK: Workaround for bug in scons where directories aren't checked for - # dependency changes. Instead, we make a temp file the target, and ensure - # that that file changes everytime we execute these actions. - # See http://scons.tigris.org/issues/show_bug.cgi?id=2261 - actions += ['$DATE > ${TARGET}'] - return env.Command(env.subst(dirtarget) + '.dir', srcs, actions) -env.AddMethod(DirBuilder) - -def FirefoxInstaller(): - dirsrcs = [ - ('/', ['$FF3_OUTDIR/genfiles/install.rdf', - '$FF3_OUTDIR/genfiles/chrome.manifest']), - ('lib/', ['$OPEN_DIR/base/firefox/static_files/lib/updater.js']), - ('chrome/chromeFiles/content/', - GetInputs('$FF3_RESOURCES $COMMON_RESOURCES')), - ('chrome/chromeFiles/locale', ['$FF3_OUTDIR/genfiles/i18n']), - ('components/', - ['$FF3_MODULE_TYPELIB', - '$OPEN_DIR/base/firefox/static_files/components/bootstrap.js']), - ('components/${SHLIBPREFIX}gears${SHLIBSUFFIX}', ['$FF2_MODULE']), - ('components/${SHLIBPREFIX}gears_ff2${SHLIBSUFFIX}', ['$FF3_MODULE']), - ] - - if env['USING_CCTESTS']: - dirsrcs += [ - ('components/', ['$IPC_TEST_EXE']), - ] - if env['OS'] != 'win32': - # TODO(playmobil): Inspector should be located in extensions dir on win32. - dirsrcs += [ - ('resources/inspector', [env.Dir('#/$OPEN_DIR/inspector')]), - ('resources/inspector/common/', ['$OPEN_DIR/sdk/gears_init.js', - '$OPEN_DIR/sdk/samples/sample.js']), - ] - if env['MODE'] == 'dbg' and env['OS'] in ['win32', 'wince']: - dirsrcs += [ - ('components/gears_ff2.pdb', ['$FF2_MODULE_PDB']), - ('components/gears.pdb', ['$FF3_MODULE_PDB']), - ] - if env['OS'] == 'osx': - dirsrcs += [ - ('resources/', ['$OSX_LAUNCHURL_EXE']), - ] - - dir = env.DirBuilder('$INSTALLER_OUTDIR/$INSTALLER_BASENAME', dirsrcs) - actions = [ - # Mark files writeable to allow .xpi rebuilds - 'chmod -R 777 ${SOURCE.base}', - '(cd ${SOURCE.base} && zip -r ../${TARGET.file} .)' - ] - - return env.Command('$FF_XPI', dir, actions) -firefox_installer = FirefoxInstaller() - -def Win32Installer(): - wxiobj = env.Command( - '$COMMON_GENFILES_DIR/win32_msi.wxiobj', - '$COMMON_GENFILES_DIR/win32_msi.wxs', - '$CANDLECOM') - # TODO(mpcomplete): remove this if/when the notifier goes away. This - # creates fake targets to satisfy the installer build. - notifier = env.Command( - [ - '$COMMON_OUTDIR/notifier.exe', - '$COMMON_OUTDIR/notifier.dll', - '$COMMON_OUTDIR/notifier_test.exe' - ], [], - 'touch $TARGETS') - # light.exe must be run from $OPEN_DIR - msi = env.Command( - '$WIN32_INSTALLER_MSI', - [wxiobj, notifier, firefox_installer, '$IE_MODULE', '$NPAPI_MODULE'], - 'cd $OPEN_DIR && light.exe -out ${TARGET.abspath} ${SOURCES[0].abspath}') - return msi -win32_installer = Win32Installer() - -def WinCEInstaller(): - env['ToUnixPath'] = ToUnixPath - inf_outdir = ToUnixPath(env.subst('$IE_OUTDIR')) - inf = env.Command( - '$COMMON_GENFILES_DIR/wince_cab_fixed.inf', - '$COMMON_GENFILES_DIR/wince_cab_ie.inf', - 'sed -e "s#bin-....wince-arm.ie.#' + inf_outdir + '#g" $SOURCE > $TARGET') - cab = env.Command( - '$WINCE_INSTALLER_CAB', - [inf, '$IE_MODULE', '$IE_WINCE_SETUP_DLL'], - ['cabwiz ${ToUnixPath(str(SOURCE))} /compress' - ' /err ${SOURCES[0].base}.log', - Copy('$TARGET', '${SOURCE.base}.CAB')]) - return cab -wince_installer = WinCEInstaller() - -def SafariPluginBundle(): - """This is the actual gears plugin bundle for Safari.""" - dirsrcs = [ - ('Contents/', ['$SF_OUTDIR/genfiles/Info.plist']), - ('Contents/Resources/English.lproj/InfoPlist.strings', - ['$OPEN_DIR/tools/osx/English.lproj/InfoPlist.strings']), - ('Contents/Resources/', env.Glob('#/$OPEN_DIR/ui/safari/*.nib')), - ('Contents/Resources/', ['$CRASH_SENDER_EXE']), - ('Contents/Resources/', ['$OSX_CRASH_INSPECTOR_EXE']), - ('Contents/Resources/', ['$OSX_LAUNCHURL_EXE']), - ('Contents/MacOS/', ['$SF_MODULE']), - ] - - if env['USING_CCTESTS']: - dirsrcs += [ - ('Contents/Resources/', ['$IPC_TEST_EXE']), - ] - - return env.DirBuilder('$SF_PLUGIN_BUNDLE', dirsrcs) -safari_plugin_bundle = SafariPluginBundle() - -def SafariPluginProxyBundle(): - """This is a proxy plugin which simply loads gears into Safari and keeps - it in memory. It exists so that gears doesn't unload when Safari wants us - to, since that causes crashes.""" - dirsrcs = [ - ('Contents/', ['$SF_OUTDIR/genfiles/Info.plist']), - ('Contents/MacOS/${SHLIBPREFIX}gears${SHLIBSUFFIX}', ['$SF_PROXY_DLL']), - ('Contents/Resources/', [safari_plugin_bundle]), - ('Contents/Resources/', ['$OPEN_DIR/tools/osx/uninstall.command']), - ] - - return env.DirBuilder('$SF_PLUGIN_PROXY_BUNDLE', dirsrcs) -safari_plugin_proxy_bundle = SafariPluginProxyBundle() - -def SafariInstallerPluginBundle(): - dirsrcs = [ - ('Contents/Info.plist', - ['$OPEN_DIR/base/safari/advanced_stats_sheet.plist']), - ('Contents/MacOS/InstallerPlugin', ['$SF_INSTALLER_PLUGIN_EXE']), - ('Contents/Resources/AdvancedStatsSheet.nib', - [env.Dir('#/$OPEN_DIR/base/safari/advanced_stats_sheet.nib')]), - ] - - return env.DirBuilder('$SF_INSTALLER_PLUGIN_BUNDLE', dirsrcs) -safari_installer_plugin_bundle = SafariInstallerPluginBundle() - -def SafariInputManagerBundle(): - info = env.Command('$SF_OUTDIR/genfiles/Enabler-Info.plist', - '$OPEN_DIR/tools/osx/Enabler-Info.plist', - 'cat $SOURCE |' - 'sed \'s/$${EXECUTABLE_NAME}/GearsEnabler/\' |' - 'sed \'s/$${PRODUCT_NAME}/GearsEnabler/\' > $TARGET') - dirsrcs = [ - ('GearsEnabler.bundle/Contents/Info.plist', [info]), - ('GearsEnabler.bundle/Contents/MacOS/', ['$SF_INPUTMANAGER_EXE']), - ('GearsEnabler.bundle/Contents/Resources/English.lproj/', - ['$OPEN_DIR/tools/osx/English.lproj/InfoPlist.strings']), - ('Info', ['$OPEN_DIR/tools/osx/Info']), - ] - - return env.DirBuilder('$SF_INPUTMANAGER_BUNDLE', dirsrcs) -safari_input_manager_bundle = SafariInputManagerBundle() - -def SafariInstallerPackage(): - pkg = env.Iceberg(env.Dir('${SF_INSTALLER_PKG}'), - [ - '$SF_OUTDIR/genfiles/installer.packproj', - safari_plugin_proxy_bundle, - safari_input_manager_bundle, - ]) - return pkg -safari_installer_package = SafariInstallerPackage() - -def SafariKeystoneInstaller(): - if not os.path.exists(env.Dir('#/$PRIVATE_DIR').abspath): - print 'Skipping Safari Keystone installer. Required sources are not public.' - return [] - - env.Append(CREATE_DISK_IMAGE = - "/usr/bin/hdiutil create -ov -imagekey zlib-level=9 -fs HFS+" - " -format UDZO -volname '$FRIENDLY_NAME ${VERSION}'" - " -srcfolder '${INSTALLER_OUTDIR}/Safari/dmg/' -scrub" - " -nocrossdev '${SF_KEYSTONE_INSTALLER_DMG}'" - ) - - pkg = env.Iceberg(env.Dir('${SF_KEYSTONE_INSTALLER_MPKG}'), - ['$SF_OUTDIR/genfiles/keystone_installer.packproj']) - env.Depends(pkg, GetInputs('$SF_M4S')) - env.Depends(pkg, safari_installer_package) - - dirsrcs = [ - ('/', [pkg]), - ('/.keystone_install', - ['$PRIVATE_DIR/tools/osx/installer/keystone_install']), - ] - dmg = env.DirBuilder('$INSTALLER_OUTDIR/Safari/dmg', dirsrcs) - env.AddPostAction(dmg, 'chmod +x ${TARGET.base}/.keystone_install') - # hdiutil is crashy under leopard, so try twice. - env.AddPostAction(dmg, '$CREATE_DISK_IMAGE || $CREATE_DISK_IMAGE') - - return dmg -safari_keystone_installer = SafariKeystoneInstaller() - -installers = [] -if 'FF3' in env['VALID_BROWSERS']: - installers += firefox_installer -if 'SF' in env['VALID_BROWSERS']: - installers += [ - safari_input_manager_bundle, - safari_plugin_bundle, - safari_plugin_proxy_bundle, - safari_installer_plugin_bundle, - safari_installer_package, - safari_input_manager_bundle, - safari_keystone_installer, - ] -if env['OS'] == 'win32': - installers += win32_installer -if env['OS'] == 'wince': - installers += wince_installer - -env.Alias('gears-installers', installers) diff --git a/gears/SConscript.libbreakpad_osx b/gears/SConscript.libbreakpad_osx deleted file mode 100644 index ced4bd8..0000000 --- a/gears/SConscript.libbreakpad_osx +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 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. - -Import('env') - -env = env.Clone( -) - -env.Append( -) - -input_files = [ - '$THIRD_PARTY_DIR/breakpad_osx/src/client/mac/handler/dynamic_images.cc', - '$THIRD_PARTY_DIR/breakpad_osx/src/client/mac/handler/exception_handler.cc', - '$THIRD_PARTY_DIR/breakpad_osx/src/common/mac/file_id.cc', - '$THIRD_PARTY_DIR/breakpad_osx/src/common/mac/macho_id.cc', - '$THIRD_PARTY_DIR/breakpad_osx/src/common/mac/macho_utilities.cc', - '$THIRD_PARTY_DIR/breakpad_osx/src/common/mac/macho_walker.cc', - '$THIRD_PARTY_DIR/breakpad_osx/src/client/minidump_file_writer.cc', - '$THIRD_PARTY_DIR/breakpad_osx/src/client/mac/handler/minidump_generator.cc', - '$THIRD_PARTY_DIR/breakpad_osx/src/client/mac/handler/protected_memory_allocator.cc', - '$THIRD_PARTY_DIR/breakpad_osx/src/common/string_conversion.cc', - '$THIRD_PARTY_DIR/breakpad_osx/src/common/mac/string_utilities.cc', -] - -env.GearsStaticLibrary('breakpad_osx-gears', input_files) diff --git a/gears/SConscript.libgd b/gears/SConscript.libgd deleted file mode 100644 index a875b45..0000000 --- a/gears/SConscript.libgd +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright (c) 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. - -# Ripped and modded from chrome. - -Import('env') - -env = env.Clone( -) - -env.Replace( - LIBGD_DIR = '$THIRD_PARTY_DIR/libgd', - CPPPATH = [ - '$LIBGD_DIR', - '$THIRD_PARTY_DIR/libjpeg', - '$THIRD_PARTY_DIR/libpng', - '$THIRD_PARTY_DIR/zlib', - '$VC80_CPPPATH', - ], -) - -env.Append( - CPPDEFINES = [ - 'HAVE_CONFIG_H', - 'BGDWIN32', - ], - -) - -if env['OS'] == 'win32': - env.Append( - CPPFLAGS = [ -# Disable some warnings when building third-party code, so we can enable /WX. -# Examples: -# warning C4244: conversion from 'type1' to 'type2', possible loss of data -# warning C4018: signed/unsigned mismatch in comparison -# warning C4003: not enough actual parameters for macro - '/wd4244', - '/wd4996', - '/wd4005', - '/wd4142', - '/wd4018', - '/wd4133', - '/wd4102', - ], - ) -elif env['OS'] in ['linux', 'osx']: - env.Append( - CPPFLAGS = [ - '-Wno-unused-variable', - '-Wno-unused-function', - '-Wno-unused-label', - ], - ) - -input_files = [ - '$LIBGD_DIR/gd.c', - '$LIBGD_DIR/gdfx.c', - '$LIBGD_DIR/gd_security.c', - '$LIBGD_DIR/gd_gd.c', - '$LIBGD_DIR/gd_gd2.c', - '$LIBGD_DIR/gd_io.c', - '$LIBGD_DIR/gd_io_dp.c', - '$LIBGD_DIR/gd_gif_in.c', - '$LIBGD_DIR/gd_gif_out.c', - '$LIBGD_DIR/gd_io_file.c', - '$LIBGD_DIR/gd_io_ss.c', - '$LIBGD_DIR/gd_jpeg.c', - '$LIBGD_DIR/gd_png.c', - '$LIBGD_DIR/gd_ss.c', - '$LIBGD_DIR/gd_topal.c', - '$LIBGD_DIR/gd_wbmp.c', - '$LIBGD_DIR/gdcache.c', - '$LIBGD_DIR/gdfontg.c', - '$LIBGD_DIR/gdfontl.c', - '$LIBGD_DIR/gdfontmb.c', - '$LIBGD_DIR/gdfonts.c', - '$LIBGD_DIR/gdfontt.c', - '$LIBGD_DIR/gdft.c', - '$LIBGD_DIR/gdhelpers.c', - '$LIBGD_DIR/gdkanji.c', - '$LIBGD_DIR/gdtables.c', - '$LIBGD_DIR/gdxpm.c', - '$LIBGD_DIR/wbmp.c', -] - -env.GearsStaticLibrary('gd', input_files) diff --git a/gears/SConscript.libjpeg b/gears/SConscript.libjpeg deleted file mode 100644 index 4e445b0..0000000 --- a/gears/SConscript.libjpeg +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (c) 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. - -# Ripped and modded from chrome. - -Import('env') - -env = env.Clone( - LIBJPEG_DIR = '' -) - -env.Replace( - LIBJPEG_DIR = '$THIRD_PARTY_DIR/libjpeg', - CPPPATH = [ - '$LIBJPEG_DIR', - '$VC80_CPPPATH', - ], -) - -if env['OS'] in ['osx', 'linux']: - env.Append( - CCFLAGS = [ - '-Wno-main', - ], - ) - -input_files = [ - '$LIBJPEG_DIR/jcapimin.c', - '$LIBJPEG_DIR/jcapistd.c', - '$LIBJPEG_DIR/jccoefct.c', - '$LIBJPEG_DIR/jccolor.c', - '$LIBJPEG_DIR/jcdctmgr.c', - '$LIBJPEG_DIR/jchuff.c', - '$LIBJPEG_DIR/jcinit.c', - '$LIBJPEG_DIR/jcmainct.c', - '$LIBJPEG_DIR/jcmarker.c', - '$LIBJPEG_DIR/jcmaster.c', - '$LIBJPEG_DIR/jcomapi.c', - '$LIBJPEG_DIR/jcparam.c', - '$LIBJPEG_DIR/jcphuff.c', - '$LIBJPEG_DIR/jcprepct.c', - '$LIBJPEG_DIR/jcsample.c', - '$LIBJPEG_DIR/jctrans.c', - '$LIBJPEG_DIR/jdapimin.c', - '$LIBJPEG_DIR/jdapistd.c', - '$LIBJPEG_DIR/jdatadst.c', - '$LIBJPEG_DIR/jdatasrc.c', - '$LIBJPEG_DIR/jdcoefct.c', - '$LIBJPEG_DIR/jdcolor.c', - '$LIBJPEG_DIR/jddctmgr.c', - '$LIBJPEG_DIR/jdhuff.c', - '$LIBJPEG_DIR/jdinput.c', - '$LIBJPEG_DIR/jdmainct.c', - '$LIBJPEG_DIR/jdmarker.c', - '$LIBJPEG_DIR/jdmaster.c', - '$LIBJPEG_DIR/jdmerge.c', - '$LIBJPEG_DIR/jdphuff.c', - '$LIBJPEG_DIR/jdpostct.c', - '$LIBJPEG_DIR/jdsample.c', - '$LIBJPEG_DIR/jdtrans.c', - '$LIBJPEG_DIR/jerror.c', - '$LIBJPEG_DIR/jfdctflt.c', - '$LIBJPEG_DIR/jfdctfst.c', - '$LIBJPEG_DIR/jfdctint.c', - '$LIBJPEG_DIR/jidctflt.c', - '$LIBJPEG_DIR/jidctfst.c', - '$LIBJPEG_DIR/jidctint.c', - '$LIBJPEG_DIR/jidctred.c', - '$LIBJPEG_DIR/jquant1.c', - '$LIBJPEG_DIR/jquant2.c', - '$LIBJPEG_DIR/jutils.c', - '$LIBJPEG_DIR/jmemmgr.c', - '$LIBJPEG_DIR/jmemnobs.c', -] - -env.GearsStaticLibrary('jpeg-gears', input_files) diff --git a/gears/SConscript.libmozjs b/gears/SConscript.libmozjs deleted file mode 100644 index 23a311529..0000000 --- a/gears/SConscript.libmozjs +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright (c) 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. - -Import('env') - -env = env.Clone( -) - -if env['OS'] == 'osx': - env.Append( - CPPDEFINES = [ - 'JS_THREADSAFE', - 'XP_UNIX', - 'DARWIN', - 'HAVE_BSD_FLOCK', - 'XP_MACOSX', - 'HAVE_LCHOWN', - 'HAVE_STRERROR', - 'FORCE_PR_LOG', - '_PR_PTHREADS', - 'UHAVE_CVAR_BUILT_ON_SEM', - '_NSPR_BUILD_', - 'OSARCH=Darwin', - 'STATIC_JS_API', - 'JS_USE_SAFE_ARENA', - 'TRIMMED', - 'JS_HAS_EXPORT_IMPORT' - ], - CPPPATH = '$MOZJS_INCLUDE_PATHS', - ) -elif env['OS'] == 'android': - env.Append( - CPPDEFINES = [ - 'JS_THREADSAFE', - 'XP_UNIX', - 'HAVE_STRERROR', - 'FORCE_PR_LOG', - '_PR_PTHREADS', - 'UHAVE_CVAR_BUILT_ON_SEM', - '_NSPR_BUILD_', - 'OSARCH=Android', - 'STATIC_JS_API', - 'JS_USE_SAFE_ARENA', - 'TRIMMED', - 'JS_HAS_EXPORT_IMPORT', - ], - CPPPATH = '$MOZJS_INCLUDE_PATHS', - ) - -input_files = [ - # Common Files - '$MOZJS_DIR/js/src/jsapi.c', - '$MOZJS_DIR/js/src/jsarena.c', - '$MOZJS_DIR/js/src/jsarray.c', - '$MOZJS_DIR/js/src/jsatom.c', - '$MOZJS_DIR/js/src/jsbool.c', - '$MOZJS_DIR/js/src/jscntxt.c', - '$MOZJS_DIR/js/src/jsdate.c', - '$MOZJS_DIR/js/src/jsdbgapi.c', - '$MOZJS_DIR/js/src/jsdhash.c', - '$MOZJS_DIR/js/src/jsdtoa.c', - '$MOZJS_DIR/js/src/jsemit.c', - '$MOZJS_DIR/js/src/jsexn.c', - '$MOZJS_DIR/js/src/jsfun.c', - '$MOZJS_DIR/js/src/jsgc.c', - '$MOZJS_DIR/js/src/jshash.c', - '$MOZJS_DIR/js/src/jsinterp.c', - '$MOZJS_DIR/js/src/jsinvoke.c', - '$MOZJS_DIR/js/src/jsiter.c', - '$MOZJS_DIR/js/src/jskwgen.c', - '$MOZJS_DIR/js/src/jslock.c', - '$MOZJS_DIR/js/src/jslog2.c', - '$MOZJS_DIR/js/src/jslong.c', - '$MOZJS_DIR/js/src/jsmath.c', - '$MOZJS_DIR/js/src/jsnum.c', - '$MOZJS_DIR/js/src/jsobj.c', - '$MOZJS_DIR/js/src/jsopcode.c', - '$MOZJS_DIR/js/src/jsparse.c', - '$MOZJS_DIR/js/src/jsprf.c', - '$MOZJS_DIR/js/src/jsregexp.c', - '$MOZJS_DIR/js/src/jsscan.c', - '$MOZJS_DIR/js/src/jsscope.c', - '$MOZJS_DIR/js/src/jsscript.c', - '$MOZJS_DIR/js/src/jsstr.c', - '$MOZJS_DIR/js/src/jsutil.c', - '$MOZJS_DIR/js/src/jsxdrapi.c', - '$MOZJS_DIR/js/src/jsxml.c', - '$MOZJS_DIR/xpcom/glue/pldhash.c', - '$MOZJS_DIR/nspr/pr/src/misc/pratom.c', - '$MOZJS_DIR/nspr/pr/src/threads/prcmon.c', - '$MOZJS_DIR/nspr/pr/src/misc/prdtoa.c', - '$MOZJS_DIR/nspr/pr/src/misc/prenv.c', - '$MOZJS_DIR/nspr/pr/src/misc/prerr.c', - '$MOZJS_DIR/nspr/pr/src/misc/prerror.c', - '$MOZJS_DIR/nspr/pr/src/misc/prerrortable.c', - '$MOZJS_DIR/nspr/pr/src/io/prfdcach.c', - '$MOZJS_DIR/nspr/pr/src/misc/prinit.c', - '$MOZJS_DIR/nspr/pr/src/misc/prinrval.c', - '$MOZJS_DIR/nspr/pr/src/io/priometh.c', - '$MOZJS_DIR/nspr/pr/src/io/pripv6.c', - '$MOZJS_DIR/nspr/pr/src/io/prlayer.c', - '$MOZJS_DIR/nspr/pr/src/linking/prlink.c', - '$MOZJS_DIR/nspr/pr/src/io/prlog.c', - '$MOZJS_DIR/nspr/pr/src/malloc/prmalloc.c', - '$MOZJS_DIR/nspr/pr/src/io/prmapopt.c', - '$MOZJS_DIR/nspr/pr/src/malloc/prmem.c', - '$MOZJS_DIR/js/src/prmjtime.c', - '$MOZJS_DIR/nspr/pr/src/io/prmmap.c', - '$MOZJS_DIR/nspr/pr/src/io/prmwait.c', - '$MOZJS_DIR/nspr/pr/src/misc/prnetdb.c', - '$MOZJS_DIR/nspr/pr/src/md/prosdep.c', - '$MOZJS_DIR/nspr/pr/src/io/prprf.c', - '$MOZJS_DIR/nspr/pr/src/threads/prrwlock.c', - '$MOZJS_DIR/nspr/pr/src/io/prscanf.c', - '$MOZJS_DIR/nspr/pr/src/memory/prseg.c', - '$MOZJS_DIR/nspr/pr/src/io/prstdio.c', - '$MOZJS_DIR/nspr/pr/src/misc/prtime.c', - '$MOZJS_DIR/nspr/pr/src/threads/prtpd.c', - '$MOZJS_DIR/nspr/pr/src/pthreads/ptio.c', - '$MOZJS_DIR/nspr/pr/src/pthreads/ptmisc.c', - '$MOZJS_DIR/nspr/pr/src/pthreads/ptsynch.c', - '$MOZJS_DIR/nspr/pr/src/pthreads/ptthread.c', - '$MOZJS_DIR/nspr/pr/src/md/unix/unix.c', - '$MOZJS_DIR/nspr/pr/src/md/unix/unix_errors.c', - '$MOZJS_DIR/nspr/pr/src/md/unix/uxproces.c', -] - -if env['OS'] == 'osx': - # Safari-specific SpiderMonkey files. - input_files += [ - '$MOZJS_DIR/nspr/pr/src/md/unix/darwin.c', - '$MOZJS_DIR/nspr/pr/src/md/unix/os_Darwin_ppc.s', - '$MOZJS_DIR/nspr/pr/src/md/unix/os_Darwin_x86.s', - ] -elif env['OS'] == 'android': - # Files needed for Android builds. - input_files += [ - '$MOZJS_DIR/nspr/pr/src/md/unix/linux.c', - '$MOZJS_DIR/nspr/pr/src/misc/prlog2.c', - ] - -env.GearsStaticLibrary('mozjs-gears', input_files) diff --git a/gears/SConscript.libpng b/gears/SConscript.libpng deleted file mode 100644 index c5a9a4c..0000000 --- a/gears/SConscript.libpng +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 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. - -# Ripped and modded from chrome. - -Import('env') - -env = env.Clone( -) - -env.Replace( - LIBPNG_DIR = '$THIRD_PARTY_DIR/libpng', - CPPPATH = [ - '$LIBPNG_DIR', - '$THIRD_PARTY_DIR/zlib', - '$VC80_CPPPATH', - ], -) - -env.Append( - CPPDEFINES = [ - ], -) - -input_files = [ - # Common Files - '$LIBPNG_DIR/png.c', - '$LIBPNG_DIR/pngerror.c', - '$LIBPNG_DIR/pngget.c', - '$LIBPNG_DIR/pngmem.c', - '$LIBPNG_DIR/pngset.c', - '$LIBPNG_DIR/pngtrans.c', - - # Reading PNGs - '$LIBPNG_DIR/pngpread.c', - '$LIBPNG_DIR/pngread.c', - '$LIBPNG_DIR/pngrio.c', - '$LIBPNG_DIR/pngrtran.c', - '$LIBPNG_DIR/pngrutil.c', -] - -# The following files are not yet needed; exclude them to save size. -if not env['OFFICIAL_BUILD']: - input_files += [ - # Writing PNGs - '$LIBPNG_DIR/pngwio.c', - '$LIBPNG_DIR/pngwrite.c', - '$LIBPNG_DIR/pngwtran.c', - '$LIBPNG_DIR/pngwutil.c', - ] - -env.GearsStaticLibrary('png-gears', input_files) diff --git a/gears/SConscript.sqlite b/gears/SConscript.sqlite deleted file mode 100644 index 4dafe59..0000000 --- a/gears/SConscript.sqlite +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright (c) 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. - -# Ripped and modded from chrome. - -Import('env') - -env = env.Clone( -) - -env.Replace( - SQLITE_DIR = '$THIRD_PARTY_DIR/sqlite_google', - CPPPATH = [ -# from Chrome -# '$ICU38_DIR/public/common', -# '$ICU38_DIR/public/i18n', - - '$SQLITE_DIR/src', - '$SQLITE_DIR/preprocessed', - '$VC80_CPPPATH', - ], -) - -env.Append( -# from Chrome -# CPPDEFINES = [ -# 'U_STATIC_IMPLEMENTATION', -# 'SQLITE_ENABLE_FTS2', -# 'SQLITE_ENABLE_BROKEN_FTS2', -# 'SQLITE_ENABLE_ICU', -# 'SQLITE_SECURE_DELETE', -# 'THREADSAFE', -# ['_HAS_EXCEPTIONS', '0'], -# ], - - CPPDEFINES = [ - 'SQLITE_CORE', - 'SQLITE_ENABLE_FTS1', - 'SQLITE_ENABLE_BROKEN_FTS1', - 'SQLITE_ENABLE_FTS2', - 'SQLITE_ENABLE_BROKEN_FTS2', - 'THREADSAFE=1', - 'SQLITE_DEFAULT_FILE_PERMISSIONS=0600', - 'SQLITE_OMIT_LOAD_EXTENSION=1', - 'SQLITE_TRANSACTION_DEFAULT_IMMEDIATE=1', - 'SQLITE_GEARS_DISABLE_SHELL_ICU', - ], -) - -if env['OS'] in ['win32', 'wince']: - env.Append( - CPPFLAGS = [ - # from Chrome - '/TC', - '/wd4800', - '/wd4244', - - # from Gears - '/wd4018', - '/wd4146', - ], - ) - env.Append(CPPFLAGS = ['/wd4146']) -elif env['OS'] == 'linux': - env.Append( - CPPFLAGS = [ - '-Wno-uninitialized', - '-Wno-unused-value', - ], - CPPDEFINES = [ - 'HAVE_USLEEP=1', - ], - ) -elif env['OS'] == 'osx': - env.Append( - CCFLAGS = [ - '-Wno-uninitialized', - '-Wno-pointer-sign', - ], - CPPDEFINES = [ - 'HAVE_USLEEP=1', - ], - ) - -input_files = [ - '$SQLITE_DIR/src/alter.c', - '$SQLITE_DIR/src/analyze.c', - '$SQLITE_DIR/src/attach.c', - '$SQLITE_DIR/src/auth.c', - '$SQLITE_DIR/src/bitvec.c', - '$SQLITE_DIR/src/btree.c', - '$SQLITE_DIR/src/btmutex.c', - '$SQLITE_DIR/src/build.c', - '$SQLITE_DIR/src/callback.c', - '$SQLITE_DIR/src/complete.c', - '$SQLITE_DIR/src/date.c', - '$SQLITE_DIR/src/delete.c', - '$SQLITE_DIR/src/expr.c', - '$SQLITE_DIR/src/fault.c', - '$SQLITE_DIR/src/global.c', - '$SQLITE_DIR/src/journal.c', - '$SQLITE_DIR/ext/fts1/fts1.c', - '$SQLITE_DIR/ext/fts1/fts1_hash.c', -# '$SQLITE_DIR/ext/fts1/fts1_icu.c', - '$SQLITE_DIR/ext/fts1/fts1_porter.c', -# '$SQLITE_DIR/ext/fts1/fts1_tokenizer.c', - '$SQLITE_DIR/ext/fts1/fts1_tokenizer1.c', - '$SQLITE_DIR/ext/fts2/fts2.c', - '$SQLITE_DIR/ext/fts2/fts2_hash.c', -# '$SQLITE_DIR/ext/fts2/fts2_icu.c', - '$SQLITE_DIR/ext/fts2/fts2_porter.c', - '$SQLITE_DIR/ext/fts2/fts2_tokenizer.c', - '$SQLITE_DIR/ext/fts2/fts2_tokenizer1.c', - '$SQLITE_DIR/src/func.c', - '$SQLITE_DIR/src/hash.c', - '$SQLITE_DIR/src/insert.c', - '$SQLITE_DIR/src/legacy.c', - '$SQLITE_DIR/src/loadext.c', - '$SQLITE_DIR/src/main.c', - '$SQLITE_DIR/src/malloc.c', - '$SQLITE_DIR/src/mem1.c', - '$SQLITE_DIR/src/mem2.c', - '$SQLITE_DIR/src/mem3.c', - '$SQLITE_DIR/src/mem4.c', - '$SQLITE_DIR/src/mem5.c', - '$SQLITE_DIR/src/mem6.c', - '$SQLITE_DIR/src/sqlite_mutex.c', - '$SQLITE_DIR/src/mutex_os2.c', - '$SQLITE_DIR/src/mutex_unix.c', - '$SQLITE_DIR/src/mutex_w32.c', - '$SQLITE_DIR/preprocessed/opcodes.c', - '$SQLITE_DIR/src/os.c', - '$SQLITE_DIR/src/os_os2.c', - '$SQLITE_DIR/src/os_unix.c', - '$SQLITE_DIR/src/os_win.c', - '$SQLITE_DIR/src/pager.c', - '$SQLITE_DIR/preprocessed/parse.c', - '$SQLITE_DIR/src/pragma.c', - '$SQLITE_DIR/src/prepare.c', - '$SQLITE_DIR/src/printf.c', - '$SQLITE_DIR/src/random.c', - '$SQLITE_DIR/src/select.c', - '$SQLITE_DIR/src/status.c', -# '$SQLITE_DIR/src/shell.c', - '$SQLITE_DIR/src/table.c', - '$SQLITE_DIR/src/tokenize.c', - '$SQLITE_DIR/src/trigger.c', - '$SQLITE_DIR/src/update.c', - '$SQLITE_DIR/src/utf.c', - '$SQLITE_DIR/src/util.c', - '$SQLITE_DIR/src/vacuum.c', - '$SQLITE_DIR/src/vdbe.c', - '$SQLITE_DIR/src/vdbeapi.c', - '$SQLITE_DIR/src/vdbeaux.c', - '$SQLITE_DIR/src/vdbeblob.c', - '$SQLITE_DIR/src/vdbefifo.c', - '$SQLITE_DIR/src/vdbemem.c', - '$SQLITE_DIR/src/vtab.c', - '$SQLITE_DIR/src/where.c', -] - -if env['OS'] == 'symbian': - input_files += ['os_symbian.cc'] - -env.GearsStaticLibrary('sqlite-gears', input_files) diff --git a/gears/SConscript.zlib b/gears/SConscript.zlib deleted file mode 100644 index 40c5442..0000000 --- a/gears/SConscript.zlib +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 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. - -# Ripped and modded from chrome. - -Import('env') - -env = env.Clone( -) - -env.Replace( - ZLIB_DIR = '$THIRD_PARTY_DIR/zlib', - CPPPATH = [ - '$ZLIB_DIR', - '$VC80_CPPPATH', - ], -) - -#env.Append( -# CPPDEFINES = [ -# ], -#) - -input_files = [ - # Common Files - '$ZLIB_DIR/adler32.c', - '$ZLIB_DIR/zutil.c', - # Inflate Algorithm (use inflate or infback, but not both) - '$ZLIB_DIR/inflate.c', - '$ZLIB_DIR/inffast.c', - '$ZLIB_DIR/inftrees.c', -] - -# The following files are not yet needed; exclude them to save size. -if not env['OFFICIAL_BUILD']: - input_files += [ - # Other Algorithms - '$ZLIB_DIR/compress.c', - '$ZLIB_DIR/deflate.c', - '$ZLIB_DIR/uncompr.c', - # Other Common Files - '$ZLIB_DIR/crc32.c', - '$ZLIB_DIR/gzio.c', - '$ZLIB_DIR/trees.c', - ] - -env.GearsStaticLibrary('zlib-gears', input_files) diff --git a/gears/SConstruct b/gears/SConstruct deleted file mode 100644 index 2dfbef6..0000000 --- a/gears/SConstruct +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 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. - -build_component = 'gears' -SConscript('../build/SConscript.main', - exports=['build_component']) diff --git a/gears/binaries/gears.dll b/gears/binaries/gears.dll Binary files differdeleted file mode 100644 index 83bccd5..0000000 --- a/gears/binaries/gears.dll +++ /dev/null diff --git a/gears/binaries/gears.pdb b/gears/binaries/gears.pdb Binary files differdeleted file mode 100644 index 9ac1a7c..0000000 --- a/gears/binaries/gears.pdb +++ /dev/null diff --git a/gears/gears.gyp b/gears/gears.gyp deleted file mode 100644 index aeafb22..0000000 --- a/gears/gears.gyp +++ /dev/null @@ -1,35 +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. - -{ - 'variables': { - 'chromium_code': 1, - }, - 'conditions': [ - [ 'OS == "win"', { - 'targets': [ - { - 'target_name': 'gears', - 'type': 'none', - 'msvs_guid': 'D703D7A0-EDC1-4FE6-9E22-56154155B24E', - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)', - 'files': [ - 'binaries/gears.dll', - 'binaries/gears.pdb', - ], - }, - ], - }, - ], - }], - ], -} - -# Local Variables: -# tab-width:2 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/gears/site_scons/utils.py b/gears/site_scons/utils.py deleted file mode 100644 index d33b705..0000000 --- a/gears/site_scons/utils.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 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. - -def PatternRule(target, source, env): - """Apply env substitution to a target with $SOURCE included. Returns a list - containing the new target and source to pass to a builder.""" - target_sub = env.subst(target, source=env.File(source)) - return [target_sub, source] - -def GetInputs(var, env): - """Expands an env substitution variable and returns it as a list of - strings.""" - return [str(v) for v in env.subst_list(var)[0]] diff --git a/o3d/breakpad/win/crash_sender_win32.cc b/o3d/breakpad/win/crash_sender_win32.cc index 4d62e5f..b5c60c2 100644 --- a/o3d/breakpad/win/crash_sender_win32.cc +++ b/o3d/breakpad/win/crash_sender_win32.cc @@ -31,7 +31,7 @@ // // Breakpad crash report uploader -// (adapted from code in Google Gears) +// (adapted from code in Gears) // diff --git a/o3d/breakpad/win/exception_handler_win32.cc b/o3d/breakpad/win/exception_handler_win32.cc index c51eab0..ade738f 100644 --- a/o3d/breakpad/win/exception_handler_win32.cc +++ b/o3d/breakpad/win/exception_handler_win32.cc @@ -31,7 +31,7 @@ // // Wrapper class for using the Breakpad crash reporting system. -// (adapted from code in Google Gears) +// (adapted from code in Gears) // #include <windows.h> diff --git a/o3d/breakpad/win/exception_handler_win32.h b/o3d/breakpad/win/exception_handler_win32.h index 9986023..a7bd045 100644 --- a/o3d/breakpad/win/exception_handler_win32.h +++ b/o3d/breakpad/win/exception_handler_win32.h @@ -31,7 +31,7 @@ // // Wrapper class for using the Breakpad crash reporting system. -// (adapted from code in Google Gears) +// (adapted from code in Gears) // #ifndef O3D_BREAKPAD_WIN_EXCEPTION_HANDLER_WIN32_H_ diff --git a/tools/emacs/trybot-mac.txt b/tools/emacs/trybot-mac.txt index c29d7ec..87d7f26 100644 --- a/tools/emacs/trybot-mac.txt +++ b/tools/emacs/trybot-mac.txt @@ -1046,18 +1046,6 @@ Distributed-CompileC ../xcodebuild/chrome.build/Debug/browser.build/Objects-norm setenv PATH "/usr/bin:/Developer/usr/bin:/usr/bin:/b/build/../depot_tools:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
/Developer/usr/bin/distcc /Developer/usr/bin/gcc-4.2 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fno-exceptions -fno-rtti -O0 -Werror -Wnewline-eof -DCHROMIUM_BUILD -DENABLE_REMOTING=1 -DENABLE_GPU=1 -DNACL_WINDOWS=0 -DNACL_LINUX=0 -DNACL_OSX=1 -DNACL_TARGET_SUBARCH=32 -DNACL_BUILD_SUBARCH=32 -DCHROME_V8 -DGOOGLE_PROTOBUF_NO_RTTI -DXML_STATIC -DFEATURE_ENABLE_SSL -DFEATURE_ENABLE_VOICEMAIL -DEXPAT_RELATIVE_PATH -DOSX -DPOSIX -DLIBXML_STATIC -DHUNSPELL_STATIC -DHUNSPELL_CHROME_CLIENT -DUSE_HUNSPELL -D__STDC_FORMAT_MACROS -DDYNAMIC_ANNOTATIONS_ENABLED=1 -D_DEBUG -isysroot /Developer/SDKs/MacOSX10.5.sdk -fvisibility=hidden -fvisibility-inlines-hidden -fno-threadsafe-statics -mmacosx-version-min=10.5 -gdwarf-2 -Wall -Wendif-labels -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fpch-preprocess -F/b/build/slave/mac/build/src/chrome/../xcodebuild/Debug -F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks -I/b/build/slave/mac/build/src/chrome/../xcodebuild/Debug/include -I../third_party/icu/public/common -I../third_party/icu/public/i18n -I.. -I/b/build/slave/mac/build/src/chrome/../xcodebuild/chrome.build/DerivedSources/Debug -I../third_party/apple -I../third_party/GTM -I../third_party/GTM/AppKit -I../third_party/GTM/Foundation -I../third_party/GTM/DebugUtils -I../gpu -I../third_party -I../third_party/mesa/MesaLib/include -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/app -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/chrome -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/protoc_out -I../third_party/protobuf -I../third_party/protobuf/src -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/app/app_resources -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/app/app_locale_settings -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/app/app_strings -I../skia/config -I../third_party/skia/include/config -I../third_party/skia/include/core -I../third_party/skia/include/effects -I../skia/ext -I../third_party/bzip2 -I../third_party/expat/files/lib -I../third_party/libjingle/overrides -I../third_party/libjingle/source -I../third_party/expat/files -I../third_party/libxml/mac/include -I../third_party/libxml/src/include -I../third_party/npapi -I../third_party/npapi/bindings -I../third_party/speex/include -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/webkit -I/b/build/slave/mac/build/src/chrome/../xcodebuild/chrome.build/Debug/browser.build/DerivedSources/i386 -I/b/build/slave/mac/build/src/chrome/../xcodebuild/chrome.build/Debug/browser.build/DerivedSources -g1 -c /b/build/slave/mac/build/src/chrome/browser/extensions/extension_menu_manager.cc -o /b/build/slave/mac/build/src/chrome/../xcodebuild/chrome.build/Debug/browser.build/Objects-normal/i386/extension_menu_manager.o
-Distributed-CompileC ../xcodebuild/chrome.build/Debug/browser.build/Objects-normal/i386/chrome_plugin_host.o browser/chrome_plugin_host.cc normal i386 c++ com.apple.compilers.gcc.4_2
- cd /b/build/slave/mac/build/src/chrome
- setenv DISTCC_COMPILER "gcc version 4.2.1 (Apple Inc. build 5659)"
- setenv DISTCC_HOSTS "--randomize distcc5.golo.chromium.org:3632,lzo,cpp/18 distcc9.golo.chromium.org:3632,lzo,cpp/18 distcc1.golo.chromium.org:3632,lzo,cpp/18 distcc2.golo.chromium.org:3632,lzo,cpp/18 distcc3.golo.chromium.org:3632,lzo,cpp/18 distcc6.golo.chromium.org:3632,lzo,cpp/18 distcc10.golo.chromium.org:3632,lzo,cpp/18 distcc7.golo.chromium.org:3632,lzo,cpp/18 distcc8.golo.chromium.org:3632,lzo,cpp/18 distcc4.golo.chromium.org:3632,lzo,cpp/18"
- setenv DISTCC_SYSTEM "10.6.4 (10F2025, i386)"
- setenv INCLUDE_SERVER_DIR /tmp/distcc-pump.C2DZDO
- setenv INCLUDE_SERVER_PID 983
- setenv INCLUDE_SERVER_PORT /tmp/distcc-pump.C2DZDO/socket
- setenv LANG en_US.US-ASCII
- setenv PATH "/usr/bin:/Developer/usr/bin:/usr/bin:/b/build/../depot_tools:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
- /Developer/usr/bin/distcc /Developer/usr/bin/gcc-4.2 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fno-exceptions -fno-rtti -O0 -Werror -Wnewline-eof -DCHROMIUM_BUILD -DENABLE_REMOTING=1 -DENABLE_GPU=1 -DNACL_WINDOWS=0 -DNACL_LINUX=0 -DNACL_OSX=1 -DNACL_TARGET_SUBARCH=32 -DNACL_BUILD_SUBARCH=32 -DCHROME_V8 -DGOOGLE_PROTOBUF_NO_RTTI -DXML_STATIC -DFEATURE_ENABLE_SSL -DFEATURE_ENABLE_VOICEMAIL -DEXPAT_RELATIVE_PATH -DOSX -DPOSIX -DLIBXML_STATIC -DHUNSPELL_STATIC -DHUNSPELL_CHROME_CLIENT -DUSE_HUNSPELL -D__STDC_FORMAT_MACROS -DDYNAMIC_ANNOTATIONS_ENABLED=1 -D_DEBUG -isysroot /Developer/SDKs/MacOSX10.5.sdk -fvisibility=hidden -fvisibility-inlines-hidden -fno-threadsafe-statics -mmacosx-version-min=10.5 -gdwarf-2 -Wall -Wendif-labels -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fpch-preprocess -F/b/build/slave/mac/build/src/chrome/../xcodebuild/Debug -F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks -I/b/build/slave/mac/build/src/chrome/../xcodebuild/Debug/include -I../third_party/icu/public/common -I../third_party/icu/public/i18n -I.. -I/b/build/slave/mac/build/src/chrome/../xcodebuild/chrome.build/DerivedSources/Debug -I../third_party/apple -I../third_party/GTM -I../third_party/GTM/AppKit -I../third_party/GTM/Foundation -I../third_party/GTM/DebugUtils -I../gpu -I../third_party -I../third_party/mesa/MesaLib/include -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/app -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/chrome -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/protoc_out -I../third_party/protobuf -I../third_party/protobuf/src -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/app/app_resources -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/app/app_locale_settings -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/app/app_strings -I../skia/config -I../third_party/skia/include/config -I../third_party/skia/include/core -I../third_party/skia/include/effects -I../skia/ext -I../third_party/bzip2 -I../third_party/expat/files/lib -I../third_party/libjingle/overrides -I../third_party/libjingle/source -I../third_party/expat/files -I../third_party/libxml/mac/include -I../third_party/libxml/src/include -I../third_party/npapi -I../third_party/npapi/bindings -I../third_party/speex/include -I/b/build/slave/mac/build/src/chrome/../xcodebuild/DerivedSources/Debug/webkit -I/b/build/slave/mac/build/src/chrome/../xcodebuild/chrome.build/Debug/browser.build/DerivedSources/i386 -I/b/build/slave/mac/build/src/chrome/../xcodebuild/chrome.build/Debug/browser.build/DerivedSources -g1 -c /b/build/slave/mac/build/src/chrome/browser/chrome_plugin_host.cc -o /b/build/slave/mac/build/src/chrome/../xcodebuild/chrome.build/Debug/browser.build/Objects-normal/i386/chrome_plugin_host.o
-
Distributed-CompileC ../xcodebuild/chrome.build/Debug/browser.build/Objects-normal/i386/browser_process_impl.o browser/browser_process_impl.cc normal i386 c++ com.apple.compilers.gcc.4_2
cd /b/build/slave/mac/build/src/chrome
setenv DISTCC_COMPILER "gcc version 4.2.1 (Apple Inc. build 5659)"
diff --git a/tools/export_tarball/export_tarball.py b/tools/export_tarball/export_tarball.py index ddb8920..78586c5 100644 --- a/tools/export_tarball/export_tarball.py +++ b/tools/export_tarball/export_tarball.py @@ -27,7 +27,6 @@ NONESSENTIAL_DIRS = ( 'chrome/tools/test/reference_build', 'courgette/testdata', 'data', - 'gears/binaries', 'native_client/src/trusted/service_runtime/testdata', 'native_client/tests', 'net/data/cache_tests', diff --git a/ui/base/dragdrop/drop_target.cc b/ui/base/dragdrop/drop_target.cc index 9cf1c9d..a938b2a 100644 --- a/ui/base/dragdrop/drop_target.cc +++ b/ui/base/dragdrop/drop_target.cc @@ -11,7 +11,6 @@ namespace ui { IDropTargetHelper* DropTarget::cached_drop_target_helper_ = NULL; -int32 DropTarget::drag_identity_ = 0; DropTarget::DropTarget(HWND hwnd) : hwnd_(hwnd), @@ -55,10 +54,6 @@ HRESULT DropTarget::DragEnter(IDataObject* data_object, return S_OK; } - // Update the drag identity, skipping 0. - if (++drag_identity_ == 0) - ++drag_identity_; - current_data_object_ = data_object; POINT screen_pt = { cursor_position.x, cursor_position.y }; *effect = OnDragEnter(current_data_object_, key_state, screen_pt, *effect); diff --git a/ui/base/dragdrop/drop_target.h b/ui/base/dragdrop/drop_target.h index 46b43c0..0baed43 100644 --- a/ui/base/dragdrop/drop_target.h +++ b/ui/base/dragdrop/drop_target.h @@ -87,9 +87,6 @@ class DropTarget : public IDropTarget { POINT cursor_position, DWORD effect); - // Return the drag identity. - static int32 GetDragIdentity() { return drag_identity_; } - private: // Returns the cached drop helper, creating one if necessary. The returned // object is not addrefed. May return NULL if the object couldn't be created. @@ -108,14 +105,6 @@ class DropTarget : public IDropTarget { // first time it is actually used. static IDropTargetHelper* cached_drop_target_helper_; - // The drag identity (id). An up-counter that increases when the cursor first - // moves over the HWND in a DnD session (OnDragEnter). 0 is reserved to mean - // the "no/unknown" identity, and is used for initialization. The identity is - // sent to the renderer in drag enter notifications. Note: the identity value - // is passed over the renderer NPAPI interface to gears, so use int32 instead - // of int here. - static int32 drag_identity_; - // The HWND of the source. This HWND is used to determine coordinates for // mouse events that are sent to the renderer notifying various drag states. HWND hwnd_; diff --git a/webkit/extensions/v8/gears_extension.cc b/webkit/extensions/v8/gears_extension.cc deleted file mode 100644 index 200135d..0000000 --- a/webkit/extensions/v8/gears_extension.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2006-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. - -#include "webkit/extensions/v8/gears_extension.h" - -namespace extensions_v8 { - -const char* const kGearsExtensionName = "v8/Gears"; - -// Note: when a page touches the "google.gears.factory" object, this script -// touches the DOM. We expect the DOM to be available at that time. -const char* const kGearsExtensionScript = - "var google;" - "if (!google)" - " google = {};" - "if (!google.gears)" - " google.gears = {};" - "(function() {" - " var factory = null;" - " google.gears.__defineGetter__('factory', function() {" - " if (!factory) {" - " factory = document.createElement('object');" - " factory.width = 0;" - " factory.height = 0;" - " factory.style.visibility = 'hidden';" - " factory.type = 'application/x-googlegears';" - " document.documentElement.appendChild(factory);" - " }" - " return factory;" - " });" - "})();"; - -class GearsExtensionWrapper : public v8::Extension { - public: - GearsExtensionWrapper() - : v8::Extension(kGearsExtensionName, kGearsExtensionScript) {} -}; - -v8::Extension* GearsExtension::Get() { - return new GearsExtensionWrapper(); -} - -} // namespace extensions_v8 diff --git a/webkit/extensions/v8/gears_extension.h b/webkit/extensions/v8/gears_extension.h deleted file mode 100644 index cb828438..0000000 --- a/webkit/extensions/v8/gears_extension.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2006-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. - -// The GearsExtension is a v8 extension to add a "google.gears.factory" getter -// on the page, which, when accessed, lazily inserts the gears plugin into -// the page and attaches it to the factory variable. - -#ifndef WEBKIT_EXTENSIONS_V8_GEARS_EXTENSION_H_ -#define WEBKIT_EXTENSIONS_V8_GEARS_EXTENSION_H_ - -#include "v8/include/v8.h" - -namespace extensions_v8 { - -class GearsExtension { - public: - static v8::Extension* Get(); -}; - -} // namespace extensions_v8 - -#endif // WEBKIT_EXTENSIONS_V8_GEARS_EXTENSION_H_ diff --git a/webkit/glue/webdropdata.cc b/webkit/glue/webdropdata.cc index 02c1a4c..0a06ac3 100644 --- a/webkit/glue/webdropdata.cc +++ b/webkit/glue/webdropdata.cc @@ -15,13 +15,8 @@ using WebKit::WebDragData; using WebKit::WebString; using WebKit::WebVector; -WebDropData::WebDropData(int32 drag_identity) - : identity(drag_identity) { -} - WebDropData::WebDropData(const WebDragData& drag_data) - : identity(0), - url(drag_data.url()), + : url(drag_data.url()), url_title(drag_data.urlTitle()), download_metadata(drag_data.downloadMetadata()), file_extension(drag_data.fileExtension()), @@ -40,8 +35,7 @@ WebDropData::WebDropData(const WebDragData& drag_data) file_contents.assign(contents.data(), contents.size()); } -WebDropData::WebDropData() - : identity(0) { +WebDropData::WebDropData() { } WebDropData::~WebDropData() { diff --git a/webkit/glue/webdropdata.h b/webkit/glue/webdropdata.h index d129b06..a9a4ae7 100644 --- a/webkit/glue/webdropdata.h +++ b/webkit/glue/webdropdata.h @@ -22,20 +22,13 @@ class WebDragData; } struct WebDropData { - // Construct with a given drag identity. Note: identity is an int32 because - // it is passed over the renderer NPAPI interface to gears. - explicit WebDropData(int32 drag_identity); - // Construct from a WebDragData object. explicit WebDropData(const WebKit::WebDragData&); - // For default constructions, use drag |identity| 0. WebDropData(); ~WebDropData(); - int32 identity; - // User is dragging a link into the webview. GURL url; string16 url_title; // The title associated with |url|. diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 1dc4664..74cb61c 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -465,8 +465,6 @@ '../extensions/v8/benchmarking_extension.h', '../extensions/v8/gc_extension.cc', '../extensions/v8/gc_extension.h', - '../extensions/v8/gears_extension.cc', - '../extensions/v8/gears_extension.h', '../extensions/v8/heap_profiler_extension.cc', '../extensions/v8/heap_profiler_extension.h', '../extensions/v8/playback_extension.cc', diff --git a/webkit/plugins/npapi/webplugin.h b/webkit/plugins/npapi/webplugin.h index 9dd1c57..db3b98a 100644 --- a/webkit/plugins/npapi/webplugin.h +++ b/webkit/plugins/npapi/webplugin.h @@ -105,14 +105,6 @@ class WebPlugin { virtual std::string GetCookies(const GURL& url, const GURL& first_party_for_cookies) = 0; - // Shows a modal HTML dialog containing the given URL. json_arguments are - // passed to the dialog via the DOM 'window.chrome.dialogArguments', and the - // retval is the string returned by 'window.chrome.send("DialogClose", - // retval)'. - virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, - const std::string& json_arguments, - std::string* json_retval) = 0; - // When a default plugin has downloaded the plugin list and finds it is // available, it calls this method to notify the renderer. Also it will update // the status when user clicks on the plugin to install. diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc index 51128da..84bc648 100644 --- a/webkit/plugins/npapi/webplugin_impl.cc +++ b/webkit/plugins/npapi/webplugin_impl.cc @@ -780,15 +780,6 @@ std::string WebPluginImpl::GetCookies(const GURL& url, return UTF16ToUTF8(cookie_jar->cookies(url, first_party_for_cookies)); } -void WebPluginImpl::ShowModalHTMLDialog(const GURL& url, int width, int height, - const std::string& json_arguments, - std::string* json_retval) { - if (page_delegate_) { - page_delegate_->ShowModalHTMLDialogForPlugin( - url, gfx::Size(width, height), json_arguments, json_retval); - } -} - void WebPluginImpl::OnMissingPluginStatus(int status) { NOTREACHED(); } diff --git a/webkit/plugins/npapi/webplugin_impl.h b/webkit/plugins/npapi/webplugin_impl.h index 3476a0e..8b7668b 100644 --- a/webkit/plugins/npapi/webplugin_impl.h +++ b/webkit/plugins/npapi/webplugin_impl.h @@ -124,9 +124,6 @@ class WebPluginImpl : public WebPlugin, const std::string& cookie); virtual std::string GetCookies(const GURL& url, const GURL& first_party_for_cookies); - virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, - const std::string& json_arguments, - std::string* json_retval); virtual void OnMissingPluginStatus(int status); virtual void URLRedirectResponse(bool allow, int resource_id); diff --git a/webkit/plugins/npapi/webplugin_page_delegate.h b/webkit/plugins/npapi/webplugin_page_delegate.h index 7cc0200..be6a75a 100644 --- a/webkit/plugins/npapi/webplugin_page_delegate.h +++ b/webkit/plugins/npapi/webplugin_page_delegate.h @@ -52,15 +52,6 @@ class WebPluginPageDelegate { // Notifies the parent view that all loads are finished. virtual void DidStopLoadingForPlugin() = 0; - // 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. - virtual void ShowModalHTMLDialogForPlugin( - const GURL& url, - const gfx::Size& size, - const std::string& json_arguments, - std::string* json_retval) = 0; - // The WebCookieJar to use for this plugin. virtual WebKit::WebCookieJar* GetCookieJar() = 0; }; diff --git a/webkit/support/test_webkit_client.cc b/webkit/support/test_webkit_client.cc index 7b90dea..c69cf6e 100644 --- a/webkit/support/test_webkit_client.cc +++ b/webkit/support/test_webkit_client.cc @@ -34,7 +34,6 @@ #include "webkit/appcache/web_application_cache_host_impl.h" #include "webkit/database/vfs_backend.h" #include "webkit/extensions/v8/gc_extension.h" -#include "webkit/extensions/v8/gears_extension.h" #include "webkit/glue/simple_webmimeregistry_impl.h" #include "webkit/glue/webclipboard_impl.h" #include "webkit/glue/webkit_glue.h" @@ -73,8 +72,6 @@ TestWebKitClient::TestWebKitClient(bool unit_test_mode) WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess( WebKit::WebString::fromUTF8("test-shell-resource")); WebScriptController::enableV8SingleThreadMode(); - WebScriptController::registerExtension( - extensions_v8::GearsExtension::Get()); WebKit::WebRuntimeFeatures::enableSockets(true); WebKit::WebRuntimeFeatures::enableApplicationCache(true); WebKit::WebRuntimeFeatures::enableDatabase(true); diff --git a/webkit/support/test_webplugin_page_delegate.h b/webkit/support/test_webplugin_page_delegate.h index 035f335..94b571e 100644 --- a/webkit/support/test_webplugin_page_delegate.h +++ b/webkit/support/test_webplugin_page_delegate.h @@ -25,11 +25,6 @@ class TestWebPluginPageDelegate : public webkit::npapi::WebPluginPageDelegate { virtual void DidMovePlugin(const webkit::npapi::WebPluginGeometry& move) {} virtual void DidStartLoadingForPlugin() {} virtual void DidStopLoadingForPlugin() {} - virtual void ShowModalHTMLDialogForPlugin( - const GURL& url, - const gfx::Size& size, - const std::string& json_arguments, - std::string* json_retval) {} virtual WebKit::WebCookieJar* GetCookieJar(); }; diff --git a/webkit/tools/test_shell/drop_delegate.cc b/webkit/tools/test_shell/drop_delegate.cc index 9fbf364..247f38f 100644 --- a/webkit/tools/test_shell/drop_delegate.cc +++ b/webkit/tools/test_shell/drop_delegate.cc @@ -29,7 +29,7 @@ DWORD TestDropDelegate::OnDragEnter(IDataObject* data_object, POINT client_pt = cursor_position; ScreenToClient(GetHWND(), &client_pt); WebDragOperation op = webview_->dragTargetDragEnter( - drop_data.ToDragData(), drop_data.identity, + drop_data.ToDragData(), 0, // web drag identity, unused. WebPoint(client_pt.x, client_pt.y), WebPoint(cursor_position.x, cursor_position.y), WebDragOperationCopy); diff --git a/webkit/tools/test_shell/test_shell_webkit_init.cc b/webkit/tools/test_shell/test_shell_webkit_init.cc index 274ad63..c986531 100644 --- a/webkit/tools/test_shell/test_shell_webkit_init.cc +++ b/webkit/tools/test_shell/test_shell_webkit_init.cc @@ -13,7 +13,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" -#include "webkit/extensions/v8/gears_extension.h" +#include "v8/include/v8.h" #include "webkit/tools/test_shell/test_shell.h" #if defined(OS_WIN) @@ -30,8 +30,6 @@ TestShellWebKitInit::TestShellWebKitInit(bool layout_test_mode) { WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess( WebKit::WebString::fromUTF8("test-shell-resource")); WebKit::WebScriptController::enableV8SingleThreadMode(); - WebKit::WebScriptController::registerExtension( - extensions_v8::GearsExtension::Get()); WebKit::WebRuntimeFeatures::enableSockets(true); WebKit::WebRuntimeFeatures::enableApplicationCache(true); WebKit::WebRuntimeFeatures::enableDatabase(true); diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index 9b8feee..a0c7543 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -247,11 +247,6 @@ class TestWebViewDelegate : public WebKit::WebViewClient, const webkit::npapi::WebPluginGeometry& move); virtual void DidStartLoadingForPlugin() {} virtual void DidStopLoadingForPlugin() {} - virtual void ShowModalHTMLDialogForPlugin( - const GURL& url, - const gfx::Size& size, - const std::string& json_arguments, - std::string* json_retval) {} virtual WebKit::WebCookieJar* GetCookieJar(); TestWebViewDelegate(TestShell* shell); |