Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: webkit/plugins/npapi/carbon_plugin_window_tracker_mac.cc

Issue 10928072: Remove all support for the Carbon NPAPI event model (Closed) Base URL: http://git.chromium.org/chromium/src.git@test-plugin-cocoa
Patch Set: Rebase Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "webkit/plugins/npapi/carbon_plugin_window_tracker_mac.h"
6
7 #include "base/logging.h"
8
9 namespace webkit {
10 namespace npapi {
11
12 CarbonPluginWindowTracker::CarbonPluginWindowTracker() {}
13
14 CarbonPluginWindowTracker::~CarbonPluginWindowTracker() {}
15
16 CarbonPluginWindowTracker* CarbonPluginWindowTracker::SharedInstance() {
17 static CarbonPluginWindowTracker* tracker = new CarbonPluginWindowTracker();
18 return tracker;
19 }
20
21 WindowRef CarbonPluginWindowTracker::CreateDummyWindowForDelegate(
22 OpaquePluginRef delegate) {
23 // The real size will be set by the plugin instance, once that size is known.
24 Rect window_bounds = { 0, 0, 100, 100 };
25 WindowRef new_ref = NULL;
26 if (CreateNewWindow(kDocumentWindowClass,
27 kWindowNoTitleBarAttribute,
28 &window_bounds,
29 &new_ref) == noErr) {
30 window_to_delegate_map_[new_ref] = delegate;
31 delegate_to_window_map_[delegate] = new_ref;
32 }
33 return new_ref;
34 }
35
36 OpaquePluginRef CarbonPluginWindowTracker::GetDelegateForDummyWindow(
37 WindowRef window) const {
38 WindowToDelegateMap::const_iterator i = window_to_delegate_map_.find(window);
39 if (i != window_to_delegate_map_.end())
40 return i->second;
41 return NULL;
42 }
43
44 WindowRef CarbonPluginWindowTracker::GetDummyWindowForDelegate(
45 OpaquePluginRef delegate) const {
46 DelegateToWindowMap::const_iterator i =
47 delegate_to_window_map_.find(delegate);
48 if (i != delegate_to_window_map_.end())
49 return i->second;
50 return NULL;
51 }
52
53 void CarbonPluginWindowTracker::DestroyDummyWindowForDelegate(
54 OpaquePluginRef delegate, WindowRef window) {
55 DCHECK(GetDelegateForDummyWindow(window) == delegate);
56 window_to_delegate_map_.erase(window);
57 delegate_to_window_map_.erase(delegate);
58 if (window) // Check just in case the initial window creation failed.
59 DisposeWindow(window);
60 }
61
62 } // namespace npapi
63 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/carbon_plugin_window_tracker_mac.h ('k') | webkit/plugins/npapi/plugin_web_event_converter_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698