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

Side by Side Diff: chrome/browser/cocoa/extension_view_mac.mm

Issue 2858028: [Mac] Base implementation of extension infobars on the mac.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 | « no previous file | chrome/browser/cocoa/extensions/extension_infobar_controller.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser/cocoa/extension_view_mac.h" 5 #include "chrome/browser/cocoa/extension_view_mac.h"
6 6
7 #include "chrome/browser/extensions/extension_host.h" 7 #include "chrome/browser/extensions/extension_host.h"
8 #include "chrome/browser/renderer_host/render_view_host.h" 8 #include "chrome/browser/renderer_host/render_view_host.h"
9 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" 9 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 // No need to use CA here, our caller calls us repeatedly to animate the 57 // No need to use CA here, our caller calls us repeatedly to animate the
58 // resizing. 58 // resizing.
59 NSView* view = native_view(); 59 NSView* view = native_view();
60 NSRect frame = [view frame]; 60 NSRect frame = [view frame];
61 frame.size.width = new_size.width(); 61 frame.size.width = new_size.width();
62 frame.size.height = new_size.height(); 62 frame.size.height = new_size.height();
63 63
64 // On first display of some extensions, this function is called with zero 64 // On first display of some extensions, this function is called with zero
65 // width after the correct size has been set. Bail if zero is seen, assuming 65 // width after the correct size has been set. Bail if zero is seen, assuming
66 // that an extension popup view doesn't want any dimensions to ever be zero. 66 // that an extension's view doesn't want any dimensions to ever be zero.
67 // TODO(andybons): Verify this assumption and look into WebCore's 67 // TODO(andybons): Verify this assumption and look into WebCore's
68 // |contentesPreferredWidth| to see why this is occurring. 68 // |contentesPreferredWidth| to see why this is occurring.
69 if (NSIsEmptyRect(frame)) 69 if (NSIsEmptyRect(frame))
70 return; 70 return;
71 71
72 DCHECK([view isKindOfClass:[RenderWidgetHostViewCocoa class]]); 72 DCHECK([view isKindOfClass:[RenderWidgetHostViewCocoa class]]);
73 RenderWidgetHostViewCocoa* hostView = (RenderWidgetHostViewCocoa*)view; 73 RenderWidgetHostViewCocoa* hostView = (RenderWidgetHostViewCocoa*)view;
74 74
75 // RenderWidgetHostViewCocoa overrides setFrame but not setFrameSize. 75 // RenderWidgetHostViewCocoa overrides setFrame but not setFrameSize.
76 // We need to defer the update back to the RenderWidgetHost so we don't 76 // We need to defer the update back to the RenderWidgetHost so we don't
77 // get the flickering effect on 10.5 of http://crbug.com/31970. 77 // get the flickering effect on 10.5 of http://crbug.com/31970
78 [hostView setFrameWithDeferredUpdate:frame]; 78 [hostView setFrameWithDeferredUpdate:frame];
79 [hostView setNeedsDisplay:YES]; 79 [hostView setNeedsDisplay:YES];
80 } 80 }
81 81
82 void ExtensionViewMac::RenderViewCreated() { 82 void ExtensionViewMac::RenderViewCreated() {
83 // Do not allow webkit to draw scroll bars on views smaller than 83 // Do not allow webkit to draw scroll bars on views smaller than
84 // the largest size view allowed. The view will be resized to make 84 // the largest size view allowed. The view will be resized to make
85 // scroll bars unnecessary. Scroll bars change the height of the 85 // scroll bars unnecessary. Scroll bars change the height of the
86 // view, so not drawing them is necessary to avoid infinite resizing. 86 // view, so not drawing them is necessary to avoid infinite resizing.
87 gfx::Size largest_popup_size( 87 gfx::Size largest_popup_size(
(...skipping 15 matching lines...) Expand all
103 DCHECK(!render_widget_host_view_); 103 DCHECK(!render_widget_host_view_);
104 render_widget_host_view_ = new RenderWidgetHostViewMac(render_view_host()); 104 render_widget_host_view_ = new RenderWidgetHostViewMac(render_view_host());
105 105
106 // The RenderWidgetHostViewMac is owned by its native view, which is created 106 // The RenderWidgetHostViewMac is owned by its native view, which is created
107 // in an autoreleased state. retain it, so that it doesn't immediately 107 // in an autoreleased state. retain it, so that it doesn't immediately
108 // disappear. 108 // disappear.
109 [render_widget_host_view_->native_view() retain]; 109 [render_widget_host_view_->native_view() retain];
110 110
111 extension_host_->CreateRenderViewSoon(render_widget_host_view_); 111 extension_host_->CreateRenderViewSoon(render_widget_host_view_);
112 } 112 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/extensions/extension_infobar_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698