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

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

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR. Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" 7 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h"
8 8
9 #include "chrome/browser/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "content/browser/renderer_host/render_view_host.h" 10 #include "content/browser/renderer_host/render_view_host.h"
(...skipping 30 matching lines...) Expand all
41 41
42 RenderViewHost* ExtensionViewMac::render_view_host() const { 42 RenderViewHost* ExtensionViewMac::render_view_host() const {
43 return extension_host_->render_view_host(); 43 return extension_host_->render_view_host();
44 } 44 }
45 45
46 void ExtensionViewMac::DidStopLoading() { 46 void ExtensionViewMac::DidStopLoading() {
47 ShowIfCompletelyLoaded(); 47 ShowIfCompletelyLoaded();
48 } 48 }
49 49
50 void ExtensionViewMac::SetBackground(const SkBitmap& background) { 50 void ExtensionViewMac::SetBackground(const SkBitmap& background) {
51 if (!pending_background_.empty() && render_view_host()->view()) { 51 if (!pending_background_.empty() && render_view_host()->GetView()) {
52 render_view_host()->view()->SetBackground(background); 52 render_view_host()->GetView()->SetBackground(background);
53 } else { 53 } else {
54 pending_background_ = background; 54 pending_background_ = background;
55 } 55 }
56 ShowIfCompletelyLoaded(); 56 ShowIfCompletelyLoaded();
57 } 57 }
58 58
59 void ExtensionViewMac::UpdatePreferredSize(const gfx::Size& new_size) { 59 void ExtensionViewMac::UpdatePreferredSize(const gfx::Size& new_size) {
60 if (container_) 60 if (container_)
61 container_->OnExtensionPreferredSizeChanged(this, new_size); 61 container_->OnExtensionPreferredSizeChanged(this, new_size);
62 } 62 }
63 63
64 void ExtensionViewMac::RenderViewCreated() { 64 void ExtensionViewMac::RenderViewCreated() {
65 // Do not allow webkit to draw scroll bars on views smaller than 65 // Do not allow webkit to draw scroll bars on views smaller than
66 // the largest size view allowed. The view will be resized to make 66 // the largest size view allowed. The view will be resized to make
67 // scroll bars unnecessary. Scroll bars change the height of the 67 // scroll bars unnecessary. Scroll bars change the height of the
68 // view, so not drawing them is necessary to avoid infinite resizing. 68 // view, so not drawing them is necessary to avoid infinite resizing.
69 gfx::Size largest_popup_size( 69 gfx::Size largest_popup_size(
70 CGSizeMake(ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight)); 70 CGSizeMake(ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight));
71 extension_host_->DisableScrollbarsForSmallWindows(largest_popup_size); 71 extension_host_->DisableScrollbarsForSmallWindows(largest_popup_size);
72 72
73 if (!pending_background_.empty() && render_view_host()->view()) { 73 if (!pending_background_.empty() && render_view_host()->GetView()) {
74 render_view_host()->view()->SetBackground(pending_background_); 74 render_view_host()->GetView()->SetBackground(pending_background_);
75 pending_background_.reset(); 75 pending_background_.reset();
76 } 76 }
77 } 77 }
78 78
79 void ExtensionViewMac::WindowFrameChanged() { 79 void ExtensionViewMac::WindowFrameChanged() {
80 if (render_view_host()->view()) 80 if (render_view_host()->GetView())
81 render_view_host()->view()->WindowFrameChanged(); 81 render_view_host()->GetView()->WindowFrameChanged();
82 } 82 }
83 83
84 void ExtensionViewMac::CreateWidgetHostView() { 84 void ExtensionViewMac::CreateWidgetHostView() {
85 extension_host_->CreateRenderViewSoon(); 85 extension_host_->CreateRenderViewSoon();
86 } 86 }
87 87
88 void ExtensionViewMac::ShowIfCompletelyLoaded() { 88 void ExtensionViewMac::ShowIfCompletelyLoaded() {
89 // We wait to show the ExtensionView until it has loaded, and the view has 89 // We wait to show the ExtensionView until it has loaded, and the view has
90 // actually been created. These can happen in different orders. 90 // actually been created. These can happen in different orders.
91 if (extension_host_->did_stop_loading()) { 91 if (extension_host_->did_stop_loading()) {
92 [native_view() setHidden:NO]; 92 [native_view() setHidden:NO];
93 if (container_) 93 if (container_)
94 container_->OnExtensionViewDidShow(this); 94 container_->OnExtensionViewDidShow(this);
95 } 95 }
96 } 96 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_navigator.cc ('k') | chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698