diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-02 23:45:21 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-02 23:45:21 +0000 |
commit | ae40ccd86384f6d6246f0d01b6629df16a008402 (patch) | |
tree | c7e0af14c9aa3c2fe72cf78925c99f6b2e0c0bd4 | |
parent | b556e23aba920c82e174432791f7cfa658c39e09 (diff) | |
download | chromium_src-ae40ccd86384f6d6246f0d01b6629df16a008402.zip chromium_src-ae40ccd86384f6d6246f0d01b6629df16a008402.tar.gz chromium_src-ae40ccd86384f6d6246f0d01b6629df16a008402.tar.bz2 |
Rename FakePluginWindowTracker
Removes confusion with the new "fake window" code related to the GPU process, and makes the name better reflect the reality of how the Carbon plugin windows are actually used since we no longer expect to replace them entirely with interposing.
BUG=none
TEST=none (no behavioral changes)
Review URL: http://codereview.chromium.org/660407
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40459 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/framework.order | 14 | ||||
-rw-r--r-- | chrome/browser/plugin_carbon_interpose_mac.cc | 11 | ||||
-rw-r--r-- | webkit/glue/plugins/carbon_plugin_window_tracker_mac.cc (renamed from webkit/glue/plugins/fake_plugin_window_tracker_mac.cc) | 23 | ||||
-rw-r--r-- | webkit/glue/plugins/carbon_plugin_window_tracker_mac.h | 51 | ||||
-rw-r--r-- | webkit/glue/plugins/fake_plugin_window_tracker_mac.h | 49 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_mac.mm | 13 | ||||
-rw-r--r-- | webkit/webkit.gyp | 4 |
7 files changed, 83 insertions, 82 deletions
diff --git a/chrome/app/framework.order b/chrome/app/framework.order index 2f66f38..3ff59b0 100644 --- a/chrome/app/framework.order +++ b/chrome/app/framework.order @@ -30,13 +30,13 @@ __ZN22mac_plugin_interposing31NotifyBrowserOfPluginHideWindowEj6CGRect __ZN22mac_plugin_interposing28NotifyPluginOfSetThemeCursorEP21WebPluginDelegateImplm __ZN22mac_plugin_interposing23NotifyPluginOfSetCursorEP21WebPluginDelegateImplPK6Cursor __ZN22mac_plugin_interposing23GetPluginWindowHasFocusEPK21WebPluginDelegateImpl -__ZN23FakePluginWindowTrackerC1Ev -__ZN23FakePluginWindowTrackerC2Ev -__ZN23FakePluginWindowTracker14SharedInstanceEv -__ZN23FakePluginWindowTracker29GenerateFakeWindowForDelegateEP21WebPluginDelegateImpl -__ZNK23FakePluginWindowTracker24GetDelegateForFakeWindowEP15OpaqueWindowPtr -__ZNK23FakePluginWindowTracker24GetFakeWindowForDelegateEP21WebPluginDelegateImpl -__ZN23FakePluginWindowTracker27RemoveFakeWindowForDelegateEP21WebPluginDelegateImplP15OpaqueWindowPtr +__ZN25CarbonPluginWindowTrackerC1Ev +__ZN25CarbonPluginWindowTrackerC2Ev +__ZN25CarbonPluginWindowTracker14SharedInstanceEv +__ZN25CarbonPluginWindowTracker28CreateDummyWindowForDelegateEP21WebPluginDelegateImpl +__ZNK25CarbonPluginWindowTracker25GetDelegateForDummyWindowEP15OpaqueWindowPtr +__ZNK25CarbonPluginWindowTracker25GetDummyWindowForDelegateEP21WebPluginDelegateImpl +__ZN25CarbonPluginWindowTracker29DestroyDummyWindowForDelegateEP21WebPluginDelegateImplP15OpaqueWindowPtr __ZN7WebCore22narrowPrecisionToFloatIdEEfT_ __ZN7WebCore24narrowPrecisionToCGFloatIdEEfT_ __ZnwmPv diff --git a/chrome/browser/plugin_carbon_interpose_mac.cc b/chrome/browser/plugin_carbon_interpose_mac.cc index 020d9ae..850b363 100644 --- a/chrome/browser/plugin_carbon_interpose_mac.cc +++ b/chrome/browser/plugin_carbon_interpose_mac.cc @@ -6,7 +6,7 @@ #include "base/gfx/rect.h" #include "chrome/plugin/plugin_interpose_util_mac.h" -#include "webkit/glue/plugins/fake_plugin_window_tracker_mac.h" +#include "webkit/glue/plugins/carbon_plugin_window_tracker_mac.h" #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -59,7 +59,7 @@ static void OnPluginWindowSelected(WindowRef window) { static Boolean ChromePluginIsWindowActive(WindowRef window) { const WebPluginDelegateImpl* delegate = - FakePluginWindowTracker::SharedInstance()->GetDelegateForFakeWindow( + CarbonPluginWindowTracker::SharedInstance()->GetDelegateForDummyWindow( window); return delegate ? IsContainingWindowActive(delegate) : IsWindowActive(window); @@ -67,7 +67,7 @@ static Boolean ChromePluginIsWindowActive(WindowRef window) { static Boolean ChromePluginIsWindowHilited(WindowRef window) { const WebPluginDelegateImpl* delegate = - FakePluginWindowTracker::SharedInstance()->GetDelegateForFakeWindow( + CarbonPluginWindowTracker::SharedInstance()->GetDelegateForDummyWindow( window); return delegate ? IsContainingWindowActive(delegate) : IsWindowHilited(window); @@ -124,8 +124,9 @@ static void ChromePluginDisposeDialog(DialogRef dialog) { static WindowPartCode ChromePluginFindWindow(Point point, WindowRef* window) { WebPluginDelegateImpl* delegate = mac_plugin_interposing::GetActiveDelegate(); - FakePluginWindowTracker* tracker = FakePluginWindowTracker::SharedInstance(); - WindowRef plugin_window = tracker->GetFakeWindowForDelegate(delegate); + CarbonPluginWindowTracker* tracker = + CarbonPluginWindowTracker::SharedInstance(); + WindowRef plugin_window = tracker->GetDummyWindowForDelegate(delegate); if (plugin_window) { // If plugin_window is non-NULL, then we are in the middle of routing an // event to the plugin, so we know it's destined for this window already, diff --git a/webkit/glue/plugins/fake_plugin_window_tracker_mac.cc b/webkit/glue/plugins/carbon_plugin_window_tracker_mac.cc index 1099a99..6131b45 100644 --- a/webkit/glue/plugins/fake_plugin_window_tracker_mac.cc +++ b/webkit/glue/plugins/carbon_plugin_window_tracker_mac.cc @@ -3,23 +3,18 @@ // found in the LICENSE file. #include "base/logging.h" -#include "webkit/glue/plugins/fake_plugin_window_tracker_mac.h" +#include "webkit/glue/plugins/carbon_plugin_window_tracker_mac.h" -FakePluginWindowTracker::FakePluginWindowTracker() { +CarbonPluginWindowTracker::CarbonPluginWindowTracker() { } -FakePluginWindowTracker* FakePluginWindowTracker::SharedInstance() { - static FakePluginWindowTracker* tracker = new FakePluginWindowTracker(); +CarbonPluginWindowTracker* CarbonPluginWindowTracker::SharedInstance() { + static CarbonPluginWindowTracker* tracker = new CarbonPluginWindowTracker(); return tracker; } -WindowRef FakePluginWindowTracker::GenerateFakeWindowForDelegate( +WindowRef CarbonPluginWindowTracker::CreateDummyWindowForDelegate( WebPluginDelegateImpl* delegate) { - // TODO(stuartmorgan): Eventually we will be interposing enough that we don't - // even need a window, and can just use made-up identifiers, but for now we - // create one so that things that we don't interpose won't crash trying to use - // a bad WindowRef. - // The real size will be set by the plugin instance, once that size is known. Rect window_bounds = { 0, 0, 100, 100 }; WindowRef new_ref = NULL; @@ -33,7 +28,7 @@ WindowRef FakePluginWindowTracker::GenerateFakeWindowForDelegate( return new_ref; } -WebPluginDelegateImpl* FakePluginWindowTracker::GetDelegateForFakeWindow( +WebPluginDelegateImpl* CarbonPluginWindowTracker::GetDelegateForDummyWindow( WindowRef window) const { WindowToDelegateMap::const_iterator i = window_to_delegate_map_.find(window); if (i != window_to_delegate_map_.end()) @@ -41,7 +36,7 @@ WebPluginDelegateImpl* FakePluginWindowTracker::GetDelegateForFakeWindow( return NULL; } -WindowRef FakePluginWindowTracker::GetFakeWindowForDelegate( +WindowRef CarbonPluginWindowTracker::GetDummyWindowForDelegate( WebPluginDelegateImpl* delegate) const { DelegateToWindowMap::const_iterator i = delegate_to_window_map_.find(delegate); @@ -50,9 +45,9 @@ WindowRef FakePluginWindowTracker::GetFakeWindowForDelegate( return NULL; } -void FakePluginWindowTracker::RemoveFakeWindowForDelegate( +void CarbonPluginWindowTracker::DestroyDummyWindowForDelegate( WebPluginDelegateImpl* delegate, WindowRef window) { - DCHECK(GetDelegateForFakeWindow(window) == delegate); + DCHECK(GetDelegateForDummyWindow(window) == delegate); window_to_delegate_map_.erase(window); delegate_to_window_map_.erase(delegate); if (window) // Check just in case the initial window creation failed. diff --git a/webkit/glue/plugins/carbon_plugin_window_tracker_mac.h b/webkit/glue/plugins/carbon_plugin_window_tracker_mac.h new file mode 100644 index 0000000..3e6ef2d --- /dev/null +++ b/webkit/glue/plugins/carbon_plugin_window_tracker_mac.h @@ -0,0 +1,51 @@ +// 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. + +#ifndef WEBKIT_GLUE_PLUGINS_CARBON_PLUGIN_WINDOW_TRACKER_MAC_H_ +#define WEBKIT_GLUE_PLUGINS_CARBON_PLUGIN_WINDOW_TRACKER_MAC_H_ + +#include <Carbon/Carbon.h> +#include <map> + +#include "base/basictypes.h" + +class WebPluginDelegateImpl; + +// Creates and tracks the invisible windows that are necessary for +// Carbon-event-model plugins. +// +// Serves as a bridge between plugin delegate instances and the Carbon +// interposing library. The Carbon functions we interpose work in terms of +// WindowRefs, and we need to be able to map from those back to the plugin +// delegates that know what we should claim about the state of the window. +class __attribute__((visibility("default"))) CarbonPluginWindowTracker { + public: + CarbonPluginWindowTracker(); + + // Returns the shared window tracker instance. + static CarbonPluginWindowTracker* SharedInstance(); + + // Creates a new carbon window associated with |delegate|. + WindowRef CreateDummyWindowForDelegate(WebPluginDelegateImpl* delegate); + + // Returns the WebPluginDelegate associated with the given dummy window. + WebPluginDelegateImpl* GetDelegateForDummyWindow(WindowRef window) const; + + // Returns the dummy window associated with |delegate|. + WindowRef GetDummyWindowForDelegate(WebPluginDelegateImpl* delegate) const; + + // Destroys the dummy window for |delegate|. + void DestroyDummyWindowForDelegate(WebPluginDelegateImpl* delegate, + WindowRef window); + + private: + typedef std::map<WindowRef, WebPluginDelegateImpl*> WindowToDelegateMap; + typedef std::map<WebPluginDelegateImpl*, WindowRef> DelegateToWindowMap; + WindowToDelegateMap window_to_delegate_map_; + DelegateToWindowMap delegate_to_window_map_; + + DISALLOW_COPY_AND_ASSIGN(CarbonPluginWindowTracker); +}; + +#endif // WEBKIT_GLUE_PLUGINS_CARBON_PLUGIN_WINDOW_TRACKER_MAC_H_ diff --git a/webkit/glue/plugins/fake_plugin_window_tracker_mac.h b/webkit/glue/plugins/fake_plugin_window_tracker_mac.h deleted file mode 100644 index d6576bf..0000000 --- a/webkit/glue/plugins/fake_plugin_window_tracker_mac.h +++ /dev/null @@ -1,49 +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. - -#ifndef WEBKIT_GLUE_PLUGINS_FAKE_PLUGIN_WINDOW_TRACKER_MAC_H_ -#define WEBKIT_GLUE_PLUGINS_FAKE_PLUGIN_WINDOW_TRACKER_MAC_H_ - -#include <Carbon/Carbon.h> -#include <map> - -#include "base/basictypes.h" - -class ScopedActivePluginWindow; -class WebPluginDelegateImpl; - -// Serves as a bridge between plugin delegate instances and the Carbon -// interposing library. The Carbon functions we interpose work in terms of -// WindowRefs, and we need to be able to map from those back to the plugin -// delegates that know what we should claim about the state of the world. -class __attribute__((visibility("default"))) FakePluginWindowTracker { - public: - FakePluginWindowTracker(); - - // Returns the shared window tracker instance. - static FakePluginWindowTracker* SharedInstance(); - - // Creates a new fake window ref associated with |delegate|. - WindowRef GenerateFakeWindowForDelegate(WebPluginDelegateImpl* delegate); - - // Returns the WebPluginDelegate associated with the given fake window ref. - WebPluginDelegateImpl* GetDelegateForFakeWindow(WindowRef window) const; - - // Returns the fake window ref associated with |delegate|. - WindowRef GetFakeWindowForDelegate(WebPluginDelegateImpl* delegate) const; - - // Removes the fake window ref entry for |delegate|. - void RemoveFakeWindowForDelegate(WebPluginDelegateImpl* delegate, - WindowRef window); - - private: - typedef std::map<WindowRef, WebPluginDelegateImpl*> WindowToDelegateMap; - typedef std::map<WebPluginDelegateImpl*, WindowRef> DelegateToWindowMap; - WindowToDelegateMap window_to_delegate_map_; - DelegateToWindowMap delegate_to_window_map_; - - DISALLOW_COPY_AND_ASSIGN(FakePluginWindowTracker); -}; - -#endif // WEBKIT_GLUE_PLUGINS_FAKE_PLUGIN_WINDOW_TRACKER_MAC_H_ diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index 15454fb..39af388 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -21,7 +21,6 @@ #include "webkit/default_plugin/plugin_impl.h" #include "webkit/glue/webplugin.h" #include "webkit/glue/plugins/coregraphics_private_symbols_mac.h" -#include "webkit/glue/plugins/fake_plugin_window_tracker_mac.h" #include "webkit/glue/plugins/plugin_constants_win.h" #include "webkit/glue/plugins/plugin_instance.h" #include "webkit/glue/plugins/plugin_lib.h" @@ -29,6 +28,10 @@ #include "webkit/glue/plugins/plugin_stream_url.h" #include "webkit/glue/webkit_glue.h" +#ifndef NP_NO_CARBON +#include "webkit/glue/plugins/carbon_plugin_window_tracker_mac.h" +#endif + // If we're compiling support for the QuickDraw drawing model, turn off GCC // warnings about deprecated functions (since QuickDraw is a deprecated API). // According to the GCC documentation, this can only be done per file, not @@ -204,7 +207,7 @@ WebPluginDelegateImpl::~WebPluginDelegateImpl() { #ifndef NP_NO_CARBON if (cg_context_.window) { - FakePluginWindowTracker::SharedInstance()->RemoveFakeWindowForDelegate( + CarbonPluginWindowTracker::SharedInstance()->DestroyDummyWindowForDelegate( this, reinterpret_cast<WindowRef>(cg_context_.window)); } #endif @@ -226,9 +229,9 @@ void WebPluginDelegateImpl::PlatformInitialize() { if (instance()->event_model() == NPEventModelCarbon) { // Create a stand-in for the browser window so that the plugin will have // a non-NULL WindowRef to which it can refer. - FakePluginWindowTracker* window_tracker = - FakePluginWindowTracker::SharedInstance(); - cg_context_.window = window_tracker->GenerateFakeWindowForDelegate(this); + CarbonPluginWindowTracker* window_tracker = + CarbonPluginWindowTracker::SharedInstance(); + cg_context_.window = window_tracker->CreateDummyWindowForDelegate(this); cg_context_.context = NULL; Rect window_bounds = { 0, 0, window_rect_.height(), window_rect_.width() }; SetWindowBounds(reinterpret_cast<WindowRef>(cg_context_.window), diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index fce94944..eaeb46e 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -241,10 +241,10 @@ 'glue/media/video_renderer_impl.cc', 'glue/media/video_renderer_impl.h', 'glue/media/web_video_renderer.h', + 'glue/plugins/carbon_plugin_window_tracker_mac.h', + 'glue/plugins/carbon_plugin_window_tracker_mac.cc', 'glue/plugins/coregraphics_private_symbols_mac.h', 'glue/plugins/nphostapi.h', - 'glue/plugins/fake_plugin_window_tracker_mac.h', - 'glue/plugins/fake_plugin_window_tracker_mac.cc', 'glue/plugins/gtk_plugin_container.h', 'glue/plugins/gtk_plugin_container.cc', 'glue/plugins/gtk_plugin_container_manager.h', |