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

Side by Side Diff: chrome/plugin/webplugin_proxy.cc

Issue 3855001: Move scoped_cftyperef from base to base/mac, use the new namespace, and name ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/plugin/webplugin_proxy.h ('k') | chrome/renderer/print_web_view_helper_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/plugin/webplugin_proxy.h" 5 #include "chrome/plugin/webplugin_proxy.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include "app/win_util.h" 10 #include "app/win_util.h"
11 #endif 11 #endif
12 #if defined(OS_MACOSX) 12 #if defined(OS_MACOSX)
13 #include "base/mac_util.h" 13 #include "base/mac_util.h"
14 #include "base/mac/scoped_cftyperef.h"
14 #endif 15 #endif
15 #include "base/scoped_handle.h" 16 #include "base/scoped_handle.h"
16 #include "base/shared_memory.h" 17 #include "base/shared_memory.h"
17 #include "base/singleton.h" 18 #include "base/singleton.h"
18 #include "build/build_config.h" 19 #include "build/build_config.h"
19 #include "chrome/common/child_process_logging.h" 20 #include "chrome/common/child_process_logging.h"
20 #include "chrome/common/plugin_messages.h" 21 #include "chrome/common/plugin_messages.h"
21 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
22 #include "chrome/plugin/npobject_proxy.h" 23 #include "chrome/plugin/npobject_proxy.h"
23 #include "chrome/plugin/npobject_util.h" 24 #include "chrome/plugin/npobject_util.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 212
212 return window_npobject_; 213 return window_npobject_;
213 } 214 }
214 215
215 NPObject* WebPluginProxy::GetPluginElement() { 216 NPObject* WebPluginProxy::GetPluginElement() {
216 if (plugin_element_) 217 if (plugin_element_)
217 return WebBindings::retainObject(plugin_element_); 218 return WebBindings::retainObject(plugin_element_);
218 219
219 int npobject_route_id = channel_->GenerateRouteID(); 220 int npobject_route_id = channel_->GenerateRouteID();
220 bool success = false; 221 bool success = false;
221 Send(new PluginHostMsg_GetPluginElement(route_id_, npobject_route_id, &success )); 222 Send(new PluginHostMsg_GetPluginElement(route_id_, npobject_route_id,
223 &success));
222 if (!success) 224 if (!success)
223 return NULL; 225 return NULL;
224 226
225 plugin_element_ = NPObjectProxy::Create( 227 plugin_element_ = NPObjectProxy::Create(
226 channel_, npobject_route_id, containing_window_, page_url_); 228 channel_, npobject_route_id, containing_window_, page_url_);
227 229
228 return plugin_element_; 230 return plugin_element_;
229 } 231 }
230 232
231 void WebPluginProxy::SetCookie(const GURL& url, 233 void WebPluginProxy::SetCookie(const GURL& url,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 #if defined(OS_MACOSX) 411 #if defined(OS_MACOSX)
410 CGContextSaveGState(windowless_context_); 412 CGContextSaveGState(windowless_context_);
411 // It is possible for windowless_context_ to change during plugin painting 413 // It is possible for windowless_context_ to change during plugin painting
412 // (since the plugin can make a synchronous call during paint event handling), 414 // (since the plugin can make a synchronous call during paint event handling),
413 // in which case we don't want to try to restore it later. Not an owning ref 415 // in which case we don't want to try to restore it later. Not an owning ref
414 // since owning the ref without owning the shared backing memory doesn't make 416 // since owning the ref without owning the shared backing memory doesn't make
415 // sense, so this should only be used for pointer comparisons. 417 // sense, so this should only be used for pointer comparisons.
416 CGContextRef saved_context_weak = windowless_context_.get(); 418 CGContextRef saved_context_weak = windowless_context_.get();
417 419
418 if (background_context_.get()) { 420 if (background_context_.get()) {
419 scoped_cftyperef<CGImageRef> image( 421 base::mac::ScopedCFTypeRef<CGImageRef> image(
420 CGBitmapContextCreateImage(background_context_)); 422 CGBitmapContextCreateImage(background_context_));
421 CGRect source_rect = rect.ToCGRect(); 423 CGRect source_rect = rect.ToCGRect();
422 // Flip the rect we use to pull from the canvas, since it's upside-down. 424 // Flip the rect we use to pull from the canvas, since it's upside-down.
423 source_rect.origin.y = CGImageGetHeight(image) - rect.y() - rect.height(); 425 source_rect.origin.y = CGImageGetHeight(image) - rect.y() - rect.height();
424 scoped_cftyperef<CGImageRef> sub_image( 426 base::mac::ScopedCFTypeRef<CGImageRef> sub_image(
425 CGImageCreateWithImageInRect(image, source_rect)); 427 CGImageCreateWithImageInRect(image, source_rect));
426 CGContextDrawImage(windowless_context_, rect.ToCGRect(), sub_image); 428 CGContextDrawImage(windowless_context_, rect.ToCGRect(), sub_image);
427 } else if (transparent_) { 429 } else if (transparent_) {
428 CGContextClearRect(windowless_context_, rect.ToCGRect()); 430 CGContextClearRect(windowless_context_, rect.ToCGRect());
429 } 431 }
430 CGContextClipToRect(windowless_context_, rect.ToCGRect()); 432 CGContextClipToRect(windowless_context_, rect.ToCGRect());
431 delegate_->Paint(windowless_context_, rect); 433 delegate_->Paint(windowless_context_, rect);
432 if (windowless_context_.get() == saved_context_weak) 434 if (windowless_context_.get() == saved_context_weak)
433 CGContextRestoreGState(windowless_context_); 435 CGContextRestoreGState(windowless_context_);
434 #else 436 #else
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 while (index != resource_clients_.end()) { 717 while (index != resource_clients_.end()) {
716 WebPluginResourceClient* client = (*index).second; 718 WebPluginResourceClient* client = (*index).second;
717 719
718 if (client == resource_client) { 720 if (client == resource_client) {
719 resource_clients_.erase(index++); 721 resource_clients_.erase(index++);
720 } else { 722 } else {
721 index++; 723 index++;
722 } 724 }
723 } 725 }
724 } 726 }
OLDNEW
« no previous file with comments | « chrome/plugin/webplugin_proxy.h ('k') | chrome/renderer/print_web_view_helper_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698