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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 8568030: base::Bind() conversion in renderer_host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing #include for Mac Created 9 years, 1 month 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 | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include <QuartzCore/QuartzCore.h> 7 #include <QuartzCore/QuartzCore.h>
8 8
9 #include "base/bind.h"
9 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/mac/mac_util.h" 12 #include "base/mac/mac_util.h"
12 #include "base/mac/scoped_cftyperef.h" 13 #include "base/mac/scoped_cftyperef.h"
13 #import "base/mac/scoped_nsautorelease_pool.h" 14 #import "base/mac/scoped_nsautorelease_pool.h"
14 #import "base/memory/scoped_nsobject.h" 15 #import "base/memory/scoped_nsobject.h"
15 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
16 #include "base/string_util.h" 17 #include "base/string_util.h"
17 #include "base/sys_info.h" 18 #include "base/sys_info.h"
18 #include "base/sys_string_conversions.h" 19 #include "base/sys_string_conversions.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // RenderWidgetHostViewMac, public: 223 // RenderWidgetHostViewMac, public:
223 224
224 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) 225 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget)
225 : render_widget_host_(widget), 226 : render_widget_host_(widget),
226 about_to_validate_and_paint_(false), 227 about_to_validate_and_paint_(false),
227 call_set_needs_display_in_rect_pending_(false), 228 call_set_needs_display_in_rect_pending_(false),
228 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 229 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
229 is_loading_(false), 230 is_loading_(false),
230 is_hidden_(false), 231 is_hidden_(false),
231 is_showing_context_menu_(false), 232 is_showing_context_menu_(false),
232 shutdown_factory_(this), 233 weak_factory_(this),
233 accelerated_compositing_active_(false), 234 accelerated_compositing_active_(false),
234 needs_gpu_visibility_update_after_repaint_(false), 235 needs_gpu_visibility_update_after_repaint_(false),
235 compositing_surface_(gfx::kNullPluginWindow) { 236 compositing_surface_(gfx::kNullPluginWindow) {
236 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| goes away. 237 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| goes away.
237 // Since we autorelease it, our caller must put |native_view()| into the view 238 // Since we autorelease it, our caller must put |native_view()| into the view
238 // hierarchy right after calling us. 239 // hierarchy right after calling us.
239 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] 240 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc]
240 initWithRenderWidgetHostViewMac:this] autorelease]; 241 initWithRenderWidgetHostViewMac:this] autorelease];
241 render_widget_host_->SetView(this); 242 render_widget_host_->SetView(this);
242 } 243 }
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 const gfx::Size& size) { 718 const gfx::Size& size) {
718 return new BackingStoreMac(render_widget_host_, size); 719 return new BackingStoreMac(render_widget_host_, size);
719 } 720 }
720 721
721 // Sets whether or not to accept first responder status. 722 // Sets whether or not to accept first responder status.
722 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { 723 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) {
723 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; 724 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag];
724 } 725 }
725 726
726 void RenderWidgetHostViewMac::KillSelf() { 727 void RenderWidgetHostViewMac::KillSelf() {
727 if (shutdown_factory_.empty()) { 728 if (!weak_factory_.HasWeakPtrs()) {
728 [cocoa_view_ setHidden:YES]; 729 [cocoa_view_ setHidden:YES];
729 MessageLoop::current()->PostTask(FROM_HERE, 730 MessageLoop::current()->PostTask(FROM_HERE,
730 shutdown_factory_.NewRunnableMethod( 731 base::Bind(&RenderWidgetHostViewMac::ShutdownHost,
731 &RenderWidgetHostViewMac::ShutdownHost)); 732 weak_factory_.GetWeakPtr()));
732 } 733 }
733 } 734 }
734 735
735 void RenderWidgetHostViewMac::PluginFocusChanged(bool focused, int plugin_id) { 736 void RenderWidgetHostViewMac::PluginFocusChanged(bool focused, int plugin_id) {
736 [cocoa_view_ pluginFocusChanged:(focused ? YES : NO) forPlugin:plugin_id]; 737 [cocoa_view_ pluginFocusChanged:(focused ? YES : NO) forPlugin:plugin_id];
737 } 738 }
738 739
739 void RenderWidgetHostViewMac::StartPluginIme() { 740 void RenderWidgetHostViewMac::StartPluginIme() {
740 [cocoa_view_ setPluginImeActive:YES]; 741 [cocoa_view_ setPluginImeActive:YES];
741 } 742 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 } 938 }
938 939
939 // TODO(apatrick): Send the acknowledgement via the UI thread when running in 940 // TODO(apatrick): Send the acknowledgement via the UI thread when running in
940 // single process or in process GPU mode for now. This is bad from a 941 // single process or in process GPU mode for now. This is bad from a
941 // performance point of view but the plan is to not use AcceleratedSurface at 942 // performance point of view but the plan is to not use AcceleratedSurface at
942 // all in these cases. 943 // all in these cases.
943 if (gpu_host_id == 0) { 944 if (gpu_host_id == 0) {
944 BrowserThread::PostTask( 945 BrowserThread::PostTask(
945 BrowserThread::UI, 946 BrowserThread::UI,
946 FROM_HERE, 947 FROM_HERE,
947 NewRunnableFunction(&GpuProcessHostUIShim::SendToGpuHost, 948 base::Bind(&GpuProcessHostUIShim::SendToGpuHost,
948 gpu_host_id, 949 gpu_host_id,
949 new AcceleratedSurfaceMsg_BuffersSwappedACK( 950 new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)));
950 route_id)));
951 } else { 951 } else {
952 GpuProcessHost::SendOnIO( 952 GpuProcessHost::SendOnIO(
953 gpu_host_id, 953 gpu_host_id,
954 content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, 954 content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
955 new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); 955 new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id));
956 } 956 }
957 } 957 }
958 958
959 void RenderWidgetHostViewMac::OnAcceleratedCompositingStateChange() { 959 void RenderWidgetHostViewMac::OnAcceleratedCompositingStateChange() {
960 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 960 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 1062
1063 // Unlock position of mouse cursor and unhide it. 1063 // Unlock position of mouse cursor and unhide it.
1064 CGAssociateMouseAndMouseCursorPosition(YES); 1064 CGAssociateMouseAndMouseCursorPosition(YES);
1065 [NSCursor unhide]; 1065 [NSCursor unhide];
1066 1066
1067 if (render_widget_host_) 1067 if (render_widget_host_)
1068 render_widget_host_->LostMouseLock(); 1068 render_widget_host_->LostMouseLock();
1069 } 1069 }
1070 1070
1071 void RenderWidgetHostViewMac::ShutdownHost() { 1071 void RenderWidgetHostViewMac::ShutdownHost() {
1072 shutdown_factory_.RevokeAll(); 1072 weak_factory_.InvalidateWeakPtrs();
1073 render_widget_host_->Shutdown(); 1073 render_widget_host_->Shutdown();
1074 // Do not touch any members at this point, |this| has been deleted. 1074 // Do not touch any members at this point, |this| has been deleted.
1075 } 1075 }
1076 1076
1077 gfx::Rect RenderWidgetHostViewMac::GetViewCocoaBounds() const { 1077 gfx::Rect RenderWidgetHostViewMac::GetViewCocoaBounds() const {
1078 return gfx::Rect(NSRectToCGRect([cocoa_view_ bounds])); 1078 return gfx::Rect(NSRectToCGRect([cocoa_view_ bounds]));
1079 } 1079 }
1080 1080
1081 void RenderWidgetHostViewMac::SetActive(bool active) { 1081 void RenderWidgetHostViewMac::SetActive(bool active) {
1082 if (render_widget_host_) 1082 if (render_widget_host_)
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
2757 if (!string) return NO; 2757 if (!string) return NO;
2758 2758
2759 // If the user is currently using an IME, confirm the IME input, 2759 // If the user is currently using an IME, confirm the IME input,
2760 // and then insert the text from the service, the same as TextEdit and Safari. 2760 // and then insert the text from the service, the same as TextEdit and Safari.
2761 [self confirmComposition]; 2761 [self confirmComposition];
2762 [self insertText:string]; 2762 [self insertText:string];
2763 return YES; 2763 return YES;
2764 } 2764 }
2765 2765
2766 @end 2766 @end
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698