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

Unified Diff: chrome/browser/ui/cocoa/extensions/extension_view_mac.mm

Issue 10913243: extensions: Add ExtensionView interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: virtual dtor for cocoa and gtk ports 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/extensions/extension_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/extensions/extension_view_mac.mm b/chrome/browser/ui/cocoa/extensions/extension_view_mac.mm
index 642face2872681e82b47f115c9d81cb2dd81c263..e9a70e0622fa6c7c1cad0ec80f8bc5970bf16faa 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_view_mac.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_view_mac.mm
@@ -25,7 +25,7 @@ ExtensionViewMac::ExtensionViewMac(extensions::ExtensionHost* extension_host,
extension_host_(extension_host),
container_(NULL) {
DCHECK(extension_host_);
- [native_view() setHidden:YES];
+ [GetNativeView() setHidden:YES];
}
ExtensionViewMac::~ExtensionViewMac() {
@@ -35,18 +35,10 @@ void ExtensionViewMac::Init() {
CreateWidgetHostView();
}
-gfx::NativeView ExtensionViewMac::native_view() {
- return extension_host_->host_contents()->GetView()->GetNativeView();
-}
-
content::RenderViewHost* ExtensionViewMac::render_view_host() const {
return extension_host_->render_view_host();
}
-void ExtensionViewMac::DidStopLoading() {
- ShowIfCompletelyLoaded();
-}
-
void ExtensionViewMac::SetBackground(const SkBitmap& background) {
if (!pending_background_.empty() && render_view_host()->GetView()) {
render_view_host()->GetView()->SetBackground(background);
@@ -56,6 +48,22 @@ void ExtensionViewMac::SetBackground(const SkBitmap& background) {
ShowIfCompletelyLoaded();
}
+Browser* ExtensionViewMac::GetBrowser() {
+ return browser_;
+}
+
+const Browser* ExtensionViewMac::GetBrowser() const {
+ return browser_;
+}
+
+gfx::NativeView ExtensionViewMac::GetNativeView() {
+ return extension_host_->host_contents()->GetView()->GetNativeView();
+}
+
+void ExtensionViewMac::SetContainer(ExtensionViewContainer* container) {
+ container_ = container;
+}
+
void ExtensionViewMac::ResizeDueToAutoResize(const gfx::Size& new_size) {
if (container_)
container_->OnExtensionSizeChanged(this, new_size);
@@ -77,6 +85,10 @@ void ExtensionViewMac::RenderViewCreated() {
}
}
+void ExtensionViewMac::DidStopLoading() {
+ ShowIfCompletelyLoaded();
+}
+
void ExtensionViewMac::WindowFrameChanged() {
if (render_view_host()->GetView())
render_view_host()->GetView()->WindowFrameChanged();
@@ -90,8 +102,16 @@ void ExtensionViewMac::ShowIfCompletelyLoaded() {
// We wait to show the ExtensionView until it has loaded, and the view has
// actually been created. These can happen in different orders.
if (extension_host_->did_stop_loading()) {
- [native_view() setHidden:NO];
+ [GetNativeView() setHidden:NO];
if (container_)
container_->OnExtensionViewDidShow(this);
}
}
+
+// static
+ExtensionView* ExtensionView::Create(extensions::ExtensionHost* host,
+ Browser* browser) {
+ ExtensionViewMac* extension_view = new ExtensionViewMac(host, browser);
+ extension_view->Init();
+ return extension_view;
+}

Powered by Google App Engine
This is Rietveld 408576698